More stuff
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-03-20 22:00:40 -04:00
parent 512998eb24
commit 58d1d86262
10 changed files with 43 additions and 56 deletions

View File

@ -1,7 +1,13 @@
@page fluidsimarchoverview Fluid Simulation Architecture Overview
# Summary of Parts
The fluid sim begins with a function to create a running threadpool for calculations.
Once the current server frame gets to the point that it should start calculating the fluid frame (we want to put this at the beginning of the server frame if possible), it calls a function that propagates all current fluid chunks to the threadpool.
The threadpool then distributes the chunks amongst the threads and performs simulation for a frame.
This simulation periodically has to synchronize data between the chunks.
The fluid system is structured very similar to the terrain manager.
Make sure to explain:
setting iso levels based on neighbor levels
Client side interpreting 0 as -1 when receiving chunk from network (for rendering purposes)
Overwriting same cache value on client side
client side chunk destroying old model incl from asset manager on update
Generic fluid simulator and specifically cellular automata ver
How to add a fluid generator/destructor via the fluid simulator
Rules of the cellular automata currently

View File

@ -161,35 +161,29 @@ Optimize instance logic (currently sorting the list of objects to push to buffer
For dynamic wind later will need to use UBOs or something like that.
Fix grass flickering (it's frustum culling being inconsistent, try commenting it out in InstancedActor and see what happens :| ) (well we won't have that problem anymore lol)
(03/20/2024)
Free camera system that can detatch from player entity
(03/20/2024)
Half pass at cellular automata fluid dynamics system
- Diffuse density
- Streaming chunks over network
- Basic model creation
# TODO
Cellular Automata Fluid Dynamics System
- Advect force
- Advect density
- Diffuse density
- Do not bound to single chunks
Fluid Chunk System
- Basic model creation
- Streaming chunks over network
- Only add compression when it starts to become an issue
Fix character movement
- Walking left or right while turning camera is very jittery
- Can lock on moving
Fix Frustum Culling for skybox
Free camera system that can detatch from player entity
Fix Character creation preview not working
Clean up main method/class
Bring LWJGL version up to latest
Include Remotery library
Physics-controlled objects system
@ -238,6 +232,14 @@ Light Manager
- Point shadows ???
Cellular Automata Fluid Dynamics System
- Advect force
- Advect density
- Diffuse density
- Do not bound to single chunks
- Only add compression when it starts to become an issue
skybox work
- make it prettier
- be able to manage its colors through a clean interface
@ -291,6 +293,8 @@ Upgrade terrain editing user experience further
- Lock to axis tools
- Server validation for client request to change terrain
Bring LWJGL version up to latest

View File

@ -9,6 +9,7 @@ import electrosphere.collision.CollisionEngine;
import electrosphere.engine.Globals;
import electrosphere.entity.ClientEntityUtils;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.types.fluid.FluidChunk;
import electrosphere.renderer.shader.ShaderProgram;
@ -33,22 +34,9 @@ public class FluidCell {
float[][][] weights = new float[ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE][ServerTerrainChunk.CHUNK_DATA_GENERATOR_SIZE];
static Texture groundTextureOne = new Texture("/Textures/Ground/Dirt1.png");
static Texture groundTextureTwo = new Texture("/Textures/Ground/Dirt1.png");
static Texture groundTextureThree = new Texture("/Textures/Ground/Dirt1.png");
static Texture groundTextureFour = new Texture("/Textures/Ground/Dirt1.png");
//the value of an empty fluid cell weight that is not neighbored by a fluid value
public static final float ISO_SURFACE_EMPTY = -1;
static {
// groundTextureOne = new Texture("/Textures/Ground/GrassTileable.png");
// groundTextureTwo = new Texture("/Textures/Ground/Dirt1.png");
// groundTextureThree = new Texture("/Textures/Ground/Dirt1.png");
// groundTextureFour = new Texture("/Textures/Ground/Dirt1.png");
}
FluidCell(){
}
@ -99,6 +87,9 @@ public class FluidCell {
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
collisionEngine.destroyEntityThatHasPhysics(modelEntity);
EntityUtils.cleanUpEntity(modelEntity);
//destruct model
String modelPath = (String)modelEntity.getData(EntityDataStrings.DATA_STRING_MODEL_PATH);
Globals.assetManager.deregisterModelPath(modelPath);
}
/**

View File

@ -376,7 +376,10 @@ public class Main {
///
/// G A R B A G E C H E C K
///
System.gc();

View File

@ -176,6 +176,10 @@ public class AssetManager {
public void registerModelToSpecificString(Model m, String s){
modelsLoadedIntoMemory.put(s,m);
}
public void deregisterModelPath(String path){
modelsLoadedIntoMemory.remove(path);
}
public void queueOverrideMeshShader(String modelName, String meshName, String vertPath, String fragPath){
MeshShaderOverride override = new MeshShaderOverride(modelName,meshName,vertPath,fragPath);

View File

@ -31,6 +31,7 @@ public class FluidChunk {
rVal.putData(EntityDataStrings.FLUID_IS_FLUID, true);
rVal.putData(EntityDataStrings.DRAW_TRANSPARENT_PASS, true);
rVal.removeData(EntityDataStrings.DRAW_SOLID_PASS);
rVal.putData(EntityDataStrings.DATA_STRING_MODEL_PATH, modelPath);
return rVal;
}

View File

@ -607,7 +607,7 @@ public class TerrainChunkModelGeneration {
terrainGrid[x+0][y+1][z+0], terrainGrid[x+0][y+1][z+1], terrainGrid[x+1][y+1][z+1], terrainGrid[x+1][y+1][z+0]
);
//polygonize the current gridcell
polygonize(currentCell, 0, triangles, vertMap, verts, normals, trianglesSharingVert);
polygonize(currentCell, 0.01f, triangles, vertMap, verts, normals, trianglesSharingVert);
}
}
}

View File

@ -21,10 +21,6 @@ public class ArenaFluidGenerator implements FluidGenerator {
}
}
}
if(worldX == 0 && worldY == 0 && worldZ == 0){
weights[7][5][7] = 1f;
}
return chunk;
}

View File

@ -22,12 +22,6 @@ public class FluidCellularAutomataSimulator implements ServerFluidSimulator {
//if true, alerts the server data cell to broadcast a new update message to all clients within it
boolean update = false;
if(worldX == 0 && worldY == 0 && worldZ == 0){
if(weights[8][3][8] < MAX_WEIGHT){
weights[8][3][8] = MAX_WEIGHT;
}
}
for(int x = 0; x < ServerTerrainChunk.CHUNK_DIMENSION; x++){
for(int y = 0; y < ServerTerrainChunk.CHUNK_DIMENSION; y++){
for(int z = 0; z < ServerTerrainChunk.CHUNK_DIMENSION; z++){

View File

@ -31,18 +31,6 @@ public class ArenaChunkGenerator implements ChunkGenerator {
}
}
}
if(worldX == 0 && worldY == 0 && worldZ == 0){
for(int x = 5; x < 11; x++){
for(int z = 5; z < 11; z++){
if((x == 10 || x == 5 || z == 10 || z == 5)){
weights[x][0][z] = 1.0f;
weights[x][1][z] = 1.0f;
values[x][0][z] = 1;
values[x][1][z] = 1;
}
}
}
}
ServerTerrainChunk rVal = new ServerTerrainChunk(worldX, worldY, worldZ, weights, values);
return rVal;
}