Infinite Non-Repeating details in materials (UE4, valid for UE5)
Vložit
- čas přidán 6. 09. 2024
- In this video I'm showing how to scatter some elements on a surface in a random and non-repeating way. In this way you can enrich your assets an landscapes with very little effort.
Link to Substance Designer Node mentioned in this video: gumroad.com/ju...
Discord: / discord
Patreon: / visualtechart
This kind of content is so lacking in the tutorial space for Unreal Engine. Thank you so much for producing these, the quality is amazing and it's very informative. You deserve far more viewers and subscribers. Keep up the good work, many of us appreciate it!
Thank you! :D
Very interesting!
But please mention that the VectorNoise node does cost quite a bit. I would not want our padawans to think they can use it everywhere without a worry. Or maybe that would be a good video idea: "Understanding the cost of Instructions".
I say this because I do have junior Techarts and aspiring Techarts in my team that watch this kind of video without the critical sense to understand that some nodes, in this case the VectorNoise node, are way more expensive than other nodes.
Padawan here. I was reading the Unreal documentation about Vector noise - cell noise, it says: "This Vector Noise function is extremely cheap to compute, so it is not necessary to bake it into a Texture for performance." I don't know if that cell noise is a exception to the other vector noise operations.
I'm currently coding in godot, so the function doesn't exist. But I'm calling a random color per vector input. I can still randomize by changing the y-value. Maybe Unreal uses the same code:
"shader_type spatial;
uniform int ScatterGridSize = 10;
float rand(vec2 grid) {
return fract(sin(dot(grid, vec2(12.9898, 78.233))) * 43758.5453);
}
vec3 RandomScattering(vec2 uv, int row_and_column)
{
uv = trunc(uv * float(ScatterGridSize));
float r = rand(uv + vec2(1.0, 0.0));
float g = rand(uv + 1.0); // Randomize by changing the y value
float b = rand(uv + vec2(0.0, 1.0));
vec3 MyVector = vec3(r,g,b) ;
// vec3 MyVector = (vec3(r,g,b) - 0.5)* 2.0;
return MyVector;
}
varying vec2 uv_pos;
void vertex() {
uv_pos = UV;
}
void fragment() {
ALBEDO = RandomScattering(uv_pos, ScatterGridSize);
}"
edit: I still haven't reached the end of the video, I'm fixing bugs hehe
I hope the algorithm catches up on you one day! Your videos are great!
Thank you, I hope so :D
Great job please continue revolutionising the way I make materials
Ahahahaha sure!
All your videos are really useful!, I hope your channel increases because you would help many more people. Greetings and thanks for this.
I hope that too xD Thank you
Wow!
:O !
Really appreciate your videos. Thanks! :)
Glad to be helpful :)
@@VisualTechArt I hope you'll find the time to make more nice tutorials. I really like the approach of focusing on more advanced stuff. When there is any possibility to support you (donation), I would be grateful to do so :)
@@aukehuys2297 Awesome, this makes me incredibly happy :) I have some long term plans, but for now I'll stick to keeping this an hobby :D
Omg! Serious cool stuff!
Big thanks for your effort, very informative and interesting :0
Another banger, thank you. I managed to get it working in godot. For other people trying the same: turn off generate mipmaps on import. Sine and cos needs to be multiplied with 2.0 * PI.
Never seen thid before, dang awesome!
It's how most of the procedural texture generation softwares randomizes placement of elements :)
Can this be made as a material function? Im not sure if thats how it works as im fairly scratching the surface, but i dont want my materials to repeat when i try to scale their tiling
Yes, you can make a MF out of it :)
This is great! Is there a way to also world align the result? I would love to have all the randomisation but also projected in world space. Thanks!
Just start from world coordinates :)
@@VisualTechArt Thank you! Very much appreciated
Existe some simple trick to make smooth transition from foliage grass to landscape material? without see edge where grass foliage disappear and grass far away look realistic? I try virtual texture but close look wierd
My advice is to match as best you can the GBuffers! If you tune up your scene in a way that in the Normal buffer, Roughness buffer, Base Color buffer etc you don't see the transition, your final scene won't have it :D
Can you scatter 3D object for example grasses depends on texture mask?
Not on meshes and from the shader, if that's what you mean. The landscape is set up to do that though
how do you even get to the point where you memorize stuff like this lol
No. Every time you have to figure that out again ahahahah it happened few times that I had to follow my own tutorials too!
The very important thing is understand the concepts behind stuff, so you're able to figure it out every time... Or being very good at remembering where to find the resources you need to follow :D
@@VisualTechArt Ya the "understanding" part is hard. Shaders are a whole new world to me, so it looks like you're just subtracting, dividing, multiplying with no rhyme or reason, when coding I can follow logical steps. It'll just take some time I guess