POV-Ray : Newsgroups : povray.newusers : Bumps, squared. Server Time
1 Nov 2024 16:22:04 EDT (-0400)
  Bumps, squared. (Message 1 to 6 of 6)  
From: Greg M  Johnson
Subject: Bumps, squared.
Date: 8 Dec 2007 22:02:56
Message: <475b5ae0@news.povray.org>
I was trying to do some isosurface-like things with some functions.  I
wanted a pigment pattern which was based on the values generated by bumps
(or wrinkles, etc)  squared.

I found that I could not get any syntax that would work for declaring a
function from a pattern and then doing arithmetic operations on it, and
then using THAT as a pigment pattern.

Help is appreciated, thanks.


Post a reply to this message

From: Karl Anders
Subject: Re: Bumps, squared.
Date: 9 Dec 2007 02:35:01
Message: <web.475b9966fb428a64a3740fdb0@news.povray.org>
"Greg M. Johnson" <pte### [at] thecommononethatstartswithYcom> wrote:
> I was trying to do some isosurface-like things with some functions.  I
> wanted a pigment pattern which was based on the values generated by bumps
> (or wrinkles, etc)  squared.
>
> I found that I could not get any syntax that would work for declaring a
> function from a pattern and then doing arithmetic operations on it, and
> then using THAT as a pigment pattern.
>
> Help is appreciated, thanks.

Hi Greg,

how about

#declare BumpFunc = function{ pattern{ bumps } };
#declare BumpSquared = function{ pow( BumpFunc( x, y, z ), 2 ) };

I didn't actually USE this for anything, but it seems syntactically correct
because POV-Ray doesn't choke on it - except for complaining about no objects
in scene ...

Greetings
Karl


Post a reply to this message

From: Karl Anders
Subject: Re: Bumps, squared.
Date: 9 Dec 2007 08:45:01
Message: <web.475bf04ffb428a644ae996d80@news.povray.org>
..... and now, after spending some time with my family on this beautiful sunday,
a
more complete example that really renders a picture, though WHAT that might be,
I really don't want to guess :-) ...

// cut HERE for BumpFunc.pov

#declare BumpFunc = function{ pattern{ bumps} };
#declare BumpSquared = function{ pow( BumpFunc( x, y, z ), 2 ) };
/*************
it's interesting that that is FASTER than
#declare BumpSquared = function{ BumpFunc( x, y, z )*BumpFunc( x, y, z ) };
*************/

isosurface {
 function {
  0.5-BumpSquared( x, y, z )
 }
 max_gradient 1.35
 contained_by {
  sphere { <0.0, 0.0, 0.0>, 8 }
 }
 rotate y*90
 scale 0.25
 #declare COLORS = yes;
 #if( COLORS )
  pigment {
   spherical
   color_map {
    [ 0.00000 rgb < 1.00000, 0.50000, 1.00000> ]
    [ 0.10000 rgb < 1.00000, 0.50000, 1.00000> ]
    [ 0.21400 rgb < 0.50000, 0.50000, 1.00000> ]
    [ 0.32800 rgb < 0.20000, 0.20000, 1.00000> ]
    [ 0.44200 rgb < 0.20000, 1.00000, 1.00000> ]
    [ 0.55600 rgb < 0.20000, 1.00000, 0.20000> ]
    [ 0.67000 rgb < 1.00000, 1.00000, 0.20000> ]
    [ 0.78400 rgb < 1.00000, 0.50000, 0.20000> ]
    [ 0.90000 rgb < 1.00000, 0.20000, 0.20000> ]
    [ 1.00000 rgb < 1.00000, 0.20000, 0.20000> ]
   }
   scale 2
  }
 #else
  pigment{ color rgb 1 }
 #end // #if( COLORS )
}

light_source {
 -10*z+y
 rgb 0.5
}

light_source {
 -10*z+y-2*x
 rgb 0.5
}

light_source {
 -10*z+y+2*x
 rgb 0.5
}

camera {
 location < 0.0, 0.0, -5>
}

// cut HERE again for end of BumpFunc.pov

Enjoy
Karl


Post a reply to this message

From: gregjohn
Subject: Re: Bumps, squared.
Date: 9 Dec 2007 09:10:00
Message: <web.475bf638fb428a6434d207310@news.povray.org>
"Karl Anders" <kar### [at] webde> wrote:
> ..... and now, after spending some time with my family
> on this beautiful sunday, a more complete example that
> really renders a picture, though WHAT that might be,
> I really don't want to guess :-) ...
>
> // cut HERE for BumpFunc.pov
>

Okay, great thanks.  I couldn't test your first reply as my PC is in a day-long
render right now. :-S

I think the key help you provided was in the word "pattern". thanks.


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Bumps, squared.
Date: 9 Dec 2007 09:50:00
Message: <web.475c0030fb428a642ae8612c0@news.povray.org>
"Greg M. Johnson" <pte### [at] thecommononethatstartswithYcom> wrote:
> I was trying to do some isosurface-like things with some functions.  I
> wanted a pigment pattern which was based on the values generated by bumps
> (or wrinkles, etc)  squared.
>
> I found that I could not get any syntax that would work for declaring a
> function from a pattern and then doing arithmetic operations on it, and
> then using THAT as a pigment pattern.
>
> Help is appreciated, thanks.

Try using the poly_wave waveform modifier.  (I think poly_wave 2 is the one you
want or poly_wave 0.5)

-tgq


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Bumps, squared.
Date: 9 Dec 2007 20:50:01
Message: <web.475c9ab7fb428a642ae8612c0@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> "Greg M. Johnson" <pte### [at] thecommononethatstartswithYcom> wrote:
> > I was trying to do some isosurface-like things with some functions.  I
> > wanted a pigment pattern which was based on the values generated by bumps
> > (or wrinkles, etc)  squared.
> >
> > I found that I could not get any syntax that would work for declaring a
> > function from a pattern and then doing arithmetic operations on it, and
> > then using THAT as a pigment pattern.
> >
> > Help is appreciated, thanks.
>
> Try using the poly_wave waveform modifier.  (I think poly_wave 2 is the one you
> want or poly_wave 0.5)
>
> -tgq

Actually, now that I thought about it, I don't think this is what you were
looking for, it affects the mapping, not the colour.  You can manipulate
pigment through colours, but keep in mind that functions don't carry vectors.
Try something like this:

#declare MyPig=pigment{bozo}  //your  priginal pigment

#declare PFunk=function{pigment{MyPig}}//declare it as a function

#declare FRd=function{PFunk(x,y,z).red  }//separate the red, green and blue
components
#declare FGn=function{PFunk(x,y,z).green}
#declare FBl=function{PFunk(x,y,z).blue }

#declare FRed=function{FRd(x,y,z)} //manipulate these functions how you want
#declare FGrn=function{FGn(x,y,z)}
#declare FBlu=function{FBl(x,y,z)}

#declare MyPig2=
pigment{average//average pigment to reassemble RGB components
  pigment_map{
      [function{FRed(x,y,z)} color_map{[0 rgb 0][1 rgb <3,0,0>]}]
      [function{FGrn(x,y,z)} color_map{[0 rgb 0][1 rgb <0,3,0>]}]
      [function{FBlu(x,y,z)} color_map{[0 rgb 0][1 rgb <0,0,3>]}]
  }
}


-tgq


Post a reply to this message

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