POV-Ray : Newsgroups : povray.general : Draw a line on the texture : Re: Draw a line on the texture Server Time
3 May 2024 15:51:37 EDT (-0400)
  Re: Draw a line on the texture  
From: Alain
Date: 11 Mar 2016 17:09:43
Message: <56e34227@news.povray.org>

> I have defined a simple texture, e.g.:
> #declare paper1 = texture {
> uv_mapping pigment { color rgb <0.8,0.8,1> }
>    normal { leopard 1 turbulence 1.7 scale 0.01 }
> }
>
> Now I want to draw a line on top of the texture (say I want black line of
> thickness 0.1 from point (u,v) = (0,0) to point (u,v) = (1,1)).
> What is the best approach to define such texture?
>
>

The best way would be using layered texture.
Start with the base texture, and follow with the second texture to be 
applyed over it.
The second texture will be mostly transparent.
In your case, the dificulty comes from the fact that the line have a 
finite length. For that, I suggest using the object pattern:
#declare PatternObject = box{0, <sqrt(3), 0.1, 0.1>rotate<-45, 0, 45>}
About the correct orientation.
You should use reorient() to get exactly the direction needed.
The distance between <0,0,0> and <1,1,1> = sqrt(3)

#declare Paper1 = texture{
  uv_mapping pigment { color rgb <0.8,0.8,1> }
  normal { leopard 1 turbulence 1.7 scale 0.01 }
}
texture{
  object{PatternObject
    rgbt 1 // outside the object is transparent
    rgb 0 // inside is black
   }
  }

If you want the line do be as long as possible, then, you can use a 
gradient texture:
texture{
  gradient -1
  color_map{[0.1 rgb 0] [0.1 rgbt 1]}
  }

You may also use the planar or cylindrical pattern if you don't want the 
line to repeat. Those need to be rotated.


Post a reply to this message

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