POV-Ray : Newsgroups : povray.general : replacing texture with depth : Re: replacing texture with depth Server Time
5 Aug 2024 04:16:54 EDT (-0400)
  Re: replacing texture with depth  
From: Tim Nikias
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

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