fixed issue with low precision normals interpolation

This commit is contained in:
Turánszki János
2024-01-28 16:41:39 +01:00
parent fcca0dfe37
commit 85cb648142
9 changed files with 22 additions and 22 deletions
+4 -4
View File
@@ -9,10 +9,10 @@ struct GSInput
float4 uvsets : UVSETS;
min16float4 color : COLOR;
min16float4 tan : TANGENT;
min16float3 nor : NORMAL;
min16float ao : AMBIENT_OCCLUSION;
float3 nor : NORMAL;
min16float2 atl : ATLAS;
float3 pos3D : WORLDPOSITION;
min16float ao : AMBIENT_OCCLUSION;
uint RTIndex : RTINDEX;
};
@@ -23,10 +23,10 @@ struct GSOutput
float4 uvsets : UVSETS;
min16float4 color : COLOR;
min16float4 tan : TANGENT;
min16float3 nor : NORMAL;
min16float ao : AMBIENT_OCCLUSION;
float3 nor : NORMAL;
min16float2 atl : ATLAS;
float3 pos3D : WORLDPOSITION;
min16float ao : AMBIENT_OCCLUSION;
uint RTIndex : SV_RenderTargetArrayIndex;
};
@@ -5,14 +5,14 @@
struct GSInput
{
float4 pos : SV_POSITION;
min16float3 nor : NORMAL;
float3 nor : NORMAL;
uint RTIndex : RTINDEX;
};
struct GSOutput
{
float4 pos : SV_POSITION;
min16float3 nor : NORMAL;
float3 nor : NORMAL;
uint RTIndex : SV_RenderTargetArrayIndex;
};
+1 -1
View File
@@ -9,7 +9,7 @@ PixelInput main(uint vid : SV_VERTEXID, uint instanceID : SV_INSTANCEID)
output.RTIndex = instanceID;
output.pos = mul(GetCamera(output.RTIndex).view_projection, float4(ICOSPHERE[vid].xyz,0));
output.nor = min16float3(ICOSPHERE[vid].xyz);
output.nor = ICOSPHERE[vid].xyz;
return output;
}
+2 -2
View File
@@ -6,7 +6,7 @@ struct GSInput
float4 pos : SV_POSITION;
float4 uvsets : UVSETS;
min16float4 color : COLOR;
min16float3 nor : NORMAL;
float3 nor : NORMAL;
};
// Note: centroid interpolation is used to avoid floating voxels in some cases
@@ -15,7 +15,7 @@ struct GSOutput
float4 pos : SV_POSITION;
centroid float4 uvsets : UVSETS;
centroid min16float4 color : COLOR;
centroid min16float3 N : NORMAL;
centroid float3 N : NORMAL;
centroid float3 P : POSITION3D;
#ifdef VOXELIZATION_CONSERVATIVE_RASTERIZATION_ENABLED
+9 -9
View File
@@ -162,12 +162,12 @@ struct VertexInput
return (min16float4)bindless_buffers_float4[GetMesh().vb_col][vertexID];
}
min16float3 GetNormal()
float3 GetNormal()
{
[branch]
if (GetMesh().vb_nor < 0)
return 0;
return (min16float3)bindless_buffers_float4[GetMesh().vb_nor][vertexID].xyz;
return bindless_buffers_float4[GetMesh().vb_nor][vertexID].xyz;
}
min16float4 GetTangent()
@@ -204,7 +204,7 @@ struct VertexSurface
float4 uvsets;
min16float2 atlas;
min16float4 color;
min16float3 normal;
float3 normal;
min16float4 tangent;
min16float ao;
@@ -232,7 +232,7 @@ struct VertexSurface
ao = 1;
}
normal = mul((min16float3x3)input.GetInstance().transformInverseTranspose.GetMatrix(), normal);
normal = mul((float3x3)input.GetInstance().transformInverseTranspose.GetMatrix(), normal);
tangent = input.GetTangent();
tangent.xyz = mul((min16float3x3)input.GetInstance().transformInverseTranspose.GetMatrix(), tangent.xyz);
@@ -282,13 +282,9 @@ struct PixelInput
#endif // OBJECTSHADER_USE_TANGENT
#ifdef OBJECTSHADER_USE_NORMAL
min16float3 nor : NORMAL;
float3 nor : NORMAL;
#endif // OBJECTSHADER_USE_NORMAL
#ifdef OBJECTSHADER_USE_AO
min16float ao : AMBIENT_OCCLUSION;
#endif // OBJECTSHADER_USE_AO
#ifdef OBJECTSHADER_USE_ATLAS
min16float2 atl : ATLAS;
#endif // OBJECTSHADER_USE_ATLAS
@@ -297,6 +293,10 @@ struct PixelInput
float3 pos3D : WORLDPOSITION;
#endif // OBJECTSHADER_USE_POSITION3D
#ifdef OBJECTSHADER_USE_AO
min16float ao : AMBIENT_OCCLUSION;
#endif // OBJECTSHADER_USE_AO
#ifdef OBJECTSHADER_USE_RENDERTARGETARRAYINDEX
#ifdef VPRT_EMULATION
uint RTIndex : RTINDEX;
@@ -131,7 +131,7 @@ PixelInput main(ConstantOutput input, float3 uvw : SV_DomainLocation, const Outp
#endif // OBJECTSHADER_USE_ATLAS
#ifdef OBJECTSHADER_USE_NORMAL
output.nor = min16float3(normalize(w * patch[0].nor + u * patch[1].nor + v * patch[2].nor));
output.nor = normalize(w * patch[0].nor + u * patch[1].nor + v * patch[2].nor);
#endif // OBJECTSHADER_USE_NORMAL
#ifdef OBJECTSHADER_USE_AO
+1 -1
View File
@@ -45,7 +45,7 @@ struct PSInput
float4 pos : SV_POSITION;
centroid float4 uvsets : UVSETS;
centroid min16float4 color : COLOR;
centroid min16float3 N : NORMAL;
centroid float3 N : NORMAL;
centroid float3 P : POSITION3D;
#ifdef VOXELIZATION_CONSERVATIVE_RASTERIZATION_ENABLED
+1 -1
View File
@@ -7,7 +7,7 @@ struct VSOut
float4 pos : SV_POSITION;
float4 uvsets : UVSETS;
min16float4 color : COLOR;
min16float3 N : NORMAL;
float3 N : NORMAL;
#ifndef VOXELIZATION_GEOMETRY_SHADER_ENABLED
float3 P : POSITION3D;
#endif // VOXELIZATION_GEOMETRY_SHADER_ENABLED
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wi::version
// minor features, major updates, breaking compatibility changes
const int minor = 71;
// minor bug fixes, alterations, refactors, updates
const int revision = 363;
const int revision = 364;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);