cbuffer _15 { float4 _15_nv_color : packoffset(c0); float4 _15_nv_desaturation_params : packoffset(c1); float4 _15_nv_light_params : packoffset(c2); float2 _15_resolution : packoffset(c3); float2 _15_zoom_to_world_params : packoffset(c3.z); float _15_nv_intensity : packoffset(c4); float _15_darkness : packoffset(c4.y); float _15_timer : packoffset(c4.z); uint _15_render_darkness : packoffset(c4.w); }; Texture2D gameview : register(t0); SamplerState _gameview_sampler : register(s0); Texture2D lightmap : register(t1); SamplerState _lightmap_sampler : register(s1); static float2 vUV; static float4 fragColor; struct SPIRV_Cross_Input { float2 vUV : TEXCOORD0; }; struct SPIRV_Cross_Output { float4 fragColor : SV_Target0; }; static bool use_nightvision; void frag_main() { use_nightvision = _15_nv_intensity > 0.0f; float2 uv = vUV; float4 color = gameview.Sample(_gameview_sampler, uv); if (!(_15_render_darkness != 0u)) { fragColor = color; return; } float4 light = lightmap.Sample(_lightmap_sampler, uv); if (use_nightvision) { float luminance = dot(color.xyz, float3(0.2989999949932098388671875f, 0.58700001239776611328125f, 0.114000000059604644775390625f)); float lightLuminance = max(light.x, max(light.y, light.z)); float3 grayscale = (luminance * _15_nv_intensity).xxx; float lightIntensity = (smoothstep(_15_nv_desaturation_params.x, _15_nv_desaturation_params.y, lightLuminance) * _15_nv_desaturation_params.z) + _15_nv_desaturation_params.w; if (lightLuminance > 0.0f) { float3 _117 = color.xyz * (((light.xyz / lightLuminance.xxx) * 0.75f) + 0.25f.xxx); color = float4(_117.x, _117.y, _117.z, color.w); } float3 _125 = lerp(grayscale, color.xyz, lightIntensity.xxx); color = float4(_125.x, _125.y, _125.z, color.w); lightIntensity = (smoothstep(_15_nv_light_params.x, _15_nv_light_params.y, lightLuminance) * _15_nv_light_params.z) + _15_nv_light_params.w; fragColor = float4(color.xyz * lightIntensity, color.w); } else { float3 _156 = color.xyz * light.xyz; color = float4(_156.x, _156.y, _156.z, color.w); fragColor = float4(color.xyz, color.w); } } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { vUV = stage_input.vUV; frag_main(); SPIRV_Cross_Output stage_output; stage_output.fragColor = fragColor; return stage_output; }