Shadow volume shader optimization
-
- Posts: 91
- Joined: Sun Oct 19, 2008 5:29 pm
- Location: Valencia (Spain)
- Contact:
Shadow volume shader optimization
Hi.
It's becoming an obsession with the issue of how to get a good system of shadows with Irrlicht, since it is the best engine for easy handling and powerful, but don't have a system of shadows decent.
I am working in a volume shadow system, that you are using a lot of games and engines, using a shader for create the extruded. If all goes well, in the future, one could integrate.
Improvement:
Current shadow volume - 104 FPS with 5472 triangles
GPU shadow volume - 540 FPS with 5472 triangles
Here I leave a link to the example, is not definitive and needs many adjustments.
http://www.elcreadordavid.hostei.com/pr ... rusion.zip
There are several flaws and is not to be, so I hope your comments and maybe solutions Smile
It's becoming an obsession with the issue of how to get a good system of shadows with Irrlicht, since it is the best engine for easy handling and powerful, but don't have a system of shadows decent.
I am working in a volume shadow system, that you are using a lot of games and engines, using a shader for create the extruded. If all goes well, in the future, one could integrate.
Improvement:
Current shadow volume - 104 FPS with 5472 triangles
GPU shadow volume - 540 FPS with 5472 triangles
Here I leave a link to the example, is not definitive and needs many adjustments.
http://www.elcreadordavid.hostei.com/pr ... rusion.zip
There are several flaws and is not to be, so I hope your comments and maybe solutions Smile
Cool, in my new system I will be adding some more options in the interface for shadowing types, so maybe I can integrate this and add GPU extrusion as an option.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
- Posts: 91
- Joined: Sun Oct 19, 2008 5:29 pm
- Location: Valencia (Spain)
- Contact:
I tried it out, I actually get about 2,600 FPS constant, however, as you noted there are some flaws. The shadows were not continuous and there were some spots where shadows would not be cast at all. If you'd like, I can screenshot it, unless you already know about those two issues.
Oh, it might be relevant to note I am using ATI's preview OpenGL 4.0 drivers.
Oh, it might be relevant to note I am using ATI's preview OpenGL 4.0 drivers.
-
- Posts: 91
- Joined: Sun Oct 19, 2008 5:29 pm
- Location: Valencia (Spain)
- Contact:
I do not think you need to view an image that shows errors, i know that there are many , but thanks.
The important thing is to know where the error if the effect or how to obtain the shadow.
Here I show the code in GLSL, that I am using (only work in ARB):
I hope someday to work properly
The important thing is to know where the error if the effect or how to obtain the shadow.
Here I show the code in GLSL, that I am using (only work in ARB):
Code: Select all
void main()
{
vec3 lightDir = (gl_ModelViewMatrix * gl_Vertex
- gl_LightSource[0].position).xyz;
// if the vertex is lit
float dt = dot(lightDir, gl_NormalMatrix * gl_Normal);
if ( dt <0.01 )
{
// don't move it
gl_Position = ftransform();
}
else
{
// move it far, is the light direction
vec4 fin = gl_ProjectionMatrix * (
gl_ModelViewMatrix * gl_Vertex
+ vec4(normalize(lightDir) * 100000.0, 0.0)
);
// if fin is behind the far plane
if ( fin.z > fin.w )
fin.z = fin.w; // move to the far plane (needed for z-fail algo.)
gl_Position = fin;
}
}
I wasn't referring to my library XEffects, but the shadow system I am working on for Irrlicht.Viz_Fuerte wrote:If this works, I would like to be integrated directly into the source code of the Irrlicht and not by any external system.
BlindSide@ I have nothing against your library, but is easier using the same command to generate the shadows as it is doing so far
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
- Posts: 222
- Joined: Mon Jan 19, 2009 10:03 pm
- Location: Miami, Florida
- Contact:
i think you're kinda missing the point with this shadowing, as I can see that the shadows are being drawn ON. A real shadow prevents a direct light ray from hitting a surface, therefore a real shadow would cause the phong or lambertian shading function to return 0 for both specular and diffuse. As I can see from the image both are present within the shadow but are dimmed down.
He just optimized the standard shadow system in Irrlicht so it doesn't make sense that he should take all that into account.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
- Posts: 91
- Joined: Sun Oct 19, 2008 5:29 pm
- Location: Valencia (Spain)
- Contact:
Hi
devsh@
As say BlindSide, I just want optimize the creation of shadows as does the Irrlicht. I know how to create shadows using the stencil buffer to make them look like Doom3, but that requires more complex and multipass, something that sounds not good.
For now I'm still "trying" to make this work but I am not very professional in this.
devsh@
As say BlindSide, I just want optimize the creation of shadows as does the Irrlicht. I know how to create shadows using the stencil buffer to make them look like Doom3, but that requires more complex and multipass, something that sounds not good.
For now I'm still "trying" to make this work but I am not very professional in this.
Re: Shadow volume shader optimization
This looks good! Any chance you could re-upload this?
I would like to see if I can integrate this into our game.
I would like to see if I can integrate this into our game.
Re: Shadow volume shader optimization
Hi,
has someone the source for the 1'st post ? ( ShadowVolumeExtrusion.zip )
has someone the source for the 1'st post ? ( ShadowVolumeExtrusion.zip )
Re: Shadow volume shader optimization
many many thanks !!!!
Re: Shadow volume shader optimization
thanks lmao
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.
**