Page 1 of 2

shadow speckles

Posted: Sat Apr 22, 2006 12:37 pm
by xDan
Hi :D
My shadows have speckles in them :-( Almost like the model has lots of small holes in it which keep dissapearing and appearing.

How can I fix this?

Here's a screenshot:
http://www.freepgs.com/defilter/images/ ... eckles.png
the speckles change every frame. you'll have to copy the link to get it work

Thanks

Posted: Sat Apr 22, 2006 1:02 pm
by hybrid
I guess it's zbuffer fighting. The terrain sometimes wins and is thus rendered in front of the shadow.

Posted: Sat Apr 22, 2006 5:58 pm
by xDan
Is there anything I can do? I tried making the zfar close (like 300).

The reason I moved to irrlicht was because I wanted easy shadows. Oh and particle effects. And normal mapping. And water. 8)

Posted: Tue Apr 25, 2006 3:49 pm
by xDan
Let me try a different tack. Has anyone managed to get shadows working without these problems? Just, like, out of interest.

If not I guess shadows should be removed from irrlicht's feature list. :D

Posted: Tue Apr 25, 2006 5:17 pm
by gfxstyler
yeah, i can enable them and they look just normal.

does your mesh have holes?

Posted: Tue Apr 25, 2006 9:08 pm
by xDan
no
I've googled z fighting and tried suggestions - larger znear, closer zfar but to no avail :-(
is there a way in irrlicht to increase the zbuffer accuracy? and what is it by default?

a quote from a website: "glDepthFunc(GL_LEQUAL); // we put it again to LESS or EQUAL (or else you will get some z-fighting)"
*wonders if GL_LEQUAL is set*

although I suppose it must be all correct or other people would have problems.

Posted: Tue Apr 25, 2006 9:29 pm
by hybrid

Code: Select all

$ grep -r GL_LEQUAL .
./COpenGLDriver.cpp:    glDepthFunc(GL_LEQUAL);
./COpenGLDriver.cpp:    glDepthFunc(GL_LEQUAL);
./COpenGLDriver.cpp:    glDepthFunc( GL_LEQUAL );
And no hits with GL_LESS. So at least not the wrong value is set :lol:
Did you try the same with DirectX? Spintz produced a fix for it to keep the FPU precision high if set to high in your settings. IIRC there is the possibility to have 16bit and 32bit zbuffer and Irrlicht usually reset it to 16bit without this fix. Maybe the same holds still for OpenGL in some occasions?

Posted: Wed Apr 26, 2006 9:04 am
by hybrid
Another short update n this topic. The problem is easily reproducable: Start the SpecialFX example and turn on real-time shadows. You'll the the errors right behind the dwarf on the topmost step. At least for the unpatched irrlicht-1.0. I could not see this problem in irrlicht-0.14.
xDan, could you please try your app with 0.14? I'll check the source diff where the probably causes could lie.

Posted: Wed Apr 26, 2006 8:32 pm
by xDan
I'm using 0.14 :)
I don't think I have it compiled for directx but I will find the libraries and try it...
maybe I will try out 1.0 as well.

Posted: Wed Apr 26, 2006 8:42 pm
by hybrid
Darn, so it's not due to engine changes, but a longer term problem. The SpecialFX example changed textures and probably other things, so this might be the reason for appearance in the latest version.

Posted: Wed Apr 26, 2006 9:28 pm
by xDan
Looks the same with directx 8 or 9.
I will go have a look at irrlicht 1.0...

Posted: Tue Oct 03, 2006 1:30 am
by funcdoobiest
Any news on this, having the same problem with the character model: animated .X mesh, made in 3ds max, not sure which exporter the artist used, resaved in the DX model viewer.

Posted: Tue Oct 03, 2006 11:27 am
by Luke
Hybrid:


It may not be a problem with Irrlicht at all, the dwarf mesh has a gap under its head to save on polygons, its not visible unless you take the body away. Maybe someone skilled in modelling can fill it in and hopefully it will fix this.


Off topic:

Irrlicht’s shadow system is very limited (eg options in turn self shadowing off, what meshes receive shadows, etc) are there any future plans to improve this?

Posted: Tue Oct 03, 2006 4:23 pm
by funcdoobiest
^ I very much doubt it, if xDans problem is anything like mine, it appears that there are loads of TINY holes (like the size of a pixel) but I am certain it is not a problem with holes in the mesh, that is simply the easiest way to describe how it looks... and also the models I am using are all closed volumes.

Posted: Tue Oct 03, 2006 5:54 pm
by bitplane
can you provide a screenshot? what's your graphics card? does it happen in OGL? can you provide a model file? is the recieving surface flat, or bumpy? does it only happen when the shadow is over certain type of material? have you tried the latest svn version of irrlicht?
if we can get enough info and a repeatable test case together this thread can be moved to bug reports.