[2.1] Compositors, HLMS and depth buffers
Posted: Fri Nov 16, 2018 10:49 am
Hi,
I am trying to dig into compositors but still floating between "Aha, I think I've got this" and "Crap, I don't understand" depending on the situation...
Currently I have compositor setup similar to dynamic cubemap sample and it works (I define and create a cubemap texture in the code, pass it to the compositor as an input, some nodes write to it and then I pass it to next pass inside custom HLMS's fillBuffersFor as CbTexture() command which make it accessible to my shaders). So far so good.
So now I want to have depth buffer information in my shaders. From the examples and the doc I think I've got how to define depth texture in the compositor, but as I understand they are kinda special and represent a view to an actual depth buffer, so the same trick with defining such texture first in the code and passing it to the compositor wouldn't work. All the examples are using low level materials, but how can I pass the depth texture to HLMS? I've tried to define everything in the compositor and then call SceneManager::getCompositorTextures() in preparePassHash and it seems to give me something, but the texture content din't look like an actual depth buffer to me. So I just want to confirm if I am on the right track or doing something wrong? Did anybody pass a depth texture to HLMS successfully and want to share an example?
And speaking of examples. TutorialDistortion doesn't do distortion when I run it (tried it on Intel UHD first and thought maybe it's absence of a proper graphics but it's the same when I run it at on NVIDIA card). I've seen the video how it's supposed to look and it doesn't work the same for me. Is it me or some of the changes in Ogre which broke it? In other words - can someone confirm that TutorialDistortion works as intended in relatively recent Ogre 2.1?
I am trying to dig into compositors but still floating between "Aha, I think I've got this" and "Crap, I don't understand" depending on the situation...
Currently I have compositor setup similar to dynamic cubemap sample and it works (I define and create a cubemap texture in the code, pass it to the compositor as an input, some nodes write to it and then I pass it to next pass inside custom HLMS's fillBuffersFor as CbTexture() command which make it accessible to my shaders). So far so good.
So now I want to have depth buffer information in my shaders. From the examples and the doc I think I've got how to define depth texture in the compositor, but as I understand they are kinda special and represent a view to an actual depth buffer, so the same trick with defining such texture first in the code and passing it to the compositor wouldn't work. All the examples are using low level materials, but how can I pass the depth texture to HLMS? I've tried to define everything in the compositor and then call SceneManager::getCompositorTextures() in preparePassHash and it seems to give me something, but the texture content din't look like an actual depth buffer to me. So I just want to confirm if I am on the right track or doing something wrong? Did anybody pass a depth texture to HLMS successfully and want to share an example?
And speaking of examples. TutorialDistortion doesn't do distortion when I run it (tried it on Intel UHD first and thought maybe it's absence of a proper graphics but it's the same when I run it at on NVIDIA card). I've seen the video how it's supposed to look and it doesn't work the same for me. Is it me or some of the changes in Ogre which broke it? In other words - can someone confirm that TutorialDistortion works as intended in relatively recent Ogre 2.1?