Skip to main content
GameDev.net gamedev.net
🔒 Locked

Transform and lighting

Started by Ataru Apr 26, 2004 at 12:08 PM 1 replies 250+ views
Original Post
Ataru
Ataru
I have two .x files. One''s width is maybe 6.0 while another may be 1000.0. One is centered around 0, while the other is centered way off somewhere. Now, for both models, I compute the bounding box, and I apply world translation and scaling to center the model and make it fit on the screen. The problem is lights, the first model is perfectly lit, while the other one has full brightness, and if rotated will turn black. Is my light being transformed because I change the world matrix? Or is the light calculation computed on untransformed vertices? How would I solve the problem, use matrix stacks?
Trip99
Trip99
It is the scaling that messes up the lighting because if you scale using the world matrix the normals also get scaled. The only solution apart from re-calculating them is to turn on the normalizenormals renderstate which means d3d normalises all your normals for you before rendering - may cause a slowdown
------------------------See my games programming site at: www.toymaker.info
Ataru
Ataru
That certainly makes sense. I will try it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.