shader minprecision fixes
This commit is contained in:
@@ -10,11 +10,13 @@ struct ImpostorOutput
|
||||
|
||||
ImpostorOutput main(PixelInput input)
|
||||
{
|
||||
float4 uvsets = input.GetUVSets();
|
||||
|
||||
float4 color;
|
||||
[branch]
|
||||
if (GetMaterial().textures[BASECOLORMAP].IsValid())
|
||||
{
|
||||
color = GetMaterial().textures[BASECOLORMAP].Sample(sampler_linear_wrap, input.uvsets);
|
||||
color = GetMaterial().textures[BASECOLORMAP].Sample(sampler_linear_wrap, uvsets);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -26,7 +28,7 @@ ImpostorOutput main(PixelInput input)
|
||||
float3 N = normalize(input.nor);
|
||||
float3 P = input.pos3D;
|
||||
|
||||
float3x3 TBN = compute_tangent_frame(N, P, input.uvsets.xy);
|
||||
float3x3 TBN = compute_tangent_frame(N, P, uvsets.xy);
|
||||
|
||||
[branch]
|
||||
if (GetMaterial().textures[NORMALMAP].IsValid())
|
||||
@@ -34,7 +36,7 @@ ImpostorOutput main(PixelInput input)
|
||||
[branch]
|
||||
if (GetMaterial().normalMapStrength > 0 && GetMaterial().textures[NORMALMAP].IsValid())
|
||||
{
|
||||
float3 normalMap = float3(GetMaterial().textures[NORMALMAP].Sample(sampler_objectshader, input.uvsets).rg, 1);
|
||||
float3 normalMap = float3(GetMaterial().textures[NORMALMAP].Sample(sampler_objectshader, uvsets).rg, 1);
|
||||
float3 bumpColor = normalMap.rgb * 2 - 1;
|
||||
N = normalize(lerp(N, mul(bumpColor, TBN), GetMaterial().normalMapStrength));
|
||||
}
|
||||
@@ -44,7 +46,7 @@ ImpostorOutput main(PixelInput input)
|
||||
[branch]
|
||||
if (GetMaterial().textures[SURFACEMAP].IsValid())
|
||||
{
|
||||
surfaceMap = GetMaterial().textures[SURFACEMAP].Sample(sampler_linear_wrap, input.uvsets);
|
||||
surfaceMap = GetMaterial().textures[SURFACEMAP].Sample(sampler_linear_wrap, uvsets);
|
||||
}
|
||||
|
||||
float4 surface;
|
||||
|
||||
@@ -19,11 +19,11 @@ ShaderMaterial EmitterGetMaterial()
|
||||
struct VertextoPixel
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float4 tex : TEXCOORD0;
|
||||
min16float4 tex : TEXCOORD0;
|
||||
float3 P : WORLDPOSITION;
|
||||
float2 unrotated_uv : UNROTATED_UV;
|
||||
nointerpolation float frameBlend : FRAMEBLEND;
|
||||
nointerpolation float size : PARTICLESIZE;
|
||||
min16float2 unrotated_uv : UNROTATED_UV;
|
||||
nointerpolation min16float frameBlend : FRAMEBLEND;
|
||||
nointerpolation min16float size : PARTICLESIZE;
|
||||
nointerpolation uint color : PARTICLECOLOR;
|
||||
};
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ VertextoPixel main(uint vid : SV_VertexID, uint instanceID : SV_InstanceID)
|
||||
VertextoPixel Out;
|
||||
Out.P = position;
|
||||
Out.pos = mul(GetCamera().view_projection, float4(position, 1));
|
||||
Out.tex = uvsets;
|
||||
Out.size = size;
|
||||
Out.tex = min16float4(uvsets);
|
||||
Out.size = min16float(size);
|
||||
Out.color = pack_rgba(color);
|
||||
Out.unrotated_uv = BILLBOARD[vertexID % 4].xy * float2(1, -1) * 0.5f + 0.5f;
|
||||
Out.frameBlend = frameBlend;
|
||||
Out.unrotated_uv = min16float2(BILLBOARD[vertexID % 4].xy * float2(1, -1) * 0.5f + 0.5f);
|
||||
Out.frameBlend = min16float(frameBlend);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@ ShaderMaterial HairGetMaterial()
|
||||
struct VertexToPixel
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 tex : TEXCOORD;
|
||||
min16float2 tex : TEXCOORD;
|
||||
nointerpolation float fade : DITHERFADE;
|
||||
uint primitiveID : PRIMITIVEID;
|
||||
float3 pos3D : POSITION3D;
|
||||
float3 nor : NORMAL;
|
||||
min16float3 nor : NORMAL;
|
||||
};
|
||||
|
||||
#endif // WI_HAIRPARTICLE_HF
|
||||
|
||||
@@ -24,8 +24,8 @@ VertexToPixel main(uint vid : SV_VERTEXID)
|
||||
Out.pos3D = Out.pos.xyz;
|
||||
Out.pos = mul(GetCamera().view_projection, Out.pos);
|
||||
|
||||
Out.nor = normalize(normal);
|
||||
Out.tex = uvsets.xy;
|
||||
Out.nor = min16float3(normal);
|
||||
Out.tex = min16float2(uvsets.xy);
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
struct GSInput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float4 uvsets : UVSETS;
|
||||
float3 nor : NORMAL;
|
||||
min16float4 color : COLOR;
|
||||
min16float4 uvsets : UVSETS;
|
||||
min16float3 nor : NORMAL;
|
||||
};
|
||||
|
||||
// Note: centroid interpolation is used to avoid floating voxels in some cases
|
||||
struct GSOutput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
centroid float4 color : COLOR;
|
||||
centroid float4 uvsets : UVSETS;
|
||||
centroid float3 N : NORMAL;
|
||||
centroid min16float4 color : COLOR;
|
||||
centroid min16float4 uvsets : UVSETS;
|
||||
centroid min16float3 N : NORMAL;
|
||||
centroid float3 P : POSITION3D;
|
||||
|
||||
#ifdef VOXELIZATION_CONSERVATIVE_RASTERIZATION_ENABLED
|
||||
|
||||
@@ -290,6 +290,15 @@ struct PixelInput
|
||||
return min16float((instanceIndex_dither >> 24u) / 255.0);
|
||||
}
|
||||
#endif // OBJECTSHADER_USE_DITHERING
|
||||
|
||||
#ifdef OBJECTSHADER_USE_UVSETS
|
||||
inline float4 GetUVSets()
|
||||
{
|
||||
float4 ret = uvsets;
|
||||
ret.xy = mad(ret.xy, GetMaterial().texMulAdd.xy, GetMaterial().texMulAdd.zw);
|
||||
return ret;
|
||||
}
|
||||
#endif // OBJECTSHADER_USE_UVSETS
|
||||
};
|
||||
|
||||
|
||||
@@ -406,8 +415,7 @@ float4 main(PixelInput input, in bool is_frontface : SV_IsFrontFace) : SV_Target
|
||||
const float2 ScreenCoord = pixel * GetCamera().internal_resolution_rcp;
|
||||
|
||||
#ifdef OBJECTSHADER_USE_UVSETS
|
||||
float4 uvsets = input.uvsets;
|
||||
uvsets.xy = mad(uvsets.xy, GetMaterial().texMulAdd.xy, GetMaterial().texMulAdd.zw);
|
||||
float4 uvsets = input.GetUVSets();
|
||||
#endif // OBJECTSHADER_USE_UVSETS
|
||||
|
||||
#ifndef DISABLE_ALPHATEST
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
[earlydepthstencil]
|
||||
float4 main(PixelInput input) : SV_TARGET
|
||||
{
|
||||
float4 uvsets = input.GetUVSets();
|
||||
|
||||
float4 color;
|
||||
[branch]
|
||||
if (GetMaterial().textures[BASECOLORMAP].IsValid() && (GetFrame().options & OPTION_BIT_DISABLE_ALBEDO_MAPS) == 0)
|
||||
{
|
||||
color = GetMaterial().textures[BASECOLORMAP].Sample(sampler_objectshader, input.uvsets);
|
||||
color = GetMaterial().textures[BASECOLORMAP].Sample(sampler_objectshader, uvsets);
|
||||
color.rgb = max(color.r, max(color.g, color.b));
|
||||
}
|
||||
else
|
||||
@@ -21,7 +23,7 @@ float4 main(PixelInput input) : SV_TARGET
|
||||
[branch]
|
||||
if (any(emissiveColor) && GetMaterial().textures[EMISSIVEMAP].IsValid())
|
||||
{
|
||||
float4 emissiveMap = GetMaterial().textures[EMISSIVEMAP].Sample(sampler_objectshader, input.uvsets);
|
||||
float4 emissiveMap = GetMaterial().textures[EMISSIVEMAP].Sample(sampler_objectshader, uvsets);
|
||||
emissiveColor *= emissiveMap.rgb * emissiveMap.a;
|
||||
}
|
||||
color.rgb += emissiveColor;
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
[earlydepthstencil]
|
||||
float4 main(PixelInput input) : SV_TARGET
|
||||
{
|
||||
const float2 pixel = (xPaintRadUVSET == 0 ? input.uvsets.xy : input.uvsets.zw) * xPaintRadResolution;
|
||||
float4 uvsets = input.GetUVSets();
|
||||
const float2 pixel = (xPaintRadUVSET == 0 ? uvsets.xy : uvsets.zw) * xPaintRadResolution;
|
||||
|
||||
const float2x2 rot = float2x2(
|
||||
cos(xPaintRadBrushRotation), -sin(xPaintRadBrushRotation),
|
||||
|
||||
@@ -43,19 +43,27 @@ void VoxelAtomicAverage(inout RWTexture3D<uint> output, in uint3 dest, in float4
|
||||
struct PSInput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
centroid float4 color : COLOR;
|
||||
float4 uvsets : UVSETS;
|
||||
centroid float3 N : NORMAL;
|
||||
centroid min16float4 color : COLOR;
|
||||
centroid min16float4 uvsets : UVSETS;
|
||||
centroid min16float3 N : NORMAL;
|
||||
centroid float3 P : POSITION3D;
|
||||
|
||||
#ifdef VOXELIZATION_CONSERVATIVE_RASTERIZATION_ENABLED
|
||||
nointerpolation float3 aabb_min : AABB_MIN;
|
||||
nointerpolation float3 aabb_max : AABB_MAX;
|
||||
#endif // VOXELIZATION_CONSERVATIVE_RASTERIZATION_ENABLED
|
||||
|
||||
inline float4 GetUVSets()
|
||||
{
|
||||
float4 ret = uvsets;
|
||||
ret.xy = mad(ret.xy, GetMaterial().texMulAdd.xy, GetMaterial().texMulAdd.zw);
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
void main(PSInput input)
|
||||
{
|
||||
float4 uvsets = input.GetUVSets();
|
||||
float3 P = input.P;
|
||||
|
||||
VoxelClipMap clipmap = GetFrame().vxgi.clipmaps[g_xVoxelizer.clipmap_index];
|
||||
@@ -87,14 +95,14 @@ void main(PSInput input)
|
||||
// mip level in which alpha is completely gone (helps with trees)
|
||||
lod_bias = -10;
|
||||
}
|
||||
baseColor *= GetMaterial().textures[BASECOLORMAP].SampleBias(sampler_linear_wrap, input.uvsets, lod_bias);
|
||||
baseColor *= GetMaterial().textures[BASECOLORMAP].SampleBias(sampler_linear_wrap, uvsets, lod_bias);
|
||||
}
|
||||
|
||||
float3 emissiveColor = GetMaterial().GetEmissive();
|
||||
[branch]
|
||||
if (any(emissiveColor) && GetMaterial().textures[EMISSIVEMAP].IsValid())
|
||||
{
|
||||
float4 emissiveMap = GetMaterial().textures[EMISSIVEMAP].Sample(sampler_linear_wrap, input.uvsets);
|
||||
float4 emissiveMap = GetMaterial().textures[EMISSIVEMAP].Sample(sampler_linear_wrap, uvsets);
|
||||
emissiveColor *= emissiveMap.rgb * emissiveMap.a;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
struct VSOut
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float4 uvsets : UVSETS;
|
||||
float3 N : NORMAL;
|
||||
min16float4 color : COLOR;
|
||||
min16float4 uvsets : UVSETS;
|
||||
min16float3 N : NORMAL;
|
||||
#ifndef VOXELIZATION_GEOMETRY_SHADER_ENABLED
|
||||
float3 P : POSITION3D;
|
||||
#endif // VOXELIZATION_GEOMETRY_SHADER_ENABLED
|
||||
|
||||
@@ -6,6 +6,6 @@ void main(PixelInput input)
|
||||
[branch]
|
||||
if (GetMaterial().textures[BASECOLORMAP].IsValid())
|
||||
{
|
||||
clip(GetMaterial().textures[BASECOLORMAP].Sample(sampler_point_wrap, input.uvsets).a - GetMaterial().alphaTest);
|
||||
clip(GetMaterial().textures[BASECOLORMAP].Sample(sampler_point_wrap, input.GetUVSets()).a - GetMaterial().alphaTest);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
[earlydepthstencil]
|
||||
float4 main(PixelInput input) : SV_TARGET
|
||||
{
|
||||
float4 uvsets = input.GetUVSets();
|
||||
float4 color;
|
||||
[branch]
|
||||
if (GetMaterial().textures[BASECOLORMAP].IsValid())
|
||||
{
|
||||
color = GetMaterial().textures[BASECOLORMAP].Sample(sampler_objectshader, input.uvsets);
|
||||
color = GetMaterial().textures[BASECOLORMAP].Sample(sampler_objectshader, uvsets);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -28,7 +29,7 @@ float4 main(PixelInput input) : SV_TARGET
|
||||
[branch]
|
||||
if (GetMaterial().textures[TRANSMISSIONMAP].IsValid())
|
||||
{
|
||||
float transmissionMap = GetMaterial().textures[TRANSMISSIONMAP].Sample(sampler_objectshader, input.uvsets).r;
|
||||
float transmissionMap = GetMaterial().textures[TRANSMISSIONMAP].Sample(sampler_objectshader, uvsets).r;
|
||||
transmission *= transmissionMap;
|
||||
}
|
||||
opacity *= 1 - transmission;
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
[earlydepthstencil]
|
||||
float4 main(PixelInput input) : SV_TARGET
|
||||
{
|
||||
float4 uvsets = input.GetUVSets();
|
||||
float2 pixel = input.pos.xy;
|
||||
|
||||
float4 color;
|
||||
[branch]
|
||||
if (GetMaterial().textures[BASECOLORMAP].IsValid())
|
||||
{
|
||||
color = GetMaterial().textures[BASECOLORMAP].Sample(sampler_objectshader, input.uvsets);
|
||||
color = GetMaterial().textures[BASECOLORMAP].Sample(sampler_objectshader, uvsets);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -23,7 +24,7 @@ float4 main(PixelInput input) : SV_TARGET
|
||||
|
||||
color.rgb = 1; // disable water shadow because it has already fog
|
||||
|
||||
color.rgb += caustic_pattern(input.uvsets.xy * 20, GetFrame().time);
|
||||
color.rgb += caustic_pattern(uvsets.xy * 20, GetFrame().time);
|
||||
|
||||
color.a = input.pos.z; // secondary depth
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wi::version
|
||||
// minor features, major updates, breaking compatibility changes
|
||||
const int minor = 71;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 300;
|
||||
const int revision = 301;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user