Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TedMar, AndrewAMD), 1,344 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
need help with "LOD booster" #172659
12/13/07 14:43
12/13/07 14:43
Joined: Jan 2002
Posts: 454
Germany
CD_saber Offline OP
Senior Member
CD_saber  Offline OP
Senior Member

Joined: Jan 2002
Posts: 454
Germany
Hello George,
I need some help with your lod booster. I use the code for a forest. From time to time, the different lod-models are not replaeced correctly. Sometimes when I get near to the model (under the lod-limit) there has to be the "normal" model without lod, but there isn't. But it sometimes it works... Do I have to change the code to use it with a lot of models?


here is the code. My models names are "tan_0.mdl" "tan_2.mdl" "tan_3.mdl"
Code:
 
define lod_dist_1, skill1;
define lod_dist_2, skill2;

string entname_str[30];
string templod_str[30];

// uses lod_dist_1, lod_dist_2
action lod_booster
{
var lod_step = 0;
if (my.skill1 == 0 || my.skill2 == 0) // if the player forgets to set the lod steps in Wed
{
my.skill1 = 1000; // set the default lod steps
my.skill2 = 3000;
}


my.material = mtl_vegetation;

my.obj_amb_fac = 0.3;
my.ambient = (-100+sun_angle.tilt*(my.obj_amb_fac*1))+(lightning/3);


while (1)
{
str_for_entfile (entname_str, my); // get the file name of the entity
str_cpy (templod_str, entname_str); // copy the name to templod_str
str_clip (templod_str, str_len(entname_str) - 6); // get rid of the first part of the name
str_trunc (templod_str, 5); // as well as of the last part of the name
str_cpy (templod_str, entname_str); // copy the name of the entity in templod_str again
str_clip (templod_str, str_len(entname_str) - 4); // we've got the extension name here (ex: .mdl)
temp = vec_dist (my.x, camera.x); // measure the distance between the camera and the entity
if (temp >= my.skill1) // the distance is bigger than the first lod step?
{
if (temp < my.skill2) // if it is smaller than the 2nd lod step, so we will use the 2nd model
{
if (lod_step != 2)
{
str_trunc (entname_str, 5);
str_cat (entname_str, "2");
str_cat (entname_str, templod_str);
ent_morph(my, entname_str);
}
}
else // the distance is bigger than the 2nd lod step as well, so we will use the 3rd model
{
if (lod_step != 3)
{
lod_step = 3;
str_trunc (entname_str, 5);
str_cat (entname_str, "3");
str_cat (entname_str, templod_str);
ent_morph(my, entname_str);
}
}
}
else // the entity is close to the camera, so we will use the 1st model
{
if (lod_step != 1)
{
lod_step = 1;
str_trunc (entname_str, 5);
str_cat (entname_str, "0");
str_cat (entname_str, templod_str);
ent_morph(my, entname_str);
}
}
// wait a random number of frames; this instruction splits the load over several frames, useful if we have many lod entities
wait (3 + random(20));
}
}





Ja, lach du nur du haariges Pelzvieh!
Re: need help with "LOD booster" [Re: CD_saber] #172660
12/15/07 21:07
12/15/07 21:07
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
If you have lots of trees you might encounter problems; the string that stores the name of the tree model might be used by several trees at the same time. You can define several arrays and assign an array for each tree automatically - this will fix the problem.
As a (better) alternative, you can use Acknex's built-in lod system.


Moderated by  George 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1