Hi, I am trying to create a shader that will use a world positioned texture, that ‘projects’ over the mesh, but avoid the stretching that occurs on faces that are facing different directions. heres what I have so far (the basic world positioned texture mapping:
Heres what it looks like with the stretching visible; essentially i want the dots to show the same on all planes, with the same orientation on the side planes as well:
I guess that I need to take the surface normal and perturb the vector from world position that is mapping the texture, but I don’t know the way to do this…
(I have tried triplanar mapping btw but it doesnt quite do what I want)
The end result is to have multiple, different sized meshes in the world that use the same materials and have the same density texture on them (no stretching or scaling)
Any pointers would be much appreciated Thanks a lot
is there a way to use this normal vector to transform/effect the vector we’re getting from world position, so that it maps the texture correctly whichever way it is facing?
I encountered a similar problem when creating a node material, as shown in the picture.
The end result is to have multiple, different sized meshes in the world that use the same materials and have the same density texture on them (no stretching or scaling).
figure 1:
When the model is scaled, the desired effect is shown in Figure 2.
figure 2:
At present, the node material I found is like this. When modifying the model size, modify the widthScale heightScale depthScale of the node material at the same time
I believe there is a better solution, but I haven’t found it yet. At present, I can only use this method
example address:
so i took that above playground, and swapped out the material for the one that was posted above by @Evgeni_Popov , and in the scene observables removed the call to change the scale height/width (ie commented out lines 189/195/201). As you can see the texture stays the same, and isn’t stretched, so I would look into using that material as a starting point.
If youre doing a top down road then you might even want to use the triplanar node built into node materials, but be careful about rotation.