Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (603)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (651)
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  
  Lighting Volumes  (Read 3078 times)
0 Members and 1 Guest are viewing this topic.
Offline kevglass

« JGO Spiffy Duke »

Medals: 272
Projects: 25
Exp: 18 years

Coder, Trainee Pixel Artist, Game Reviewer

« Posted 2004-01-07 05:17:41 »

Not sure if this is commonly done, or if there are loads of tutorials hanging around that I can't find using google. However, I'm trying to create effective spot lights for my troops as they walk round the map. Bearing in mind my map is mostly made up of simple blocks and the lighting doesn't have to be super accurate or cast object shadows I was planning on doing the following.

Could anyone let me know if they can see problems and/or faster ways of doing things? Also, is there an easier way to perform multipass rendering in Xith?

-- Cut of a mail I was just sending to Endolf --

This is how I'm going to get lighting to look right, its effectively multipass rendering but with a scenegraph.

1) The lit geometry exists within a SharedGroup node, which is linked twice in the scene graph. The links are in an ordered group so they always get rendered in the right order (multipass rendering Smiley)

2) First the lit geometry is rendered with a dark marterial setting, no transparency. This provides the base layer

3) Next I generate the light volume geometry and render it with the stencil buffer bit set. This effectively masks out the area that should be "lit". In addition the alpha component is written shading away from the light source (this will be used later on).

4) Next I generate the shadow volumes caused bu this light and render it with the stencil operation set to clear the stencil buffer. This effectively unmasks the bits that would be lit but are in shadow.

5) Then the second link to the shared geomtery is rendered. Before this is rendered the appearances are updated. RenderingAttributes are setup so that the geometry is only rendered where the "lit" areas are. The Material colours are set up to be brighter, this will give the lit appearance. Finally the transparency attributes are set up to blend against the alpha that was written earlier. This should shade the geometry against the light that was generated earlier.

Multiple Lights

This would work for 1 light, additional lights can all be rendered in the same pass by using only single bits in the stencil buffer. So the light A sets bit 1 and the shadows generated from light A unset bit 1. If any bits are left by the time we get to the second set of geometry then the pixel should be lit.



Offline Yuri Vl. Gushchin

Senior Devvie

Speak Java!

« Reply #1 - Posted 2004-01-07 09:05:37 »

Also, is there an easier way to perform multipass rendering in Xith?

Xith3D atchitecture generally supports multipass rendering and ready for that, but currently rendering passes are out of user's control. I have several ideas [and need] to implement that, but implementation details have to be discussed to fit everybody's needs.

There are 2 types of rendering passes I see: scene-level passes (line opaque and transparent objects), and object-level passes. Currently I use OrderedGroups to implement object-level passes (at least have working implementation for alpha-conditional depth-buffer writes).

I think that multipass rendering will also be good to implement render-to-texture, but we should discuss all these points before starting coding.

Send here your ideas on how you see rendering passes to be controlled in Xith3D - we have to implement this eariler or later.


Yuri Vl. Gushchin
JProof Group
Offline Java Cool Dude

Senior Devvie

Java forever

« Reply #2 - Posted 2004-01-08 20:53:56 »

Off topic: An additional rednering pass for 2D shapes will be more than welcome coughalsotexturecubemapasappleasekthxbyecough Grin
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kevglass

« JGO Spiffy Duke »

Medals: 272
Projects: 25
Exp: 18 years

Coder, Trainee Pixel Artist, Game Reviewer

« Reply #3 - Posted 2004-01-09 05:24:14 »

Pretty close to having this working now Smiley.

Multiple pass rendering for shapes, I'd like to see the number of passes a shape should have become one of the shape properties. So you pass a count of the number passes that this shape should be rendered in into the Shape3D constructor.

EDIT: actually it might be nice to pass in a BitSet of the passes in which you want the shape to be rendered. Might be a bit more performance friendly.

Then update the NodeUpdater interface to pass in the "pass number" to the preRender() method. It would then be possible to exclude a shape from the pass or change the appearance attributes (read stencil, depth, alpha buffer) just before the pass.

I'm not sure how well this would fit in with other folks intended usage but it'd suit me just fine Smiley


Offline Yuri Vl. Gushchin

Senior Devvie

Speak Java!

« Reply #4 - Posted 2004-01-09 08:10:02 »

Another topic related to multipass rendering is;action=display;num=1073393576, named "Quake3 Renderer progress"


Yuri Vl. Gushchin
JProof Group
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

SHC (11 views)
2015-08-01 03:58:20

Jesse (17 views)
2015-07-29 04:35:27

Riven (38 views)
2015-07-27 16:38:00

Riven (19 views)
2015-07-27 15:35:20

Riven (22 views)
2015-07-27 12:26:13

Riven (12 views)
2015-07-27 12:23:39

BurntPizza (32 views)
2015-07-25 00:14:37

BurntPizza (43 views)
2015-07-24 22:06:39

BurntPizza (25 views)
2015-07-24 06:06:53

NoxInc (31 views)
2015-07-22 22:16:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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‑
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!