SpiderPig Posted August 4, 2023 Share Posted August 4, 2023 What's the correct way to store vertex normals in a pixmap so that it can be saved and actually look like a normal map? This is xyz mapped to rgb: Quote Link to comment Share on other sites More sharing options...
Josh Posted August 4, 2023 Share Posted August 4, 2023 color.r = normal.x * 0.5 + 0.5 color.g = normal.y * 0.5 + 0.5 color.b = normal.z * 0.5 + 0.5 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted August 4, 2023 Author Share Posted August 4, 2023 Thanks, but what does that do exactly? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted August 4, 2023 Author Share Posted August 4, 2023 Should it be converted back before using it? Quote Link to comment Share on other sites More sharing options...
Josh Posted August 4, 2023 Share Posted August 4, 2023 An RGBA unorm value cannot store negative values. This compresses the values into the range 0-1. If you look in the fragment shaders, they typically convert the color back to a normal like this: normal.rgb = color.rgb * 2.0 - 1.0 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
SpiderPig Posted August 4, 2023 Author Share Posted August 4, 2023 Oooohhh. It all makes sense now. Thanks! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.