#yes, i dont have a screenshot in front
1 messages · Page 1 of 1 (latest)
Are you looking into replicating this specific workflow, or just researching in general?
semi-copy this workflow. working on an isometric game with a friend of mine where we intend to do similiar post production work such as in disco elysium on the pre-rendered background, so their workflow is a big inspiration / resource. im on the art side of things and my partner is on the technical side, but im trying to understand the line up between blender and unity, and our main problem we are trying to solve right now is occlusion of the player when moving around the 2d environment, hence our deep dive into depth maps and such
Hmm I haven't precisely implemented anything like that but I have some ideas where to start
Using alpha clipping to remove pixels of characters when occluded might not be the most optimized way but it would work (the most optimized way would be to do a custom depth testing pass but they are beyond me)
Or clipping out the pixels of the background, inversely
If you know the "virtual" height position stored in the texture at that pixel and compare that to the real flat position on the background, you should with some maths get a value that can be directly compared with the character's real depth position to know whether to clip or not
Kind of reminds me how simple water depth shaders compare from the water's surface to the depth texture to turn the camera depth into a vertical depth
Like in this image someone posted in #archived-shaders a while ago
What you'd be doing is basically the opposite of that, turning vertical depth relative to a plane into camera-relative depth instead
so we have something similiar semi working.. basically we can occlude the player in some areas but not all, and its not entirely consistent. we were wondering if what was going on with the height map is what was throwing us off, but it seems like thats not the case.
the main point right now seems to be the depth pass we are exporting from blender isnt matching up completely with the math written in unity. a mist pass in blender gives a better result than a z pass, but im not sure if they are entirely interchangeable and im just sort of strong arming it to work
The mist pass is a remapped Z depth, it won't give you the height map
This effect is easier to do with just a depth texture since you don't need to flip it from height first
But that's avoided because it's effectively limited to one screen of space
Important to note that the height/depth data you render to must be linear, not something like quadratic that Mist Pass is by default
And when you save it you must save it as non-color, otherwise it'll get gamma-corrected
Furthermore values in most file formats like png are limited to 0-1, but some like .exr can go higher
0-1 is usually fine but you might consider remapping it when using it in the shader
im assuming the z-depth pass in blender is linear by default? ive been changing the mist pass to linear because of the isometric camera in unity defaulting to that.
okay im beginning to understand this a lot better
No idea what type of depth blender uses
There are many varieties, even within just Unity
And they vary by platform too
This is the kind of setup I'd use for rendering a height map
Though you will also need to disable all the bloom and such, and not render with filmic view transform
Probably also needs Non-Color Sequencer
The issue with these nodes is that you only have exactly 1 vertical unit of height to work with
So you can remap it to 0-15, but then you have to remap it from 0-15 back to 0-1 when doing the math in Unity
(or below 0 if you know you need to go under the floor)
frac is what makes the stripes appear, if you find some way to utilize that
yeah really getting hung up on what the fractions are for, but im pretty unfamiliar in this whole realm so perhaps itll become clear later on. this is immensely helpful, thank you so much
okay silly question here... but in this case is it an either or situation? like you would either use a height or depth map or are you using both together? I want to preface that I am extremely new to game dev and this level of rendering, my main job is in architectural design but i dont do a ton render side, aside from quick viz
I think a depth map is the "simpler" way to do it, but only if your camera doesn't move at all
Height maps are used out of practicality or necessity because a depth map doesn't scale to a big level
Height maps are able to use the bit depth way more efficiently also, because your level depth isn't restricted to an arbitrary camera frustum that you would've baked the depth map with