POV-Ray : Newsgroups : povray.binaries.animations : Muscles (702KB MPEG-1) : Re: Muscles (702KB MPEG-1) Server Time
8 Jul 2024 11:10:43 EDT (-0400)
  Re: Muscles (702KB MPEG-1)  
From: David El Tom
Date: 5 Jan 2006 04:09:22
Message: <43bce242@news.povray.org>
> 
> MegaPOV used to have a blob-pattern, but for some reason the latest version doesn't
have it anymore :(
> 
> cu!

at least I found a way to fake a blob pattern via usage of functions:

<<<<SNIPPET-START>>>>

//"prove of principle" - blob pattern-function

// number of blob components
#declare blob_component_count = 3;

// arrays holding strength, radius and position for each component
#declare blob_strength = array[blob_component_count];
#declare blob_radii = array[blob_component_count];
#declare blob_positions = array[blob_component_count];

// fill these arrays with something
#declare blob_strength[0]=1.0;
#declare blob_strength[1]=1.2;
#declare blob_strength[2]=-.5;
#declare blob_radii[0]   =1.3;
#declare blob_radii[1]   =1.3;
#declare blob_radii[2]   =1.0;
#declare blob_positions[0] = <-.8,0,0>;
#declare blob_positions[1] = <.8,0,0>;
#declare blob_positions[2] = <.0,.3,0>;


#declare counter = 0;
#declare blob_fcn =
function
{
#while (counter < blob_component_count)
   #local x_pos = blob_positions[counter].x;
   #local y_pos = blob_positions[counter].y;
   #local z_pos = blob_positions[counter].z;
   #local radius_squared = pow(blob_radii[counter],2);
   #if (counter > 0)
     +
   #end //if
   (blob_strength[counter] *
pow((1.0-min(1,((pow((x-x_pos),2)+pow((y-y_pos),2)+pow((z-z_pos),2))/radius_squared))),2))
   #declare counter= counter +1;
#end // while
}


plane
{
   z,0
   pigment
   {
     function{min(1,max(0,blob_fcn(x,y,z)))}
     color_map
     {
       [0 rgb 0]
       [0.2 rgb <1,0,0>]
       [0.4 rgb <0,1,0>]
       [0.6 rgb <0,0,1>]
       [0.8 rgb <0,1,1>]
       [1 rgb 1]
     }
     ramp_wave
   }
}

<<<<SNIPPET-END>>>>

... dave


Post a reply to this message


Attachments:
Download 'blob_fcn.png' (26 KB)

Preview of image 'blob_fcn.png'
blob_fcn.png


 

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