-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch over to new rendering pipeline that does proper color space, c…
…orrects pre-multiplied alpha, and handles blending properly.
- Loading branch information
1 parent
0536324
commit 91704f3
Showing
13 changed files
with
243 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
uniform float4x4 ViewProj; | ||
uniform texture2d image; | ||
uniform texture2d output_image; | ||
|
||
sampler_state textureSampler{ | ||
Filter = Linear; | ||
AddressU = Clamp; | ||
AddressV = Clamp; | ||
MinLOD = 0; | ||
MaxLOD = 0; | ||
}; | ||
|
||
struct VertData | ||
{ | ||
float4 pos : POSITION; | ||
float2 uv : TEXCOORD0; | ||
}; | ||
|
||
VertData mainTransform(VertData v_in) | ||
{ | ||
v_in.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj); | ||
return v_in; | ||
} | ||
|
||
float srgb_nonlinear_to_linear_channel(float u) | ||
{ | ||
return (u <= 0.04045) ? (u / 12.92) : pow((u + 0.055) / 1.055, 2.4); | ||
} | ||
|
||
float3 srgb_nonlinear_to_linear(float3 v) | ||
{ | ||
return float3(srgb_nonlinear_to_linear_channel(v.r), srgb_nonlinear_to_linear_channel(v.g), srgb_nonlinear_to_linear_channel(v.b)); | ||
} | ||
|
||
float4 mainImage(VertData v_in) : TARGET | ||
{ | ||
float4 px = output_image.Sample(textureSampler, v_in.uv); | ||
px.xyz = srgb_nonlinear_to_linear(px.xyz); | ||
return px; | ||
} | ||
|
||
technique Draw | ||
{ | ||
pass | ||
{ | ||
vertex_shader = mainTransform(v_in); | ||
pixel_shader = mainImage(v_in); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.