NatronGitHub / Natron

Open-source video compositing software. Node-graph based. Similar in functionalities to Adobe After Effects and Nuke by The Foundry.
http://NatronGitHub.github.io
GNU General Public License v2.0
4.63k stars 338 forks source link

Depth Tools #88

Open devernay opened 6 years ago

devernay commented 6 years ago

From @blackearth2014 on November 26, 2014 3:17

Will it be possible to get a depth tool node when the Deep Data Nodes get developed. I want to covert a 2d image into a depth map greyscale. Silhouettefx has this ability. You can see an example at http://www.silhouettefx.com/ under the S3D tab.

Copied from original issue: MrKepzie/Natron#332

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/57502363-depth-tools?utm_campaign=plugin&utm_content=tracker%2F83915136&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F83915136&utm_medium=issues&utm_source=github).
devernay commented 6 years ago

I think this kind of easy conversion can be done using a guided bilateral filter: generate a vertical ramp (or a gradient that looks roughly like image depth for your scene), and then apply a bilateral filter to this ramp with a very large sigma_position, guided by the intensity image, so that pixels of the same color that are close enough get roughly the same depth. From the images I see on that web site, this certainly works this way. For now, the bilateral filter in Natron doesn't accept an external guide, but this may be changed in the future, making this kind of effect possible. And at least you understand what's inside! It's not a black box that says 'convert 2D to 3D'.

devernay commented 6 years ago

From @blackearth2014 on November 26, 2014 20:9

Thanks. I will try this tonight.

devernay commented 6 years ago

From @sozap on November 27, 2014 14:34

thanks for the tips ! I've tried it in blender and it works . I would never thougth of that trick by myself !

devernay commented 6 years ago

If that trick (ramp + guided bilateral) works, do you think It should be i tegrated as a single node (or maybe a pyplug)?

devernay commented 6 years ago

From @blackearth2014 on July 22, 2015 14:41

I didn't get it to work. Maybe I was doing something wrong. A pynode should be sufficient.

devernay commented 6 years ago

From @sozap on May 21, 2016 12:23

the thing is, that depending on the image you want to convert depth to, the gradient need to be different. Also you may want to add masks, or tweak the grayscale image very differently. So it's difficult to think of a general pyplug that can do the job on most cases. Maybe that trick can be explain on a Natron Cookbook wiki next to the documentation, with cool tips and tricks were users can learn more on what to do with nodes rather that what nodes do...