POV-Ray : Newsgroups : povray.newusers : Blobs functions Server Time
25 Nov 2024 15:52:52 EST (-0500)
  Blobs functions (Message 1 to 6 of 6)  
From: Oleguer Vilella
Subject: Blobs functions
Date: 22 Jun 2005 04:14:34
Message: <42b91dea@news.povray.org>
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?

Thanks in advance,
Oleguer


Post a reply to this message

From: Mike Williams
Subject: Re: Blobs functions
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

From: Oleguer Vilella
Subject: Re: Blobs functions
Date: 22 Jun 2005 09:51:53
Message: <42b96cf9$1@news.povray.org>
Hi Mike,

And using more than two colors?

I was reading the documentation about that. They say that:
"When the gradient x function returns values from 0.0 to 0.3 the red 
highlighted texture is used. From 0.3 to 0.6 the texture identifier T_Wood11 
is used. From 0.6 up to 0.9 a blend of T_Wood11 and a shiny DMFWood4 is 
used. From 0.9 on up only the shiny wood is used."

I thought that number is used to divide the object in different parts, for 
exemple if your are using 3 colors you can put 1/3 before the pigment 
instead of the 1/2 that you've put the divide the object. But I obtain some 
strange results.

======================================
texture {gradient x
 texture_map {[0.3  pigment {rgb <0,0,1>}]
               [0.6  pigment {rgb <1,0,0>}]
              [0.9 pigment { rgb <0, 1, 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
======================================

Well, I'm not understanding it properly.

Thanks for the anwers,
Oleguer



news:dCr### [at] econymdemoncouk...
> 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

From: Oleguer Vilella
Subject: Re: Blobs functions
Date: 22 Jun 2005 10:39:10
Message: <42b9780e@news.povray.org>
Something like this:
======================================
texture {
gradient x
texture_map {
[0.2  pigment{Red}]
[0.4  pigment { Blue }]
[0.6  pigment { Yellow}]
[0.9  pigment{Green }]}
}
=======================================
But I couldn't undesrstand right the values that are before the pigment.




news:42b96cf9$1@news.povray.org...
> Hi Mike,
>
> And using more than two colors?
>
> I was reading the documentation about that. They say that:
> "When the gradient x function returns values from 0.0 to 0.3 the red 
> highlighted texture is used. From 0.3 to 0.6 the texture identifier 
> T_Wood11 is used. From 0.6 up to 0.9 a blend of T_Wood11 and a shiny 
> DMFWood4 is used. From 0.9 on up only the shiny wood is used."
>
> I thought that number is used to divide the object in different parts, for 
> exemple if your are using 3 colors you can put 1/3 before the pigment 
> instead of the 1/2 that you've put the divide the object. But I obtain 
> some strange results.
>
> ======================================
> texture {gradient x
> texture_map {[0.3  pigment {rgb <0,0,1>}]
>               [0.6  pigment {rgb <1,0,0>}]
>              [0.9 pigment { rgb <0, 1, 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
> ======================================
>
> Well, I'm not understanding it properly.
>
> Thanks for the anwers,
> Oleguer
>
>

> news:dCr### [at] econymdemoncouk...
>> 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

From: Mike Williams
Subject: Re: Blobs functions
Date: 22 Jun 2005 12:13:38
Message: <4$4dQHAm4YuCFwH1@econym.demon.co.uk>
Wasn't it Oleguer Vilella who wrote:
>Hi Mike,
>
>And using more than two colors?
>
>I was reading the documentation about that. They say that:
>"When the gradient x function returns values from 0.0 to 0.3 the red 
>highlighted texture is used. From 0.3 to 0.6 the texture identifier T_Wood11 
>is used. From 0.6 up to 0.9 a blend of T_Wood11 and a shiny DMFWood4 is 
>used. From 0.9 on up only the shiny wood is used."
>
>I thought that number is used to divide the object in different parts, for 
>exemple if your are using 3 colors you can put 1/3 before the pigment 
>instead of the 1/2 that you've put the divide the object. But I obtain some 
>strange results.
>
>======================================
>texture {gradient x
> texture_map {[0.3  pigment {rgb <0,0,1>}]
>               [0.6  pigment {rgb <1,0,0>}]
>              [0.9 pigment { rgb <0, 1, 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
>======================================
>
>Well, I'm not understanding it properly.
>
>Thanks for the anwers,
>Oleguer

One of the significant things is that you should get rid of the 
"scale 100" if you want more than two bands. I just put that there so
that you wouldn't see more than two bands unless you made the blob
extremely large.

Texture_maps work just like colour_maps, so try reading that
documentation and see if it's any easier.

The basic idea is that "gradient x" sets up a *pattern* that takes the
value (x - floor(x)) at all points in space. E.g. at the point <0,1,2>
the pattern takes the value 0, and at <2.45,4,6> it takes the value 0.45
(that's 2.45 - 2.0). The pattern doesn't care where your object is, it
only concerns itself with points in space.

So, lets suppose that POVRay is tracing some object and finds a point on
the surface at <2.45,4,6>, it works out that the value of the pattern is
0.45, and looks that up in the texture_map. In your example above, 0.45
comes exactly half way between these two entries
   [0.3  pigment {rgb <0,0,1>}]
   [0.6  pigment {rgb <1,0,0>}]
so it renders a 50-50 blend of those two textures giving pigment 
{rgb <0.5,0,0.5>}

However, when it finds a point like <3.1,3,3>, the pattern evaluates to
0.1 and that's below the first entry in the map, so POV uses the first
entry in the map.

So for three equally spaced hard-edged bands you might use

pigment {gradient x
  pigment_map {[1/3  rgb <0,0,1>]
               [1/3  rgb <0,1,0>]
               [2/3  rgb <0,1,0>]
               [2/3  rgb <1,0,0>]}
  translate <-0.5,0,0>   // move transition point to the origin
  scale 0.95*2           // scale up the texture_map to show 3 bands
  translate <0.95/2,0,0> // move the mid point texture to half way along 
                         // the blob
  }

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Oleguer Vilella
Subject: Re: Blobs functions
Date: 23 Jun 2005 03:41:38
Message: <42ba67b2$1@news.povray.org>
Hi Mike,

Yeah, I think I've understood it now.
======================================
pigment {gradient x
pigment_map {[0.2  rgb <0,0,1>]
               [0.4  rgb <0,1,0>]
               [0.6  rgb <1,1,0>]
               [0.8  rgb <1,0,0>]
               [1 color Yellow]}
translate <-0.5,0,0>
scale 0.95*1
translate <0.95/2,0,0>
  }
=======================================
Let more time to practise it. I've also read that documentation and it has 
more information than the other I had read.

Thank you very much for the replys,
Oleguer


"Mike Williams"says:
> > One of the significant things is that you should get rid of the
> "scale 100" if you want more than two bands. I just put that there so
> that you wouldn't see more than two bands unless you made the blob
> extremely large.
>
> Texture_maps work just like colour_maps, so try reading that
> documentation and see if it's any easier.
>
> The basic idea is that "gradient x" sets up a *pattern* that takes the
> value (x - floor(x)) at all points in space. E.g. at the point <0,1,2>
> the pattern takes the value 0, and at <2.45,4,6> it takes the value 0.45
> (that's 2.45 - 2.0). The pattern doesn't care where your object is, it
> only concerns itself with points in space.
>
> So, lets suppose that POVRay is tracing some object and finds a point on
> the surface at <2.45,4,6>, it works out that the value of the pattern is
> 0.45, and looks that up in the texture_map. In your example above, 0.45
> comes exactly half way between these two entries
>   [0.3  pigment {rgb <0,0,1>}]
>   [0.6  pigment {rgb <1,0,0>}]
> so it renders a 50-50 blend of those two textures giving pigment
> {rgb <0.5,0,0.5>}
>
> However, when it finds a point like <3.1,3,3>, the pattern evaluates to
> 0.1 and that's below the first entry in the map, so POV uses the first
> entry in the map.
>
> So for three equally spaced hard-edged bands you might use
>
> pigment {gradient x
>  pigment_map {[1/3  rgb <0,0,1>]
>               [1/3  rgb <0,1,0>]
>               [2/3  rgb <0,1,0>]
>               [2/3  rgb <1,0,0>]}
>  translate <-0.5,0,0>   // move transition point to the origin
>  scale 0.95*2           // scale up the texture_map to show 3 bands
>  translate <0.95/2,0,0> // move the mid point texture to half way along
>                         // the blob
>  }
>
> -- 
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

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