Sign in to follow this  
manuelb

problems with scaled model lighting

Recommended Posts

I'm new to directx, I'm using managend directx9 with C#. I have som problems when lightning a scaled .x model. 1)When I scale it by 0.01 it becames 100 times lighter.. how could a change this? I gess it would be something like "scaling the normal vectors too"... 2)This model is a AutocadModel wich I exported to 3ds format and then exported again to .x format(using blender). Some faces are wrong orientated, they are facing the oposit direction. I can solve the culling problem by applying "cullmode=cull.none". But I can't solve the ligthing problem... How could I solve it? How could I tell the light modell it ignore if its clock or counterclock? It would be like telling the light model that te triangle has 2 oposit normal vectors or something like this. Thank's in advance, and sorry for the broken English.

Share this post


Link to post
Share on other sites
Hi, yes if you scale the model via the world matrix the normals will be scaled as well. You can set the render state D3DRS_NORMALIZENORMALS which means the normals will be renormalized for you by Direct3D before rendering. This may slow down rendering slightly.

Share this post


Link to post
Share on other sites
Thank's a lot, now light intensity is ok.
About the other problem, when the normals as facing the oposit direction (poiting to inside the model, not to outside), is there something I could do in directx, or the only way is to correct it on the model? I ask it because it's a very big and complicated model.

Thank's again.

Share this post


Link to post
Share on other sites
There is no way to fix the lighting issue except to write a vertex shader and do the lighting yourself.

One hack would be to make 2 lights on opposite sides of the model.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this