Alright, I think I have it down. Please correct me on this technique.
I have been trying to learn how to do tree/leaf effects like speedtree and blitztree3d and I think I have it.
Create a mesh, parent it to the camera.
Create all your leaf quads in it facing camera.
Go through the tree list and simply move the quads to the needed location (this way they stay facing camera).
Rotate the texture a bit for the leaves and modify the texture u,v positioning to keep the leaf texture in the center.
I have been playing with this technique and it seems pretty decent.
Speed comparrisons:
Using sprites: Max in scene before I see a slow down is 1000.
Using quads and rotating the verts to match camera: can do about 4,000 before a noticable slowdown (before the frame rate comes off strong).
Using the above method: about 12,000 quads before a slow down.
Now that makes a huge difference... Each tree having roughly 40 leaf quads, rotating and such yet still facing camera. That gives me ...
25 trees for the 1st method
100 trees for the 2nd method
and 300 trees for the method described at the beg of this post.
Not that I NEED 300 trees, but the ability to have more, means that the system can do other things than just do trees...
Anything I could be doing better????
I also found out that when modifying a mesh's structure, dont leave the function (or call other functions). It impacts the performance somewhat. It may not be noticable on a few operations per mesh, but when going through a list of 2000 verticies, it gives a hella slow down..
For example:
is 25 ms faster then doing this:
Just to give you an idea on my system:
Fresh install, default Board config, XP Pro set to performance config rather then appearance config, 2.4 GHZ P4 with Hyperthreading, 512 MB DDR, 120 GIG 7200 rpm WD Special Edition, Geforce 4200 128mb
But anyway, anyone with any ideas on how i can speed up my tree process?
I was considering publishing the system in the code archives if I can get something decent cooked out.
I have been trying to learn how to do tree/leaf effects like speedtree and blitztree3d and I think I have it.
Create a mesh, parent it to the camera.
Create all your leaf quads in it facing camera.
Go through the tree list and simply move the quads to the needed location (this way they stay facing camera).
Rotate the texture a bit for the leaves and modify the texture u,v positioning to keep the leaf texture in the center.
I have been playing with this technique and it seems pretty decent.
Speed comparrisons:
Using sprites: Max in scene before I see a slow down is 1000.
Using quads and rotating the verts to match camera: can do about 4,000 before a noticable slowdown (before the frame rate comes off strong).
Using the above method: about 12,000 quads before a slow down.
Now that makes a huge difference... Each tree having roughly 40 leaf quads, rotating and such yet still facing camera. That gives me ...
25 trees for the 1st method
100 trees for the 2nd method
and 300 trees for the method described at the beg of this post.
Not that I NEED 300 trees, but the ability to have more, means that the system can do other things than just do trees...
Anything I could be doing better????
I also found out that when modifying a mesh's structure, dont leave the function (or call other functions). It impacts the performance somewhat. It may not be noticable on a few operations per mesh, but when going through a list of 2000 verticies, it gives a hella slow down..
For example:
Function ModifyLeafs() Local L.Leaf Local RX#,RY#,RZ# For l.Leaf = Each Leaf For x22 = 1 To 4 X# = Rnd(-10,10) Y# = Rnd(-10,10) Z# = Rnd(-10,10) X# = X# + 5 Y# = Y# + 5 Z# = Z# + 5 ;Rotate3d() VertexCoords(L\Surface,L\Vert[x22],X#,Y#,Z#) Next Next End Function
is 25 ms faster then doing this:
Function ModifyLeafs() Local L.Leaf Local RX#,RY#,RZ# For l.Leaf = Each Leaf For x22 = 1 To 4 ;Rotate3d() VertexCoords(L\Surface,L\Vert[x22],RotX#(),RotY#(),RotZ#()) Next Next End Function Function RotX#() Return Rnd(-10,10) End Function Function RotY#() Return Rnd(-10,10) End Function Function RotZ#() Return Rnd(-10,10) End Function
Just to give you an idea on my system:
Fresh install, default Board config, XP Pro set to performance config rather then appearance config, 2.4 GHZ P4 with Hyperthreading, 512 MB DDR, 120 GIG 7200 rpm WD Special Edition, Geforce 4200 128mb
But anyway, anyone with any ideas on how i can speed up my tree process?
I was considering publishing the system in the code archives if I can get something decent cooked out.
