gourad shading not so nice

Started by
6 comments, last by Gagyi 17 years, 1 month ago
The gourad shading i am using does not light an object the way i would like ie. It is too stark and to much of the object is pitch black. Is there some way of making its lighting more diverse, with out cheating and changing the normals. I tried using an additional ambient light, but i dont know how to make the ambient light dimmer, so that is doesnt light up the object to much. Any one know how to get around these problems?
Advertisement
Could you post a screenshot of your scene?
How do you upload an image?
You added an *additional* ambient light?

Isn't ambient light some global light setting that exists only once?

You make the ambient light dimmer, by lowering its color value. So instead of setting it to RGB(128,128,128) you set it to RGB(64,64,64), for instance.

What kind of lights are you using anyway? (i.e.: omni aka point lights, spot lights, directional/parralel lights)
Can you provide us with more detail, your post is increadibly vague. There are plenty of things that could cause what you describe, but without knowing which

1. D3D fixed function lighting?
a. how are your D3D materials set?

b. how are your D3D lights set?

c. have you set the D3DRS_AMBIENT render state? what to?

d. what type of D3D light are you using?

e. are you doing any multi-texture blending, if so, how does your light get blended to produce the final result?

f. do you have the emissive part of your material set to anything other than black?


2. lighting in a vertex shader?
a. which model? Plain Phong diffuse illumination?

b. are light and normal vector definitely in the same space?

c. are you remembering to clamp N dot L into the 1 to 0 range?

d. have you remembered that L should point from the surface being illuminated towards the light when you do the dot product?

e. what are you doing for the rest of your lighting equation?

f. remember, light is additive so it's AMBIENT + DIFFUSE + SPECULAR (in case you have a shader doing anything like multiplying ambient and diffuse together).



3.
a. are your normals definitely unit length (normalized)?

b. is your light direction vector (if applicable) unit length?

c. are you absolutely sure normal and light are in the same space?

d. if you're doing some form of point/omni light or specular, are you absolutely certain any positions are in the same space?

e. if you're uncertain about any of your vectors, I'd recommend you add some debugging code to draw coloured lines to visualise them (use a different colour for each end of the line so you can see which direction the vector points). Drawing simple debug lines has helped me solve so many things like this in the past...


A screenshot and/or a code snippet may help people on the forum identify your problem straight away.


An aside: "Gouraud shading" is the process of interpolating colours/light intensities across the surface of a polygon - it shouldn't affect how your lighting looks.

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

My application is very simple, one directional light one texture per tile, ect.
I think a screen shot will really help, how do you post one?
A really neat and cool-looking trick:
Dont use ambient, but use two lights:
[courier]
L1.....L2
\....../
.\..../
..\../
...\/
----------<=Terrain
[/courier]
L1 is bright Yellow and L2 is faint blue.
-----------------------------------"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrashstickman.hu <=my game (please tell me your opinion about it)

This topic is closed to new replies.

Advertisement