Page 1 of 1

Problem with rendering depth map to texture

Posted: Fri Jul 26, 2019 1:38 am
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?

Re: Problem with rendering depth map to texture

Posted: Fri Jul 26, 2019 8:50 am
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.

Re: Problem with rendering depth map to texture

Posted: Sat Jul 27, 2019 4:29 pm
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.