1 registered members (AndrewAMD),
1,213
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Material LOD
[Re: Cellulaer]
#28582
06/09/04 00:36
06/09/04 00:36
|
Joined: Oct 2003
Posts: 1,258 Virginia, USA
qwerty823
Senior Developer
|
Senior Developer
Joined: Oct 2003
Posts: 1,258
Virginia, USA
|
Quote:
This code (see below) will return the distance between the current entity and the camera. Just stick it in the action of the model with the material and change the material or what have you based on the distance.
vec_dist(my.x,camera.x);
For example:
if vec_dist(my.x,camera.x)<1000 { // lod 0 } else { if (vec_dist(my.x,camera.x)>1000)&&(vec_dist(my.x,camera.x)<5000) { //lod 1 } else { if (vec_dist(my.x,camera.x)>5000)&&(vec_dist(my.x,camera.x)<10000) { //lod 2 } else { //lod 3 } } }
But just dont do it like that. That code calls vec_dist up to 5 times. Just call vec_dist once, and store in a local var, and compare on that.
Never argue with an idiot. They drag you down to their level then beat you with experience
|
|
|
|