Environmental bump mapping problem

Started by
9 comments, last by Arcibald Wearlot 20 years, 4 months ago
hi, i'm having some problems using bump env map in dx 8.1. the problem is, i want to use a cube texture to simulate the environment, but something isnt working using the following settings:

SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_DIFFUSE);

SetTextureStageState(1,D3DTSS_TEXCOORDINDEX,0);
SetTextureStageState(1,D3DTSS_COLOROP,D3DTOP_BUMPENVMAP);
SetTextureStageState(1,D3DTSS_COLORARG1,D3DTA_TEXTURE);
SetTextureStageState(1,D3DTSS_COLORARG1,D3DTA_CURRENT);

SetTextureStageState(1,D3DTSS_BUMPENVMAT00,F2DW(1.0f));
SetTextureStageState(1,D3DTSS_BUMPENVMAT01,F2DW(0.0f));
SetTextureStageState(1,D3DTSS_BUMPENVMAT10,F2DW(0.0f));
SetTextureStageState(1,D3DTSS_BUMPENVMAT11,F2DW(1.0f));

SetTextureStageState(2,D3DTSS_TEXCOORDINDEX,D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR);
SetTextureStageState(2,D3DTSS_COLOROP,D3DTOP_MODULATE2X);
SetTextureStageState(2,D3DTSS_COLORARG1,D3DTA_TEXTURE);
SetTextureStageState(2,D3DTSS_COLORARG1,D3DTA_CURRENT);
i'm getting something strange. the environment is NOT reflected as it should: i always see the positive X side no matter the position of the camera. the texture only slightly moves. if, for example, i rotate the camera far to the right, i can see a little of another face (on the right side of the object): this should be another cubemap face, right? but it is STILL the positive X side! i mean that 1) no matter where the camera is, the cubemap X side is always facing it 2) the X side is used in all the 6 faces of the cube (well i suppose, as i can really see just 5 faces) sure it's not a texture problem, it's a 6-sides .dds cubemap, and i load it using D3DX. and if i try doing plain env mapping (no bump), i get something similar but still strange: the cubemap is still not moving when i move the camera, only slightly when i rotate it (same as above), but this time the -Z side is facing me. i can see the +Y up, -Y down, -X left, +X right and a little of the +Z behind. so it seems correct, but the cube map is not changing when i move. so what am i forgetting/doing wrong? i hope you can help me, thank you in advance uh, i'm using a GeForce4 Ti4600 with detonator 45.23 drivers. [edited by - Arcibald Wearlot on December 15, 2003 12:50:20 PM]
Advertisement
HAHAHA I have the same problem!!!!!! My primary machine fails like yours does.

I have an ATI on another machine, AND IT BEHAVES EXACTLY AS IT SHOULD, very-same code, reflecting all 6 faces respectively.

Only way to do it is with VS I guess...

Damn that positive X reflection! It only happens when using bump mapping reflections/refractions, not when I am using regular cube-reflections...

Please let me know if you find a solution without using VShaders. I tried just about every combination of renderstate settings but nothing made it work properly.

Incidentally, in my main machine I have GeForce4 Ti4200, which is same as yours, but slower...


[edit] clarifications [/edit]

[edited by - superdeveloper on December 15, 2003 4:40:38 PM]
I complained back in the day...

My Thread starter...

My videos are gone now... ran out of space but I know that you are seeing the same things...
sorry... one more blurb...

Have you tried this with REF drivers? just to see if its infact a card problem?!?!

Wow I cannot believe I didn''t think of this sooner. If you try with REF, please let me know if the problem fixes itself.

I realize that this is not a viable solution, as you will get 1 FPS, but this is purely a test to see if it is infact a HAL/Driver problem...

MAke sure you set the D3DCreate_softwarevertexprocessing as well in the creation flags for creating a device...
with a REF device, bump env mapp behaves exactly as plain env mapping: the -Z side is facing me, and other sides are reflected around it. but there is still this problem, if i move the camera im always getting -Z facing it, the texture isnt moving..

i'm gonna install the new nvidia drivers now, to se if something changes..
did you try to set it up with directx 9?

[edited by - Arcibald Wearlot on December 16, 2003 6:55:52 AM]
Yes I have been using dx9 only.

I will play with it again to see if I can come up with something new and creative.

This problem has seriously slowed me down..
I believe this is normal behavior. I had the exact same issue. I had to change my code that instead of locking each cube and facing it a direction (n,s,e,w,up,down), I had to lock the cube and get the direction relative to the camera (get its forward vector, then multiply that to the direction). That gave it much better results.

I don''t know if this is what you are looking for, but it worked for me.
you're right, i just checked some sdk samples: you have to render each face of the cubemap according to the camera position. thanks for your help
by the way i sent the program to a friend so he tried it on his pc. he as a different config but similar video card (GeForce4 Ti4200) and he is getting exactly the same stuff (+X reflection only).

so here's the point of the situation:
-using environmental bump mapping with D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR only the +X side of the cubemap is shown.
-this only happens with a HAL device. with a REF it works fine.
-this only seems to happen with GeForce4 GPUs.
-this seems to happen no matter if using DX 8.1 or DX 9.0, and no matter what other render states have been set.
-"plain" env mapping works fine.

next step would be to try this program on non-nvidia GPUs and to see if it works (as superdeveloper said on his old post)

[edited by - Arcibald Wearlot on December 17, 2003 9:49:44 AM]
yes this has been a painful experience.

Which sdk example has cubemapped bumpmapping sample?? I know there are cube map samples, but none that demonstrate bumpmapping (reflection?) as well.
none of the env bump map samples uses a cube texture. cube textures are only used in env map samples..
hmm i just added some bumpenvmap code to an old demo i did some time ago, and im still getting the same stuff. the init code, the render states and everything else is completely different from my current project, the demo used .x files etc etc. but same problem. im really shocked

This topic is closed to new replies.

Advertisement