debug pain
This commit is contained in:
@@ -69,7 +69,7 @@ public class RenderService<T extends AbstractSectionRenderer<J, ?>, J extends Vi
|
|||||||
this.sectionUpdateQueue.push(section);
|
this.sectionUpdateQueue.push(section);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.traversal = new HierarchicalOcclusionTraverser(this.nodeManager, 512);
|
this.traversal = new HierarchicalOcclusionTraverser(this.nodeManager, 256);
|
||||||
|
|
||||||
world.setDirtyCallback(router::forward);
|
world.setDirtyCallback(router::forward);
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ public class RenderService<T extends AbstractSectionRenderer<J, ?>, J extends Vi
|
|||||||
//this.nodeManager.insertTopLevelNode(WorldEngine.getWorldSectionId(0, 0,0,0));
|
//this.nodeManager.insertTopLevelNode(WorldEngine.getWorldSectionId(0, 0,0,0));
|
||||||
//this.nodeManager.insertTopLevelNode(WorldEngine.getWorldSectionId(4, 0,0,0));
|
//this.nodeManager.insertTopLevelNode(WorldEngine.getWorldSectionId(4, 0,0,0));
|
||||||
|
|
||||||
|
/*
|
||||||
final int H_WIDTH = 10;
|
final int H_WIDTH = 10;
|
||||||
for (int x = -H_WIDTH; x <= H_WIDTH; x++) {
|
for (int x = -H_WIDTH; x <= H_WIDTH; x++) {
|
||||||
for (int y = -1; y <= 0; y++) {
|
for (int y = -1; y <= 0; y++) {
|
||||||
@@ -87,7 +87,7 @@ public class RenderService<T extends AbstractSectionRenderer<J, ?>, J extends Vi
|
|||||||
this.nodeManager.insertTopLevelNode(WorldEngine.getWorldSectionId(4, x, y, z));
|
this.nodeManager.insertTopLevelNode(WorldEngine.getWorldSectionId(4, x, y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setup(Camera camera) {
|
public void setup(Camera camera) {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class HiZBuffer {
|
|||||||
private void alloc(int width, int height) {
|
private void alloc(int width, int height) {
|
||||||
this.levels = (int)Math.ceil(Math.log(Math.max(width, height))/Math.log(2));
|
this.levels = (int)Math.ceil(Math.log(Math.max(width, height))/Math.log(2));
|
||||||
//We dont care about e.g. 1x1 size texture since you dont get meshlets that big to cover such a large area
|
//We dont care about e.g. 1x1 size texture since you dont get meshlets that big to cover such a large area
|
||||||
this.levels -= 3;//Arbitrary size, shinks the max level by alot and saves a significant amount of processing time
|
this.levels -= 1;//Arbitrary size, shinks the max level by alot and saves a significant amount of processing time
|
||||||
// (could probably increase it to be defined by a max meshlet coverage computation thing)
|
// (could probably increase it to be defined by a max meshlet coverage computation thing)
|
||||||
|
|
||||||
//GL_DEPTH_COMPONENT32F //Cant use this as it does not match the depth format of the provided depth buffer
|
//GL_DEPTH_COMPONENT32F //Cant use this as it does not match the depth format of the provided depth buffer
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ layout(location = 0) in vec2 uv;
|
|||||||
layout(binding = 0) uniform sampler2D depthTex;
|
layout(binding = 0) uniform sampler2D depthTex;
|
||||||
void main() {
|
void main() {
|
||||||
vec4 depths = textureGather(depthTex, uv, 0); // Get depth values from all surrounding texels.
|
vec4 depths = textureGather(depthTex, uv, 0); // Get depth values from all surrounding texels.
|
||||||
|
//depths = mix(vec4(0), depths, lessThanEqual(vec4(0.99999999), depths));
|
||||||
gl_FragDepth = max(max(depths.x, depths.y), max(depths.z, depths.w)); // Write conservative depth.
|
gl_FragDepth = max(max(depths.x, depths.y), max(depths.z, depths.w)); // Write conservative depth.
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ void setupScreenspace(in UnpackedNode node) {
|
|||||||
maxBB = maxBB*0.5f+0.5f;
|
maxBB = maxBB*0.5f+0.5f;
|
||||||
minBB = minBB*0.5f+0.5f;
|
minBB = minBB*0.5f+0.5f;
|
||||||
|
|
||||||
size = (maxBB.xy - minBB.xy);//We half it for implicit conversion to screenspace
|
size = clamp(maxBB.xy - minBB.xy, vec2(0), vec2(1));//We half it for implicit conversion to screenspace
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,8 +85,12 @@ bool isCulledByHiz() {
|
|||||||
vec2 ssize = size.xy * vec2(screenW, screenH);
|
vec2 ssize = size.xy * vec2(screenW, screenH);
|
||||||
float miplevel = ceil(log2(max(max(ssize.x, ssize.y),1)));
|
float miplevel = ceil(log2(max(max(ssize.x, ssize.y),1)));
|
||||||
vec2 midpoint = (maxBB.xy + minBB.xy)*0.5f;
|
vec2 midpoint = (maxBB.xy + minBB.xy)*0.5f;
|
||||||
// printf("HiZ sample point culled: (%f,%f)@%f against %f", midpoint.x, midpoint.y, miplevel, minBB.z);
|
bool culled = textureLod(hizDepthSampler, vec3(midpoint, minBB.z), miplevel) < 0.0001f;
|
||||||
return textureLod(hizDepthSampler, vec3(midpoint, minBB.z), miplevel) < 0.0001f;
|
/*
|
||||||
|
if (culled) {
|
||||||
|
printf("HiZ sample point not culled: (%f,%f)@%f against %f, level %d", midpoint.x, midpoint.y, miplevel, minBB.z, lod);
|
||||||
|
}*/
|
||||||
|
return culled;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns if we should decend into its children or not
|
//Returns if we should decend into its children or not
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ void traverse(in UnpackedNode node) {
|
|||||||
//printf("A");
|
//printf("A");
|
||||||
enqueueChildren(node);
|
enqueueChildren(node);
|
||||||
} else {
|
} else {
|
||||||
printf("B");
|
//printf("B");
|
||||||
addRequest(node);
|
addRequest(node);
|
||||||
//TODO: use self mesh (is error state if it doesnt have one since all leaf nodes should have a mesh)
|
//TODO: use self mesh (is error state if it doesnt have one since all leaf nodes should have a mesh)
|
||||||
// Basicly guarenteed to have a mesh, if it doesnt it is very very bad and incorect since its a violation of the graph properties
|
// Basicly guarenteed to have a mesh, if it doesnt it is very very bad and incorect since its a violation of the graph properties
|
||||||
@@ -81,10 +81,10 @@ void traverse(in UnpackedNode node) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hasMesh(node)) {
|
if (hasMesh(node)) {
|
||||||
printf("C");
|
//printf("C");
|
||||||
enqueueSelfForRender(node);
|
enqueueSelfForRender(node);
|
||||||
} else {
|
} else {
|
||||||
printf("D");
|
//printf("D");
|
||||||
//!! not ideal, we want to render this mesh but dont have it. If we havent sent a request
|
//!! not ideal, we want to render this mesh but dont have it. If we havent sent a request
|
||||||
// then send a request for a mesh for this node.
|
// then send a request for a mesh for this node.
|
||||||
addRequest(node);
|
addRequest(node);
|
||||||
|
|||||||
Reference in New Issue
Block a user