POV-Ray : Newsgroups : povray.general : replacing texture with depth Server Time
5 Aug 2024 06:13:31 EDT (-0400)
  replacing texture with depth (Message 1 to 7 of 7)  
From: David
Subject: replacing texture with depth
Date: 6 Dec 2002 03:25:04
Message: <web.3df05dbfdb7a7ea83b35a1fc0@news.povray.org>
I have been searching for the best way to get detailed depth information out
of POV-Ray (besides editing the source code).  The following code works if
the Depth_Texture is applied to every object.  However, since child objects
do not inherit parent texture, how can I plop this texture onto everything?

/*---depth.ini---*/
Output_File_Type=P
Bits_Per_Color=16
Input_File_Name=depth.pov
/*---END---*/

/*---depth.pov---*/
#declare Depth_Texture = texture
{
  pigment
  {
    spherical
    scale 655.35 //depth resolution = 0.01 [units]
    phase 0
  }
  finish
  {
    ambient 1
    diffuse 0
    specular 0
    reflection 0
  }
  translate Camera_Origin
}

#declare World = union
{
  //many objects with textures . . .
}

object
{
  World
  texture{Depth_Texture} //does not replace child textures :(
}
/*---END---*/


Thanks,

David Diel

ddi### [at] mitedu


Post a reply to this message

From: Tim Nikias
Subject: Re: replacing texture with depth
Date: 6 Dec 2002 04:57:08
Message: <3df07474$1@news.povray.org>
What I've done once is to make a small macro like:

#declare Use_Texture=on;
#macro T(Texture)
 #if (Use_Texture)
 texture{Texture}
 #else
 texture{My_Default_Texture}
 #end
#end

This also works if you just replace Texture with Material and
the texture{...} with material{}. Just make sure you actually
give a texture or a material definition with the macro, or POV
will stop and issue an error.

Then, when ever you need the depth-texture to be used,
you just declare Use_Texture to off, and voila! The Macro
uses the Depth-Texture (My_Default_Texture) instead of
the given Texture.
This is hard to add, but actually you can do a search and
replace like:
Search: " texture{" <- Notice the freespace in front!
Replace: " T(texture{"
In this manner, you can easily put the "T(" in front of the
texture statements, then, you just search for the "T(" and
add the closing bracket after the texture.

I used in  one scene right from the beginning, so it might be
a little intensive to add later on, but it might help you...

Regards,
Tim

--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmxde
"David" <nomail@nomail> schrieb im Newsbeitrag
news:web.3df05dbfdb7a7ea83b35a1fc0@news.povray.org...
> I have been searching for the best way to get detailed depth information
out
> of POV-Ray (besides editing the source code).  The following code works if
> the Depth_Texture is applied to every object.  However, since child
objects
> do not inherit parent texture, how can I plop this texture onto
everything?
>
> /*---depth.ini---*/
> Output_File_Type=P
> Bits_Per_Color=16
> Input_File_Name=depth.pov
> /*---END---*/
>
> /*---depth.pov---*/
> #declare Depth_Texture = texture
> {
>   pigment
>   {
>     spherical
>     scale 655.35 //depth resolution = 0.01 [units]
>     phase 0
>   }
>   finish
>   {
>     ambient 1
>     diffuse 0
>     specular 0
>     reflection 0
>   }
>   translate Camera_Origin
> }
>
> #declare World = union
> {
>   //many objects with textures . . .
> }
>
> object
> {
>   World
>   texture{Depth_Texture} //does not replace child textures :(
> }
> /*---END---*/
>
>
> Thanks,
>
> David Diel
>
> ddi### [at] mitedu
>
>
>
>
>
>


Post a reply to this message

From: Warp
Subject: Re: replacing texture with depth
Date: 6 Dec 2002 07:18:23
Message: <3df0958f@news.povray.org>
Unfortunately there's no currently any way of replacing all textures
in all objects in the current scene automatically.
  You either will have to change them all manually, or use a patch which
supports outputting depth information (eg. MegaPov had such patch).

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: David
Subject: Re: replacing texture with depth
Date: 6 Dec 2002 18:10:05
Message: <web.3df12dfb28766bdeac64e6620@news.povray.org>
I appreciate the comments so far.  I would love to hear more ideas.  In the
following work-around, I exploit the fact that two textures can be stored
for every object, one interior, and one exterior.  Child objects must lack
an interior texture for this to work.  Beginning with the set of objects
called World, and the Depth_Texture mentioned previously, use the following
statement to get depth information:

object
{
  World
  texture{}
  interior_texture{Depth_Texture}
  inverse
}

I'm curious why depth is not an output option or camera option?  It should
be easy to calculate, and it is useful for academic studies of image
motion.

David Diel
ddi### [at] mitedu


Post a reply to this message

From: Christopher James Huff
Subject: Re: replacing texture with depth
Date: 6 Dec 2002 19:27:06
Message: <chrishuff-A6328F.19240206122002@netplex.aussie.org>
In article <web.3df12dfb28766bdeac64e6620@news.povray.org>,
 "David" <nomail@nomail> wrote:

> I'm curious why depth is not an output option or camera option?  It should
> be easy to calculate, and it is useful for academic studies of image
> motion.

Easier than that, it is already calculated, all you have to do is output 
the depth values instead of calculating textures and lighting. I did 
this as one of my earliest patches, Ron Parker did a similar patch, and 
the post_process patch in MegaPOV had a fiilter that output the depth 
data, though it didn't skip the texture and lighting calculations.

The post_process patch wasn't ready for an official release, and it 
would be pointless to add one of the other implementations when it would 
only get replaced with something else in the future.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: David
Subject: Re: replacing texture with depth
Date: 14 Apr 2003 17:20:04
Message: <web.3e9b248428766bdefff4d2090@news.povray.org>
After using the inversion method for quite a while, I found that it doesn't
work with primitive patch (2D) objects.  Go figure.  It should be so easy
to output depth.  Can this please, please be added to the next official
release?

David


Post a reply to this message

From: Christopher James Huff
Subject: Re: replacing texture with depth
Date: 14 Apr 2003 18:08:29
Message: <cjameshuff-EC1954.18082714042003@netplex.aussie.org>
In article <web.3e9b248428766bdefff4d2090@news.povray.org>,
 "David" <nomail@nomail> wrote:

> After using the inversion method for quite a while, I found that it doesn't
> work with primitive patch (2D) objects.  Go figure.  It should be so easy
> to output depth.  Can this please, please be added to the next official
> release?

Just put if statements in your scene to change between textures. If you 
define all your textures separately, you can do it with one if-else 
statement.

Odds of it being in the next official release are low, but it will 
probably get into MegaPOV.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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