Archived

This topic is now archived and is closed to further replies.

Syrillix

Setting dx9 shader constants

Recommended Posts

ok, does dx9 do strange things to shader constants now? im still getting used to dx9s shader system, but i tried sending in an light direction to a shader that was transformed by the inverse world matrix, like you would do in dx8. i kept getting the wrong lighting. i sent in the light direction as it was and the lighting was correct? did dx9 transform this constant behind my back? or what just happened? Get busy livin'' or get busy dyin''... - Shawshank Redemption If a man is talking in the forest, and no woman is around to hear him, is he still wrong? - Unknown Fulcrum

Share this post


Link to post
Share on other sites
So:
"Light direction in object space (== multiplied by invWorld matrix) -> Wrong lighting
Light direction in world space -> Correct lighting"?

Seems like you're doing the lighting (dot-product and stuff) on world-space vertices, so make sure that you've not multiplied the vertex by the world matrix before the lighting compuation.

Muhammad Haggag

[edit]Clarification

[edited by - Coder on November 17, 2003 12:37:05 AM]

Share this post


Link to post
Share on other sites