diff --git a/buildNumber.properties b/buildNumber.properties index 58fecef4..2778ee10 100644 --- a/buildNumber.properties +++ b/buildNumber.properties @@ -1,3 +1,3 @@ #maven.buildNumber.plugin properties file -#Sun Mar 10 11:10:27 EDT 2024 -buildNumber=45 +#Tue Mar 12 21:28:50 EDT 2024 +buildNumber=46 diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 35d39f6d..f8793c3b 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -147,7 +147,9 @@ Overhaul mesh class (03/10/2024) De-dupe render calls via doing mutations in render pipeline status and dont call setting variables to values they are already set to - +(03/12/2024) +Foliage Manager upgrades + - Place foliage intelligently @@ -160,11 +162,6 @@ Fix Frustum Culling for skybox Clean up main method/class -Build a lod system - - Could potentially be held at actor level - - Link different models based on LOD level - - LOD trees aggressively - Fluid Dynamics System - Basic transparent voxels for fluid @@ -174,6 +171,31 @@ Fluid Dynamics System - Networked fluid chunk transportation (including force vectors for generating particles on client) - Save fluid chunks +Transvoxel Algorithm + Client Terrain Entity Management (specifically creation/teardown for client) + - Also queries for far out chunks to load far away terrain + Server Terrain Management (specifically for collision) + - Handles communicating far out LOD chunks to client as well + Terrain Interface Positional Access Interface + - Ability to get terrain at point for interactions with game world eg placing grass/water collision + Actually implement transvoxel algo + Marching Cubes Texture Overhaul + - Detect opengl max image size + - Construct texture atlas of max size + - (target 256x256 resolution initially, should give ~1000 types for 8192x8192) + - Prebake all textures into atlas + - Rewrite marching cubes shader to leverage this atlas + +Build a lod system + - Could potentially be held at actor level + - Link different models based on LOD level + - LOD trees aggressively + + +skybox work + - make it prettier + - be able to manage its colors through a clean interface + Ray Traced Audio Engine Documentation Pass on as many files as you can stomache @@ -186,18 +208,11 @@ Generate Tree Entities Fix Character creation preview not working -Marching Cubes Texture Overhaul - - Detect opengl max image size - - Construct texture atlas of max size - - (target 256x256 resolution initially, should give ~1000 types for 8192x8192) - - Prebake all textures into atlas - - Rewrite marching cubes shader to leverage this atlas +Fix grass flickering (it's frustum culling being inconsistent, try commenting it out in InstancedActor and see what happens :| ) - -Terrain Interface Positional Access Interface - - Ability to get terrain at point for interactions with game world eg placing grass/water collision Foliage Manager upgrades - - Place foliage intelligently + - Wind system (environment ubi that defines wind that is lookup'd by individual blades) + Server Micro/Macro transitioning (turning entity into character in macro simulation and vice-versa) Macro level content tracker @@ -222,13 +237,6 @@ Weather tracking Foliage Manager upgrades - Add wind simulation if relevant -Client Terrain Entity Management (specifically creation/teardown for client) - - Also queries for far out chunks to load far away terrain -Server Terrain Management (specifically for collision) - - Handles communicating far out LOD chunks to client as well -Upgrade Terrain Chunk - - Implement Transvoxel Algorithm - Server Content Engine diff --git a/src/main/java/electrosphere/client/foliagemanager/ClientFoliageManager.java b/src/main/java/electrosphere/client/foliagemanager/ClientFoliageManager.java index 7ed5a432..52226c5b 100644 --- a/src/main/java/electrosphere/client/foliagemanager/ClientFoliageManager.java +++ b/src/main/java/electrosphere/client/foliagemanager/ClientFoliageManager.java @@ -55,7 +55,7 @@ public class ClientFoliageManager { //The maximum number of foliage cells static final int CELL_COUNT_MAX = 100; //The target number of foliage to place per cell - static final int TARGET_FOLIAGE_PER_CELL = 50; + static final int TARGET_FOLIAGE_PER_CELL = 200; //Stores a list of all locations that are currently invalid which map to //the amount of frames that must pass before they are considered valid to evaluate Map locationEvaluationCooldownMap = new ConcurrentHashMap(); @@ -117,6 +117,15 @@ public class ClientFoliageManager { public void update(){ if(ready){ //TODO: frustum cull at cell level before individual model level + //to be clear, these blades are frustum culled 1-by-1 currently at the InstancedActor level + //if we frustum cull at cell level with priority updates around then, we can pack foliage into buffer in chunks + //and maintain the size of chunks and location on cpu + //then use opengl calls to buffer only occasionally + //if we're doing that we can also increase the amount and type of data (would be really nice to include position-in-chunk of foliage + //for instance for fancy shaders based on local position (think rainbow grass constantly pulsing)) + //this will inherit all the difficulty of defragmenting the buffer, turning individual chunks on and off on gpu side, etc + //a way to save on sending position buffer to gpu would be to pack voxel pos into a smaller size ie use bitwise operators to store + //local coord in 1 * 4 bytes instead of 3 * 4 for a full vector for(FoliageCell cell : activeCells){ cell.draw(modelMatrixAttribute); } @@ -299,22 +308,27 @@ public class ClientFoliageManager { String foliageTypeName = foliageTypesSupported.get(placementRandomizer.nextInt() % foliageTypesSupported.size()); FoliageType foliageType = Globals.gameConfigCurrent.getFoliageMap().getFoliage(foliageTypeName); //get position to place - double offsetX = placementRandomizer.nextDouble() * 0.6 + 0.2; - double offsetZ = placementRandomizer.nextDouble() * 0.6 + 0.2; - Vector3d absolutePosition = new Vector3d( + double offsetX = placementRandomizer.nextDouble() - 0.5; + double offsetY = 2; + double offsetZ = placementRandomizer.nextDouble() - 0.5; + // double offsetY = placeFoliage(dataToConsider, offsetX, offsetZ, 0.2, 0.5, 0.15, 0.2+0.6); + Vector3d testPosition = new Vector3d( worldPos.x * ChunkData.CHUNK_SIZE + voxelPos.x + offsetX, - worldPos.y * ChunkData.CHUNK_SIZE + voxelPos.y + data.getWeight(voxelPos) * 0.6, + worldPos.y * ChunkData.CHUNK_SIZE + voxelPos.y + offsetY, worldPos.z * ChunkData.CHUNK_SIZE + voxelPos.z + offsetZ ); - //create entity - Entity grassEntity = EntityCreationUtils.createClientSpatialEntity(); - makeEntityInstancedFoliage(grassEntity, foliageType.getModelPath(), grassCapacity); - EntityUtils.getPosition(grassEntity).set(absolutePosition); - EntityUtils.getRotation(grassEntity).set(getNewRotation()); - EntityUtils.getScale(grassEntity).set(new Vector3d(2.0, 2.0, 2.0)); - //add ambient foliage behavior tree - AmbientFoliage.attachAmbientFoliageTree(grassEntity, initialGrowthLevel, foliageType.getGrowthModel().getGrowthRate()); - cell.addEntity(grassEntity); + Vector3d placementPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(testPosition, new Vector3d(0,-1,0), 2.5); + if(placementPos != null){ + //create entity + Entity grassEntity = EntityCreationUtils.createClientSpatialEntity(); + makeEntityInstancedFoliage(grassEntity, foliageType.getModelPath(), grassCapacity); + EntityUtils.getPosition(grassEntity).set(placementPos); + EntityUtils.getRotation(grassEntity).set(getNewRotation()); + EntityUtils.getScale(grassEntity).set(new Vector3d(2.0, 2.0, 2.0)); + //add ambient foliage behavior tree + AmbientFoliage.attachAmbientFoliageTree(grassEntity, initialGrowthLevel, foliageType.getGrowthModel().getGrowthRate()); + cell.addEntity(grassEntity); + } } activeCells.add(cell); locationCellMap.put(getFoliageCellKey(worldPos, voxelPos),cell);