Sign in to follow this  

extract normals from normal map?

This topic is 4514 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do I extract normals from a normal map? I have been told that each texel in the normal map represents the xyz components of a normal. But in the shader how would I code this. Thanks

Share this post


Link to post
Share on other sites
float3 normal=tex2D(surface,coords);

You might need to expand the normals (from [0,1] to [-1,1]) so add
normal=normal*2-1;

EDIT2: Godammit wrong smiley. ^__^

Share this post


Link to post
Share on other sites
Hi there shaqdx,
How are you doing?

The Problem
How to extract normals from a normal map

The Solution
float3 normal = 2.0f * tex2D(texSampler1, IN.tex1).rgb - 1.0f;

Hope this helps.
Take care bud.

Share this post


Link to post
Share on other sites
Sign in to follow this