Hi, I'm working on a project with really simple decals. They are just flat planes mapped to textures. We have tangent space normal maps that are created for them. We are using uv rotation rather than local object rotation, ( not my call), and the normal maps don't update. I've seen some normal map update "solutions" but generally on teh same thread i see people saying they don't work I've attempted a few but couldn't get it to work.
For our simple project it would seem to make sense to instead use a height map rotate that and convert it to normal after rotation. The provided Normal Create function seems to be what I want to use but I'm not sure how to pass/convert the data to it in sampler 2d form, or if i could use a different data type to achieve the same thing.
Thank You,
Attachments
normal_convertt.jpg (236.99 KiB) Viewed 5331 times
Hello, thank you for getting in touch and for your support!
Rather than modify the NormalCreate Shader Function, I'd recommend that you copy its contents and either create a new function, or adapt them to your shader.
I believe that you could try to use Texture Samples set as Reference to the Heightmap sampler with custom UVs in this situation:
ah... ok i think i see the flaw in my logic the uvs are being rotated not the texture map itself. so the texture map will always render the same. I was thinking I was rotating a height map and it would be recalculated in 2d space
Ya I saw the Rotate About Axis node but unfortunately I'm not currently skilled enough to figure it out. There were doubts as well on the other post. I know I've heard of some a games using a world space normal maps and they are then converted to tangent space in the shader. https://polycount.com/discussion/101157 ... normal-map
As an example on how to use the Rotate About Axis node, you first need to go to your Output node properties, hit the Vertex Output dropdown and select the Absolute option as we will be setting absolute vertex positions on the Output node.
Then you can use the Rotate About Axis node to perform the rotation over the vertex position as it performs a rotation on a given position about a specified axis.
You can also specify a pivot point to where the rotation will occur.
In the example below we are doing a rotation on the current vertex position about the object local y axis:
One other thing to take into consideration is that the vector you supply as the rotation axis must be normalized.
If its not, you can either normalize the axis vector through a Normalize node before connecting it to the 'Normalized Rotate Axis' input port, or you can go to the Rotate About Axis node parameters and enable "Normalize Axis".
You can do the exact operation over the vertex normals, simply use the Rotate About Axis with the Vertex Normal instead and connect it to the Local Vertex Normal input port over the Output node