optimizations
Some checks reported errors
studiorailgun/Renderer/pipeline/head Something is wrong with the build of this commit

This commit is contained in:
austin 2025-03-28 20:36:26 -04:00
parent da021f889f
commit 50a816adc0
6 changed files with 134 additions and 137 deletions

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file
#Fri Mar 28 12:07:10 EDT 2025
buildNumber=611
#Fri Mar 28 19:50:10 EDT 2025
buildNumber=612

View File

@ -1363,6 +1363,8 @@ Lower duplicate physics frame count
Various code cleanup
Stop sleeping during high frame time
Actor bone spatial data caching for performance
Volumetric pipeline optimization
Collidable tree simplification

View File

@ -75,7 +75,7 @@ public class CollisionEngine {
* IE, if this value is 3, every main game engine frame, the physics simulation will run 3 frames.
* This keeps the physics simulation much more stable than it would be otherwise.
*/
public static final int PHYSICS_SIMULATION_RESOLUTION = 2;
public static final int PHYSICS_SIMULATION_RESOLUTION = 3;
/**
* Threshold after which the engine warns about collidable count

View File

@ -1,18 +1,12 @@
package electrosphere.entity.state.collidable;
import electrosphere.collision.PhysicsUtils;
import electrosphere.collision.collidable.Collidable;
import electrosphere.engine.Globals;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.btree.BehaviorTree;
import electrosphere.entity.state.gravity.ServerGravityTree;
import electrosphere.entity.state.movement.fall.ServerFallTree;
import electrosphere.server.datacell.Realm;
import org.joml.Quaterniond;
import org.joml.Vector3d;
import org.ode4j.ode.DBody;
/**
@ -42,9 +36,6 @@ public class ServerCollidableTree implements BehaviorTree {
static int incrementer = 0;
public void simulate(float deltaTime){
Vector3d position = EntityUtils.getPosition(parent);
Quaterniond rotation = EntityUtils.getRotation(parent);
Vector3d newPosition = new Vector3d(position);
//have we hit a terrain impulse?
//handle impulses
for(Impulse impulse : collidable.getImpulses()){
@ -57,18 +48,6 @@ public class ServerCollidableTree implements BehaviorTree {
this.resetGravityFall();
}
}
Realm realm = Globals.realmManager.getEntityRealm(parent);
//bound to world bounds
if(newPosition.x < realm.getServerWorldData().getWorldBoundMin().x){
newPosition.x = realm.getServerWorldData().getWorldBoundMin().x;
}
if(newPosition.y < realm.getServerWorldData().getWorldBoundMin().y){
newPosition.y = realm.getServerWorldData().getWorldBoundMin().y;
}
if(newPosition.z < realm.getServerWorldData().getWorldBoundMin().z){
newPosition.z = realm.getServerWorldData().getWorldBoundMin().z;
}
PhysicsUtils.setRigidBodyTransform(realm.getCollisionEngine(), newPosition, rotation, body);
}

View File

@ -69,6 +69,7 @@ public class MainContentPipeline implements RenderPipeline {
//
// D R A W A L L E N T I T I E S
//
Globals.profiler.beginCpuSample("MainContentPipeline.render - Solids non-instanced");
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
Vector3d position = EntityUtils.getPosition(currentEntity);
if(shouldDrawSolidPass(currentEntity)){
@ -86,7 +87,11 @@ public class MainContentPipeline implements RenderPipeline {
currentActor.draw(renderPipelineState,openGLState);
}
}
Globals.profiler.endCpuSample();
Globals.profiler.beginCpuSample("MainContentPipeline.render - Solids Foliage");
Globals.renderingEngine.getFoliagePipeline().render(openGLState, renderPipelineState);
Globals.profiler.endCpuSample();
Globals.profiler.beginCpuSample("MainContentPipeline.render - Solids instanced");
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
Vector3d position = EntityUtils.getPosition(currentEntity);
if(shouldDrawSolidPass(currentEntity)){
@ -115,6 +120,7 @@ public class MainContentPipeline implements RenderPipeline {
}
//draw all instanced models
Globals.clientInstanceManager.draw(renderPipelineState, openGLState);
Globals.profiler.endCpuSample();
this.firstPersonSubPipeline.render(openGLState, renderPipelineState);
//
@ -149,7 +155,7 @@ public class MainContentPipeline implements RenderPipeline {
//TLDR OF ABOVE: DO NOT DRAW TRANSPARENT OBJECTS IN OPAQUE PASS
//
Globals.profiler.beginCpuSample("MainContentPipeline.render - Transparents non-instanced");
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE)){
Vector3d position = EntityUtils.getPosition(currentEntity);
if(shouldDrawTransparentPass(currentEntity)){
@ -167,6 +173,8 @@ public class MainContentPipeline implements RenderPipeline {
currentActor.draw(renderPipelineState,openGLState);
}
}
Globals.profiler.endCpuSample();
Globals.profiler.beginCpuSample("MainContentPipeline.render - Transparents instanced");
for(Entity currentEntity : Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_INSTANCED)){
Vector3d position = EntityUtils.getPosition(currentEntity);
if(shouldDrawTransparentPass(currentEntity)){
@ -195,6 +203,7 @@ public class MainContentPipeline implements RenderPipeline {
}
//draw all instanced models
Globals.clientInstanceManager.draw(renderPipelineState,openGLState);
Globals.profiler.endCpuSample();
//

View File

@ -1,5 +1,7 @@
package electrosphere.renderer.pipelines;
import java.util.Set;
import org.joml.Matrix4d;
import org.joml.Vector3d;
import org.lwjgl.opengl.GL40;
@ -23,6 +25,10 @@ public class VolumeBufferPipeline implements RenderPipeline {
@Override
public void render(OpenGLState openGLState, RenderPipelineState renderPipelineState) {
Globals.profiler.beginCpuSample("VolumeBufferPipeline.render");
Set<Entity> depthEntities = Globals.clientScene.getEntitiesWithTag(EntityTags.DRAW_VOLUMETIC_DEPTH_PASS);
if(depthEntities != null && depthEntities.size() > 0){
Matrix4d modelTransformMatrix = new Matrix4d();
//set the viewport to shadow map size
@ -150,6 +156,7 @@ public class VolumeBufferPipeline implements RenderPipeline {
openGLState.glBindFramebuffer(GL40.GL_FRAMEBUFFER,0);
//resume culling backface
GL40.glDisable(GL40.GL_CULL_FACE);
}
Globals.profiler.endCpuSample();
}