Sign in to follow this  

EMBM tutorial/info (help me integrate EMBM in my shader)

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

Hello all, I was searching for a simple EMBM (environment-map bump mapping) tutorial (I found one on nVidia's website, but that was too complex with a lot of stuff happening), but couldn't find a simple one. By simple I mean it should have no other fancy effects other than EMBM. I want to see the exact differences between two scenes (with and without EMBM) so I can know exactly what is going on. The real motivation behind this is to educate myself and get familiar with EMBM (I understand DOT3 bump mapping and have read Two Kings' tutorial on it). Armed with this knowledge, the goal is to write a small shader that does EMBM inside my real shader (I don't want to use fixed function SetTextureStage operations). This brings me to another question: If I only want to use shaders (like DX 10 style):

SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_BUMPENVMAP );

should NOT be used, right? Even if you think what I'm trying to do is wrong or non-optimal, please refer to me a good tutorial on EMBM so I can do it entirely in my shader as opposed to using DirectX function calls. Any and all help will be appreciated. P.S. Kindly excuse my English as it is not my first language.

Share this post


Link to post
Share on other sites
What EMBM does is use the values you read from a texture as texture coordinate offsets for the next stage.

Conceptually, this works much more simply in shaders, since you're just using dependent reads. You'd do something like:

float2 newCoords = In.texCoords1 + tex2D(bumpMapSampler, In.texCoords0).xy;
output = tex2D(envMapSampler, newCoords);

EMBM allows transforming the value read from the texture, which you can easily do in the shader, if you need it.

You can look up 'Bump Mapping Formulas', 'Using Bump Mapping' and 'texbem - ps' in the DX docs for more info about what calculations bump mapping does.

Share this post


Link to post
Share on other sites

This topic is 3857 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.

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