Hi to everyone,
say I have a pre-rendered background image and I want to display 3d characters on top of it. I also have a depth map; to create it the same background is rendered again but this time the resulting texture stores depth values instead of colors. We then have 2 textures ready to use: color and depth.
Now what I ideally need is a way to copy the visible portion of the depth map into the depth buffer prior to rendering 3d objects. I say visible because the backgrounds will most likely be very big. I'll probably need to create sub-images from them like a tile map with very big tiles. The same applies to the depth map of course.
I'm a bit new to Unity but I think I could render a quad using a custom shader that samples the depth map (the visible part of it) and outputs the read values to the depth buffer. Sadly, I have no idea how to implement this (in Unity) so I'd be very grateful if you could:
- Comment on my approach
- Suggest a way to implement it or point me to relevant info
I'm sorry if my post is a bit confusing, please don't hesitate to ask more details.
Thank you very much,
ung
EDIT: there's a typo in the title but I can't edit it, if you know how to do it please tell me. Thank you.