Jump to content
  • Advertisement
Sign in to follow this  
oh123you

OpenGL In Normal mapping(Bump Mapping), what does green color mean in DirectX (or LHS) ?

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

DirectX is left-handed system, and OpenGL is right-handed system.

And then, I know that normal map's green color channel means Y vector(Binormal coordinate) values.

So, I think that, in Diret3D (LHS), if the Y value of normal map's vector is positive, green color is negative.

(Actually, green color must be larger than 0, "Negative value of green color" means smaller than 128.)



But, in many samples of DirectX or OpenGL, some samples uses green color channel as "-Y" value, and other samples uses green color channel as "+Y" value.

[original texture]




[height map]





[normal map A: LHS? RHS?]





[normal map B: LHS? RHS?]





In that case, which normal map is LHS's texture? A? B?



(I think that A is LHS's normal map, but some DirectX samples use B as normal map.)







Share this post


Link to post
Share on other sites
Advertisement
They mean the same thing; that LHS/RHS stuff is outdated nonsense with programmable shading. The only thing that matters is what handedness the specific application you're writing (and not the underlying graphics API) uses.

Share this post


Link to post
Share on other sites
Quote:
Original post by InvalidPointer
They mean the same thing; that LHS/RHS stuff is outdated nonsense with programmable shading. The only thing that matters is what handedness the specific application you're writing (and not the underlying graphics API) uses.


I do not agree with you , coordinates systems are still very important and can cause you days of headache when implementing shaders...but i admitt that for this problem there is no influence.

Green color is generally the y component of your normal but it's in tangent space coordinate system (ie image texture space) , so the pb is not the LHS/RHS conversion.

Rather i think it's how the tool has produced the normal map from heightmap...
the normal map is constructed by being the result of the cross product between the X Texture Axis aligned vector and Y Texture Axis aligned vector for a particular pixel (difference between pixel and 2 neighbours)

Depending on order of fetching the pixels information the result can be negated :

If the tool start by upper left corner of the image the vectors are like this :

* -> *
^
| Y coord

*

otherwise if tool start at bottom right :

* <- *
|
V Y coord

*

Now i've seen that some input format with image library like devils are loaded by considering the origin is bottom right ( case for TGA files for example )
So an explanation could be that one image source has been inputed in the tool with TGA , the other a BMP ? (i'm juste making a supposition ) or they have been produced with 2 different tools that doesn't calc the normal map in the same order has explained above (i argue for 1st hypothesis )...

Sorry for ugly ascii art :-) hopes this help.

Share this post


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

  • Advertisement
×

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!