multiple visual lod levels
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-24 21:08:16 -04:00
parent 33cfc3601b
commit 11b519ef79
4 changed files with 23 additions and 7 deletions

View File

@ -1968,6 +1968,7 @@ Performance improvements
- Character services references set of already-loaded characters when simulating macro data
- Normal outline pipeline use draw accumulator
- Reduced the visual LOD cutoff
- Multiple visual LOD levels

View File

@ -73,6 +73,9 @@ public class ClientSimulation {
Globals.profiler.beginCpuSample("update actor animations");
for(Entity currentEntity : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE)){
Actor currentActor = EntityUtils.getActor(currentEntity);
if(currentActor.getLodLevel() == Actor.LOD_LEVEL_STATIC){
continue;
}
if(currentActor.isPlayingAnimation()){
currentActor.incrementAnimationTime((float)Globals.engineState.timekeeper.getSimFrameTime());
}

View File

@ -47,12 +47,17 @@ public class Actor {
/**
* full-resolution lod level
*/
public static final int LOD_LEVEL_FULL = 1;
public static final int LOD_LEVEL_FULL = 2;
/**
* lower-resolution lod level
*/
public static final int LOD_LEVEL_LOWER = 0;
public static final int LOD_LEVEL_LOWER = 1;
/**
* Performs static draw
*/
public static final int LOD_LEVEL_STATIC = 0;
/**
@ -523,7 +528,7 @@ public class Actor {
//fetch the model
String pathToFetch = this.modelPath;
if(this.lodLevel == Actor.LOD_LEVEL_LOWER && this.lowResPath != null){
if(this.lodLevel <= Actor.LOD_LEVEL_LOWER && this.lowResPath != null){
pathToFetch = this.lowResPath;
}
Model model = Globals.assetManager.fetchModel(pathToFetch);
@ -581,7 +586,7 @@ public class Actor {
public boolean isStaticDrawCall(){
return
//is low lod level
this.lodLevel == Actor.LOD_LEVEL_LOWER ||
this.lodLevel == Actor.LOD_LEVEL_STATIC ||
//actor doesn't have anything complicated render-wise (animations, custom textures, etc)
(
this.animationQueue.size() == 0 &&

View File

@ -26,7 +26,12 @@ public class DrawTargetEvaluator {
/**
* Cutoff after which we start using LOD models
*/
public static final int LOD_CUTOFF = 50;
public static final int LOD_STATIC_CUTOFF = 50;
/**
* Cutoff after which we draw lower resolution models
*/
public static final int LOD_LOWER_CUTOFF = 30;
/**
* Evaluates the draw targets
@ -75,10 +80,12 @@ public class DrawTargetEvaluator {
//evaluate LOD level
if(currentActor.getLowResPath() != null){
if(dist < LOD_CUTOFF){
if(dist < LOD_LOWER_CUTOFF){
currentActor.setLodLevel(Actor.LOD_LEVEL_FULL);
} else {
} else if(dist < LOD_STATIC_CUTOFF) {
currentActor.setLodLevel(Actor.LOD_LEVEL_LOWER);
} else {
currentActor.setLodLevel(Actor.LOD_LEVEL_STATIC);
}
}