Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Lighting  (Read 1267 times)
0 Members and 2 Guests are viewing this topic.
Offline nickdotjava

Full Member
**

Posts: 149


I have fallen to the dark side.  I'm using DX9


« on: 2003-07-08 13:06:16 »

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.

-Nick

"Oh ya, that's trivial.  I should have it done in an hour."
Offline bmyers

Full Member
**

Posts: 175



« Reply #1 on: 2003-07-09 07:54:38 »

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.

Offline nickdotjava

Full Member
**

Posts: 149


I have fallen to the dark side.  I'm using DX9


« Reply #2 on: 2003-07-10 09:41:49 »

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.

-Nick

"Oh ya, that's trivial.  I should have it done in an hour."
Games published by our own members! Go get 'em!
Offline abies

Sr. Member
**

Posts: 456



« Reply #3 on: 2003-07-10 10:28:27 »

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.

Artur Biesiadowski
Offline Breakfast

JGO Strike Force
***

Posts: 784
Medals: 1


for great justice!


« Reply #4 on: 2003-07-11 02:45:11 »

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

Sr. Member
**

Posts: 456



« Reply #5 on: 2003-07-11 03:26:35 »

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.

Artur Biesiadowski
Offline nickdotjava

Full Member
**

Posts: 149


I have fallen to the dark side.  I'm using DX9


« Reply #6 on: 2003-07-11 11:38:26 »

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!

-Nick

"Oh ya, that's trivial.  I should have it done in an hour."
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.089 seconds with 19 queries.