POV-Ray : Newsgroups : povray.advanced-users : stacked planes method : Re: stacked planes method Server Time
29 Jul 2024 18:18:18 EDT (-0400)
  Re: stacked planes method  
From: Jan Walzer
Date: 10 Mar 2002 08:55:22
Message: <3c8b65ca@news.povray.org>
excuse me... for:

1) I'mposting the source heree direcctly ...
2) using your original scene ..

this is only a quick hack ...
I tried to "port" your quick-grass to media ...

As I'm under time-pressure, I had no time tweaking it very much ...
it's not very cheap at the moment ...
And currently it's far away from being as nice as your original version ...

see it as "proove of concept" that it is certainly possible, to do your
grass with media, but I'm still on the progress ...

I had a hard time, to figure out, how your macros work, so in my minutes, I
had left, there was not much time tweaking the scene ...
I hope it comes a bit near to your scene ...

I'll see if I can do better this evening ...


--------------------------
   #include "functions.inc"
   #declare CamLoc = <15,4.1,0>;

   camera {location CamLoc look_at CamLoc+z-y*.01}

   light_source {<2,3,-1>*1000, color 1.8}

   sky_sphere {
      pigment {
         planar poly_wave 1.5
         color_map {
            [0, color <0.4,0.6,1.0>]
            [1, color <0.9,1.0,1.0>]
         }
      }
   }

#declare HF =
height_field {
  function 50, 50 {pattern {spotted scale 0.3 rotate -90*x}} smooth
  scale <30,5,30>
}



#declare PathFunction =
function {
  pattern {
     planar rotate 90*z turbulence 0.3
     rotate 20*y translate <15,2.5,15>
  }
}

#declare GrassMap =
   function(x,y,z) {
      (0.4+f_noise3d(x/5,y/5+3.6,z/5))
      *(1-1*PathFunction(x,y,z))
   }

object {
    HF
    translate y*-0.001
   pigment { color rgb <0.33,0.25,0.18>}
}

#macro Dens(CamLoc,Scale,Color,Turb,Seed)
      density {
         #local F = 20;
         #local Vx = CamLoc.x;
         #local Vy = CamLoc.y-Seed*8;
         #local Vz = CamLoc.z;
         #local FMap = function(x,y,z){GrassMap(x,y,z)}
         function {
            min(1,
                max(0,

oise3d( 
                       
sin(atan2(x/Scale,z/Scale)*F)*sqrt((x/Scale)^2+(z/Scale)^2)/0.3,
                        Seed*8,
                       
cos(atan2(x/Scale,z/Scale)*F)*sqrt((x/Scale)^2+(z/Scale)^2)/0.3                       
                    )
                -0.3 +0.3*min(1,FMap(x+Vx,y+Vy,z+Vz)) ))
            }
         warp {turbulence Turb octaves 2}
         translate CamLoc-Seed*8*y
         color_map {
            [0.60, color transmit 1]
            [0.60, color Color*0.5 ]
            [0.70, color Color*0.9 ]
            [0.85, color Color*1.0 ]
            [0.95, color rgb 1     ]
         }
      }
   #end

           
object {
        difference { 
            object {HF translate y*0.08}
            object {HF }             
            }            
    hollow    
    pigment { color rgbt <0,0,0,1> }  
    finish { ambient 0 diffuse 0}     

    interior {
        media {        
            absorption 2
            scattering {1, 1}
            samples 16,128   
            Dens(CamLoc,1.0,<0.5,0.6,0.4>,0.2,1)
            }
        media {       
            absorption 2
            scattering {1, 1} 
            samples 16,128  
            Dens(CamLoc,1.0,<0.7,0.7,0.4>,0.2,4)
            }
        media {       
            absorption 2
            scattering {1, 1} 
            samples 16,128   
            Dens(CamLoc,1.0,<0.6,0.8,0.4>,0.2,5)
            }
        }
    }                        
-----------------


Post a reply to this message

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