POV-Ray : Newsgroups : povray.advanced-users : stacked planes method Server Time
29 Jul 2024 16:24:13 EDT (-0400)
  stacked planes method (Message 11 to 15 of 15)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Jan Walzer
Subject: Re: stacked planes method
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

From:
Subject: Re: stacked planes method
Date: 10 Mar 2002 10:15:05
Message: <3c8b792b.5901729@news.povray.org>
On Sun, 10 Mar 2002 14:55:32 +0100, "Jan Walzer" <jan### [at] lzernet>
wrote:

>excuse me... for:
>#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,


Something goes wrong around 'oise3d(', too quick pasting ??

/Erkki


Post a reply to this message

From: Rune
Subject: Re: stacked planes method
Date: 11 Mar 2002 10:53:22
Message: <3c8cd2f2@news.povray.org>
"Jan Walzer" wrote:
> this is only a quick hack ...
> I tried to "port" your quick-grass to media ...

Hehe, I'm not sure you know what you're doing. The vertical strands of grass
in my fast grass trick are an illusion. They're entirely caused by the
special pattern used, not because of stacked planes. I only use stacked
planes to mix different shades of strands and to make the grass at the
horizon a bit fuzzy.

As you have copied the pattern used directly, the strands of media grass
you're seeing in your scene also are not vertical. They're sort of painted
on the ground like a texture, and using media to achieve this make no sense
at all IMO.

I'm not saying that the media method don't work, but in order to justify it,
it must have some advantage over the texture method, and i have yet to see
that.

There are three goals you could go for:
- making the media method faster than the texture method.
- making the media method look better than the texture method.
- making the media method overcome the problems that the texture method has,
so for example it looks right when the camera is moving.

Anyway, I'd be interested if you plan to develop your method further...

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Jan Walzer
Subject: Re: stacked planes method
Date: 11 Mar 2002 12:33:34
Message: <3c8cea6e@news.povray.org>
> Hehe, I'm not sure you know what you're doing. The vertical strands of
grass
> in my fast grass trick are an illusion. They're entirely caused by the
> special pattern used, not because of stacked planes. I only use stacked
> planes to mix different shades of strands and to make the grass at the
> horizon a bit fuzzy.

re: Hehe, ...
;) I was 'bout to tell you, that your grass doesn't work well, when
animating ...

As I look at the source now, I'm slowly understanding, how you achive the
effect, and why
it's so fast ...

And in this case, of course, using media is no improvement ...
But I _had_ a quite fast media version of grass ...

I'm sure a more advanced artist would have been able to color it in a way,
to make it
look more real ... (I'm not so good, when it comes, to make the textures
look real) ...

It consisted mainly of an absorbing media-pattern, probably bozo, that was
stretched along y and turbulence <0.5,0,0.5>
It was suitable for mid-distance grass ...
If you had it near to you, you saw that it was media, and to smooth (and
transparent) and
when you had it to far away, it was going to black, as I used absorption
...

But in mid-distance, it was nice green, it had fuzzy edges, and the ground
was on some
points imaginable ... Another bad thing was, that (again, because of
absorption) you
could only use it in daylight-scenes and with a bright ground...

I thought 'bout using emission or scatter, but this would have been even
more cheating
and is probably not faster ...

But I've not the pressure, to present HQ-works here on that server, as I'm
not such
an artist as you are *g ...

Again, good work ... and thanx for sharing ...


Post a reply to this message

From: Rune
Subject: Re: stacked planes method
Date: 11 Mar 2002 16:30:58
Message: <3c8d2212$1@news.povray.org>
"Jan Walzer" wrote:
> ;) I was 'bout to tell you, that your grass
> doesn't work well, when animating ...

Well, if you had read the page I referred you to... ;)

> And in this case, of course, using media is no improvement ...
> But I _had_ a quite fast media version of grass ...

You posted one to povray.binaries.images at one time, which didn't include
camera or lights, so it was a bit difficult to know what it looked like at
your end.

> I'm sure a more advanced artist would have been able to
> color it in a way, to make it look more real ...
> (I'm not so good, when it comes, to make the textures
> look real) ...

That, unfortunately, would also make it slower.

The problem with using media for grass is that media is not made to simulate
solid objects. Emitting media becomes too bright at the horizon and
absorbing media becomes too dark. A combination would be better, but it
would still not be affected by light sources, so it would glow in the dark
and in shadows. To avoid that you'd need scattering media which is extremely
slow when dealing with a pattern as detailed as this one. I think, if you
managed to make media grass that's quite good looking, then it would
probably be slower than if you just used mesh objects for the grass. :/

Hmm, this thread originated as a discussion about clouds. Clouds are ideally
suited for media (or is it media that's ideally suited for clouds?). But I
just don't think that's the case with grass...

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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