voxel fixes
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
d2ccf3c479
commit
c02959efee
@ -931,6 +931,13 @@ Refactoring generator code
|
|||||||
Optimizations
|
Optimizations
|
||||||
Fix transvoxel xnzn edge generation
|
Fix transvoxel xnzn edge generation
|
||||||
|
|
||||||
|
(11/04/2024)
|
||||||
|
Major draw cell optimizations
|
||||||
|
Fix normals calculation in transvoxel rasterizer
|
||||||
|
Fix draw cell LOD joining bug
|
||||||
|
Fix draw cell bounding sphere calculation
|
||||||
|
Hill Gen tweaks
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
|||||||
@ -28,12 +28,12 @@ public class ClientDrawCellManager {
|
|||||||
/**
|
/**
|
||||||
* The distance to draw at full resolution
|
* The distance to draw at full resolution
|
||||||
*/
|
*/
|
||||||
public static final double FULL_RES_DIST = 5 * ServerTerrainChunk.CHUNK_DIMENSION;
|
public static final double FULL_RES_DIST = 12 * ServerTerrainChunk.CHUNK_DIMENSION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The distance for half resolution
|
* The distance for half resolution
|
||||||
*/
|
*/
|
||||||
public static final double HALF_RES_DIST = 15 * ServerTerrainChunk.CHUNK_DIMENSION;
|
public static final double HALF_RES_DIST = 16 * ServerTerrainChunk.CHUNK_DIMENSION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The octree holding all the chunks to evaluate
|
* The octree holding all the chunks to evaluate
|
||||||
@ -355,7 +355,7 @@ public class ClientDrawCellManager {
|
|||||||
!node.isLeaf() &&
|
!node.isLeaf() &&
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
node.getLevel() == this.chunkTree.getMaxLevel() &&
|
node.getLevel() == this.chunkTree.getMaxLevel() - 1 &&
|
||||||
this.getMinDistance(pos, node) > FULL_RES_DIST
|
this.getMinDistance(pos, node) > FULL_RES_DIST
|
||||||
)
|
)
|
||||||
||
|
||
|
||||||
|
|||||||
@ -892,13 +892,15 @@ public class TerrainChunkModelGeneration {
|
|||||||
|
|
||||||
|
|
||||||
//bounding sphere logic
|
//bounding sphere logic
|
||||||
float halfChunk = ServerTerrainChunk.CHUNK_DIMENSION / 2.0f;
|
|
||||||
mesh.updateBoundingSphere(
|
mesh.updateBoundingSphere(
|
||||||
halfChunk,
|
ServerTerrainChunk.CHUNK_DIMENSION,
|
||||||
halfChunk,
|
ServerTerrainChunk.CHUNK_DIMENSION,
|
||||||
halfChunk,
|
ServerTerrainChunk.CHUNK_DIMENSION,
|
||||||
(float)Math.sqrt(halfChunk * halfChunk + halfChunk * halfChunk + halfChunk * halfChunk)
|
(float)Math.sqrt(
|
||||||
);
|
ServerTerrainChunk.CHUNK_DIMENSION * ServerTerrainChunk.CHUNK_DIMENSION +
|
||||||
|
ServerTerrainChunk.CHUNK_DIMENSION * ServerTerrainChunk.CHUNK_DIMENSION +
|
||||||
|
ServerTerrainChunk.CHUNK_DIMENSION * ServerTerrainChunk.CHUNK_DIMENSION
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -375,7 +375,7 @@ public class TransvoxelModelGeneration {
|
|||||||
* @param vertMap The vert map
|
* @param vertMap The vert map
|
||||||
* @param verts The list of verts
|
* @param verts The list of verts
|
||||||
* @param normals The normal map
|
* @param normals The normal map
|
||||||
* @param trianglesSharingVert The indices of triangles sharing verts
|
* @param trianglesSharingVert The indices of triangles sharing verts -- Used for making sure normals are pointing correctly
|
||||||
* @return The number of triangles created
|
* @return The number of triangles created
|
||||||
*/
|
*/
|
||||||
protected static int polygonizeTransition(
|
protected static int polygonizeTransition(
|
||||||
@ -491,7 +491,8 @@ public class TransvoxelModelGeneration {
|
|||||||
|
|
||||||
|
|
||||||
//the class of transition cell
|
//the class of transition cell
|
||||||
short cellClass = (short)(transitionCellClass[caseIndex]);
|
short cellClass = transitionCellClass[caseIndex];
|
||||||
|
int windingOrder = (cellClass >>> 7) & 1;
|
||||||
|
|
||||||
LoggerInterface.loggerRenderer.DEBUG("Cell class: " + cellClass + " " + String.format("0x%02X", cellClass));
|
LoggerInterface.loggerRenderer.DEBUG("Cell class: " + cellClass + " " + String.format("0x%02X", cellClass));
|
||||||
|
|
||||||
@ -700,6 +701,11 @@ public class TransvoxelModelGeneration {
|
|||||||
int index1 = getVertIndex(vert1,vertMap,verts);
|
int index1 = getVertIndex(vert1,vertMap,verts);
|
||||||
int index2 = getVertIndex(vert2,vertMap,verts);
|
int index2 = getVertIndex(vert2,vertMap,verts);
|
||||||
|
|
||||||
|
if(windingOrder == 1){
|
||||||
|
index0 = getVertIndex(vert2,vertMap,verts);
|
||||||
|
index2 = getVertIndex(vert0,vertMap,verts);
|
||||||
|
}
|
||||||
|
|
||||||
//add 0's to normals until it matches vert count
|
//add 0's to normals until it matches vert count
|
||||||
while(trianglesSharingVert.size() < verts.size()){
|
while(trianglesSharingVert.size() < verts.size()){
|
||||||
trianglesSharingVert.add(0);
|
trianglesSharingVert.add(0);
|
||||||
@ -978,6 +984,14 @@ public class TransvoxelModelGeneration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mixes two normals given a proportion value for each
|
||||||
|
* @param normal0 The first vector
|
||||||
|
* @param proportion0 The proportion of the first vector
|
||||||
|
* @param normal1 The second vector
|
||||||
|
* @param proportion1 The proportion of the second vector
|
||||||
|
* @return The mixed vector
|
||||||
|
*/
|
||||||
private static Vector3f averageNormals(Vector3f normal0, float proportion0, Vector3f normal1, float proportion1){
|
private static Vector3f averageNormals(Vector3f normal0, float proportion0, Vector3f normal1, float proportion1){
|
||||||
Vector3f rVal = new Vector3f(normal0);
|
Vector3f rVal = new Vector3f(normal0);
|
||||||
rVal = rVal.mul(proportion0).add(new Vector3f(normal1).mul(proportion1));
|
rVal = rVal.mul(proportion0).add(new Vector3f(normal1).mul(proportion1));
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public class HillsGen implements HeightmapGenerator {
|
|||||||
/**
|
/**
|
||||||
* Scales the input positions
|
* Scales the input positions
|
||||||
*/
|
*/
|
||||||
static final float POSITION_SCALE = 0.005f;
|
static final float POSITION_SCALE = 0.01f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scales the output height
|
* Scales the output height
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user