Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (763)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (852)
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 2663 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: 1342
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
Offline 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
Offline 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 (545 views)
2018-06-10 19:43:48

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

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

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

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

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

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

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

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

Solater (567 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
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!