RodZill4 / material-maker

A procedural textures authoring and 3D model painting tool based on the Godot game engine
MIT License
3.44k stars 217 forks source link

Optional input to Voronoi allowing tight control #289

Open unfa opened 3 years ago

unfa commented 3 years ago

Substance Designer has a "Distance" node that takes an image (and I think) analyses it to find mean points of possible islands, and then uses these points to draw a Voronoi Diagram.

It's like Worley Noise, only the user can have precise control over how it's going to be done. The benefit of that is, it can be used to generate roads on a world texture, controlling the road density - make more roads in towns, no roads underwater and no roads on the mountains.

Of course output of such an operation would need to be processed to find edges, distort and dialate it before using as a mask.

I've been searching the newest version of Material Maker because I thought something like this existed, but I couldn't find the node to do it. Voronoi doesn't have an optional input. And an optional input that could define the point locations would be excellent here.

RodZill4 commented 3 years ago

I think the Node you're looking for is named Dilate.

unfa commented 3 years ago

Yes!

I have a problem with it though.. Despite being configured to fill the islands with color, there's a bit of a color change resulting in these concentric rays being added to the resulting edge-detection:

image

I've noticed that changing the size of the circles I used definitely has a huge impact: image

I wonder what should I do for a perfectly clean output (no godrays in the islands basically)...

It seems the issue is that Dialate doesn't output "just the color" when the 3rd parameter is set to 1 (as I thought it will)- it overlays that somewhat on the incoming images, or IDK - the image is not flat:

image

I've tried to correct that using the Quantize node, but then some of my "roads" lead to nowhere: ![Uploading image.png…]()

unfa commented 3 years ago

With making the input circle smaller and softening it up and using QUantize I was able to get this result: image Though some "roads" don't seem like making much sense still - this is not exactly like a Voronoi diagram, as the necessary Quantize operation removes some of the edges.

unfa commented 3 years ago

I was able to get some better results, though it's finnicky: image

If I could have a shape node that produces an exactly 1 x 1 px large white dot so I can spray that - this'd solve the problem.

RodZill4 commented 3 years ago

Hmm maybe inserting a Buffer node in front of the Dilate would help.

BTW you may want to join our new Discord server. ;)

unfa commented 3 years ago

What would the buffer improve here? Doesn't it just cache results to speed up processing?