POV-Ray : Newsgroups : povray.advanced-users : depth map? : Re: depth map? Server Time
18 Apr 2024 15:59:26 EDT (-0400)
  Re: depth map?  
From: Chris B
Date: 12 May 2009 16:31:42
Message: <4a09dcae@news.povray.org>
"Marvin" <mto### [at] grfhr> wrote in message 
news:web.4a0942cf3a6933703f8cf8140@news.povray.org...
> Alain <ele### [at] netscapenet> wrote:
>> Marvin nous illumina en ce 2009-05-08 09:49 -->
>> > "Sidney Cadot" <sid### [at] jigsawnl> wrote:
>> >
>> > I've been thinking about this thread and what is explained on
>> > http://www.wowvx.com/create/Format.aspx
>> >
>> > Depth map may allow creating of 2D-plus-Depth image.
>> >
>> > Is there a way to extract "Declypse" information from POV-Ray model?
>
>> You can't with a single image.
>> What you can do:
>> - Render only the background then the foreground.
>> - Render twice from two different points of view shifted left and right.
>>
>> For the depth map, just render the scene with all textures replaced by a 
>> single
>> gradient oriented toward the camera. The gradient direction goes from the
>> look_at to the camera location, black for far, white for close.
>
> Could you please give an example of a texture with grayscale gradient 
> oriented
> towards the camera?
>


#include "transforms.inc"

#declare Camera_Location = <-4,7,-4>;
#declare Camera_Lookat   = <10,-10,10>;

camera {location  Camera_Location look_at Camera_Lookat}

// Union containing all scene objects
union {
  sphere {0,1}
  sphere {<-2,0,-2>,1}
  sphere {< 5,0, 5>,1}
  sphere {<10,0,10>,1}
  box {-10,10}
  pigment {
    gradient x color_map {
      [0 color rgb 1]
      [1 color rgb 0]
    }
    scale <vlength(Camera_Location-Camera_Lookat),1,1>
    Reorient_Trans(x, Camera_Lookat-Camera_Location)
    translate Camera_Location
  }
  finish {ambient 1}
}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.