User:Mgriggs22

From Bo3b's School for Shaderhackers
Jump to: navigation, search

Lesson 0

TheBall01 50.jpg

Lesson 1

// // Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022 // // Parameters: // // float4 MinZ_MaxZRatio; // float NvStereoEnabled; // sampler2D NvStereoFixTexture; // sampler2D SceneColorTexture; // float4 ScreenPositionScaleBias; // sampler2D Texture2D_0; // sampler2D Texture2D_1; // float UniformPixelScalar_10; // float UniformPixelScalar_12; // float UniformPixelScalar_13; // float UniformPixelScalar_14; // float UniformPixelScalar_15; // float UniformPixelScalar_16; // float UniformPixelScalar_9; // float4 UniformPixelVector_0; // float4 UniformPixelVector_1; // float4 UniformPixelVector_2; // float4 UniformPixelVector_3; // // // Registers: // // Name Reg Size // ----------------------- ----- ---- // UniformPixelVector_0 c0 1 // ScreenPositionScaleBias c1 1 // MinZ_MaxZRatio c2 1 // NvStereoEnabled c3 1 // UniformPixelVector_1 c4 1 // UniformPixelVector_2 c5 1 // UniformPixelVector_3 c6 1 // UniformPixelScalar_9 c7 1 // UniformPixelScalar_10 c8 1 // UniformPixelScalar_12 c9 1 // UniformPixelScalar_13 c10 1 // UniformPixelScalar_14 c11 1 // UniformPixelScalar_15 c12 1 // UniformPixelScalar_16 c13 1 // SceneColorTexture s0 1 // NvStereoFixTexture s1 1 // Texture2D_0 s2 1 // Texture2D_1 s3 1 // ps_3_0 def c14, -9.99999997e-007, 0, 0.0625, 65503 def c15, 5000, -0.00100000005, 1000, 0 def c16, 2, 1.5, 0.5, -1 dcl_texcoord4 v0 dcl_texcoord5 v1.xyw dcl_texcoord6 v2.xyz dcl_texcoord v3.xy dcl_2d s0 dcl_2d s1 dcl_2d s2 dcl_2d s3 dp3 r0.x, v2, v2 rsq r0.x, r0.x mul r0.x, r0.x, v2.z mov r1, c16 mad r0.yz, v3.xxyw, r1.x, c5.xxyw texld r2, r0.yzzw, s2 mad r0.yz, v3.xxyw, r1.y, c6.xxyw texld r3, r0.yzzw, s2 add r0.y, r3.y, r3.y mul r0.y, r2.z, r0.y mad r0.y, r0.y, r1.z, c7.x mul r0.yzw, r0.y, c4.xxyz mov r1.x, c8.x mad_pp r0.yzw, r1.x, r0, c0.xxyz mad r1.x, v1.w, c9.x, r1.w mad r1.y, c10.x, r1.x, -r1.w cmp r1.x, r1.x, -c16.w, r1.y add r1.y, r0_abs.x, c14.x pow r1.z, r0_abs.x, c11.x mul r0.x, r1.z, r1.x texld r2, v3, s3 mul r0.x, r0.x, r2.y mul r0.x, r0.x, c12.x cmp r0.x, r1.y, r0.x, c14.y min r1.x, r0.x, -c16.w abs r0.x, c3.x if_ne c3.x, -c3.x texld r2, c14.zyzw, s1 add r1.y, -r2.y, v1.w mad r2.x, r2.x, r1.y, v1.x mov r2.yz, v1.xyww else mov r2.xyz, c14.y endif cmp r2.xyz, -r0.x, v1.xyww, r2 rcp r0.x, r2.z mul r1.yz, r0.x, r2.xxyw mad r1.yz, r1, c1.xxyw, c1.xwzw texld_pp r2, r1.yzzw, s0 min_pp r0.x, r2.w, c14.w mad r0.x, r0.x, c2.z, -c2.w rcp_pp r0.x, r0.x add r1.y, -r1.w, -c13.x mul r1.z, r1.y, c15.x add r0.x, r0.x, -v1.w mad r1.y, r1.y, c15.x, c15.y rcp r1.z, r1.z cmp r1.y, r1.y, r1.z, c15.z mul_sat r0.x, r0.x, r1.y mul_pp oC0.w, r0.x, r1.x mad_pp oC0.xyz, r0.yzww, v0.w, v0 // approximately 55 instruction slots used (5 texture, 50 arithmetic)

Lesson 2

Before: TheBall01 50.jpg After: TheBall01 MGFixed.jpg