Skip to content

Commit

Permalink
16 bit normals, fix SMAA macro, include warnings fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
martymcmodding committed Dec 17, 2023
1 parent 83a1130 commit 944cf54
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 591 deletions.
4 changes: 2 additions & 2 deletions Shaders/MartysMods/mmx_deferred.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
namespace Deferred
{
//normals, RG8 octahedral encoded
texture NormalsTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RG8; };
sampler sNormalsTex { Texture = NormalsTex; };
texture NormalsTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RG16; };
sampler sNormalsTex { Texture = NormalsTex; MinFilter = POINT; MipFilter = POINT; MagFilter = POINT;};

//motion vectors, RGBA16F, XY = delta uv, Z = confidence, W = depth because why not
texture MotionVectorsTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RG16F; };
Expand Down
7 changes: 4 additions & 3 deletions Shaders/MartysMods/mmx_math.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ bool inside_screen(float2 uv)
//normalized 3D in, [0, 1] 2D out
float2 octahedral_enc(in float3 v)
{
float2 result = v.xy * rcp(dot(abs(v), 1));
float2 t = (1.0 - abs(result.yx)) * fast_sign(result.xy);
return (v.z < 0 ? t : result) * 0.5 + 0.5;
float2 result = v.xy * rcp(dot(abs(v), 1));
float2 sgn = fast_sign(v.xy);
result = v.z < 0 ? sgn - abs(result.yx) * sgn : result;
return result * 0.5 + 0.5;
}

//[0, 1] 2D in, normalized 3D out
Expand Down
4 changes: 1 addition & 3 deletions Shaders/MartysMods/mmx_noise.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ float3 rand3_from_uint(uint x)
return float3((x >> uint3(0, 10, 20)) & 0x3FF) * exp2(-10.0);
}

float3 rand4_from_uint(uint x)
float4 rand4_from_uint(uint x)
{
return float4((x >> uint4(0, 8, 16, 24)) & 0xFF) * exp2(-8.0);
}



//2x uniform [0, 1] -> 2x gaussian distributed with sigma 1
float2 box_muller(float2 unirand01)
{
Expand Down
Loading

0 comments on commit 944cf54

Please sign in to comment.