Jump to content
• Advertisement

# extract normals from normal map?

This topic is 4816 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

##### Share on other sites
Advertisement
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

##### 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

##### Share on other sites
That's brilliant.

Thanks!

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5
• Advertisement

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633300
• Total Posts
3011266
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!