Lighting

I’m having trouble with lighting effects on my models (from certain angles, it still looks 2d), and am trying to find some good tutorials and/or books on the subject. Any recommendations?

Thanks.

Hmmm… do you have some specifics? Like what angles causes it to look 2D? Or maybe even a (small!) screenshot?

Are you using Java3D or LWJGL or JOGL?

If you’re using Java3D then I would suggest the Daniel Selman book on Java 3D Programming: http://www.manning.com/selman/

And it will all probably come down to how your normals are defined, and/or what Material you are using for your models.

I’m using LWJGL

Well, after thinking about it, I realized that since I’m allowed an 8 light max, I won’t have lighting on every ship, but a few huge lights that will light everything on the screen. I figured a light really far away at the top back left of a cube, the top back right, and the top back middle. This is an RTS, similar view to Starcraft, but with 3d graphics (2-d playing).

My normals are just cross products of two lines on the triangles. Haven’t added materials yet. They’ll probably be metal colored with some empty spaces where the player’s color will show through. I’m still trying to figure out how to make it so the color of the polygons only show through where the texture is transparent, and elsewhere, the colors don’t blend.

You probably should not use 8 lights at same time anyway - they cost a lot of GPU power. Maybe finding few lights closest to given object + 1 or two global lights for ambient light would be enough ? Anyway, to get really nice effects, you should think about some kind of per-pixel light - should be doable for ships in RTS game.

I thought it was 8 lights on one thing at a time- is it 8 lights total?

Yes, it is 8 lights at one time. But these 8 lights cost performance and unless you have very tessalated object (which will cost you even more performance, as light is computed per-vertex), they do not give a real difference in look of object.

hmmm… Any good tutorials on doing per-pixel lighting with OpenGL? I’ve found some stuff on the math behind it, which is nice and all, but there’s no sample code. And is it video card specific? Because most said “with NVIDIA…”.

Edit:

OT: I just realized I’m a full member! Woo hoo!