From 53ab6a69532be0ed25b063f0a20dc356aec7c0e4 Mon Sep 17 00:00:00 2001 From: Lorenzo Ferrillo Date: Sun, 19 May 2024 21:09:56 +0200 Subject: [PATCH] remove testing ishit shaders, add specular effect --- .../OblivionReloaded/Effects/Specular.fx.hlsl | 246 ++++++++++++++++++ .../OblivionReloaded/Shaders/ISHIT2001.pso.b | Bin 1256 -> 0 bytes .../Shaders/ISHIT2001.pso.hlsl.b | 69 ----- .../OblivionReloaded/Shaders/ISHIT2002.pso.b | Bin 1004 -> 0 bytes .../Shaders/ISHIT2002.pso.hlsl.b | 91 ------- .../OblivionReloaded/Shaders/ISHIT2002.vso.b | Bin 292 -> 0 bytes .../Shaders/ISHIT2002.vso.hlsl.b | 47 ---- .../Shaders/NIGHTEYE000.pso.hlsl.bak | 55 ---- OblivionReloaded/OblivionReloaded.aps | Bin 2216 -> 2216 bytes 9 files changed, 246 insertions(+), 262 deletions(-) create mode 100644 Extra/Shaders/OblivionReloaded/Effects/Specular.fx.hlsl delete mode 100644 Extra/Shaders/OblivionReloaded/Shaders/ISHIT2001.pso.b delete mode 100755 Extra/Shaders/OblivionReloaded/Shaders/ISHIT2001.pso.hlsl.b delete mode 100644 Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.pso.b delete mode 100755 Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.pso.hlsl.b delete mode 100644 Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.vso.b delete mode 100755 Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.vso.hlsl.b delete mode 100644 Extra/Shaders/OblivionReloaded/Shaders/NIGHTEYE000.pso.hlsl.bak diff --git a/Extra/Shaders/OblivionReloaded/Effects/Specular.fx.hlsl b/Extra/Shaders/OblivionReloaded/Effects/Specular.fx.hlsl new file mode 100644 index 00000000..26905ab9 --- /dev/null +++ b/Extra/Shaders/OblivionReloaded/Effects/Specular.fx.hlsl @@ -0,0 +1,246 @@ +// Specular multiplier fullscreen shader for Oblivion/Skyrim Reloaded + +float4x4 TESR_ProjectionTransform; +float4x4 TESR_InvProjectionTransform; +float4 TESR_ReciprocalResolution; +float4 TESR_SpecularData; // x: strength, y:blurMultiplier, z:glossiness, w:drawDistance +float4 TESR_CameraData; // x: nearZ, y: farZ, z: aspect ratio, w: fov +float4 TESR_ScreenSpaceLightDir; + +sampler2D TESR_RenderedBuffer : register(s0) = sampler_state { ADDRESSU = CLAMP; ADDRESSV = CLAMP; MAGFILTER = LINEAR; MINFILTER = LINEAR; MIPFILTER = LINEAR; }; +sampler2D TESR_DepthBuffer : register(s1) = sampler_state { ADDRESSU = CLAMP; ADDRESSV = CLAMP; MAGFILTER = LINEAR; MINFILTER = LINEAR; MIPFILTER = LINEAR; }; +sampler2D TESR_SourceBuffer : register(s2) = sampler_state { ADDRESSU = CLAMP; ADDRESSV = CLAMP; MAGFILTER = LINEAR; MINFILTER = LINEAR; MIPFILTER = LINEAR; }; + +static const float nearZ = TESR_CameraData.x; +static const float farZ = TESR_CameraData.y; +static const float Q = farZ/(farZ - nearZ); + +static const float Strength = TESR_SpecularData.x; +static const float BlurRadius = TESR_SpecularData.y; +static const float Glossiness = TESR_SpecularData.z; +static const float DrawDistance = TESR_SpecularData.w; +static const float2 texelSize = float2(TESR_ReciprocalResolution.x, TESR_ReciprocalResolution.y); +static const int cKernelSize = 12; + +static const float BlurWeights[cKernelSize] = +{ + 0.057424882f, + 0.058107773f, + 0.061460144f, + 0.071020611f, + 0.088092873f, + 0.106530916f, + 0.106530916f, + 0.088092873f, + 0.071020611f, + 0.061460144f, + 0.058107773f, + 0.057424882f +}; + +static const float2 BlurOffsets[cKernelSize] = +{ + float2(-6.0f * TESR_ReciprocalResolution.x, -6.0f * TESR_ReciprocalResolution.y), + float2(-5.0f * TESR_ReciprocalResolution.x, -5.0f * TESR_ReciprocalResolution.y), + float2(-4.0f * TESR_ReciprocalResolution.x, -4.0f * TESR_ReciprocalResolution.y), + float2(-3.0f * TESR_ReciprocalResolution.x, -3.0f * TESR_ReciprocalResolution.y), + float2(-2.0f * TESR_ReciprocalResolution.x, -2.0f * TESR_ReciprocalResolution.y), + float2(-1.0f * TESR_ReciprocalResolution.x, -1.0f * TESR_ReciprocalResolution.y), + float2( 1.0f * TESR_ReciprocalResolution.x, 1.0f * TESR_ReciprocalResolution.y), + float2( 2.0f * TESR_ReciprocalResolution.x, 2.0f * TESR_ReciprocalResolution.y), + float2( 3.0f * TESR_ReciprocalResolution.x, 3.0f * TESR_ReciprocalResolution.y), + float2( 4.0f * TESR_ReciprocalResolution.x, 4.0f * TESR_ReciprocalResolution.y), + float2( 5.0f * TESR_ReciprocalResolution.x, 5.0f * TESR_ReciprocalResolution.y), + float2( 6.0f * TESR_ReciprocalResolution.x, 6.0f * TESR_ReciprocalResolution.y) +}; + +struct VSOUT +{ + float4 vertPos : POSITION; + float2 UVCoord : TEXCOORD0; +}; + +struct VSIN +{ + float4 vertPos : POSITION0; + float2 UVCoord : TEXCOORD0; +}; + +VSOUT FrameVS(VSIN IN) +{ + VSOUT OUT = (VSOUT)0.0f; + OUT.vertPos = IN.vertPos; + OUT.UVCoord = IN.UVCoord; + return OUT; +} + +float readDepth(in float2 coord : TEXCOORD0) +{ + float Depth = tex2D(TESR_DepthBuffer, coord).x;; + float ViewZ = (-nearZ *Q) / (Depth - Q); + return ViewZ; +} + +float3 reconstructPosition(float2 uv) +{ + float4 screenpos = float4(uv * 2.0 - 1.0f, tex2D(TESR_DepthBuffer, uv).x, 1.0f); + screenpos.y = -screenpos.y; + float4 viewpos = mul(screenpos, TESR_InvProjectionTransform); + viewpos.xyz /= viewpos.w; + return viewpos.xyz; +} + +float3 GetNormal( float2 uv) +{ + // improved normal reconstruction algorithm from + // https://gist.github.com/bgolus/a07ed65602c009d5e2f753826e8078a0 + + // store coordinates at 1 and 2 pixels from center in all directions + float4 rightUv = uv.xyxy + float4(1.0, 0.0, 2.0, 0.0) * texelSize.xyxy; + float4 leftUv = uv.xyxy + float4(-1.0, 0.0, -2.0, 0.0) * texelSize.xyxy; + float4 bottomUv = uv.xyxy + float4(0.0, 1.0, 0.0, 2.0) * texelSize.xyxy; + float4 topUv =uv.xyxy + float4(0.0, -1.0, 0.0, -2.0) * texelSize.xyxy; + + float depth = readDepth(uv); + + // get depth values at 1 & 2 pixels offsets from current along the horizontal axis + half4 H = half4( + readDepth(rightUv.xy), + readDepth(leftUv.xy), + readDepth(rightUv.zw), + readDepth(leftUv.zw) + ); + + // get depth values at 1 & 2 pixels offsets from current along the vertical axis + half4 V = half4( + readDepth(topUv.xy), + readDepth(bottomUv.xy), + readDepth(topUv.zw), + readDepth(bottomUv.zw) + ); + + half2 he = abs((2 * H.xy - H.zw) - depth); + half2 ve = abs((2 * V.xy - V.zw) - depth); + + // pick horizontal and vertical diff with the smallest depth difference from slopes + float3 centerPoint = reconstructPosition(uv); + float3 rightPoint = reconstructPosition(rightUv.xy); + float3 leftPoint = reconstructPosition(leftUv.xy); + float3 topPoint = reconstructPosition(topUv.xy); + float3 bottomPoint = reconstructPosition(bottomUv.xy); + float3 left = centerPoint - leftPoint; + float3 right = rightPoint - centerPoint; + float3 down = centerPoint - bottomPoint; + float3 up = topPoint - centerPoint; + + half3 hDeriv = he.x < he.y ? left : right; + half3 vDeriv = ve.x < ve.y ? down : up; + + // get view space normal from the cross product of the best derivatives + // half3 viewNormal = normalize(cross(hDeriv, vDeriv)); + half3 viewNormal = normalize(cross(vDeriv, hDeriv)); + + return viewNormal; +} + + +float4 Desaturate(float4 input) +{ + float greyscale = input.r * 0.3f + input.g * 0.59f +input.b * 0.11f; + return float4(greyscale, greyscale, greyscale, input.a); +} + + +float4 specularHighlight( VSOUT IN) : COLOR0 +{ + float2 coord = IN.UVCoord; + float3 origin = reconstructPosition(coord); + if (origin.z > DrawDistance) return 0.0; + + //reorient our sample kernel along the origin's normal + float3 normal = GetNormal(IN.UVCoord); + float3 viewRay = normalize(origin); + float3 reflection = reflect(TESR_ScreenSpaceLightDir.xyz, normal); + + // float diffuse = dot(normal, TESR_ScreenSpaceLightDir.xyz); + float specular = pow(dot(viewRay, reflection), Glossiness) * Glossiness * Glossiness; + + specular = lerp(specular, 0.0, origin.z/DrawDistance); + + // return diffuse; + return specular.xxxx; + // return specular + diffuse; +} + + +// perform depth aware 12 taps blur along the direction of the offsetmask +float4 BlurPS(VSOUT IN, uniform float2 OffsetMask) : COLOR0 +{ + float WeightSum = 0.114725602f; + float4 color1 = tex2D(TESR_RenderedBuffer, IN.UVCoord); + color1.r = color1.r * WeightSum; + + float depth1 = readDepth(IN.UVCoord); + clip(DrawDistance - depth1); //don't process pixels further away than effect fade distance + + int i = 0; + for (i = 0; i < cKernelSize; i++) + { + float2 uvOff = (BlurOffsets[i] * OffsetMask) * BlurRadius; + float4 color2 = tex2D(TESR_RenderedBuffer, IN.UVCoord + uvOff); + float depth2 = readDepth(IN.UVCoord + uvOff); + float diff = abs(float(depth1 - depth2)); + + // only factor it pixels that are close in terms of depth + if(diff <= 1) + { + color1.r += BlurWeights[i] * color2.r; + WeightSum += BlurWeights[i]; + } + } + color1.r /= WeightSum; + return color1.rrrr; +} + + +float4 CombineSpecular(VSOUT IN) :COLOR0 +{ + float4 color = tex2D(TESR_SourceBuffer, IN.UVCoord); + float specular = tex2D(TESR_RenderedBuffer, IN.UVCoord).r; + float luminance = Desaturate(color).r; + float lt = luminance; + + // scale effect with scene luminance + specular = lerp(0.0, specular, luminance) * TESR_SpecularData.x; + color += specular * color * TESR_SpecularData.x; + + return float4 (color.rgb, 1.0f); +} + +technique +{ + + pass + { + VertexShader = compile vs_3_0 FrameVS(); + PixelShader = compile ps_3_0 specularHighlight(); + } + + pass + { + VertexShader = compile vs_3_0 FrameVS(); + PixelShader = compile ps_3_0 BlurPS(float2(1.0f, 0.0f)); + } + + pass + { + VertexShader = compile vs_3_0 FrameVS(); + PixelShader = compile ps_3_0 BlurPS(float2(0.0f, 1.0f)); + } + + pass + { + VertexShader = compile vs_3_0 FrameVS(); + PixelShader = compile ps_3_0 CombineSpecular(); + } +} \ No newline at end of file diff --git a/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2001.pso.b b/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2001.pso.b deleted file mode 100644 index 17d010a3df65b2d4b8d40bf5610c4cc4ae9cb94a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1256 zcmb7DF>KR76#cdn`_fbjqDv)^8YVzO5oy&SB_gHifKZSqrU)^#3P}*H5@I=JHwzO( zHW)gXHAP}Uh^gLDK@1&`m?~LiK@3bxnD_4-6M4%e-@f<$yZ`V0eUlMIf1@p`-@CDP zo`~ui9^eeT7!z<6_JC;#b!sz@u?N#3(8wf@35+33$1jKXKI|>bZn>S#Q`>2_I+USV zxq{R1c+`F7-f6nc-hd7?WYC}(`y9L3bGjXP4q~4niK* za|LsSZ;7p1`;&EjjDLT*aP4Td9E|bBvo8<-Ebk_I=j%!^|MN7_m)v~q`-@znU)Vht z9KWt6`1D;h_%OGTU}vzsw0)Is@3h?hp#ONUcF{I#{$ZW1s-l=$a9cG5(OVM!(0PT zeufBt!_z4Afx(>&;l%YBn1|p`-b`X}v40l+bx)^te+^=d3c$ZS5}~j3%5TJeJ>}QP z;+$B|#`%;!Go?N|rQV!UZ%wHeQ|fcjtMjXR&)^=oo~mAXNfxSi^dJ%oX`;O$^Rqv^D zfP0>&W4T{l_THw?z4lP{r@&eGoFUeYd}|`+WPBBG9vY4x`9zyO=N#up4OG92|9jy2 P$?ri3FOTmbiirLJ_s9O- diff --git a/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2001.pso.hlsl.b b/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2001.pso.hlsl.b deleted file mode 100755 index 0df9df1f..00000000 --- a/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2001.pso.hlsl.b +++ /dev/null @@ -1,69 +0,0 @@ -// -// Generated by Microsoft (R) D3DX9 Shader Compiler 9.08.299.0000 -// -// vsa shaderdump19/ISHIT2001.pso /Fcshaderdump19/ISHIT2001.pso.dis -// -// -//#define ScreenSpace Src0 -// Parameters: - -sampler2D ScreenSpace : register(s0); -float4 blurParams : register(c1); - - -// Registers: -// -// Name Reg Size -// ------------ ----- ---- -// blurParams const_1 1 -// ScreenSpace texture_0 1 -// - -// Structures: - -struct VS_OUTPUT { - float2 ScreenOffset : TEXCOORD0; -}; - -struct PS_OUTPUT { - float4 color_0 : COLOR0; -}; - -// Code: - -float3 pSamples[] ={ - {-0.929317,-0.295797,1}, - {0.525823,0.672132,1}, - {0.867314,0.132608,1}, - {0.002469,-0.692395,1}, - {-0.273576,0.914886,1}, - {-0.729743,0.451020,1}, - {0.544711,-0.537214,1}, - {-0.607088,-0.736707,1}, - {-0.737059,-0.816707,1} - }; - - -PS_OUTPUT main(VS_OUTPUT IN) { - PS_OUTPUT OUT; - - const float4 constant_vec = {1, 0.2, 0.2, 0}; //r0 - float4 col = tex2D(ScreenSpace, IN.ScreenOffset.xy); - - float3 retCol = 0; - float weights = 0; - float2 blur_vec = (blurParams.xy * constant_vec.y) + IN.ScreenOffset.yx - (blurParams.yx * constant_vec.x); - for (int i=0; i < 9; i++ ) - { - retCol += tex2D(ScreenSpace, (IN.ScreenOffset + blur_vec + pSamples[i].xy)).rgb; - weights += pSamples[i].z; - } - retCol /= weights; - - OUT.color_0.a = 1; - OUT.color_0.rgb = lerp(retCol.rgb, constant_vec.rgb, saturate((2 * length(IN.ScreenOffset.xy - 0.5)) - 0.5) * blurParams.z); - - return OUT; -}; - - diff --git a/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.pso.b b/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.pso.b deleted file mode 100644 index 864483dbf0c989588fa9d505219d28b7ea2b66e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1004 zcmaJLb8+A5(M_b?nK9EFY(*gK0XxWTe!Mr>YY*P0M_Jz9og7a`V;a5ARYRuY& z>Wkp3{-v(n@%R?!RRxmD_v38hD+^TRCi4;T#@E9JU;MzDg~uDTRDXpBHrTuJJ)53u z!o0KGkz5nzoX3i*W|5oa{PH!xUnk_%U;NfF0Vj<3FD&zA=n?n`Q}+kGtVmtdx%r`c8HMN Jr0ojlfIo8NwnzW~ diff --git a/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.pso.hlsl.b b/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.pso.hlsl.b deleted file mode 100755 index c7ecc245..00000000 --- a/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.pso.hlsl.b +++ /dev/null @@ -1,91 +0,0 @@ -// -// Generated by Microsoft (R) D3DX9 Shader Compiler 9.08.299.0000 -// -// vsa shaderdump19/ISHIT2002.pso /Fcshaderdump19/ISHIT2002.pso.dis -// -// -//#define ScreenSpace Src0 -// Parameters: - -sampler2D ScreenSpace : register(s0); -sampler2D OverlaySpace : register(s1); -float4 blurParams : register(c1); -float4 doubleVisParams : register(c2); - - -// Registers: -// -// Name Reg Size -// --------------- ----- ---- -// blurParams const_1 1 -// doubleVisParams const_2 1 -// ScreenSpace texture_0 1 -// Src1 texture_1 1 -// - -// Structures: - -struct VS_OUTPUT { - float2 ScreenSpace : TEXCOORD0; - float2 OverlayOffset : TEXCOORD1; - float2 ScreenPos : VPOS; -}; - -struct PS_OUTPUT { - float4 color_0 : COLOR0; -}; - -// Code: -float3 pSamples[] ={ - {-0.929317,-0.295797,1}, - {0.525823,0.672132,1}, - {0.867314,0.132608,1}, - {0.002469,-0.692395,1}, - {-0.273576,0.914886,1}, - {-0.729743,0.451020,1}, - {0.544711,-0.537214,1}, - {-0.607088,-0.736707,1}, - {-0.737059,-0.816707,1} - }; - - - -PS_OUTPUT main(VS_OUTPUT IN) { - PS_OUTPUT OUT; -#define expand(v) (((v) - 0.5) / 0.5) -#define compress(v) (((v) * 0.5) + 0.5) -#define weight(v) dot(v, 1) -#define sqr(v) ((v) * (v)) - - float1 q1; - float1 q2; - float4 r1; - float4 r2; - const float4 constant_vec = {1, 0.2, 0.2, 0}; - float4 pointInOverlay = tex2D(OverlaySpace, IN.OverlayOffset.xy); //t3 - - float2 r0 = IN.ScreenSpace.xy - doubleVisParams.xy; - r1.y = max(r0.y, 1 - doubleVisParams.w); - r1.x = max(r0.x, 0); - r2.xy = IN.ScreenSpace.xy + doubleVisParams.xy; - r0.y = min(r2.y, 1); - r0.x = min(doubleVisParams.z, r2.x); - r2.xyzw = tex2D(ScreenSpace, r1.xy); - r1.xyzw = tex2D(ScreenSpace, r0.xy); - q1.x = 2 * ((doubleVisParams.z / doubleVisParams.w) * (IN.OverlayOffset.x - 0.5)); // [0,1] to [-1,+1] - q2.x = min(sqrt(sqr(q1.x) + (expand(IN.ScreenSpace.y) * expand(IN.OverlayOffset.y))) * (5* blurParams.z), 1); - OUT.color_0 = float4(0.5 * ((r2.xyz + r1.xyz) * (1 - q2.x)) + (pointInOverlay.xyz * q2.x), 0.7); - - float2 center = float2(0.5f, 0.5f); - float2 camp_point = float2(0.5f, 0.1f); //to check proper hardcoding values - float distc = abs(camp_point.y - center.y); - float2 dist_comp = abs(center - IN.ScreenSpace); - float dist = sqrt((dist_comp.x * dist_comp.x) + (dist_comp.y * dist_comp.y)); - float halo_intensity = blurParams.z * 3; - OUT.color_0 = lerp((OUT.color_0) * (1 - (dist * halo_intensity)), float4(1,0, 0, 0.3) * (dist * halo_intensity), dist); - OUT.color_0.a = saturate(dist); - return OUT; -}; - -// approximately 11 instruction slots used (1 texture, 10 arithmetic) - diff --git a/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.vso.b b/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.vso.b deleted file mode 100644 index c3bb4248052e0d9bf56d30eb3861c81e8e3c87c6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 292 zcmYL@I}U3R#izcRi_<}O0WnxwRn$;hS2iABM&KC!(8*g{fhQ_lSp6#_7cGGoT z?ySg@zy&a`(iiAO?sK00xte=%QJ|(8pz)_v;BnRQxaoM_B$JtB2AM&|e|f`9L6&8} E8|LdeivR!s diff --git a/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.vso.hlsl.b b/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.vso.hlsl.b deleted file mode 100755 index aa579b1e..00000000 --- a/Extra/Shaders/OblivionReloaded/Shaders/ISHIT2002.vso.hlsl.b +++ /dev/null @@ -1,47 +0,0 @@ -// -// Generated by Microsoft (R) D3DX9 Shader Compiler 9.08.299.0000 -// -// vsa shaderdump19/ISHIT2002.vso /Fcshaderdump19/ISHIT2002.vso.dis -// -// -// Parameters: - -float4 texRatio0 : register(c6); -float4 texRatio1 : register(c7); - - -// Registers: -// -// Name Reg Size -// ------------ ----- ---- -// texRatio0 const_6 1 -// texRatio1 const_7 1 -// - - -// Structures: - -struct VS_INPUT { - float4 position : POSITION; - float4 texcoord_0 : TEXCOORD0; -}; - -struct VS_OUTPUT { - float4 position : POSITION; - float2 texcoord_0 : TEXCOORD0; - float2 texcoord_1 : TEXCOORD1; -}; - -// Code: - -VS_OUTPUT main(VS_INPUT IN) { - VS_OUTPUT OUT; - - OUT.position.xyzw = IN.position.xyzw; - OUT.texcoord_0.xy = (IN.texcoord_0.xy * texRatio0.xy) + texRatio0.zw; - OUT.texcoord_1.xy = (IN.texcoord_0.xy * texRatio1.xy) + texRatio1.zw; - - return OUT; -}; - -// approximately 3 instruction slots used diff --git a/Extra/Shaders/OblivionReloaded/Shaders/NIGHTEYE000.pso.hlsl.bak b/Extra/Shaders/OblivionReloaded/Shaders/NIGHTEYE000.pso.hlsl.bak deleted file mode 100644 index ced534e0..00000000 --- a/Extra/Shaders/OblivionReloaded/Shaders/NIGHTEYE000.pso.hlsl.bak +++ /dev/null @@ -1,55 +0,0 @@ -// -// Generated by Microsoft (R) D3DX9 Shader Compiler 9.08.299.0000 -// -// vsa shaderdump19/NIGHTEYE000.pso /Fcshaderdump19/NIGHTEYE000.pso.dis -// -// -// Parameters: - -float4 SpellInput : register(c1); -sampler2D ScreenSpace : register(s0); - - -// Registers: -// -// Name Reg Size -// ------------ ----- ---- -// SpellInput const_1 1 -// ScreenSpace texture_0 1 -// - - -// Structures: - -struct VS_OUTPUT { - float4 ScreenOffset : TEXCOORD0; -}; - -struct PS_OUTPUT { - float4 Color : COLOR0; -}; - -// Code: - -PS_OUTPUT main(VS_OUTPUT IN) { - PS_OUTPUT OUT; - - const int4 const_0 = {1, 0, 0, -1}; - const float4 const_2 = {1, 1, 1, 0.5}; - const float4 const_3 = {0.21, 0.5, 0.78, 0}; - - float q1; - float4 r0; - float4 r1; - - IN.ScreenOffset.xyzw = tex2D(ScreenSpace, IN.ScreenOffset.xy); - r1.xyzw = dot(const_0.xyz, SpellInput.xyz); - r0.w = 1; - q1 = 0.5 - (((r1.w - 1) * (r1.w - 1)) * 0.5); - r0.xyz = lerp(IN.ScreenOffset.xyz, dot(const_2.xyz, IN.ScreenOffset.xyz) * const_3.xyz, q1 > 0.5 ? 0 : 1); - OUT.Color.xyzw = r0.xyzw; - - return OUT; -}; - -// approximately 7 instruction slots used (1 texture, 6 arithmetic) diff --git a/OblivionReloaded/OblivionReloaded.aps b/OblivionReloaded/OblivionReloaded.aps index 25f9ddcb0d9435cf63ca4290bea11c63d955bd49..034e99f5282ded54223cb238f31f7342a49f97ba 100644 GIT binary patch delta 77 zcmZ1>xI%El0!DrY25trj0MnD#GalzOWYA+U0O85?Ow$=nCW|v4Mu=^G%$&*uxI%El0!DsD1}+8$21XzR)05XT9_KV*&|@$J;mP$((;1B>i!&cah;4q%oXW&$ P#9+i=0D_wX*}|CsG3*YJ