D3D & Lighting

Started by
2 comments, last by NoNseNse 23 years, 10 months ago
Ok, another question. I'm using DX7's gouraud shading, and am experiencing some problems with it. On large polygons the lighting is very inaccurate, so I wrote a routine which subdivides them into smaller ones. Is there any faster/easier method? Another thin I wondered about is that normally gouraud-shading is supposed to make most objects look smooth, but my shaded objects don't look a bit smooth. Here's a screenshot of the player: Screenshot SO what's wrong with that? I'm quiet sure that I got the normals correctly, THX for any other ideas,, NoNseNse Edited by - NoNseNse on 5/30/00 9:30:21 AM Edited by - NoNseNse on 5/30/00 9:32:44 AM
Advertisement
That looks more like flat shading!
Are you sure you have the render states set up for gouraud shading?

MCSE, MCSD, Sun Certified Java Programmer
Pimp Daddy ;)
MCSE, MCSD, Sun Certified Java ProgrammerPimp Daddy ;)
quote:Original post by ryoder

That looks more like flat shading!
Are you sure you have the render states set up for gouraud shading?

MCSE, MCSD, Sun Certified Java Programmer
Pimp Daddy


Actually it looks like gourad shading to me. If you look closely, you will notice that somewhere on his arms, it is interpolated.

Well, your problem is that DirectX ONLY lights your verticies and not between your verticies. Gourad shading does create the illusion of lighting between verticies because it uses interpolation. Your solution, subdivide your character or use lightmaps.



------------------------
Captured Reality.
I have found my error. It was Gouraud shading, but I got the normals wrong. I used the face-normals instead of the vertex-normals, no it nearly looked like flat shading. Now I''m working on a procedure that calculates the vertex normals out of the 3 connected face normals. can I use this formula:
VertexNormal=Normalize(Normal[0]+Normal[1]+Normal[2]);
?
THX

This topic is closed to new replies.

Advertisement