POV-Ray : Newsgroups : povray.newusers : meshes and rotation : meshes and rotation Server Time
30 Jul 2024 18:21:13 EDT (-0400)
  meshes and rotation  
From: Justin Smith
Date: 20 Nov 2003 22:20:02
Message: <web.3fbd82efbdd378f4a5634560@news.povray.org>
I'm trying to use a mesh to generate a clump of grass. I'm having a problem
because apparently I can't rotate the individual triangles within the mesh.
I'll show the erroneous code I'm using, so you can see what I am trying to
do:

#declare grassclump =
mesh
{
  #local numblades = 0;
  #local maxblades = 60+int((rand(randseed)*40));
  #while(numblades < maxblades)
    #local rotationx = rand(randseed)*30;
    #local rotationy = rand(randseed)*360;
    triangle
    {
      <.02,0,0>,<-.02,0,0>,<.018,1.2,0>
      rotate < rotationx,0,0>
      rotate <0,rotationy,0>
    }
    triangle
    {
      <-.02,0,0>,<-.018,1.2,0>,<.018,1.2,0>
      rotate < rotationx,0,0>
      rotate <0,rotationy,0>
    }
    triangle
    {
      <-.018,1.2,0>,<.018,1.2,0>,<0,2.5,0>
      rotate < rotationx,0,0>
      rotate <0,rotationy,0>
    }
    #local numblades = numblades+1;
  #end
  texture
  {
    pigment
    {
      color rgb <.1,1,.26>
    }
  }
}

I am using 500,000 of these clumps of grass in my scene, randomly placed. I
could just keep the grassblade as the individual mesh and then use union to
form the clump, but as I have so many, I think I need to be able to keep
the whole clump as a single mesh to keep the number of objects down, right?


Post a reply to this message

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