### Rendering depth buffer from DE

• 6 Replies
• 143 Views

0 Members and 1 Guest are viewing this topic.

#### utak3r

• Fractal Phenom
• Posts: 58

#### Rendering depth buffer from DE

« on: February 24, 2018, 09:59:48 PM »
I'm working on an animation I want to render with a depth buffer attached. And now I'm struggling with a proper packing the depth into this tiny 8 bits    as I want it to be normally usable by any software.
So, for now I've came to something like this:

Code: [Select]
float zdepth = log(clamp(totalDist, 0.0, MAX_DEPTH)) / log(MAX_DEPTH);return vec3(1.0 - zdepth, 1.0 - zdepth, 1.0 - zdepth);
where MAX_DEPTH is definable by user. I've chosen the log because it allows me to have some more depth in this depth
Probaby it could be bound to focal plane, instead of a fixed MAX_DEPTH, which serves well for stills - but it would also require user controlling this param across whole animation, which is quite a job.

Do you maybe have any other idea of packing this amount of data into the image?
I'm attaching a sample output from this method.

#### 3DickUlus

• Fractal Freak
• Posts: 679

#### Re: Rendering depth buffer from DE

« Reply #1 on: February 24, 2018, 10:38:23 PM »
Fragmentarium: EXR image format using floats for RGBA with depth value stored in A channel, check the sources on https://github.com/3Dickulus/FragM you can name the "A" layer anything you like, "depth" maybe if you're targeting some image processing software that expects that name for that data layer. Maybe it can be adapted to Synthclipse, the source can at least present an example. Using EXR tiled format also removes the image XY size limit imposed by Qt and RGBA values can be 16 or 32 bit.

edit: you can also bind the focal plane to the "target" coords and control the target pos via a spline path, then depth value could be  target distance +/- range value.
« Last Edit: February 24, 2018, 11:13:55 PM by 3DickUlus, Reason: tips »
Resistance is fertile... you will be illuminated!

https://en.wikibooks.org/wiki/Fractals/fragmentarium

#### utak3r

• Fractal Phenom
• Posts: 58

#### Re: Rendering depth buffer from DE

« Reply #2 on: March 04, 2018, 07:37:04 PM »
Maybe it can be adapted to Synthclipse
But my problem is I need a video, not a single image, and that's why I'm packing it into RGB. And what I was asking for is ideas for best strategies for packing such ranges into it - like my log idea.

#### 3DickUlus

• Fractal Freak
• Posts: 679

#### Re: Rendering depth buffer from DE

« Reply #3 on: March 05, 2018, 12:30:31 AM »
oh, yes, I recall _revers_ asking me if he could use some EXR stuff from FragM  (of course I said yes)

what I mention above applies to all images in an animation sequence, not sure about the "best" way, 8 bits is a tight space.

#### utak3r

• Fractal Phenom
• Posts: 58

#### Re: Rendering depth buffer from DE

« Reply #4 on: March 05, 2018, 01:57:20 AM »
8 bits is a tight space.
Hell yes it is...
Especially for close-ups, where the dynamic of distance values is crazy.
I'll try to find out, how they do it in animations.

#### 3DickUlus

• Fractal Freak
• Posts: 679

#### Re: Rendering depth buffer from DE

« Reply #5 on: March 05, 2018, 02:28:05 AM »
In production I think rendering to EXR format would be preferred.

The default depth buffer in GL is 24 bits depth and 8 bits stencil, in FragM I set the depth buffer to 32 bits and no stencil so the fragment can write the full 32bit float value to the depth buffer, when the value is taken from the depth buffer it is stored as 32bit float in the EXR format Alpha channel, the EXR package includes some tools for viewing and managing the images, like, converting to 16bit png or extracting channels, these tools are in the FragM/bin folder as part of the OpenEXR package.

If the full EXR package is intalled then FragM will show a "EXR Tools" menu next to the "Help" menu, they are all commandline tools but the menu will give information about how to use them.
( @_revers_   you should include these with synthclipse too )

are you rendering a full color sequence, then rendering a depth only sequence, using some video processing software to add elements to the full color sequence using the depth sequence as the blend mask?

#### utak3r

• Fractal Phenom
• Posts: 58

#### Re: Rendering depth buffer from DE

« Reply #6 on: March 05, 2018, 08:43:57 AM »
are you rendering a full color sequence, then rendering a depth only sequence, using some video processing software to add elements to the full color sequence using the depth sequence as the blend mask?
Currently yes, but I can also render them at single pass, using multi target rendering.
I'm converting the sequences into DNxHD clips, and then feeding Natron with it.

### Similar Topics

###### How to render only z - buffer

Started by Salol on Mandelbulb3d

3 Replies
185 Views
January 30, 2018, 03:09:48 AM
by Salol
###### Mandelbulb 3D - Render only Z buffer

Started by ys on Mandelbulb3d

0 Replies
80 Views
July 07, 2018, 04:11:36 PM
by ys
###### [Feature Request] Ability to render only z- buffer image

Started by Salol on Mandelbulb3d

0 Replies
109 Views
January 30, 2018, 06:55:59 AM
by Salol
###### color by depth

Started by mclarekin on Fractal Image Gallery

1 Replies
153 Views
January 29, 2018, 06:35:32 AM
by M Benesi
###### depth of field problem

Started by Tsarvek on Mandelbulb3d

1 Replies
190 Views
August 17, 2018, 06:36:21 PM
by muinami