Foros - Stratos

Proyectos => Jad Engine => Mensaje iniciado por: auron en 06 de Febrero de 2006, 06:13:41 AM

Título: Shadow Glitches
Publicado por: auron en 06 de Febrero de 2006, 06:13:41 AM
 Hey guys,

What do each of these lines do?

HShadowVolumes.AddToCache = true;
Haddd.Scene.Shadows.UsePCF = true;
Haddd.Scene.Shadows.Shadow_Bias = (value);


I'm testing out shadows now but I'm getting some rather strange graphical glitches when I set AddToCache to true. It causes the shadows of my moving objects to generate inaccurate flickering shadows. Other than that everything's fine.

Also, how do I set the maximum shadow range? because I found that if the object is too far away, the shadow doesn't reach my plane.
Título: Shadow Glitches
Publicado por: Haddd en 06 de Febrero de 2006, 08:10:06 AM
 HShadowVolumes.AddToCache = true;

You know that shadow volumes are builded from the vertex and light position. If you move the light or the object, you must re-build the shadow volume.

When you set AddToCache=true, you tell the engine that stores every new shadow builded. This way, when the engine needs to build a new one, first take a look at the list.

The problem is that the engine compares the position this way:

       
static Vector3 VectorRounded(Vector3 v)
       {
           return new Vector3((float)Math.Round(v.X, 1), (float)Math.Round(v.Y, 1), (float)Math.Round(v.Z, 1));
       }


So, of course there are some problems with it. It's good for the example, but for some different cases it's not ....

Haddd.Scene.Shadows.UsePCF = true;

For shadowmapping, tells the engine that uses Percentage Close Filtering. But does not work for stencil.

Haddd.Scene.Shadows.Shadow_Bias = (value);

Not used. I must remove it.  :(

and for the shadow range, you should use the property:

meshobject.Mesh.ShadowVolume.ExtrusionConstant

(ole)  
Título: Shadow Glitches
Publicado por: auron en 06 de Febrero de 2006, 09:32:18 AM
 Thanks a bunch haddd. :D

But one thing I noticed is that if the camera is underneath the shadow, the shadows become rather screwed up... Is there a way to get around this?

Cheers
Título: Shadow Glitches
Publicado por: Haddd en 06 de Febrero de 2006, 09:55:39 AM
 You must set the Depth fail option ( DepthPass=false) , but we have problems with it. The object that makes shadows appears shadowed and it should not.  :(  I took a look a lot with it but i can not see the bug...
Título: Shadow Glitches
Publicado por: auron en 06 de Febrero de 2006, 10:21:24 AM
 Yeah setting DepthPass to false creates some shadow gitches that can be seen pretty easily at certain angles.
I took a screenshot and the shadow near the middle is missing a whole piece.

(http://screenshots.chewableonline.com/Glitch.Jpg)

But the "underneath" problem isn't there anymore.

Any idea why the shadow appears that way when DepthPass is set to false?
Título: Shadow Glitches
Publicado por: Haddd en 06 de Febrero de 2006, 10:47:37 AM
 Nice volumetric light  :P

Shadows, shadows...I will take a deep look at the Depth fail algorithm.... O_O  
Título: Shadow Glitches
Publicado por: auron en 06 de Febrero de 2006, 11:51:25 AM
 Thanks Haddd... :D

Another shadow problem I encountered...
Here's the scenario:

I created many glowing balls with a red light each attached to them.
I placed a directional light that rotates when I press a key so I can change the global light direction.
The problem is that at certain angles, the light attached to certain balls are "turned off".

Here's some screenshots:

(http://screenshots.chewableonline.com/ShadowMap1.jpg)

(http://screenshots.chewableonline.com/ShadowMap2.jpg)

Notice the balls on the top right. The light attached to them doesn't emit any light when my directional light is adjusted.
The third line of text on the top left corner is the current X angle of the directional light just in case you need to know.
Also I noticed that when I rotated the light, the X value isn't wrapped down to 0 after PI.

You think this might cause overflow problems in the future if the number gets too large?
Would it be better if you wrapped the angles?

EDIT:
I managed to resolve the issue by setting the directional light not to cast shadows.
Título: Shadow Glitches
Publicado por: Haddd en 06 de Febrero de 2006, 04:14:33 PM
 Very nice image... :P  
Título: Shadow Glitches
Publicado por: auron en 06 de Febrero de 2006, 06:06:33 PM
 Thanks! :D Expect more though! B)

Oh yeah, you think the angle wrapping is a good idea Haddd?
Bringing it down to 0 to PI.
Título: Shadow Glitches
Publicado por: Vicente en 06 de Febrero de 2006, 06:20:51 PM
 Auron, don´t tell anyone, but I think you are giving them a good work ;) (I´m scared now to release the AI things :P). Greetings!

Vicente
Título: Shadow Glitches
Publicado por: auron en 06 de Febrero de 2006, 06:23:03 PM
 Thanks a bunch Vicente... :D

That's encouraging.. I'm gonna try to model some stuff and put it in the game...

I'll need some ragdoll templates too so i'll try my hand at that when I get confident enough.
Título: Shadow Glitches
Publicado por: Haddd en 16 de Febrero de 2006, 12:41:16 PM
 Solved the coplanar issues with depth fail. Please send me the scene and the code to test the directional lights problems.
Título: Shadow Glitches
Publicado por: auron en 21 de Febrero de 2006, 12:43:47 PM
 Sorry I took so long... :( I'll send it to you right away... What email addy you want me to send it to?
Título: Shadow Glitches
Publicado por: Haddd en 21 de Febrero de 2006, 12:47:20 PM
 haddd@telefonica.net

:P  
Título: Shadow Glitches
Publicado por: auron en 23 de Febrero de 2006, 08:58:57 AM
 Sent. :D
Título: Shadow Glitches
Publicado por: Haddd en 23 de Febrero de 2006, 10:14:01 AM
 well, first of all you are not working with the last version...Please update... :)

And the second big problem is the extrusion constant. You have a big terrain, and the extrusion value is 40. It's not enough, but a problem with big extrusion values are that in depth fail mode, they can not be greater than the far clip plane. There is a solution with all of this, but when i studied the shadows, i think that you really need the extrusion values, because if you are in a room, you do not want that the shadow volume extrusion goes through the walls, so you need to fix a good value. But maybe i should give you the option to use infinite far plane shadow volumes... ;)  
Título: Shadow Glitches
Publicado por: auron en 23 de Febrero de 2006, 06:42:49 PM
 I was just testin out the extrusion constant.. :D Cos the shadows tended not to reach certain points if it was too far off. Infinite planes would be nice. :D