Problem with rendering depth map to texture

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Problem with rendering depth map to texture

Post by JunkerKun »

Hey there. I'm pretty sure this has been covered somewhere on this forum but I just can't find it.

So the problem is - I'm trying to make shadow maps. And I got it working but there is one problem - it looks like shadow maps are lagging. Depth map rendering is lagging to be exact. The current scenario looks like this:

Code: Select all

render depth map by rendering each necessary node's render() method
render everything else by calling drawAll()
Now before you tell my anything, yes I do realize this will actually render depth map a frame late than necesssary, but no matter what I change it still lags.
I tried to render each node manually but something doesn't work this way. I tried the next scenario:

Code: Select all

call camera's OnRegisterSceneNode(), then render()
In a loop: call each node's OnAnimate(), then OnRegisterSceneNode() then render()
but it just doesn't render anything at all.

How can I render depth map after everything is updated but before anything is rendered? Or do I just have to change irrlicht itself?
CuteAlien
Admin
Posts: 9651
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Problem with rendering depth map to texture

Post by CuteAlien »

Not seeing your code. But just as experiment, try if things change if you put a beginScene/endScene around the shadwowmap rendering. Or maybe you have the depthmap texture into which you render still as part of the material while you render (not sure if that just fails or causes such problems). So make sure to reset/restore that texture-slot before doing the depth-map.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Re: Problem with rendering depth map to texture

Post by JunkerKun »

Nah, the problem was the order of rendering after all. I got it solved by adding a custom scene node and rendering shadows in OnRegisterSceneNode method, effectively rendering after all nodes were animated but before they were rendered.
Post Reply