|
|
Hi,
I'm trying to make grass - http://raf256.com/pov/grass/
effects are not bad as far, but I realizaed that final scene, with field of
i.e. 1000x1000 graf leafs will take *forever* to render.
What optimization technics can I use ? Currently my ideas are :
- 1 leaf=mesh, but alsow 10x10 leafs union will be another mesh - repeatet
100x100 times to get 1000x1000 field
- only about 300x300 field, closes to camera will be drawn so presisly,
grass that is far evey will contain less details :
* very near - inside(mesh)+isosurface, pigment (2 bozos), normal (2 bozos)
* near - mesh, pigment (2 bozos), normal (2 bozos)
* medium - mesh with half triangles, pigment (bozo), normal (bozo)
* far - mesh with 0.1 triangles, pigment (bozo)
* very far - each leaf is a cone, regular pigment for each leaf
* horizont - gras wil be simulated as green pigment on ground
--
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M
Post a reply to this message
|
|
|
|
To get full advantage of meshes, there are two things you have to do:
1. You should make them as big as possible (ie. put as many triangles as
possible inside one mesh). Putting a few triangles inside a mesh and copying
this mesh does not help anything (in fact, it actually produces a slower
rendering than just using a union of triangles).
2. You should see if you can generate the scene by copying this big mesh
several times (this saves memory).
In practice you have to find a compromise between these two things.
You could put *everything* inside one single mesh for maximum speed, but
then it would take a lot of memory (besides being very slow to parse).
To save memory you should create a mesh as a part of the scene, and then
copy this mesh around the scene. However, as you get exact copies of this
mesh, the result might not be good (ie. if you can see the repeating meshes
in the scene), so you need to model the scene carefully. You could create
several different meshes and make copies of them around the scene in order
to introduce more variation.
--
#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
|
|