Loading thousands of mesh trees, fast?
Blitz3D Forums/Blitz3D Programming/Loading thousands of mesh trees, fast?
| ||
Hey there, in my game, I need to load and position quite a few (maybe over a thousand) low-poly tree models. The problem is, you can imagine that code like this is very slow: for n=1 to 1000 t.tree = new tree t\id = loadmesh("tree.b3d") next is there a way I can speed this up? Maybe by using copyEntity or CopyMesh? Thanks |
| ||
Yes - don't have 1000 different trees. Load X amount and reuse them. |
| ||
Try something like this... even though there are better ways of optimizing it. [CODE] Tree1=loadmesh("tree1.b3d") Tree2=loadmesh("tree2.b3d") Tree3=loadmesh("tree3.b3d") hideentity tree1 hideentity tree2 hideentity tree3 type tree field entity field x,y,z end type Number_of_trees% = 1000 for MakeTrees = 1 to Number_of_trees% Type_of_tree=Rand(0,2) Tree_x# = Rand(-100,100) Tree_y# = 0 ; put all trees in y at 0 Tree_z# = Rand(-100,100) T.Tree = new Tree T\X = Tree_X# T\Y = Tree_Y# T\Z = Tree_Z# Select Type_of_tree case 0 T\entity = copyentity tree1 case 1 T\entity = copyentity tree2 case 2 T\entity = copyentity tree3 end select positionentity T\entity,T\X, T\Y, T\Z next [/CODE] This saves on surfaces etc, but will be excessive due to poly count. I would suggest creating the trees using types like above, but use a function and have a tree constructor. Good luck, Scott |
| ||
unless you spesifically did todo your own tree routine, i would consider buying this: http://blitzbasic.com/Community/posts.php?topic=72001 |
| ||
mytree = loadmesh("tree.b3d") HideEntity mytree for n=1 to 1000 t.tree = new tree t\id = CopyEntity(mytree) next |
| ||
Or you can buy this: http://gothasoft.com/Default.aspx?tabid=81 Depending on hardware, you can achieve tens of thousands of trees. ![]() |
| ||
. |
| ||
beat you too it puki. I always like to buy lib's. If you think about it, it would take you longer than 2 hours to program a tree lib as good as treeparty (if ever, since the developer has many years experiance with tree systems) but for 2 hours work at min wage will get you it. |
| ||
http://www.blitzbasic.com/Community/posts.php?topic=72044 Why Buy stupid libs. then Blitz3d has the power built in. ? Somthing like this. ? |
| ||
lol...well I know which one I would like my game to look like. |
| ||
:) |
| ||
:P |
| ||
This is great |
| ||
As far as I see treeparty trees have about 10 times more tris than the ones by Wings. You need the right polycount for every kind of job IMHO. So with a little polish Wings trees ain't that bad. |
| ||
you can design your own trees in treeparty. Even loading in just normal model files and using them as trees within the system. |
| ||
Never mind the tris. My gfx card can handle 1.000.000 Tris and still have 60 fps Thoe avarege gfx card can handle upp to 250.000 tris over that is trouble. My gaming pc x800 handels 1.300.000 tris 60 fps My new laptop cryes att 500.000 tris. 60 fps My old laptop cyres at 100.000 tris 59 fps |
| ||
Simple solution for all this: Everyone in the world needs to upgrade their vid cards! Problem solved! :) |