Render temporal scene with motion, resolve and sharp UI
Native and manual checks / native (ubuntu-24.04) (push) Failing after 37s
Native and manual checks / manual (push) Successful in 28s
Windows editor and software Vulkan / windows-graphics (push) Canceled after 0s
Native and manual checks / native (windows-2025) (push) Canceled after 0s
Native and manual checks / native (ubuntu-24.04) (push) Failing after 37s
Native and manual checks / manual (push) Successful in 28s
Windows editor and software Vulkan / windows-graphics (push) Canceled after 0s
Native and manual checks / native (windows-2025) (push) Canceled after 0s
This commit is contained in:
+55
-2
@@ -122,8 +122,7 @@ float3 directBRDF(float3 base, float rough, float metal, float3 n, float3 view,
|
||||
float3 spec=d*g*fresnel/max(4.0*nv*nl,0.001);
|
||||
return ((1.0-fresnel)*(1.0-metal)*base/pi+spec)*nl;
|
||||
}
|
||||
[shader("fragment")]
|
||||
float4 fragmentMain(VertexOutput v) : SV_Target {
|
||||
float4 shadeScene(VertexOutput v) {
|
||||
float4 sampled = colorMap.Sample(colorSampler, v.uv);
|
||||
if (dot(v.normal,v.normal) < 1e-12) {
|
||||
// UI/sprite tint is in display space; sRGB textures were decoded by Vulkan.
|
||||
@@ -202,3 +201,57 @@ float4 fragmentMain(VertexOutput v) : SV_Target {
|
||||
linear=linear/(1.0+linear);
|
||||
return float4(pow(max(linear,0),float3(1.0/2.2)),base.a);
|
||||
}
|
||||
[shader("fragment")]
|
||||
float4 fragmentMain(VertexOutput v) : SV_Target { return shadeScene(v); }
|
||||
|
||||
struct TemporalVertexInput {
|
||||
float4 clip : POSITION;
|
||||
float3 world : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
float4 color : COLOR0;
|
||||
float2 material : TEXCOORD1;
|
||||
float2 uv : TEXCOORD2;
|
||||
float4 previousClip : TEXCOORD3;
|
||||
float motionValid : TEXCOORD4;
|
||||
};
|
||||
struct TemporalVertexOutput {
|
||||
float4 position : SV_Position;
|
||||
float3 world : TEXCOORD0;
|
||||
float3 normal : NORMAL;
|
||||
float4 color : COLOR0;
|
||||
float2 material : TEXCOORD1;
|
||||
float2 uv : TEXCOORD2;
|
||||
float4 previousClip : TEXCOORD3;
|
||||
float4 currentClip : TEXCOORD4;
|
||||
float motionValid : TEXCOORD5;
|
||||
};
|
||||
[shader("vertex")]
|
||||
TemporalVertexOutput temporalVertexMain(TemporalVertexInput v) {
|
||||
TemporalVertexOutput o;
|
||||
o.position=v.clip; o.world=v.world; o.normal=v.normal; o.color=v.color;
|
||||
o.material=v.material; o.uv=v.uv; o.previousClip=v.previousClip;
|
||||
o.currentClip=v.clip; o.motionValid=v.motionValid;
|
||||
return o;
|
||||
}
|
||||
struct TemporalFragmentOutput {
|
||||
float4 color : SV_Target0;
|
||||
float4 velocity : SV_Target1;
|
||||
};
|
||||
[shader("fragment")]
|
||||
TemporalFragmentOutput temporalFragmentMain(TemporalVertexOutput v) {
|
||||
VertexOutput shading;
|
||||
shading.position=v.position; shading.world=v.world; shading.normal=v.normal;
|
||||
shading.color=v.color; shading.material=v.material; shading.uv=v.uv;
|
||||
TemporalFragmentOutput result;
|
||||
result.color=shadeScene(shading);
|
||||
result.velocity=float4(0);
|
||||
if (v.motionValid > .5 && result.color.a >= .999 &&
|
||||
all(isfinite(v.currentClip)) && all(isfinite(v.previousClip)) &&
|
||||
v.currentClip.w > 0 && v.previousClip.w > 0) {
|
||||
result.velocity.xy=(v.currentClip.xy / v.currentClip.w -
|
||||
v.previousClip.xy / v.previousClip.w) * .5;
|
||||
result.velocity.z=v.previousClip.z / v.previousClip.w;
|
||||
result.velocity.w=1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user