Anyone who worked with Blender is familiar with procedural textures in material nodes. I use them all the time to generate stuff like scratches on walls, certain types of metal plates, even wooden floors. This offer more control over an image, infinite patterns that don't repeat, and greatly reduce the size of a project since you don't need to store huge high-res textures.

So I wonder if with shaders or other means it's possible to create realtime textures in Godot and assign them to a material. I'm working on a generator for procedural voxel terrain and could use simple patterns for stone / sand / dirt / grass / etc, ideally with triplanar mapping which might make things a bit trickier. I want sharpness so in the past I tried using 4k textures: They're huge even with dds compression and even then you see them repeating... this alternative would be very helpful.

Is this something possible to do with Godot 4.0? If yes do you have any examples for common patterns, such as noise splats or voronoi bumps or wood bands / rings with distortion? I'd throw in a bonus question as it's likely something I'll want to use: Is it possible to influence the patterns to get different effects based on a value at the location of a vertice in GDScript, so for instance "noise_scale_at_corner *= dictionary_of_position_properties[this_vec3_position]" to get smaller noise on some surfaces?

Yes, you can do this in Godot 3.4 no problem.

Wonderful, I shall take a look at this soon. Definitely the best fit for marching cubes terrain and registering different surfaces and materials for use with it. If I can get different effects per 3D point / vertice, it would also save me the worry of having to manually blend textures per cell which would have been a nightmare to code.

19 days later

Hello, which strategy is better for high performance in game engines in general and specifically in Godot and why?

  • texture reading or algorithmic texture (pixel shader)?

Mainly I am trying to understand the process Godot/Game engines handle it. In doc I am seeing a clause where it is encouraged to use algorithmic texture whenever possible. https://docs.godotengine.org/en/stable/tutorials/performance/gpu_optimization.html#reading-textures

  • Is there any optimization strategy needs to be followed while authoring GLSL in Godot?

Thanks for your help in advance!

Godot does have a node editor for making shaders. You get similar functions that blender has for it's shaders.

Was wondering if there are any Youtube videos or more step-by-step tutorials on exactly how you code a procedural material in Godot 4.0, in such a way that you can extract all the necessary maps (albedo, roughness, normal, parallax, etc) and use them accordingly to get as much detail as possible. I'm mainly going to need this for dirt / gravel / rock which should be easy to get with simple noise... what about a brick pattern to mix it with in order to get bricks though? Would like some detail on how to pretty much do this but in Godot:

I already posted in your original thread, which seemed to ask the same question, and it appears you never even read what I said or responded. In the future, please ask your questions (if they are the same or materially similar) in the original thread and not make 2 or 3 threads asking the same thing. Thanks.

For clarity: I have read and appreciate the answers provided, just that I still can't figure out exactly what I'm looking for yet. Material Maker seems like an interesting tool to generate some materials, but I'm trying to learn how you can code your own simple patterns via shaders from scratch or simple examples.

I was curious if someone could offer a few lines of Godot specific shader code for how you generate a pattern procedurally to obtain a color, which node of the Visual Shader editor you'd plug that into for it to work... or perhaps you can use the existing vector functions to make good patterns with the builtin nodes and OpenSimplexNoise? From there I can probably change the math to get different pattern types... mostly curious about the basics of defining a seamless pattern in code, it's something I didn't get to play with before so I'm a little new to it.

Sorry, I didn't mean to be rude, I'd just prefer similar threads from the same author to stay in the same place.

To answer your question, Material Maker was made in Godot. So it's certainly possible to do it manually. I haven't worked with visual shaders much, but from what I understand they work similar to Blender (but more limited) so I imagine there is a way to do it without manual shader programming.

Here is a shader code I found to make a brick, but I think it's probably not the best way (but you can use it as an example to get some ideas): https://godotshaders.com/shader/brick-wall/

And here is how to use the visual shaders, which I believe is the better method:

No worries and thanks, that is very useful! Will need to understand how it works but I have something to work with, hopefully I can get something like that with my own technique. Saw that video today funny enough, it explained how to use the default OpenSimplexNoise and get the base grime at least, already happy with how that works and it even has a builtin option to do the normal map!

