shadow map pipeline distance check
This commit is contained in:
parent
028c416dab
commit
9516209bc3
@ -1964,6 +1964,7 @@ Performance improvements
|
|||||||
- Block entities are back to using same mesh for all blocks, will eventually just have closest ones ONLY on client use multi-mesh
|
- Block entities are back to using same mesh for all blocks, will eventually just have closest ones ONLY on client use multi-mesh
|
||||||
- Accumulator draw calls do not use bones
|
- Accumulator draw calls do not use bones
|
||||||
- LOD skipping in realm simulation
|
- LOD skipping in realm simulation
|
||||||
|
- Shadow map pipeline only considers entities that are nearby
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,11 @@ public class ShadowMapPipeline implements RenderPipeline {
|
|||||||
*/
|
*/
|
||||||
public static final int SHADOW_MAP_RESOLUTION = 4096;
|
public static final int SHADOW_MAP_RESOLUTION = 4096;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cutoff for adding to shadow map pipeline draw accumulator
|
||||||
|
*/
|
||||||
|
public static final double DRAW_CUTOFF_DIST = 30f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The eye of the camera that is used to render the shadow map
|
* The eye of the camera that is used to render the shadow map
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import electrosphere.entity.EntityTags;
|
|||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.renderer.actor.Actor;
|
import electrosphere.renderer.actor.Actor;
|
||||||
import electrosphere.renderer.pipelines.MainContentPipeline;
|
import electrosphere.renderer.pipelines.MainContentPipeline;
|
||||||
|
import electrosphere.renderer.pipelines.ShadowMapPipeline;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates the draw targets
|
* Evaluates the draw targets
|
||||||
@ -61,10 +62,12 @@ public class DrawTargetEvaluator {
|
|||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
|
|
||||||
|
//get distance from camera
|
||||||
|
posVec.set(position);
|
||||||
|
double dist = posVec.distance(cameraCenter);
|
||||||
|
|
||||||
//evaluate LOD level
|
//evaluate LOD level
|
||||||
if(currentActor.getLowResPath() != null){
|
if(currentActor.getLowResPath() != null){
|
||||||
posVec.set(position);
|
|
||||||
double dist = posVec.distance(cameraCenter);
|
|
||||||
if(dist < LOD_CUTOFF){
|
if(dist < LOD_CUTOFF){
|
||||||
currentActor.setLodLevel(Actor.LOD_LEVEL_FULL);
|
currentActor.setLodLevel(Actor.LOD_LEVEL_FULL);
|
||||||
} else {
|
} else {
|
||||||
@ -88,7 +91,7 @@ public class DrawTargetEvaluator {
|
|||||||
if(MainContentPipeline.shouldDrawSolidPass(currentEntity)){
|
if(MainContentPipeline.shouldDrawSolidPass(currentEntity)){
|
||||||
mainAccumulator.addCall(currentActor.getModelPath(), position, modelTransformMatrix);
|
mainAccumulator.addCall(currentActor.getModelPath(), position, modelTransformMatrix);
|
||||||
}
|
}
|
||||||
if(shadowList.contains(currentEntity)){
|
if(dist < ShadowMapPipeline.DRAW_CUTOFF_DIST && shadowList.contains(currentEntity)){
|
||||||
shadowAccumulator.addCall(currentActor.getModelPath(), position, modelTransformMatrix);
|
shadowAccumulator.addCall(currentActor.getModelPath(), position, modelTransformMatrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +99,7 @@ public class DrawTargetEvaluator {
|
|||||||
if(MainContentPipeline.shouldDrawSolidPass(currentEntity)){
|
if(MainContentPipeline.shouldDrawSolidPass(currentEntity)){
|
||||||
mainQueue.add(currentEntity);
|
mainQueue.add(currentEntity);
|
||||||
}
|
}
|
||||||
if(shadowList.contains(currentEntity)){
|
if(dist < ShadowMapPipeline.DRAW_CUTOFF_DIST && shadowList.contains(currentEntity)){
|
||||||
shadowQueue.add(currentEntity);
|
shadowQueue.add(currentEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user