Material LOD

Posted By: Sylic

Material LOD - 06/08/04 21:22

Hi,

Itīs possible use a Material LOD in GameStudio?

Somebody has a Material LOD Code?

I search in google, but donīt found nothing.

Sorry my bad english.
Posted By: slacer

Re: Material LOD - 06/08/04 21:56

Do you mean MIPMAPPING?

First I would use several models with different quantity of polygons for the different distances (view <-> object)
Most performance drop comes from the poly count.
But if you reduce the amount of polygons you have to hide the loss of details with a different texture applied.

If you are very close to a statue with a crack in its leg, you need to see the crack as geometry.
If you go away a bit, you don't need to model the crack - it is sufficient to alter the texture
(with a dark painted shadow at the crack position ) and use a more simple geometry.

MIP Maps are reduced in size for each LOD step and avoid the need to scale the texture
at runtime from 1024x1024 down to an object which is only 75 pixel heigh at the time of rendering.

So, what do you need?

-- slacer
Posted By: ventilator

Re: Material LOD - 06/08/04 22:00

material lod can be easily done per script. just switch to a cheaper shader / material version once the entity is at a certain distance from the camera.
Posted By: Cellulaer

Re: Material LOD - 06/09/04 00:19


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
}
}
}
Posted By: qwerty823

Re: Material LOD - 06/09/04 00:36

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.
Posted By: Marco_Grubert

Re: Material LOD - 06/09/04 08:32

..and we can also optimize away the ">" comparisons, but the basic idea is right.
© 2024 lite-C Forums