Per pixel lighting/shadows

Started by Kaiidyn, January 19, 2011, 01:29:22 PM

Previous topic - Next topic

Kaiidyn

I have a simple box with a light, but the light casts on the triangles of the box and that is..... ugly.. =p
Is there any way to enable a per pixel lighting or shadow casting?
if so, how would i go about doing that?
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer's intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch

EgonOlsen

What exactly is ugly? Do you have a screen shot? I'm not sure if i understand the actual problem.

Kaiidyn

i dont think a screenshot will propperly capture what i mean, so i made a small video..

http://93.95.149.126/light.mpeg

as the cube rotates, you see the light go on and off on the different triangles, hence the ugly thing.
Is there any way to go around this? (per pixel light, instead of per triangle or w/e)
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer's intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch

EgonOlsen

I see...the usual vertex lighting artefacts. They are especially visible on a cube, because the vertex normals at the corners are very different from each other. You might improve this with per pixel lighting but you have to use shaders for this. That's means that you (apart from having to learn GLSL and to write the shader code) will lose fixed function support (as mentioned in AGP's water thread lately)...i'm not sure if it's worth it in this case. It might be sufficient to increase the the polygon count of the cube. Splitting each triangle into two might look already good enough.