|
Re: Bump Mapping Shader
[Re: jcl]
#22174
01/22/04 11:22
01/22/04 11:22
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
actually i didn't really investigate this bump mapping example. i knew that if you set the directx states it's possible to achieve the same lighting as with mat_model...
but i haven't been able to achieve the same lighting with a pure vertex and pixelshader combination (using veclight and so on). i don't know how to combine the influence of the shadowmap and other lightsources in the right way. a simple example for this would be nice!
...
@drew:
COLOROP[0] = dotproduct3;
COLORARG1[0] = texture;
COLORARG2[0] = diffuse;
COLOROP[1] = modulate2x; // here
COLORARG1[1] = texture;
COLORARG2[1] = current;
|
|
|
Re: Bump Mapping Shader
[Re: ventilator]
#22177
01/23/04 01:02
01/23/04 01:02
|
Joined: Jul 2000
Posts: 27,986 Frankfurt
jcl
Chief Engineer
|
Chief Engineer
Joined: Jul 2000
Posts: 27,986
Frankfurt
|
Yes, ventilator is right.
This is the default render setting used by the engine:
Models, sprites, and flat textures:
SetTexture(0,Skin); SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE2X); SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE); // entity texture SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE); // lighting
Shaded textures:
Stage 0 adds dynamic lights to the lightmap:
SetTexture(0,LightMap); SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_ADD); SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE); // lightmap SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE); // lighting
Stage 1 modulates the actual texture with the result of stage 0:
SetTexture(1,Texture); SetTextureStageState(1,D3DTSS_COLOROP,D3DTOP_MODULATE2X); SetTextureStageState(1,D3DTSS_COLORARG1,D3DTA_TEXTURE); // texture SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT); // stage 0
The shader must emulate this setting.
|
|
|
|