It is currently Sat Aug 22, 2020 4:14 am


All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Just want to share my cave lighting tests
PostPosted: Sun Apr 17, 2011 7:46 pm 

Joined: Sat Sep 18, 2010 9:45 pm
Posts: 189
Hi, I know a few of you are working on Minecraft style games and I'm wondering how you are doing "cave" lighting. I believe you can say this is related, or a better description a hack, of far-field ambient occlusion. In Minecraft the AO is based on whether you can see the sky in a vertical direction and by propagating low bit light values via flood-fill algorithms. (Don't quote me on this though because I never looked into this.)

I'm currently evaluating several ways to do this. One of my goals is I do not want to store and propagate any light values in the Minecraft way. I've came up with several methods. The current one I'm working on is based on generation of light volumes at valid voxels and then sampling the light volumes. By valid voxel I mean any voxel which can see the sky (vertical direction) and is neighboring a voxel that cannot see the sky. The light volume generated is centered at the mean position of all valid voxels some NxNxM region of space. Here is a video showing it in action:

http://youtu.be/jG9LXXKEblI?hd=1

It's not 100% yet but I will let you know how it turn out. Also, this method is completely CPU based. I plan to implement a similar method on the GPU using deferred shading, which is what I will work on next once I get deferred shading in place. Also, there is the issue of determining whether a voxel can see the light (e.g. behind a wall) or not. I plan to tackle this problem by using some probability, the idea is given N observations of occupied voxels in some region, what is the probability that I can see the light. Another way to do this is perhaps by ray-casting from that voxel to the light source, or maybe instead of doing it per voxel, do it for multiple voxels. This only works for the CPU method, won't work for GPU method with deferred shading (perhaps it will work but I have to do this in the pixel shader somehow).

Beside this method, I also have plans for Spherical Harmonics based AO. Basically the idea is for some NxNxM region, project a disk representing the region into SH space. So each NxNxM region contains 9 SH coefficients. Then when shading a voxel, simply sample these SH coefficients, in a way similar to N-body simulations (superposition of SH coefficients). I'm not sure I have the time to try this out.

Another method is based on Light Volume Propagation. Although I admit I haven't worked out the details with this one yet. With the above two methods, I'm pretty sure they work. Not sure with LVP.

...
Once I get some of the kinks worked out with the first method, I will post some code. You probably can't just directly plug it into your system and expect to work. With that said, basically I wrote a custom surface extractor that extracts the surface and does per vertex shading, given the needed light data. The light data is stored using PolyVox::Array and also a custom accessor wrapper (for boundary checks).

Just thought I'd share this info with you all.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Just want to share my cave lighting tests
PostPosted: Sun Apr 17, 2011 8:58 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Great stuff, I'm sure that is the nicest lighting I have seen in a Minecraft clone :-)

I don't have anything very exciting myself - I'm using the ambient occlusion from PolyVox and then a single shadow-casting dynamic light. But I'd definitely like to work on more GI approches in the future, and techniques like RSMs, VPLs, and LPVs all have a lot of potential. It's nice to see Crytek doing a lot of this research into fully dynamic GI.

I'd also like to try loading the volume data onto the GPU and using that for computing ambient occlusion, and maybe even for shadow casting...


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Just want to share my cave lighting tests
PostPosted: Mon Apr 18, 2011 5:22 am 

Joined: Fri Feb 18, 2011 8:41 pm
Posts: 173
Really pretty! :)

Oh, and I love the moon's texture.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Just want to share my cave lighting tests
PostPosted: Mon Apr 18, 2011 4:54 pm 

Joined: Sat Sep 18, 2010 9:45 pm
Posts: 189
@ shanee
I'm using a Ogre plugin called SkyX.

@ David

I haven't tested Polyvox's AO module, I'm in a position now to test it so I will probably check it soon.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Just want to share my cave lighting tests
PostPosted: Mon Apr 18, 2011 7:32 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Actually I'm not sure it will be suitable for your scenario, as it creates a volume texture you have to upload to the GPU. So really it's only good for relatively small scenes (plus it's slow to generate at the moment).


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net