POV-Ray : Newsgroups : povray.general : Feature Request: Textures as a function of distance (?) : Re: Feature Request: Textures as a function of distance (?) Server Time
1 Aug 2024 08:14:24 EDT (-0400)
  Re: Feature Request: Textures as a function of distance (?)  
From: Marc Jacquier
Date: 15 Dec 2005 14:59:08
Message: <43a1cb0c$1@news.povray.org>

le message de news:43a19d67$1@news.povray.org...
>
> You'd have to integrate some variables to keep track where the camera is
and
> translate the sphere accordingly. If you scale the sphere, you'd have to
> reverse-scale the textures (I think, untested, but that's what often
happens
> to me, depending on the approach), but aside of that, there isn't much to
be
> found which would be impossible for POV-SDL (just the time required to do
it
> is a nuisance sometimes :-).
>
> Regards,
> Tim
>
The use of pigment_pattern for the texture_map allows independent pattern
and textures transformations

#version 3.5;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
}

// ----------------------------------------
#declare Cam_loc=<0.0, 1, -4.0>;  // Camera location declaration
camera {
  location  Cam_loc
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

// ----------------------------------------
#declare Texture0  = texture {
    pigment {
      checker
      color rgb 1
      color rgb <1.0, 0.0, 0.0>

    }
  }
#declare Texture1  = texture { pigment {
      checker
      color rgb 1
      color rgb <0.0, 0.0, 1.0>

    }
  }
//*********************************************************** Here begins
the texture
#declare T_distance =
   texture
   {
      pigment_pattern
      {
            spherical
            /*
            color_map   {  [ 0.0     rgb 0 ] [ 1.0     rgb 1 ]} //optional
colormap
            */

       scale 100  //scale as needed
     translate Cam_loc   //pre declared Camera location
      }
      texture_map
      {
         [0.0 Texture0]
         [1.0 Texture1]
      }
   }


plane {
  y, -1
  texture{T_distance}}



sphere {              // reflective sphere
  0.0, 1
  texture {
    pigment {
      color rgb <0.8,0.8,1.0>
    }
    finish{
      diffuse 0.3
      ambient 0.0
      specular 0.6
      reflection {
        0.8
        metallic
      }
      conserve_energy
    }
  }
}


Post a reply to this message

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