Depth Pass

Started by sjefen, April 27, 2019, 12:39:17 PM

Previous topic - Next topic

sjefen

Hi,


I'm trying to render a Depth pass of my renders, but I can't figure it out.
Is this even possible?


- Terje
ArtStation: https://www.artstation.com/royalt

AMD Ryzen Threadripper 1950X
128 GB RAM
GeForce RTX 3060 12GB

WAS

#1
I believe Render Elements can give you the depth map used for DoF. You would composite the cloud depth and surface depth maps.  If not maybe try my example for freeware.

Paint landscape white with a surface layer at end of chain. Use constant colour and white for object surfaces. Than use a lightsource at cameras position. Disable shadows, disable atmosphere and sun, and play with Max distance and light intensity.

With Facebook, and probably other 3D image producers, the depth map needs to be much smoother than what is produced by my method. So you may need to use the surface layers smooth feature plus some post work.

sjefen

Yeah, I tried render elements, but it's not there  :'(
I'll try your method for now  ;)

I don't know why, but I am almost certain Terragen used to have a depth pass before. I think I remember using it for DOF before Terragen had a native DOF feature. Am I wrong?


- Terje
ArtStation: https://www.artstation.com/royalt

AMD Ryzen Threadripper 1950X
128 GB RAM
GeForce RTX 3060 12GB

sboerner

#3
For depth of field during rendering you need to enable it under the Quality tab of the render panel. Focus distance and aperture are set in under Blur in the camera panel.j (Edit - I see you're already doing this!)

For depth of field in post you can render out depth passes as shown.


sjefen

#4
I saw this, but I can't figure out how to get those out, if you know what I mean?
My renders look just normal?


- Terje
ArtStation: https://www.artstation.com/royalt

AMD Ryzen Threadripper 1950X
128 GB RAM
GeForce RTX 3060 12GB

digitalguru

Have you got Extra Output Images turned on the Sequence/Output tab of the Render node?

Also, make sure the file path in Extra Output Images has the IMAGETYPE token in it :
C:\temp.IMAGETYPE.%04d.tif

Oshyan

You have to use "Render All To Disk", the normal Render button doesn't output render elements (besides Alpha).

As for how to create it without render elements, just use a Distance Shader! Apply it as the only shader on the terrain and voila.

- Oshyan

WAS

Quote from: Oshyan on April 27, 2019, 11:27:18 PM

As for how to create it without render elements, just use a Distance Shader! Apply it as the only shader on the terrain and voila.

- Oshyan

Wait, what? How? You mean after disabling sun, atmosphere, etc, and illuminating the distance shader with luminosity on a surface shader or something? That's actually a good idea though what you said seems a little vague on application?

WAS

Seems to be an issue with the distance shader? Maybe cameras distance from ground?

René

#9
Add the distance shader last in the shader network. If there are objects in the scene, do not use the distance shader from the shader network but create a new one with the same settings, otherwise the objects will get the displacements of the textures and the terrain.
I have no idea if the distance shader can be applied to the atmosphere and clouds so you can just turn them off, unless there are very low hanging clouds.
Turn off Render GI settings or you'll get halos in some places as you can see.

WAS

#10
Quote from: René on April 28, 2019, 04:33:55 AM
Add the distance shader last in the shader network. If there are objects in the scene, do not use the distance shader from the shader network but create a new one with the same settings, otherwise the objects will get the displacements of the textures and the terrain.
I have no idea if the distance shader can be applied to the atmosphere and clouds so you can just turn them off, unless there are very low hanging clouds.
Turn off Render GI settings or you'll get halos in some places as you can see.

Weird it even works considering your distance shader has no position. How could it be accurate from 1 to 0 from camera origin?

I can't get the distance shader to work for me. In TGD you provide everything is black. It's like broken. My other project has camera, and the distance goes on into infinity even though set to 10m.

Update: I installed the latest freeware version and have no issues now. I don't know what was going on before with the camera and default origin.

WAS

#11
So, some notes

Distance Shader is not perfect, but produces the best effect. The issue with it has been one of the issues I've explained for awhile, the falloff on the distance shader is 1000x times too sharp (exaggeration). And since we're not dealing with unclamped values interpreted by TG, tha hard falloff doesn't allow gradual gradient to black. So you can't have a true soft rolling hills fading into the distance, there will be a point where it will drop off suddenly and you'll get a "layer" effect in 3D image makers.

Example: https://www.facebook.com/groups/Terragen.Galleries/permalink/2140971892695489/

Matt

#12
Try passing it through an "Inverse Scalar" function node. That will give you 1/z, producing the same kind of falloff as the built-in Render Element. You will need to set near colour to 0 and far colour to 1, and turn off the clamp options.

You'll need to use something like a Default Shader to make it luminous. The Distance Shader does this for you, but once you pass it through the Inverse Scalar you will lose the luminosity.
Just because milk is white doesn't mean that clouds are made of milk.

sboerner

Just for the sake of completeness, here's an example scene with a render node set up to produce a depth pass.

Terje, it's best to output depth passes as high bit files, 16 or 32 bit. An 8-bit file just doesn't have enough levels to store the data. You need floating point. Most software used for post processing (still and video) can handle that. The 32-bit exr file in the attached zip file will look dark in Photoshop, but the data are there. (If you need an 8-bit file you can use an image editor to equalize the 32-bit image first, then save it down to 8-bit. The attached image has been equalized in Photoshop.)

Now, for the sake of argument . . . isn't this the preferred way to create a depth map? It involves no changes to the node network, and the beauty and depth passes can be output simultaneously.


WAS

#14
Quote from: Matt on April 28, 2019, 01:31:00 PM
Try passing it through an "Inverse Scalar" function node. That will give you 1/z, producing the same kind of falloff as the built-in Render Element. You will need to set near colour to 0 and far colour to 1, and turn off the clamp options.

You'll need to use something like a Default Shader to make it luminous. The Distance Shader does this for you, but once you pass it through the Inverse Scalar you will lose the luminosity.

Thank you for the feedback Matt! Going to give it a go after the benchmark depth render finishes.

Quote from: sboerner on April 28, 2019, 01:52:51 PM
Just for the sake of completeness, here's an example scene with a render node set up to produce a depth pass.

Terje, it's best to output depth passes as high bit files, 16 or 32 bit. An 8-bit file just doesn't have enough levels to store the data. You need floating point. Most software used for post processing (still and video) can handle that. The 32-bit exr file in the attached zip file will look dark in Photoshop, but the data are there. (If you need an 8-bit file you can use an image editor to equalize the 32-bit image first, then save it down to 8-bit. The attached image has been equalized in Photoshop.)

Now, for the sake of argument . . . isn't this the preferred way to create a depth map? It involves no changes to the node network, and the beauty and depth passes can be output simultaneously.

Thanks for adding a little tutorial for render elements!

The point of the other discussions is not everyone has access to render elements. I might argue a lot of the users checking out TG. I've never owned TG, I've used others licenses like at school.