floooh / oryol-samples

Oryol extension module samples
MIT License
82 stars 16 forks source link

BulletPhysicsBasic sample: no shadows on D3D11 and Metal #1

Closed floooh closed 8 years ago

floooh commented 8 years ago

at least in Metal, nothing gets rendered to the shadow map render target, probably easier to debug in visual studio...

floooh commented 8 years ago

Reasons (at least for D3D11) are the different D3D/OpenGL projection space conventions for D3D vs OpenGL, see here: http://www.slideshare.net/Mark_Kilgard/opengl-32-and-more/29-Direct3D_10_to_OpenGL_ulliHow, this usually goes unnoticed unless working in post-projection-space, I guess it's best to move all of Oryol to D3D10 conventions

floooh commented 8 years ago

Ok, fixed for D3D11, I had to fudge the light projection matrix to move clipspace Z into [0,1] and inverse the shadow map lookup in the shader when not running on GL. I wonder if it makes sense to provide helper functions to build 3D-API-agnostic projection matrices.

floooh commented 8 years ago

The D3D11 fixes also fix shadow rendering on Metal.