Trying to fix mesh culling

This commit is contained in:
Dynamitos
2024-05-04 13:25:19 +02:00
parent f0fd9a7ae7
commit 87b72dcd84
8 changed files with 53 additions and 51 deletions
+2 -2
View File
@@ -26,7 +26,7 @@ void taskMain(
{
head = 0;
float3 origin = float3(0, 0, 0);
const float offset = 0.0f;
const float offset = 600.0f;
float3 corners[4] = {
screenToModel(instance.inverseTransformMatrix, float4(offset, offset, -1.0f, 1.0f)).xyz,
screenToModel(instance.inverseTransformMatrix, float4(pViewParams.screenDimensions.x - offset, offset, -1.0f, 1.0f)).xyz,
@@ -46,7 +46,7 @@ void taskMain(
{
uint m = mesh.meshletOffset + i;
MeshletDescription meshlet = pScene.meshletInfos[m];
//if(meshlet.bounding.insideFrustum(viewFrustum))
if(meshlet.bounding.insideFrustum(viewFrustum))
{
uint index;
InterlockedAdd(head, 1, index);
+2 -2
View File
@@ -54,7 +54,7 @@ struct BlinnPhong : IBRDF
float3 h = normalize(lightDir_TS + viewDir_TS);
float specular = saturate(dot(normal_TS, h));
return baseColor;//((baseColor * diffuse) + (specularColor * specular)) * lightColor;
return (baseColor * diffuse * lightColor) + (specularColor * specular) * lightColor;
}
float3 evaluateAmbient()
@@ -169,7 +169,7 @@ struct CookTorrance : IBRDF
float nDotL = max(dot(n, lightDir_TS), 0.0);
float3 result = (k_d * baseColor / PI + specular) * nDotL * lightColor;
return baseColor;//result * ambientOcclusion;
return result * ambientOcclusion;
}
float3 evaluateAmbient()
{
+2 -2
View File
@@ -2,7 +2,7 @@ import Bounding;
struct MeshletDescription
{
AABB bounding;
BoundingSphere bounding;
uint32_t vertexCount;
uint32_t primitiveCount;
uint32_t vertexOffset;
@@ -13,7 +13,7 @@ struct MeshletDescription
struct MeshData
{
AABB bounding;
BoundingSphere bounding;
uint32_t numMeshlets;
uint32_t meshletOffset;
uint32_t firstIndex;