1
Support / Shadow mapping approach
« on: March 20, 2013, 01:53:49 am »
I'm trying to implement simple shadow mapping for jPCT-AE. I saw some of the recent forum posts about how shadows will soon be implemented?... but I just wanted to know if my approach is correct. (I'm trying to implement this for a school project that's due in a little over 48 hours!)
Then I'll have to pass in the light's model view projection matrix to the regular shadow mapping shader. Since GLSLShader does not support passing in your own uniforms, I'll have to create an implementation of IRenderHook... right? Or is there a way to pass in the model-view-projection matrix for the light source(s) via GLSLShader without implementing IRenderHook?
Code: [Select]
// Framebuffer fb
// Camera lightCam represents the light's view
// Texture shadowMap
// GLSLShader depthShader
// render shadow map
fb.setRenderTarget(shadowMap);
world.setCameraTo(lightCam);
world.setGlobalShader(depthShader); // doesn't override the shader for objects that called setShader!
world.renderScene(fb);
world.draw(fb);
fb.removeRenderTarget();
world.setGlobalShader(null); // is this how you remove the global shader?
world.setCameraTo(cam); // set back to regular camera
...
// regular render pass
world.renderScene(fb);
world.draw(fb);
fb.display();
Then I'll have to pass in the light's model view projection matrix to the regular shadow mapping shader. Since GLSLShader does not support passing in your own uniforms, I'll have to create an implementation of IRenderHook... right? Or is there a way to pass in the model-view-projection matrix for the light source(s) via GLSLShader without implementing IRenderHook?