POV-Ray : Newsgroups : povray.advanced-users : Grass Server Time
29 Jul 2024 12:16:26 EDT (-0400)
  Grass (Message 3 to 12 of 12)  
<<< Previous 2 Messages Goto Initial 10 Messages
From: Slime
Subject: Re: Grass
Date: 30 Aug 2002 09:09:06
Message: <3d6f6e72$1@news.povray.org>
> Unfortunately this needs far too much memory. (much more that I have)
> I tried something alike with triangles (in a mesh), but with that it'd
need
> weeks to render the scene (spheres with lots of swapping are actually
> faster!)

#declare a grass blade, and then place however many of them with
object{grassblade translate...}. Then it's not creating a new object in
memory for every blade.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: Le Forgeron
Subject: Re: Grass
Date: 30 Aug 2002 09:59:51
Message: <3D6F7A84.3050403@free.fr>
Niki Estner wrote:

> Hi there,
> 
> I got a scene where I need some grass. I know, there are include files on
> the www that do wonderful grass, but in my case the camera is quite far of,
> so only rough shapes can be seen: I decided to make only ellipsoids for the
> grass. So I built a #while loop that creates 500.000 spheres, all scaled,
> rotated and translated.
> Unfortunately this needs far too much memory. (much more that I have)
> I tried something alike with triangles (in a mesh), but with that it'd need
> weeks to render the scene (spheres with lots of swapping are actually
> faster!)
> 
> I don't think this is a new problem: using many particles for hair, grass,
> explosions isn't a big idea, and using the fastest raytracing object - the
> sphere - is also only reasonable. Did anyone find a way to keep the memory
> usage in bounds?


Classical with grass is to make a mesh of triangles for a "unit",
then duplicate the mesh around to pave.

The right tuning of "unit" is nevertheless required:
  - too small, there is too much mesh bounding box to test against.
  - too big, memory usage is too high and there is more time
    to find the intersection in the mesh than finding the mesh it is 
part of with bounding box.

To avoid pattern repetition, a little jitter as well as random rotation


Post a reply to this message

From: Christopher James Huff
Subject: Re: Grass
Date: 30 Aug 2002 12:18:39
Message: <chrishuff-1AD438.12180330082002@netplex.aussie.org>
In article <3d6f6e72$1@news.povray.org>, "Slime" <slm### [at] slimelandcom> 
wrote:

> #declare a grass blade, and then place however many of them with
> object{grassblade translate...}. Then it's not creating a new object in
> memory for every blade.

Wrong, it does create a new object for each blade. With meshes, the 
geometry data gets shared between all the copies, so you can make lots 
of complex objects with very little memory...each mesh only needs 
transformations, flags, a pointer to the geometry data, and maybe 
textures (I'm not sure how textures are handled).

The usual method of making grass is to make a mesh of a patch of grass, 
and duplicate that patch around the scene. To avoid tiling effects, you 
can randomly select from an array of several different patches and/or 
randomly rotate or flip (scale by -1 along a dimension) the patches.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: Grass
Date: 30 Aug 2002 12:20:02
Message: <chrishuff-066138.12192630082002@netplex.aussie.org>
In article <3d6f2ba0@news.povray.org>,
 "Niki Estner" <nik### [at] freenetde> wrote:

> I don't think this is a new problem: using many particles for hair, grass,
> explosions isn't a big idea, and using the fastest raytracing object - the
> sphere - is also only reasonable. Did anyone find a way to keep the memory
> usage in bounds?

What makes you think the sphere is the fastest?
Using meshes is more efficient memory-wise, and probably a lot faster 
than a bunch of spheres.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Niki Estner
Subject: Re: Grass
Date: 30 Aug 2002 13:17:26
Message: <3d6fa8a6@news.povray.org>
> What makes you think the sphere is the fastest?
I tried putting 10000 spheres and 10000 triangles into a scene. Rendering
the triangle scene took about 5 times longer (don't know the exact numbers
any more).
For a triangle an intersection between a plane and a ray has to be
calculated, and then it has to be checked if the point is inside the
triangle. For a sphere, only the intersection point has to be calculated. I
think checking if a point is inside a triangle is more complex than
calculating the ray-sphere intersection.

> Using meshes is more efficient memory-wise, and probably a lot faster
> than a bunch of spheres.
Triangles surely need less memory, but they seem to render slower. Also, if
I want similar effects to the sphere-grass, I need smooth triangles, which
render even more slower.


Post a reply to this message

From: Christoph Hormann
Subject: Re: Grass
Date: 30 Aug 2002 13:57:22
Message: <3D6FB202.E175FCBC@gmx.de>
Niki Estner wrote:
> 
> I tried putting 10000 spheres and 10000 triangles into a scene. Rendering
> the triangle scene took about 5 times longer (don't know the exact numbers
> any more).
> For a triangle an intersection between a plane and a ray has to be
> calculated, and then it has to be checked if the point is inside the
> triangle. For a sphere, only the intersection point has to be calculated.
> [...]

No, a high number of triangles in a mesh will always render much faster
than individual spheres (of roughly the same size of course)

You should make sure your triangles are in a mesh (and not a union) and
all in one mesh of course.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 13 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Warp
Subject: Re: Grass
Date: 30 Aug 2002 15:08:25
Message: <3d6fc2a8@news.povray.org>
Actually povray can optimize a bunch of spheres so that they will
render faster (by defining bounding box hierarchies).
  20000 spheres will not take twice as long to render as 10000 spheres.
I haven't measured, but I would guess that the factor is more close to
something like 1.1 or whatever.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Dearmad
Subject: Re: Grass
Date: 30 Aug 2002 16:43:16
Message: <3D6FD99B.73803C96@applesnake.net>
if they're far enough off that spheres could have done it, then I'd have
used nothing but a procedural texture on a contoured surface.

-p
-- 
Modeling slave:
"Ballet pour ma fille."
http://www.applesnake.net


Post a reply to this message

From: Slime
Subject: Re: Grass
Date: 30 Aug 2002 19:21:27
Message: <3d6ffdf7$1@news.povray.org>
> Wrong, it does create a new object for each blade.

Well, yes, yes... it does, but I believe the new objects contain little more
than pointers to other objects. At least, I should *hope* that's the case.

I'm sure you're right that a mesh is the best solution for grass, but there
are other cases (involving more complex objects) where this is a helpful
strategy.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: Christopher James Huff
Subject: Re: Grass
Date: 2 Sep 2002 22:57:07
Message: <chrishuff-E99A99.22564702092002@netplex.aussie.org>
In article <3d6ffdf7$1@news.povray.org>, "Slime" <slm### [at] slimelandcom> 
wrote:

> > Wrong, it does create a new object for each blade.
> 
> Well, yes, yes... it does, but I believe the new objects contain little more
> than pointers to other objects. At least, I should *hope* that's the case.

That is only for meshes, for spheres you get a complete copy. And even 
then, there is other information that is needed for each object: 
transformation matrices, textures, flags, etc.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

<<< Previous 2 Messages Goto Initial 10 Messages

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