Mike Horvath <mik### [at] gmailcom> wrote:
> On 6/18/2021 1:19 AM, BayashiPascal wrote:
> >> Interesting. The pigment in that example is clipped and normalized,
> >> however. Wouldn't it make more sense geometrically to extend the pigment
> >> to infinity?
> >> Mike
> > Do you mean the *gradient* is clipped and normalized ? If so, it is done in
> > order to use it as an entry of the color_map (which afaik only takes value in
> > [0, 1]). If not, I don't understand your comment.
> > Pascal
> I mean the gradient function has a minimum and maximum range versus. It
> should more realistically start at the camera and extend into infinity.
> (But also be scaled somehow to the scale of the scene.)
> Here is my attempt, though I don't think it is working.
> #declare CAMERAPOS = <3,3,3>;
> #declare CAMERALOOKAT = <0,0,0>;
> #declare CAMERAFRONT = vnormalize(CAMERALOOKAT - CAMERAPOS);
> #declare CAMERAFRONTX = CAMERAFRONT.x;
> #declare CAMERAFRONTY = CAMERAFRONT.y;
> #declare CAMERAFRONTZ = CAMERAFRONT.z;
> #declare my_gradient = function(x, y, z, gradx, grady, gradz)
> atan(x * gradx + y * grady + z * gradz)/(pi/2)
> #declare Muns_depth_pigment = pigment
> // clipped_scaled_gradient(x, y, z, CAMERAFRONTX, CAMERAFRONTY,
> CAMERAFRONTZ, DEPTHMIN, DEPTHMAX)
> my_gradient(x, y, z, CAMERAFRONTX, CAMERAFRONTY, CAMERAFRONTZ)
> [0 color rgb <1,1,1>]
> [1 color rgb <0,0,0>]
> translate CAMERAPOS
I don't see any problem with your solution. It really just depends on how you
(or the tool you use) interpret the generated depth values.
I've never made such images for Facebook, and have no idea how their plugin
works. Googling a little about it brought me to this article:
containing a link to the research paper behind the plugin:
I had a quick look at it but had neither the courage nor motivation to read it
entirely. However I've noticed page 5 they said "However, this
did not achieve good results, because, as we learned, many depth
maps are normalized using unknown curves. We tried a variety of
other classes of global transformations, ...". Which makes me think they're
reconstructing an approximate 3D mesh, pleasant for the eye but not realistic,
to manage any kind of input, noise, and extrapolation from even a single image.
After all, their goal was probably to make an user-friendly plugin, rather than
Conclusion, it probably doesn't really matter what kind of depth encoding you
use if you plan to use it on Facebook ! Maybe the best is to experiment...
I've wrote the script on the site of Paul Bourke while working with 3D scanners
where depth was encoding linearly either planar or spherical distance from the
camera within a range. You can also set DEPTHMIN to 0.0 and DEPTHMAX to an
arbitrarily big value to get a depth map from the camera to (kind of) infinity.
That's why they are variables and not hard coded in my script.
Post a reply to this message