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

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

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 on other sites
Hey I had this problem but I was looking for a way to do it without shaders and in OpenGL I gave up tho.

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.

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

• 11
• 12
• 9
• 12
• 37
• Forum Statistics

• Total Topics
631420
• Total Posts
2999990
×