Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (769)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (855)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Easy way to get more than MAX_LIGHTS?  (Read 2706 times)
0 Members and 1 Guest are viewing this topic.
Offline keith_myers

Senior Newbie





« Posted 2006-02-14 18:37:13 »

I just read an article on how to use shaders to achieve this, but that's way beyond my current level of knowledge. Is there a relatively easy way to achieve this using the basic calls in the Red Book?
Offline Niwak
« Reply #1 - Posted 2006-02-14 18:51:43 »

Yes ; you just render multiple time your geometry with different lighting condition and with additive blending (multiple passes).
So, in short, it gives the following pseudo code ;
- Disable blending, set ambient lighting
- Pass 1 : render geometry with MAX_LIGHTS set to your first MAX_LIGHTS lights,
- Enable additive blending, disable ambient lighting
- Pass 2 : render geometry with MAX_LIGHTS set tp the next MAX_LIGHTS lights,
- Pass 3 : ... and so on.

In practice, this algorithm is highly inefficient. Lighting computations are expensive and you should find a way to limit the number of lights influencing a model.
If you don't want to spend too much time on this, I would suggest to use Java3D which does this automatically for you.
Offline Riven
Administrator

« JGO Overlord »


Medals: 1356
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2006-02-14 18:52:03 »

Multipass rendering with additive-blending maybe...

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Spasi
« Reply #3 - Posted 2006-02-14 20:38:19 »

Are you sure you want more than MAX_LIGHTS on a *single* surface? Keep in mind that you'd need HDR rendering for that. 8bit precision can't handle the contribution of so many lights, at least with decent quality.
Offline keith_myers

Senior Newbie





« Reply #4 - Posted 2006-02-14 21:20:45 »

I was just curious to tell you the truth.  I had made a little test scene with more than 8 lights (sort of like torches) at various locations and just wondered how this was handled since it SEEMS like professional games have quite a few on at one time sometimes.  I was simply hoping for an easy / cheap way to go, but it obviously isn't going to happen.

Thanks for the answers, I certainly appreciate it.

Keith
Online Spasi
« Reply #5 - Posted 2006-02-15 11:35:14 »

Yeah, I suspected that. The optimal way to render such a scene would be to group areas by light and/or light count. If you have a copy of Doom 3 (or Quake 4?) available, there's a console command that draws the scene colored, showing how it is actually split depending on the active lights.
Offline Mr EEK

Senior Newbie





« Reply #6 - Posted 2006-02-15 13:45:23 »

One technique is to simply enable the closest MAX_LIGHTS lights to the object you are rendering, switching off the more distant (and therefore less significant) ones.
Offline keith_myers

Senior Newbie





« Reply #7 - Posted 2006-02-16 17:33:59 »

I spent a bit of time looking on the Web and found some descriptions of "virtualized lighting" techniques, so I believe I'll try to code a Light class and LightManager to implement the idea.  If I get something that seems to work OK in the near future I'll put the code up here in case someone else might find it useful / interesting.
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (1574 views)
2018-06-10 19:43:48

EgonOlsen (1658 views)
2018-06-10 19:43:44

EgonOlsen (1145 views)
2018-06-10 19:43:20

DesertCoockie (1573 views)
2018-05-13 18:23:11

nelsongames (1174 views)
2018-04-24 18:15:36

nelsongames (1664 views)
2018-04-24 18:14:32

ivj94 (2421 views)
2018-03-24 14:47:39

ivj94 (1631 views)
2018-03-24 14:46:31

ivj94 (2719 views)
2018-03-24 14:43:53

Solater (884 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!