[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: 996
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 14
Contact:

[demo added]Volume Shadows & Light Shafts

Post by Crashy » Fri Jun 22, 2007 9:05 pm

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.
0 x
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
Contact:

Re: Volume Shadows & Light Shafts

Post by jacmoe » Fri Jun 22, 2007 9:21 pm

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

Anyway, this looks promising! :)
0 x
/* 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: 996
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 14
Contact:

Post by Crashy » Fri Jun 22, 2007 9:27 pm

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.
0 x
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 1
Contact:

Post by Kencho » Fri Jun 22, 2007 9:35 pm

w0000t!! Dude, this is seriously cool! Just too bad about the performance... :(
0 x
Image

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Post by jacmoe » Fri Jun 22, 2007 10:02 pm

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:
0 x
/* 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: 996
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 14
Contact:

Post by Crashy » Fri Jun 22, 2007 10:09 pm

No problem, I'm not aware of this discussion ;)
Shader X is for me just a good learning basis for shader stuff.
0 x
Follow la Moustache on Twitter or on Facebook
Image

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19261
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
Contact:

Post by sinbad » Sat Jun 23, 2007 3:59 pm

Really nice, well done!
0 x

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

Post by ahmedismaiel » Sat Jun 23, 2007 11:21 pm

that's really awesome
I've been wandering around it for sometime ,but couldn't get the planes right
how did u do it? :)
0 x

Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 996
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 14
Contact:

Post by Crashy » Sun Jun 24, 2007 9:33 pm

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 ;)
0 x
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 » Mon Jun 25, 2007 9:39 am

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
0 x

Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 996
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 14
Contact:

Post by Crashy » Mon Jun 25, 2007 7:38 pm

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/
0 x
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 » Fri Jun 29, 2007 12:46 pm

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
0 x

Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 996
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 14
Contact:

Post by Crashy » Fri Jun 29, 2007 6:07 pm

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.
0 x
Follow la Moustache on Twitter or on Facebook
Image

User avatar
Virion
Halfling
Posts: 84
Joined: Mon Jul 24, 2006 11:06 am
Location: Malaysia

Post by Virion » Wed Aug 22, 2007 2:16 pm

It looks really great! 8)
0 x

Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 996
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 14
Contact:

Post by Crashy » Thu Aug 23, 2007 4:16 pm

Thanks for the comment
I jsut got a new computer and more free time, to finalize the code&shaders and release a little demo. :)
0 x
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 » Sun Aug 26, 2007 11:09 pm

this is seriously awesome! Can't wait to see a 'usable' version
0 x
asteroidWars - an OGRE game
NOOB MAKE MMORPG- the flash movie

User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2702
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 2

Post by syedhs » Mon Aug 27, 2007 5:03 pm

Err...ShaderX series code are all GPLed? So no copy paste into our own application?
0 x

User avatar
Falagard
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2060
Joined: Thu Feb 26, 2004 12:11 am
Location: Toronto, Canada
Contact:

Post by Falagard » Mon Aug 27, 2007 6:09 pm

syedhs wrote:Err...ShaderX series code are all GPLed? So no copy paste into our own application?
Inspired by ShaderX, not copied from ;-)
0 x

User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2702
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 2

Post by syedhs » Mon Aug 27, 2007 6:50 pm

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?
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Post by jacmoe » Mon Aug 27, 2007 8:20 pm

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
0 x
/* 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: 2702
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 2

Post by syedhs » Tue Aug 28, 2007 9:19 am

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.
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Post by jacmoe » Tue Aug 28, 2007 11:06 pm

I feel that way too, but I am pretty sure they mean it.. :|
0 x
/* 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: 2702
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 2

Post by syedhs » Wed Aug 29, 2007 3:56 pm

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.
0 x

Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 996
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 14
Contact:

Post by Crashy » Thu Oct 25, 2007 4:57 pm

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.
0 x
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 » Tue Oct 30, 2007 12:13 am

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!
0 x
"Threehandled Mosscovered Gredunza"

Post Reply