Stencil shadow artifacts, near clip collides shadow volume
-
farfpeuf
- Gnoblar
- Posts: 8
- Joined: Fri Jan 26, 2007 8:29 am
Stencil shadow artifacts, near clip collides shadow volume
Hi I have shadow artifacts when the camera near clip plane collides with the shadow volume
I am using a directionnal light
near clip = 5
far clip = 0 (infinite)
ShadowFarDistance = 200.0f
ShadowTechnique = SHADOWTYPE_STENCIL_MODULATIVE
How can I Handle that please ?
I am using a directionnal light
near clip = 5
far clip = 0 (infinite)
ShadowFarDistance = 200.0f
ShadowTechnique = SHADOWTYPE_STENCIL_MODULATIVE
How can I Handle that please ?
You do not have the required permissions to view the files attached to this post.
-
farfpeuf
- Gnoblar
- Posts: 8
- Joined: Fri Jan 26, 2007 8:29 am
Re: Stencil shadow artifacts, near clip collides shadow volu
the problem does not seem to appear when I use the Ninja model, and yet I checked my ogreMax exporter version is 1.7.1
-
farfpeuf
- Gnoblar
- Posts: 8
- Joined: Fri Jan 26, 2007 8:29 am
Re: Stencil shadow artifacts, near clip collides shadow volu
The artefacts seem to appear with unclosed shapes (like the ogre head)
-
Dakiar
- Halfling
- Posts: 83
- Joined: Sun Dec 11, 2005 10:09 pm
Re: Stencil shadow artifacts, near clip collides shadow volu
I have the same problem, let me know if you find a solution.
-
Nodrev
- Gremlin
- Posts: 193
- Joined: Fri Jan 25, 2008 6:55 pm
- Location: Nantes / France
- x 17
Re: Stencil shadow artifacts, near clip collides shadow volu
Hello,
Got the same problem, it's a loggued bug for Ogre 1.7 (.1 and maintenance repository too for the moment).
The strange thing is, that this bug doesn't exist in 1.6 versions, neither in the trunk 1.8 version...
I'm fed up with this, cause we can't switch our ogre version while this is not corrected. I don't want to say "why this is not corrected now", i know that if i want it corrected, i rather have to do it myself, due to the fact that stencil is not really popular anymore (and outdated for sure), but i have 40 diff files within those 3 version (1.6.5 / 1.7.1 / 1.8 ) and it's a mess to find the little line that changes everithing...
Anyway, if someone who works on this part (camera or frustrum or stencil shadow generation) on the 1.8 has an idea...
Got the same problem, it's a loggued bug for Ogre 1.7 (.1 and maintenance repository too for the moment).
The strange thing is, that this bug doesn't exist in 1.6 versions, neither in the trunk 1.8 version...
I'm fed up with this, cause we can't switch our ogre version while this is not corrected. I don't want to say "why this is not corrected now", i know that if i want it corrected, i rather have to do it myself, due to the fact that stencil is not really popular anymore (and outdated for sure), but i have 40 diff files within those 3 version (1.6.5 / 1.7.1 / 1.8 ) and it's a mess to find the little line that changes everithing...
Anyway, if someone who works on this part (camera or frustrum or stencil shadow generation) on the 1.8 has an idea...
-
frr171
- Gnoblar
- Posts: 4
- Joined: Thu Oct 07, 2010 2:39 am
Re: Stencil shadow artifacts, near clip collides shadow volu
I'm getting the exact same error


