POV-Ray : Newsgroups : povray.newusers : Blobs functions : Re: Blobs functions Server Time
29 Jul 2024 16:21:06 EDT (-0400)
  Re: Blobs functions  
From: Mike Williams
Date: 22 Jun 2005 08:19:59
Message: <dCrEvHApdVuCFwwj@econym.demon.co.uk>
Wasn't it Oleguer Vilella who wrote:
>Hi again,
>
>Using this function:
>======================================
>#declare Blobs = function { f_blob2(x, y, z, 0.95, 4, 1.8, 1) }
>isosurface {
>function { Blobs(x, y, z) }
>max_gradient 6
>contained_by { sphere { 0, 9 } }
>scale 2
>rotate 75*y
>translate <0, 0, 0>
>pigment { color Blue }
>}
>======================================
>I've here two blobs situated along the y axis. Is it anyway to give a 
>texture to the first and then giving another texture and color to the other 
>using the function?

You can't do it from the function itself, because the function only
thinks of the whole shape as a single primitive object. It doesn't know
that the resulting shape is going to look like two blobs.

What you can do, is to use a texture_map to apply different textures, or
a pigment_map to apply different pigments to chosen regions of the
surface, like this:

(The "0.95/2" I used is calculated to be half way to the blob separation
"0.95" specified in the first line.)

#declare Blobs = function { f_blob2(x, y, z, 0.95, 4, 1.8, 1) }
isosurface {
function { Blobs(x, y, z) }
max_gradient 6
contained_by { sphere { 0, 9 } }
texture{gradient x
  texture_map {[0.5  pigment {rgb <0,0,1>}]
               [0.5  pigment {rgb <1,0,0>}]}
  translate <-0.5,0,0>   // move transition point to the origin
  scale 100              // scale up the texture_map
  translate <0.95/2,0,0> // move the transition point to half way              
  }
scale 2
rotate 75*y
translate <0, 0, 0>
}


Or 

pigment {gradient x
  pigment_map {[0.5  rgb <0,0,1>]
               [0.5  rgb <1,0,0>]}
  translate <-0.5,0,0>   // move transition point to the origin
  scale 100              // scale up the texture_map
  translate <0.95/2,0,0> // move the transition point to half way              
  }

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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