[demo added]Volume Shadows & Light Shafts
-
- Google Summer of Code Student
- Posts: 1005
- Joined: Wed Jan 08, 2003 9:15 pm
- Location: Lyon, France
- x 49
[demo added]Volume Shadows & Light Shafts
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
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
Last edited by Crashy on Fri Oct 26, 2007 7:31 am, edited 2 times in total.
-
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
Re: Volume Shadows & Light Shafts
Hehe! GPL really sucks, huh?Crashy wrote:inspirated by far from the Shader X3 code.
Anyway, this looks promising!
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Google Summer of Code Student
- Posts: 1005
- Joined: Wed Jan 08, 2003 9:15 pm
- Location: Lyon, France
- x 49
-
- OGRE Retired Moderator
- Posts: 4011
- Joined: Fri Sep 19, 2003 6:28 pm
- Location: Burgos, Spain
- x 2
-
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
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!
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!
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
-
- OGRE Contributor
- Posts: 217
- Joined: Wed Jan 25, 2006 11:16 pm
- Location: Redmond,WA
-
- Google Summer of Code Student
- Posts: 1005
- Joined: Wed Jan 08, 2003 9:15 pm
- Location: Lyon, France
- x 49
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
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
-
- OGRE Contributor
- Posts: 217
- Joined: Wed Jan 25, 2006 11:16 pm
- Location: Redmond,WA
-
- Google Summer of Code Student
- Posts: 1005
- Joined: Wed Jan 08, 2003 9:15 pm
- Location: Lyon, France
- x 49
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
More here:
http://crashy.cartman.free.fr/light_shafts/knots/
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
More here:
http://crashy.cartman.free.fr/light_shafts/knots/
-
- Halfling
- Posts: 67
- Joined: Sun Sep 24, 2006 8:49 pm
-
- Google Summer of Code Student
- Posts: 1005
- Joined: Wed Jan 08, 2003 9:15 pm
- Location: Lyon, France
- x 49
-
- Halfling
- Posts: 85
- Joined: Mon Jul 24, 2006 11:06 am
- Location: Malaysia
- x 2
-
- Silver Sponsor
- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
-
- OGRE Retired Moderator
- Posts: 2060
- Joined: Thu Feb 26, 2004 12:11 am
- Location: Toronto, Canada
- x 3
-
- Silver Sponsor
- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
-
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
You should know what the GPL means, syedhs.
Unless you are GPL'ing your stuff, you need to do some thinking on your own.
Unless you are GPL'ing your stuff, you need to do some thinking on your own.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Silver Sponsor
- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
-
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
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.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Silver Sponsor
- Posts: 2703
- Joined: Mon Aug 29, 2005 3:24 pm
- Location: Kuala Lumpur, Malaysia
- x 51
Okay I really dont want to hijack this thread, but creating a new thread is not worthwhile either . 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,
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.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.
-
- Google Summer of Code Student
- Posts: 1005
- Joined: Wed Jan 08, 2003 9:15 pm
- Location: Lyon, France
- x 49
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.
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.
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.
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.
-
- Silver Sponsor
- Posts: 76
- Joined: Fri Jun 30, 2006 6:57 pm
- Location: Prague, Czech Republic
Great
Gee, this looks really good! Pitty, we can't have this in our project, our
programmer's busy till February 2050 No matter what - I love
volumetric effects and these are just perfect!
programmer's busy till February 2050 No matter what - I love
volumetric effects and these are just perfect!
"Threehandled Mosscovered Gredunza"