Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
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 1102 times)
0 Members and 1 Guest are viewing this topic.
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
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.

----------------------------------------------------------

Kev

Offline Yuri Vl. Gushchin

Senior Duke




Speak Java!


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

Quote
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

Yuri Vl. Gushchin
JProof Group
Offline Java Cool Dude

Senior Duke




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
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
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

Kev

Offline Yuri Vl. Gushchin

Senior Duke




Speak Java!


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

Another topic related to multipass rendering is

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=xith3d;action=display;num=1073393576, named "Quake3 Renderer progress"

Yuri

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

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (42 views)
2014-10-16 15:22:06

Norakomi (32 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (66 views)
2014-10-14 00:35:47

TehJavaDev (59 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (85 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!