docs(editor): sync script assembly builder api docs
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
Shader "Builtin Gaussian Splat Composite"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
Name "GaussianComposite"
|
||||
Tags { "LightMode" = "GaussianComposite" }
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
ZTest Always
|
||||
Blend One OneMinusSrcAlpha
|
||||
HLSLPROGRAM
|
||||
#pragma target 4.5
|
||||
#pragma vertex MainVS
|
||||
#pragma fragment MainPS
|
||||
|
||||
Texture2D GaussianSplatAccumulationTexture;
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
};
|
||||
|
||||
VSOutput MainVS(uint vertexId : SV_VertexID)
|
||||
{
|
||||
const float2 positions[3] = {
|
||||
float2(-1.0f, -1.0f),
|
||||
float2(-1.0f, 3.0f),
|
||||
float2( 3.0f, -1.0f)
|
||||
};
|
||||
|
||||
VSOutput output;
|
||||
output.position = float4(positions[vertexId], 1.0f, 1.0f);
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 MainPS(VSOutput input) : SV_TARGET
|
||||
{
|
||||
const int2 pixelCoord = int2(input.position.xy);
|
||||
return GaussianSplatAccumulationTexture.Load(int3(pixelCoord, 0));
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,21 +229,21 @@ Shader "Builtin Gaussian Splat Utilities"
|
||||
}
|
||||
|
||||
float3 CalcCovariance2D(
|
||||
float3 localPosition,
|
||||
float3 viewPosition,
|
||||
float3 covariance3D0,
|
||||
float3 covariance3D1,
|
||||
float4x4 modelViewMatrix,
|
||||
float4x4 viewMatrix,
|
||||
float4x4 projectionMatrix,
|
||||
float2 screenSize)
|
||||
{
|
||||
const float3 viewPosition = mul(modelViewMatrix, float4(localPosition, 1.0)).xyz;
|
||||
if (abs(viewPosition.z) <= 1.0e-5)
|
||||
{
|
||||
return float3(0.3, 0.0, 0.3);
|
||||
}
|
||||
|
||||
const float aspect = projectionMatrix[0][0] / projectionMatrix[1][1];
|
||||
const float tanFovX = rcp(projectionMatrix[0][0]);
|
||||
const float tanFovY = rcp(projectionMatrix[1][1]);
|
||||
const float tanFovY = rcp(projectionMatrix[1][1] * aspect);
|
||||
const float limitX = 1.3 * tanFovX;
|
||||
const float limitY = 1.3 * tanFovY;
|
||||
|
||||
@@ -264,7 +264,7 @@ Shader "Builtin Gaussian Splat Utilities"
|
||||
0.0,
|
||||
0.0,
|
||||
0.0);
|
||||
const float3x3 worldToView = (float3x3)modelViewMatrix;
|
||||
const float3x3 worldToView = (float3x3)viewMatrix;
|
||||
const float3x3 transform = mul(jacobian, worldToView);
|
||||
const float3x3 covariance3D = float3x3(
|
||||
covariance3D0.x, covariance3D0.y, covariance3D0.z,
|
||||
@@ -284,7 +284,7 @@ Shader "Builtin Gaussian Splat Utilities"
|
||||
const float offDiagonal = covariance2D.y;
|
||||
const float mid = 0.5 * (diagonal0 + diagonal1);
|
||||
const float radius = length(float2((diagonal0 - diagonal1) * 0.5, offDiagonal));
|
||||
const float lambda0 = mid + radius;
|
||||
const float lambda0 = max(mid + radius, 0.1);
|
||||
const float lambda1 = max(mid - radius, 0.1);
|
||||
|
||||
float2 basis = normalize(float2(offDiagonal, lambda0 - diagonal0));
|
||||
@@ -425,22 +425,22 @@ Shader "Builtin Gaussian Splat Utilities"
|
||||
GaussianSplatSortDistances[index] = FloatToSortableUint(viewCenter.z);
|
||||
|
||||
const float4 clipCenter = mul(gProjectionMatrix, float4(viewCenter, 1.0));
|
||||
const float nearClip = max(gCameraWorldPos.w, 1.0e-4);
|
||||
if (clipCenter.w > 0.0 && viewCenter.z > nearClip)
|
||||
if (clipCenter.w > 0.0)
|
||||
{
|
||||
const float4x4 modelViewMatrix = mul(gViewMatrix, gModelMatrix);
|
||||
const float3x3 modelLinear = (float3x3)gModelMatrix;
|
||||
const float3x3 rotationScaleMatrix =
|
||||
CalcMatrixFromRotationScale(otherData.rotation, otherData.scaleReserved.xyz);
|
||||
const float3x3 worldRotationScale = mul(modelLinear, rotationScaleMatrix);
|
||||
|
||||
float3 covariance3D0 = 0.0;
|
||||
float3 covariance3D1 = 0.0;
|
||||
CalcCovariance3D(rotationScaleMatrix, covariance3D0, covariance3D1);
|
||||
CalcCovariance3D(worldRotationScale, covariance3D0, covariance3D1);
|
||||
|
||||
const float3 covariance2D = CalcCovariance2D(
|
||||
localCenter,
|
||||
viewCenter,
|
||||
covariance3D0,
|
||||
covariance3D1,
|
||||
modelViewMatrix,
|
||||
gViewMatrix,
|
||||
gProjectionMatrix,
|
||||
gScreenParams.xy);
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ Shader "Builtin Gaussian Splat"
|
||||
{
|
||||
_PointScale ("Point Scale", Float) = 1.0
|
||||
_OpacityScale ("Opacity Scale", Float) = 1.0
|
||||
_DebugViewMode ("Debug View Mode", Float) = 0.0
|
||||
}
|
||||
HLSLINCLUDE
|
||||
cbuffer PerObjectConstants
|
||||
@@ -24,7 +23,6 @@ Shader "Builtin Gaussian Splat"
|
||||
{
|
||||
float4 gPointScaleParams;
|
||||
float4 gOpacityScaleParams;
|
||||
float4 gDebugViewModeParams;
|
||||
};
|
||||
|
||||
struct GaussianSplatViewData
|
||||
@@ -93,14 +91,8 @@ Shader "Builtin Gaussian Splat"
|
||||
discard;
|
||||
}
|
||||
|
||||
if (gDebugViewModeParams.x >= 0.5)
|
||||
{
|
||||
return float4(alpha, alpha, alpha, alpha);
|
||||
}
|
||||
|
||||
return float4(input.colorOpacity.rgb * alpha, alpha);
|
||||
return float4(input.colorOpacity.rgb, alpha);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
|
||||
SubShader
|
||||
@@ -113,13 +105,12 @@ Shader "Builtin Gaussian Splat"
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
ZTest LEqual
|
||||
Blend OneMinusDstAlpha One
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
HLSLPROGRAM
|
||||
#pragma target 4.5
|
||||
#pragma vertex MainVS
|
||||
#pragma fragment MainPS
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user