Sign in to follow this  

D3D Lighting/Shading Problem

This topic is 4304 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm fairly new to D3D and 3D in general, so bear with me here. :) I've noticed that when rendering things in my programs that jagged edges can be seen on the model where the shading starts. I just put this down all my models being low poly but it happens on the higher poly models aswell. I am using the D3DSHADE_GOURAUD render state. The screenshot below should show the problem. I've adjusted the lighting so it shows up pretty clearly. Example I'm guessing it is the way I have my lighting set up, but I can't seem to solve it. Any help would be much appreciated. Let me know if I need to paste any code or whatever. Thanks

Share this post


Link to post
Share on other sites
My guess would be it's with the normals.

Either they're not normalized in the mesh, or (more likely), you're running it through a scaling matrix as a transform.

Try setting the render state D3DRS_NORMALIZENORMALS to true, and see if it solves the problem.

Share this post


Link to post
Share on other sites
I have to agree with Drillian, It looks like a normal problem to me too.
Open up the DXViewer in the Microsoft DirectX SDK (February 2006)\Utilities\Bin\x86 directory and open your mesh. Then view the normals, it's a tick in the options and check if they are correct. If not it's your model.

I hope this helps.
Take care.

Share this post


Link to post
Share on other sites
Thanks for the replies.

I've looked at the model in the DxViewer and the normals all appear to be fine and D3DRS_NORMALIZENORMALS is set to true aswell.

I have tried loading some of the model samples from the SDK and they don't actually appear to have this issue, so I guess it must be something to do with how I'm exporting my models from Blender.

I'll keep looking and also try another exporter.

Thanks

Share this post


Link to post
Share on other sites
I've tried another exporter and it seems to have improved things a fair bit.

Thanks again for the help, it steered me in the right direction.

Share this post


Link to post
Share on other sites

This topic is 4304 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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