[demo added]Volume Shadows & Light Shafts

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

[demo added]Volume Shadows & Light Shafts

Post by Crashy »

Hello, I'm currently trying to implement a Volume Shadows/Light Shafts technique, inspirated by far from the Shader X3 code.(here is a light version
http://ati.amd.com/developer/gdc/Mitche ... Shafts.pdf )

For the moment I just modified the shadow receiver for volume maps, but the results are good for just some hours.

FPS are low, but at the moment all slices are independant objects, it should be faster with all slices merged in one object.
I must also clip the slices to the light frustrum, but I don't know how to do this, if somebody has an idea :)
And finally, improve the general lighting model of course.

The slices aren't currently linked to the camera, It is really a quick test .

[edit] I'm not using stencil shadows as the gui shows, I've just heavily hacked the shadows demo :D
Image
Image
Last edited by Crashy on Fri Oct 26, 2007 7:31 am, edited 2 times in total.
Follow la Moustache on Twitter or on Facebook
Image
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Volume Shadows & Light Shafts

Post by jacmoe »

Crashy wrote:inspirated by far from the Shader X3 code.
Hehe! GPL really sucks, huh? :P

Anyway, this looks promising! :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

In fact it's "inspirated " for the global idea. But the fragment shader given is not copy-pastable directly in Ogre. And it is really more intersting to make my own code for such a thing(over Ogre code of course ) , as it is a personnal work to learn new things.
Follow la Moustache on Twitter or on Facebook
Image
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Post by Kencho »

w0000t!! Dude, this is seriously cool! Just too bad about the performance... :(
Image
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

No offense meant, Crashy!
I know you work wonders with shaders! :)

Looks like I jumped to conclusions and put your comment in context of recent discussions about the ShaderX code being under the GPL - sorry! :oops:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

No problem, I'm not aware of this discussion ;)
Shader X is for me just a good learning basis for shader stuff.
Follow la Moustache on Twitter or on Facebook
Image
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Really nice, well done!
User avatar
ahmedismaiel
OGRE Contributor
OGRE Contributor
Posts: 217
Joined: Wed Jan 25, 2006 11:16 pm
Location: Redmond,WA

Post by ahmedismaiel »

that's really awesome
I've been wandering around it for sometime ,but couldn't get the planes right
how did u do it? :)
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

For the moment planes are just basic planes with a fixed orientation.

I'm wondering if the planes must follow the camera in both translation and orientation, or just orientation. After all it depends on what you want to do with this effect.

For orientation only, I think simple billboards or particles should behave fine.

About optimisations, clipping is really necessary. But as far as I know, there is no way in OGRE to define custom clip planes to clip only one object, is there?

I was thinking of alpha testing to reject the most pixels possible, but I didn't see a significant fps improvement.
Maybe a discard/kill call the earliest possible in the pixel shader, but I'm not sure it may improve fps.
Any idea for optimisations?

Anyway, here are some screens of enhencements of the lighting model, with a notion of attenuation.


http://crashy.cartman.free.fr/light_sha ... 141336.jpg
http://crashy.cartman.free.fr/light_sha ... 225548.jpg
http://crashy.cartman.free.fr/light_sha ... 232853.jpg


I'm using 30 planes for this result. Using a smoothed shadow texture may resolve the visibility of the slices.

If I can get that thing working at a decent framerate, no doubt the sample will be released ;)
Follow la Moustache on Twitter or on Facebook
Image
User avatar
ahmedismaiel
OGRE Contributor
OGRE Contributor
Posts: 217
Joined: Wed Jan 25, 2006 11:16 pm
Location: Redmond,WA

Post by ahmedismaiel »

what i was doing in making the object getting rendered on a separate render queue (because it'll be rendered after all the objects) and set the clip planes at the render queue started

i have no idea if it's useful or not ,because i didn't see it running with my code yet
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Mmmh yes that sounds good. I'll try next.
I've made a test with particles but it wasn't pretty, as it is difficult to setup correctly their position in space.

Simple billboards are far better.
Some pics of a test with a torus knot, because the spear of Athena is too thin and the shadows on the slices are ugly when the light direction is orthogonal with view's direction.

Some pics with 20 billboards
Image

Image

Image

More here:
http://crashy.cartman.free.fr/light_shafts/knots/
Follow la Moustache on Twitter or on Facebook
Image
User avatar
ebol
Halfling
Posts: 67
Joined: Sun Sep 24, 2006 8:49 pm

Post by ebol »

Hey Crashy, this looks really great :) Can wait to se more. Are you using shader model 2.0 or 3.0 ?

