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

Started by
1 comment, last by ET3D 16 years, 11 months ago
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.
a h31p1355 n00b
Advertisement
Hey I had this problem but I was looking for a way to do it without shaders and in OpenGL I gave up tho.
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.

This topic is closed to new replies.

Advertisement