I'm not sure how similar to substance designer the godot based material maker is vis-a-vis runtime generated procedural textures/shaders. I'd have to give it a more thorough look, though the quick glimpse I gave it a while ago(a month maybe?) left a lot to be desired far as I could tell. And that's before even considering authoring to runtime use. Which is to say I was only really judging the UX/workflow of just creating a texture within it.

edit: In fairness I should make it clear that I've been a long time substance user and Map Zone that preceded it since something like 2005, so I've been spoiled.


I've attached to the post a visualshader node tree that implements a barebone brick mask/texture. Pretty sure I forgot to normalize something somewhere but it looks like bricks enough to get by, so eh, it'll do for now.

Good luck dissecting it tho. I'd have made some use of groups and frames and what not other quality of life features if we had them. Mind, I assembled it in 3.4 so no idea if things are better in the 4.0 alpha land.

@Megalomaniak said: I'm not sure how similar to substance designer the godot based material maker is vis-a-vis runtime generated procedural textures/shaders. I'd have to give it a more thorough look, though the quick glimpse I gave it a while ago(a month maybe?) left a lot to be desired far as I could tell. And that's before even considering authoring to runtime use. Which is to say I was only really judging the UX/workflow of just creating a texture within it.

edit: In fairness I should make it clear that I've been a long time substance user and Map Zone that preceded it since something like 2005, so I've been spoiled.


I've attached to the post a visualshader node tree that implements a barebone brick mask/texture. Pretty sure I forgot to normalize something somewhere but it looks like bricks enough to get by, so eh, it'll do for now.

Good luck dissecting it tho. I'd have made some use of groups and frames and what not other quality of life features if we had them. Mind, I assembled it in 3.4 so no idea if things are better in the 4.0 alpha land.

Very nice, thanks! Sadly it doesn't appear to work in 4.0, plugging it into the albedo is pure white color. But at least I know it's possible, maybe I can simplify that somewhat. Am attempting something similar using two gradients, far fewer nodes but no idea how to do the alternation pattern that way.

Wanted to ask this question separately since I couldn't find a clear answer anywhere. I just got familiar with the visual shader editor which I'm gonna use to make simple procedural textures. I can use an OpenSimplexNoise for fine details like grain which I already did with the base Noise Texture.

What I'm looking for next is an alternating brick pattern to blend it with, usable as both normal and even parallax maps to warp that noise effect over the bricks. What's the simplest way to do this from the shader nodes using builtin functions and texture types? Or if I have to write a custom shader or procedural texture definition, can anyone please offer an example? I'm not looking for other tools if possible, just an explanation on how to generate my own noise patterns from scratch.

In this case I was thinking of using a sine function or two textures blended in different directions. Even if this rather complicated approach works however, I can't do an alternating pattern per row just a grid.

@cybereality said: Sorry, I didn't mean to be rude, I'd just prefer similar threads from the same author to stay in the same place.

I think the most appropriate solution here was to merge the two topics instead, so I've gone ahead and done so.

@MirceaKitsune said:

Very nice, thanks! Sadly it doesn't appear to work in 4.0, plugging it into the albedo is pure white color. But at least I know it's possible, maybe I can simplify that somewhat.

make sure to tweak the shader parameters, they default to god knows what. I just shared the graph, not a material it'd be attached to. The shader parameters should be in the inspector.

edit: to be clear tho, it was meant to be a reference point/a learning experience so don't be afraid to open it in version 3 and then rebuild it yourself in 4. Might make for good practice.

They default to 0, set them to higher values but nothing happened. With my approach I was able to get somewhere for now... it does what I want just no pattern alteration. I'm also running into the issue of having to generate the normal map from the grayscale image result which I wanted to do in the same nodes, managed to get an acceptable result though I think the normals point the wrong way in places.

Heres a screenshot of what it should look like with the parameters dialed in as the inspector shows. I think you just didn't realize that I've set the brick scale value of 1.0 to essentially be max and for the mortar lines to show up at values below 1.0

It's meant to just produce a black and white mask so you can mix mortar and brick materials.

Aha, now it's working! Thanks again. Only problem apart from the number of nodes is I can't set a smoothness so the edge is fully sharp... I take it that can't be easily helped, thus I'll have to play around with all available options and see what looks best.