Just wondering, in case you release this shader one day, will I have to get a better graphic card :P
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

It's shader 2, I'm only making shader with version 2.0 as I "only" have an Ati X800.

I've had too less free time this week to really work on it, but yes, this shader will be released.
Follow la Moustache on Twitter or on Facebook
Image
User avatar
Virion
Halfling
Posts: 85
Joined: Mon Jul 24, 2006 11:06 am
Location: Malaysia
x 2

Post by Virion »

It looks really great! 8)
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Thanks for the comment
I jsut got a new computer and more free time, to finalize the code&shaders and release a little demo. :)
Follow la Moustache on Twitter or on Facebook
Image
User avatar
yuriythebest
Orc
Posts: 468
Joined: Sun Jul 10, 2005 11:44 am
Location: Kiev, Ukraine
Contact:

Post by yuriythebest »

this is seriously awesome! Can't wait to see a 'usable' version
asteroidWars - an OGRE game
NOOB MAKE MMORPG- the flash movie
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Err...ShaderX series code are all GPLed? So no copy paste into our own application?
User avatar
Falagard
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2060
Joined: Thu Feb 26, 2004 12:11 am
Location: Toronto, Canada
x 3
Contact:

Post by Falagard »

syedhs wrote:Err...ShaderX series code are all GPLed? So no copy paste into our own application?
Inspired by ShaderX, not copied from ;-)
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Sorry for not making myself clear. I bought ShaderX2 and understand a few of the articles therein - in this context, I cant use the shader/code for my own application?
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

You should know what the GPL means, syedhs. :)

Unless you are GPL'ing your stuff, you need to do some thinking on your own. :P
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Yes of course I know what GPL is all about - it is just that to my thinking when you buy a book, you are also entitled to everything inside :wink:

And some code examples in the book are pretty complete and elaborate, it is hard for me to think that those are all GPLed even to the book buyers.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

I feel that way too, but I am pretty sure they mean it.. :|
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Okay I really dont want to hijack this thread, but creating a new thread is not worthwhile either :wink: . But I flipped to the last page of ShaderX2 book and I noticed the 'CD/Source Code Usage Agreement' section and the last point says,
You may use the source code, techniques and example programs in your own commercial or private applications unless otherwise noted by additional usage agreements on the CD.
It pretty contradict with GPL doesnt it? Maybe the GPL thingy is when Wolfgang Engel has proposed not too long ago that he wants to publish the earlier version of ShaderX (maybe ShaderX2 too) for free on the internet and this is to be GPLed.
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Post by Crashy »

Hi everybody.
I've been re working on it the last days, doing some little tests in the code.
Nevertheless, I cannot speend more time on it for a while, so I decided to clean thecode, upload it and give it to the community.
But that's not a big gift I make, as the shader is almost the one for depth shadow mapping, just a few lines changes.

Here it is:
http://crashy.cartman.free.fr/light_sha ... hShafts.7z
There is a source + a binary demo.


a screenshot with 50 planes and a better attenuation than the previous ones.
Image

As I wrote before, the big challenge is the optimization, and one of the key optimization is to clip the billboards in the light fullstrum. I currently don't have time to do that, and I didn't want to keep the other stuff already made for me until I had time to write it.

Another problem is when the camera->object direction is perpendicular to the light->object direction. In this case the billboards are coplanar, so the effect is really ugly. One solution is to reorganise the position(and not only the orientation) of the billboard dynamically when the camera moves,.


Enjoy ;)

Oh, I forgot to say that I made only an hlsl version of the shader, so directx only for the moment.
Follow la Moustache on Twitter or on Facebook
Image
User avatar
Edman
Silver Sponsor
Silver Sponsor
Posts: 76
Joined: Fri Jun 30, 2006 6:57 pm
Location: Prague, Czech Republic
Contact:

Great

Post by Edman »

Gee, this looks really good! Pitty, we can't have this in our project, our
programmer's busy till February 2050 :D No matter what - I love
volumetric effects and these are just perfect!
"Threehandled Mosscovered Gredunza"
Post Reply