Mesh darkens when scaling bigger

Started by
2 comments, last by Aldenar 19 years, 4 months ago
Hi all in my actual gameproject i stumbled in a strange Problem: say i create a mesh and render it without any modifications. I get what i exepected: my mesh with colors and textures and all material options (like transparency). now i scale this mesh bigger and bigger see what i get: Screenie you see the mesh darkens until it is black as the big black hole in the middle of the milkyway. where is the trick? why darkens my mesh, or is it a bug? ;) thx for any answer.... Freakdesign
Advertisement
Hello,

This looks like a case of normals getting scaled. Try setting de D3DRS_NORMALIZENORMALS render state to TRUE.
Great! it works perfectly.
thats it!
Thx for the fast help Aldenar.

i setted it in the beginscene() - endscene() sequence. it seems to slow my engine a bit. is it performance expensive?
i guess i need a table of all renderstates with their costs to speed ;)

Yeah, there is an extra cost when using this render state. Actually, what it does is it re-normalize all normals that are transformed. This is mandatory when your world transform has scaling in it, but you don't need it when rotations and translations only are applied. I think it may be good to turn it on only when rendering a scaled object so you won't decrease the speed of the entire rendering process.

This topic is closed to new replies.

Advertisement