Sign in to follow this  
shaqdx

extract normals from normal map?

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this