mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-12-23 08:20:06 +00:00
Mtl implementation screenspace fvar interp
Fixed smooth face-varying interpolation for the Metal viewer when using screen-space tessellation. The location to evaluate the face-varying value needs to match the computed tess location instead of the intrinsic position_in_patch.
This commit is contained in:
parent
11bcf82632
commit
8912b3f3d3
@ -434,7 +434,7 @@ vertex OutputVertex vertex_main(
|
||||
out.patchColor = patchVertex.patchCoord.xyz;
|
||||
#elif SHADING_TYPE == SHADING_TYPE_FACE_VARYING
|
||||
int patchIndex = OsdGetPatchIndex(patch_id);
|
||||
float2 uv = position_in_patch;
|
||||
float2 uv = patchVertex.tessCoord;
|
||||
#if OSD_FACEVARYING_PATCH_REGULAR
|
||||
float wP[16], wDs[16], wDt[16], wDss[16], wDst[16], wDtt[16];
|
||||
int patchCVs = 16;
|
||||
|
@ -197,6 +197,7 @@ OsdPatchVertex ds_regular_patches(
|
||||
output.vSegments = vSegments;
|
||||
#endif
|
||||
|
||||
output.tessCoord = UV;
|
||||
output.patchCoord = OsdInterpolatePatchCoord(UV, patchParam);
|
||||
output.position = P;
|
||||
return output;
|
||||
|
@ -147,6 +147,7 @@ struct OsdPatchVertex {
|
||||
float3 tangent;
|
||||
float3 bitangent;
|
||||
float4 patchCoord; //u, v, faceLevel, faceId
|
||||
float2 tessCoord; // tesscoord.st
|
||||
#if OSD_COMPUTE_NORMAL_DERIVATIVES
|
||||
float3 Nu;
|
||||
float3 Nv;
|
||||
|
@ -36,7 +36,7 @@ void OsdComputePerVertex(
|
||||
OsdPatchParamBufferSet osdBuffers
|
||||
)
|
||||
{
|
||||
OsdComputePerVertexGregory(vertexId, position.xyz, hullVertex, osdBuffers);
|
||||
OsdComputePerVertexGregory(vertexId, position.xyz, hullVertex, osdBuffers);
|
||||
|
||||
#if OSD_ENABLE_PATCH_CULL
|
||||
float4 clipPos = mul(modelViewProjectionMatrix, position);
|
||||
@ -164,6 +164,7 @@ OsdPatchVertex ds_gregory_patches(
|
||||
output.Nv = dNv;
|
||||
#endif
|
||||
|
||||
output.tessCoord = UV;
|
||||
output.patchCoord = OsdInterpolatePatchCoord(UV, patchParam);
|
||||
|
||||
return output;
|
||||
|
@ -165,6 +165,7 @@ OsdPatchVertex ds_gregory_basis_patches(
|
||||
output.Nv = dNv;
|
||||
#endif
|
||||
|
||||
output.tessCoord = UV;
|
||||
output.patchCoord = OsdInterpolatePatchCoord(UV, patchParam);
|
||||
|
||||
return output;
|
||||
|
Loading…
Reference in New Issue
Block a user