-
Nodrev
- Gremlin
- Posts: 193
- Joined: Fri Jan 25, 2008 6:55 pm
- Location: Nantes / France
- x 17
Re: Stencil shadow artifacts, near clip collides shadow volu
Hi,
Here some news about my researchs concerning this problem: I had already remarked that the stencil volumes mess up on the caps beetween sub-entities (even if there's no "visible" cap). So, i update all mesh and entities functions where the cap calculation was done with the trunk (1.8 ) version, but unfortunally, that's doesn't change anything. I check the extrusion programs too beetween those two version (i'm talking about 1.7 and 1.8 ), and there's no noticiable modification, expect a new program (anyway, that's not that, cause my cg does not support those programs). Viewports and frustrum classes are obviously the same (except a clear depth buffer in viewport if i remind well...).
So, the last big difference beetween 1.7 and 1.8 (except the normals animations and the entity instancing parts) that is left is the Depth Buffer management system. But here, i have to say that it's comes a little too low-level for me (:-(), but i'm pretty sure that there something related to this problem in there...
<edit>I forgot to mention that, obviously, my tests where done with closed meshes</edit>
Here some news about my researchs concerning this problem: I had already remarked that the stencil volumes mess up on the caps beetween sub-entities (even if there's no "visible" cap). So, i update all mesh and entities functions where the cap calculation was done with the trunk (1.8 ) version, but unfortunally, that's doesn't change anything. I check the extrusion programs too beetween those two version (i'm talking about 1.7 and 1.8 ), and there's no noticiable modification, expect a new program (anyway, that's not that, cause my cg does not support those programs). Viewports and frustrum classes are obviously the same (except a clear depth buffer in viewport if i remind well...).
So, the last big difference beetween 1.7 and 1.8 (except the normals animations and the entity instancing parts) that is left is the Depth Buffer management system. But here, i have to say that it's comes a little too low-level for me (:-(), but i'm pretty sure that there something related to this problem in there...
<edit>I forgot to mention that, obviously, my tests where done with closed meshes</edit>
-
JonnyJP
- Goblin
- Posts: 231
- Joined: Sun Nov 01, 2009 4:23 pm
- x 2
Re: Stencil shadow artifacts, near clip collides shadow volu
Has this been fixed yet?
-
Nodrev
- Gremlin
- Posts: 193
- Joined: Fri Jan 25, 2008 6:55 pm
- Location: Nantes / France
- x 17
Re: Stencil shadow artifacts, near clip collides shadow volu
It's ok with the trunk (1.8 ) version, but I did not test the 1.7.3...
-
JonnyJP
- Goblin
- Posts: 231
- Joined: Sun Nov 01, 2009 4:23 pm
- x 2
Re: Stencil shadow artifacts, near clip collides shadow volu
Ok thanks, I'm just trying 1.6.5 too (I read that that version didn't have the problem).
EDIT 1.6.5 seems to have the same problem. How do I get 1.8?
EDIT 1.6.5 seems to have the same problem. How do I get 1.8?
-
JonnyJP
- Goblin
- Posts: 231
- Joined: Sun Nov 01, 2009 4:23 pm
- x 2
Re: Stencil shadow artifacts, near clip collides shadow volu
Does anyone know which files contained the bug fix in 1.8 please? I'd like to just put this fix in my 1.7.2 installation without getting all of 1.8.
Thanks
Thanks
-
Nodrev
- Gremlin
- Posts: 193
- Joined: Fri Jan 25, 2008 6:55 pm
- Location: Nantes / France
- x 17
Re: Stencil shadow artifacts, near clip collides shadow volu
I think that it's related to the depth buffer management... as it completely changed since 1.7, you can't do that...
-
JonnyJP
- Goblin
- Posts: 231
- Joined: Sun Nov 01, 2009 4:23 pm
- x 2
-
Kaylx
- Greenskin
- Posts: 123
- Joined: Sun May 22, 2011 10:45 pm
- Location: Scotland
- x 7
Re: Stencil shadow artifacts, near clip collides shadow volu
God news everyone!
After trawling through the code changes between 1.7.2 and 1.8 I managed to track down and fix the stencil shadow artifact problem.
It's a massive change. See below:
OgreShadowCaster.cpp@158
That's right. Remove that break statement and everything works again. So not really a massive change after all. 
Hope this helps everyone that's been suffering with this issue.
Regards,
Kaylx
After trawling through the code changes between 1.7.2 and 1.8 I managed to track down and fix the stencil shadow artifact problem.
It's a massive change. See below:
OgreShadowCaster.cpp@158
Code: Select all
for ( ; ti != tiend; ++ti, ++lfi)
{
assert(ti->vertexSet == eg.vertexSet);
// Check it's light facing
if (*lfi)
preCountIndexes += increment;
}
break; // <----- Comment out this lineHope this helps everyone that's been suffering with this issue.
Regards,
Kaylx
-
JonnyJP
- Goblin
- Posts: 231
- Joined: Sun Nov 01, 2009 4:23 pm
- x 2
Re: Stencil shadow artifacts, near clip collides shadow volu
You're a star!!!
-
Nodrev
- Gremlin
- Posts: 193
- Joined: Fri Jan 25, 2008 6:55 pm
- Location: Nantes / France
- x 17
Re: Stencil shadow artifacts, near clip collides shadow volu
Great, I must have missed this point while comparing...
-
dustbin1_uk
- Halfling
- Posts: 55
- Joined: Sat Dec 22, 2007 6:56 pm
- x 1
Re: Stencil shadow artifacts, near clip collides shadow volu
Just wanted to say THANK YOU! for resolving this!
I raised this a while back,
http://www.ogre3d.org/forums/viewtopic. ... 07#p445407
But I did not have the skill to sort it. Though you seem have nailed it simply.
Thank you again!
I raised this a while back,
http://www.ogre3d.org/forums/viewtopic. ... 07#p445407
But I did not have the skill to sort it. Though you seem have nailed it simply.
Thank you again!
-
muttob
- Gnoblar
- Posts: 8
- Joined: Thu Jul 28, 2011 7:00 am
Re: Stencil shadow artifacts, near clip collides shadow volu
Hello everyone,
i have the same problem with the shadows, but i can't find the OgreShadowCaster.cpp file only the .h file.
It would be great if someone could help me.
nice Greetings
Tobi
i have the same problem with the shadows, but i can't find the OgreShadowCaster.cpp file only the .h file.
It would be great if someone could help me.
nice Greetings
Tobi
-
Kaylx
- Greenskin
- Posts: 123
- Joined: Sun May 22, 2011 10:45 pm
- Location: Scotland
- x 7
Re: Stencil shadow artifacts, near clip collides shadow volu
If you don't have the cpp files then i'm presuming you've installed the SDK and not the source package.
You'd need to download, modify and build the source package.
Alternatively wait till 1.8 is released, shouldn't be too long now. It has the fix in it.
You'd need to download, modify and build the source package.
Alternatively wait till 1.8 is released, shouldn't be too long now. It has the fix in it.
-
ekee
- Gnoblar
- Posts: 6
- Joined: Mon Feb 01, 2010 4:14 am
Re: Stencil shadow artifacts, near clip collides shadow volu
Kaylx, great job!
however, it did not fix the problem on my computer after I followed the instruction to comment out the "break" statement ...
btw, I'm revising the code based on 1.7.0RC1.
does that mean I might also have to modify the code somewhere else?
in ogre 1.7.0RC1, even the sample app has the fault:
however, it did not fix the problem on my computer after I followed the instruction to comment out the "break" statement ...
btw, I'm revising the code based on 1.7.0RC1.
does that mean I might also have to modify the code somewhere else?
in ogre 1.7.0RC1, even the sample app has the fault:
You do not have the required permissions to view the files attached to this post.
-
Kaylx
- Greenskin
- Posts: 123
- Joined: Sun May 22, 2011 10:45 pm
- Location: Scotland
- x 7
Re: Stencil shadow artifacts, near clip collides shadow volu
My 'fix' was for 1.7.2 and I didn't test it on any older version.
If you're still seeing the issue in 1.7.0RC1 then as you said it looks like more code has to changed to get things working. What code to modify though, i couldn't tell you i'm afraid.
May I ask, out of curiosity, why you're using a RC build and not a proper release?
If you're still seeing the issue in 1.7.0RC1 then as you said it looks like more code has to changed to get things working. What code to modify though, i couldn't tell you i'm afraid.
May I ask, out of curiosity, why you're using a RC build and not a proper release?
-
ekee
- Gnoblar
- Posts: 6
- Joined: Mon Feb 01, 2010 4:14 am
Re: Stencil shadow artifacts, near clip collides shadow volu
thanks, i will try to figure it out what code to modify in order to make 1.7.0rc1 work.
it's a little bit complicated to explain why we stick to this RC build, it's not my decision to make though...
i hope our project can switch to a more stable version one day.
it's a little bit complicated to explain why we stick to this RC build, it's not my decision to make though...
i hope our project can switch to a more stable version one day.