- Home /
Using a Pre-Rendered Depth Mask?
I have searched for this many times and have not found a satisfactory answer.
The effect I am trying to achieve is that found in the old pre-rendered survival horror/puzzle games, pre-rendered 2D background and depth masking.
I've tried several methods, using 2 cameras (orthographic for background and perspective for models) and using distance sorting to hide cutouts of depth objects (tables, chairs etc) but this only works so far as one character is concerned.
I've tried the depth mask shader found on the Unity wiki and this is great, but to work for this context would involve a lot of guesswork/tweaking to get something that matches the backgrounds properly.
What I would like to be able to do is use a pre-rendered depth map alongside the pre-rendered background to cut down the workload significantly, I saw a couple shaders most notably Aubergine's one but could not get them to work properly. Does anybody know of a shader or tool that would let me do this?
Thanks in advance guys.
I am sorry, I do not understand what effect you are trying to achieve. $$anonymous$$aybe I should have played more horror puzzle games. :D
Can you describe a little more or link to an example?
$$anonymous$$y bad, I meant to but the site derped and I forgot to paste that section.
Specifically though, I do mean precisely the effect I want to achieve is Resident Evil 1 and 2, completely fixed cameras with no movement, but with proper depth based on the image. Other similar games are Fear Effect and Alone in the Dark.
Video examples: http://www.youtube.com/watch?v=Pc7vnJ0O5LU (original game)
I'm interested in doing the same thing so I second this question.
Answer by acid201677 · Dec 30, 2012 at 08:39 PM
I'm trying to build a team for my indi game development studios, Liquid-State game studios. We're actually trying to work something like this out for our first game. Give us a shout out and maybe you could join the team?
We got some good pre-rendering technology if you heard of it, vue xstream. We've worked out a system basically you tell unity to not allow shadows on the plain, then mimic the lighting you have pre-rendered so that it appears to be the same as the rendered source. As for the layer effect try using alpha planes to give the effect that the player can move behind the object.
"maybe theres a better system for unity out there, as stated above we're just coming about."
I think we will mostly have pre-rendered backgrounds also with movie texture as well.
If you're interested give us a shout.
More people more ideas.
Where now rendering a GB's of images and videos, but this is our FB page.."just made today"
Answer by JonnyHilly · Aug 16, 2013 at 06:56 PM
well I can think of doing it part way.... assuming you have a low-model of your scene, a redered 2D backdrop, a camera and a 3d animated character in the scene. 1) clear background with camera 2) draw your 2D backdrop image (you could also use your main camera to render this once to a render texture, then just draw the render texture as 2d polygon, this would give you option to edit render direction easily in unity) 3) Render your low poly version of the scene, take, any unlit (super cheap) shader, leave z-write on, but strip out all lighting and color and everything else... It will still be rendering to z-buffer, so maybe not quite as fast as re-rendered. But it wont be reading from any textures, and wont have to do any lighting calculations, so it will still be pretty darn fast comparatively speaking. 4) Render your 3d characters. That should work
Your answer
![](https://koobas.hobune.stream/wayback/20220613065306im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to get the depth values of the camera view? 1 Answer
Scene View Camera Depth Texture? 0 Answers
FPS Halves to 30 when i enable using depth or opaque textures on URP Mobile 0 Answers
Depth Rendering Issue 0 Answers
Mesh z-fighting to itself 1 Answer