[2.1] Shadows pixelated far from the origin on iOS only
-
- Halfling
- Posts: 83
- Joined: Sun Feb 21, 2010 4:58 pm
- x 28
[2.1] Shadows pixelated far from the origin on iOS only
I am running my application on macOS and iOS and the shadows look fine on the mac but on iOS they only work correctly when I'm near (0,0,0). As I move away the shadows start to become more and more pixelated, which seems that it's basically not focusing the PSSM on the camera so it's using the higher splits. The weirdest thing is that it only happens on iOS really. I am using the Metal render system. Is there iOS-specific code that deals with this?
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1279
- Contact:
Re: [2.1] Shadows pixelated far from the origin on iOS only
There is nothing iOS specific except for an out of bounds check for the UV (iOS doesn't support border colour samplers) but it shouldn't cause this.
I suspect floating point precision problems caused by NEON code in Focused shadow camera setup. Could you try recompiling without OGRE_SIMD_NEON?
Btw how far are you from origin?
Update: nevermind. I remember I found out 1 week ago that half is not enough for shadow mapping. I'll post a fix in a few hs when I get back home
I suspect floating point precision problems caused by NEON code in Focused shadow camera setup. Could you try recompiling without OGRE_SIMD_NEON?
Btw how far are you from origin?
Update: nevermind. I remember I found out 1 week ago that half is not enough for shadow mapping. I'll post a fix in a few hs when I get back home
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1279
- Contact:
Re: [2.1] Shadows pixelated far from the origin on iOS only
This commit should fix it. Please let me know how it goes.
Basically, with a shadow map of 2048x2048, all UVs past 0.5 can only identify half a pixel of precision (i.e. 1024, 1024.5, 1025, 1025.5, 1026, 1026.5 ... 2048), which is extremely low for precise filtering.
Desktop GPUs usually promote half floating point to 32-bit, but iOS does have native support half floating point support.
Basically, with a shadow map of 2048x2048, all UVs past 0.5 can only identify half a pixel of precision (i.e. 1024, 1024.5, 1025, 1025.5, 1026, 1026.5 ... 2048), which is extremely low for precise filtering.
Desktop GPUs usually promote half floating point to 32-bit, but iOS does have native support half floating point support.
-
- Halfling
- Posts: 83
- Joined: Sun Feb 21, 2010 4:58 pm
- x 28
Re: [2.1] Shadows pixelated far from the origin on iOS only
Thanks for the quick response. I have unchecked OGRE_SIMD_NEON on CMake and got a bunch of undefined symbols when linking. Then I also disabled OGRE_SIMD_SSE2 and got to build it. Disabling both has fixed the shadows.
I have tried your updates as well and the only difference I notice is that the shadow is more blurred but it's just a slight "dot" under the object far from the origin. I am around 500 meters from the origin or something. But just moving away slightly makes the shadow noticeably blurry, apparently because the PSSM is focusing on (0,0,0).
I have tried your updates as well and the only difference I notice is that the shadow is more blurred but it's just a slight "dot" under the object far from the origin. I am around 500 meters from the origin or something. But just moving away slightly makes the shadow noticeably blurry, apparently because the PSSM is focusing on (0,0,0).