chaosfire / vdrift-ogre

Automatically exported from code.google.com/p/vdrift-ogre
0 stars 0 forks source link

Shadows #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Fixing shadows, adding depth for them, best without much performance dropped.
Current implementation (color shadows) requires objects either to cast or 
receive shadows, not self shadowing is possible. When cast, the shadow is 
everywhere in one direction (depth isn't used, either 0 or one written in 
shadowmap).
This requires good knowledge of OGRE and shaders.
Using z-buffer for depth this could be done, then reading it with special 
function.
Depth shadows are working in OGRE but they are very demanding (2x lower Fps).
Other work could also be done to use the default ogre shadows (1 shadowmap, no 
PSSM) to work good with terrain (this option good for fps and gives also self 
shadows but only near).

Original issue reported on code.google.com by Cry...@gmail.com on 21 Mar 2011 at 6:18

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Whatever will be changed, the user should still have full control over shadows 
and choose between different implementations. Under certain conditions they can 
really be an FPS killer.

Original comment by scrawl...@gmail.com on 21 Mar 2011 at 6:33

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This may be a useful link:
http://www.ogre3d.org/forums/viewtopic.php?f=2&t=38354&start=25

Original comment by Cry...@gmail.com on 27 Mar 2011 at 7:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Not sure if we are going get it to a usable state, but we have progress with 
depth shadows. The terrain still has a problem with them, but otherwise they 
are most likely ok.

Original comment by scrawl...@gmail.com on 11 Oct 2011 at 9:18

GoogleCodeExporter commented 8 years ago

Original comment by Cry...@gmail.com on 12 Oct 2011 at 5:27

GoogleCodeExporter commented 8 years ago

Original comment by scrawl...@gmail.com on 14 Oct 2011 at 8:51

GoogleCodeExporter commented 8 years ago
Road shader should also read terrain's lightmap, so it will receive shadows 
from terrain.

Original comment by scrawl...@gmail.com on 15 Oct 2011 at 11:17

GoogleCodeExporter commented 8 years ago
Status update on this.

The depth shadows itself are now working, even on terrain, which we achieved by 
using a custom TerrainMaterialGenerator for ogre with a custom receiver shader.

This means we have, in theory, self shadows working, with the following 
implications:
 - there is an issue with directx (shader fails to compile), probably easy to fix this one. 
 - PSSM depth shadows need back faces rendered in the shadow map. As a result, an "unclosed" mesh (loose faces, etc) will have "gaps" in its shadow. This can be seen on ES car for example. Not a major issue, and could be solved by adjusting the relevant meshes.
 - We need to adjust all materials that they should receive shadows, but depending on shadow setting. E.g. car should only receive shadow when depth shadows are turned on. Since it's a very tedious job to put these materials for both shadowed and not shadowed in *.material scripts, for all materials, we decided to do a "Material generator" in Cpp code. If we already do this, we can also make other material parameters (like normal maps, environment maps) configurable (so they can be turned off). This will probably be a lot of work.

Original comment by scrawl...@gmail.com on 16 Oct 2011 at 8:23

GoogleCodeExporter commented 8 years ago
Yes, I'll add that material generator also needs params like: texture size 
(names with _s), shadows on/off, shadow texture count, depth shadows, per pixel 
lighting (shaders) on/off, and maybe some new ones. Those come from user 
settings (pSet), changed in GUI.
The materials by themself have such variations (with/without): alpha (on 
terrain road), env reflection (car body,wall), car glass, road glass, shadows 
(ultimately for each in depth, but not for normal) etc. Water shader is 
probably a different story.

Original comment by Cry...@gmail.com on 17 Oct 2011 at 5:20

GoogleCodeExporter commented 8 years ago
Awesome, finally working self-shadows.

Original comment by Cry...@gmail.com on 21 Oct 2011 at 9:17

GoogleCodeExporter commented 8 years ago
Depth shadows itself are working, and with terrain too.

Material Generator is up and working. Already some materials are generated with 
it (car, road wall, pipe wall) and have working self-shadow.

Shadows look very good now and everything seems working, so I'm marking it 
fixed now.

Of course other things like more gui options (Shader tab) could be done now 
that we have a nice material generator. But that's a different issue then.

Original comment by scrawl...@gmail.com on 22 Oct 2011 at 10:30