User:Dakobed

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

Lesson 0

TheBall002 050 - Copy.jpg

Lesson 1

//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
// Parameters:
//
//   float4 AmbientColorAndSkyFactor;
//   float4 LightColorAndFalloffExponent;
//   float3 LowerSkyColor;
//   float4 MinZ_MaxZRatio;
//   sampler2D Texture2D_0;
//   sampler2D Texture2D_1;
//   sampler2D Texture2D_2;
//   sampler2D Texture2D_3;
//   float4 UniformPixelVector_0;
//   float3 UpperSkyColor;
//
//
// Registers:
//
//   Name                         Reg   Size
//   ---------------------------- ----- ----
//   UniformPixelVector_0         c0       1
//   MinZ_MaxZRatio               c2       1
//   LightColorAndFalloffExponent c4       1
//   UpperSkyColor                c5       1
//   LowerSkyColor                c6       1
//   AmbientColorAndSkyFactor     c7       1
//   Texture2D_0                  s0       1
//   Texture2D_1                  s1       1
//   Texture2D_2                  s2       1
//   Texture2D_3                  s3       1
//

    ps_3_0
    def c1, 0.300000012, 0.589999974, 0.109999999, 9.99999997e-007
    def c3, 0.800000012, 2.79999995, 0.5, -0.5
    def c8, -0.160000011, 0.00100000005, 1.20000005, 300
    def c9, 0, 1.60000002, 1, 200
    def c10, 2, -1, 1, 5
    def c11, 8, 16, 0, 0
    dcl_texcoord4 v0.xyz
    dcl_texcoord5 v1.w
    dcl_texcoord6 v2.xyz
    dcl_texcoord7 v3.xyz
    dcl_texcoord v4.xy
    dcl_2d s0
    dcl_2d s1
    dcl_2d s2
    dcl_2d s3
    mul r0.xy, c10.w, v4
    texld r0, r0, s1
    dp3 r0.x, r0, c1
    max r1.x, r0_abs.x, c1.w
    mul r0.x, r1.x, r1.x
    mul r0.x, r0.x, r1.x
    texld r1, v4, s3
    max r0.yzw, r1_abs.xxyz, c1.w
    mul r2.xyz, r0.yzww, r0.yzww
    mul r0.yzw, r0, r2.xxyz
    dp3 r0.y, r0.yzww, c1
    nrm r2.xyz, v2
    mad r0.z, r2.z, -c9.y, c9.z
    cmp r0.z, r2.z, r0.z, c10.z
    mul r0.w, r0_abs.z, r0_abs.z
    mul r0.w, r0.w, r0.w
    mul r0.w, r0.w, r0_abs.z
    add r0.z, r0_abs.z, -c1.w
    mul r0.w, r0.y, r0.w
    mul r0.w, r0.w, c9.w
    cmp r0.z, r0.z, r0.w, c9.x
    mul r3.xy, r2, c8.x
    mad r3.xy, v4, c8.y, r3
    texld r3, r3, s2
    pow r0.w, r3_abs.y, c8.z
    add r1.w, r3_abs.y, -c1.w
    mul r0.w, r0.w, c8.w
    mul r0.y, r0.w, r0.y
    cmp r0.y, r1.w, r0.y, c9.x
    add r1.xyz, r1, r0.y
    mad r0.yzw, r1.xxyz, c8.z, r0.z
    mul r1.xyz, r1, c8.z
    mul r0.yzw, r0, c3.x
    mad r0.xyz, r0.x, c3.y, r0.yzww
    mul r1.xyz, r0, r1
    mul_pp r1.xyz, r1, c11.x
    texld r3, v4, s0
    mad_pp r3.xyz, r3, c10.x, c10.y
    nrm_pp r4.xyz, r3
    dp3 r0.w, r4, r2
    mul r3.xyz, r0.w, r4
    mad r2.xyz, r3, c10.x, -r2
    nrm_pp r3.xyz, v0
    dp3_sat r0.w, r2, r3
    dp3_sat_pp r1.w, r4, r3
    add r2.x, r0.w, -c1.w
    pow_pp r2.y, r0.w, c11.y
    cmp_pp r0.w, r2.x, r2.y, c9.x
    mul_pp r1.xyz, r1, r0.w
    mov r2.z, c10.z
    add r2.xyz, r2.z, -c0
    mul_pp r0.xyz, r0, r2
    add r0.w, r1.w, -c1.w
    cmp_pp r0.w, r0.w, r1.w, c9.x
    mad_pp r1.xyz, r0, r0.w, r1
    nrm r2.xyz, v3
    dp3 r0.w, r2, r4
    mad r2.xy, r0.w, c3.zwzw, c3.z
    mul r2.xy, r2, r2
    mul r2.yzw, r0.xxyz, r2.y
    mul r3.xyz, r0, r2.x
    mul r2.xyz, r2.yzww, c6
    mad r2.xyz, r3, c5, r2
    mov_pp r0.w, c7.w
    mad_pp r2.xyz, r2, r0.w, c0
    mad_pp r1.xyz, r1, c4, r2
    mad_pp oC0.xyz, r0, c7, r1
    rcp r0.x, v1.w
    mad_pp oC0.w, c2.x, r0.x, c2.y

// approximately 81 instruction slots used (4 texture, 77 arithmetic)