POV-Ray : Newsgroups : povray.binaries.images : Grassy blob over granite plane Server Time
16 Nov 2024 14:18:24 EST (-0500)
  Grassy blob over granite plane (Message 1 to 4 of 4)  
From: Burki
Subject: Grassy blob over granite plane
Date: 18 Mar 2007 09:45:02
Message: <web.45fd5020646059817b9a38460@news.povray.org>
Hi Raytracers,

the weather's so bad, and I needed some green.

So here's my grassy blob.


Yours,
Bu.


Post a reply to this message


Attachments:
Download 'grassblob.jpg' (98 KB)

Preview of image 'grassblob.jpg'
grassblob.jpg


 

From: Nekar
Subject: Re: Grassy blob over granite plane
Date: 20 Mar 2007 00:57:56
Message: <45ff77e4@news.povray.org>
How did you do that?

Could you please post the code?


-- 
-Nekar Xenos
"The truth is out there"

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 472 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!


Post a reply to this message

From: Burki
Subject: Re: Grassy blob over granite plane
Date: 20 Mar 2007 13:05:01
Message: <web.4600215570d890167beb2560@news.povray.org>
"Nekar" <ger### [at] rpmmagcoza> wrote:
> How did you do that?
>
> Could you please post the code?
>
>




Hi Raytracers,

well first I couldn't find that grass macro. I know there must be one
somewhere, but anyway,
I wanted to have a look at the trace() command of POVray.


So I made a blade of grass with Wings3d and exported it to POVray.
The "foot" of the blade of grass is in the zero XY-plane.
I used Wings because I was too lazy to make a grass with POVray. But it
could be done with a prism shape I think.

Then I made ~32 thousand grasses randomly oriented and aranged them with the
trace command on the surface of a standard blob.

Code: Only the .pov file
The grass is in a zip file (omly two kilobytes),
please download at:
http://www.ginko.de/user/burki/halm.zip

// 3'17'' rendering time
// Persistence of Vision Ray Tracer Scene Description File
// File: ?.pov
// Vers: 3.6
// Desc: Checkered Floor Example
// Date: mm/dd/yy
// Auth: ?
//

#version 3.6;

#include "colors.inc"
#include "halm.inc" // halm=blade of grass, in the zip file



global_settings {
  assumed_gamma 1.0
  max_trace_level 3
}

// ----------------------------------------

camera {
  location  <0.0, 0.5, -4.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

// ----------------------------------------

plane {               // granite floor
  y, -1
  texture
  {
    pigment {
     granite
     color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.6,0.3,1.0>]
     }
     scale 12
    }
    finish{
      diffuse 0.8
      ambient 0.1
    }
  }
}

// The blob (standard blob from menu)
#declare RadiusVal   = 1.0; // (0 < RadiusVal) outer sphere of influence on
other components
#declare StrengthVal = 1.0; // (+ or -) strength of component's radiating
density
#declare blobby=
blob {
  // threshold (0.0 < threshold <= StrengthVal) surface falloff threshold #
  threshold 0.6
  sphere { < 0.75,   0,    0>, RadiusVal, StrengthVal }
  sphere { <-0.375,  0.65, 0>, RadiusVal, StrengthVal }
  sphere { <-0.375, -0.65, 0>, RadiusVal, StrengthVal }
  cylinder { -z, +z, RadiusVal, StrengthVal }
  // [sturm]
  scale 0.7

  rotate 137
}



// Grass

#declare r1=seed(0); // seed. well, that fits with grass
#declare r2=seed(2134);
#declare r3=seed(1532135);
#declare misplaced = 0;

#declare i=0;
#declare num = 32479; // yes, a prime number
#while (i < num)
     #local normale=<0,0,0>;
     #local pos = (<rand(r1), rand(r2), rand(r3)>-0.5) *16 ;

//////////////////////////////////////////////////////////////////////////////////////
     #local foot = trace(blobby, pos, -pos, normale);  // The trace command,
powerfull ! //

//////////////////////////////////////////////////////////////////////////////////////

     #if (vlength(normale) > 0)
          object {
               halm // blade of grass from include file (see below)
               scale 0.1
               //rotate 60*y
               finish {ambient 0.25}


               // --------------  polar Coordinates from normale vector
               // phi, to be -z rotated
               #declare nor_phi = degrees (acos(normale.y) );
               #declare nor_phi_text = concat("nor_phi: ", str(nor_phi,0,1),
" degs");
               // nor_phi_text not used here

               // theta, to be -y-rotated
               #declare nor_theta = degrees ( atan2 (normale.z, normale.x)
);
               #declare nor_theta_text = concat("nor_theta: ",
str(nor_theta,0,1), " degs");
               // nor_theta_text not used here


               // arrange the grass along the blob
               rotate -z * nor_phi
               rotate -y * nor_theta
               translate foot
          }
     #else
          #local misplaced = misplaced + 1; // used for debugging
     #end // if
     #declare i = i + 1; // i=counter
#end


text {
  ttf
  "crystal.ttf",
  concat("#=", str (num,0,0)) ,
  0,
  0
  translate <-20,10,50>
}





// blobby  itself is not displayed


#debug concat ("misplaced: ", str(misplaced,0,0) )















Maybe the following is a bit too late for
this year's St. Patricks Day.





Yours,
Bu.


Post a reply to this message


Attachments:
Download 'shamrock2.jpg' (70 KB)

Preview of image 'shamrock2.jpg'
shamrock2.jpg


 

From: Nekar
Subject: Re: Grassy blob over granite plane
Date: 26 Mar 2007 02:05:32
Message: <460770bc@news.povray.org>
Thanks, I first thought maybe you did it with media.


-- 
-Nekar Xenos
"The truth is out there"


Post a reply to this message

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