User:DJ-RK

From Bo3b's School for Shaderhackers
Revision as of 13:50, 1 February 2015 by DJ-RK (Talk | contribs)

Jump to: navigation, search

Lesson 0

Hopefully the beginning of a productive and helpful undertaking. Wish me luck!

TheBall02 50.jpg


Lesson 1

Took a while to get the shaders to dump. Thankfully reading the forum thread helped me find the answer to simply launch the .exe from the folder. Might be a good idea to mention this as a possible hiccup in the lesson!

Here is the pixel shader that I dumped, which is for the bloom effect around certain lights.

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

    ps_3_0
    def c1, 2, -1, 0.200000003, 9.99999997e-007
    def c3, 0.200000003, 0.100000001, 0, 3
    def c7, 7.5, 3, 0.375, 1.5
    def c8, 5, 2, 0.25, 0
    def c9, 0.816496611, 0.577350259, 0, 0.600000024
    def c10, -0.707106769, -0.408248305, 0.577350259, 0.707106769
    dcl_texcoord2_pp v0.xyz
    dcl_texcoord3_pp v1.xyz
    dcl_texcoord5 v2.w
    dcl_texcoord6 v3.xyz
    dcl_texcoord v4.xy
    dcl_2d s0
    dcl_2d s1
    dcl_2d s2
    dcl_2d s3
    nrm r0.xyz, v3
    texld r1, v4, s0
    mad_pp r1.xyz, r1, c1.x, c1.y
    nrm_pp r2.xyz, r1
    dp3 r0.w, r2, r0
    mul r1.xyz, r0.w, r2
    mad r0.xyz, r1, c1.x, -r0
    dp2add_sat_pp r1.x, r0.yzzw, c9, c9.z
    dp3_sat_pp r1.y, r0, c10
    dp3_sat_pp r1.z, r0.yzxw, c10.yzww
    max r0.xyz, r1, c1.w
    mul r1.xyz, r0, r0
    mul r1.xyz, r1, r1
    mul r1.xyz, r1, r1
    mul r1.xyz, r1, r1
    mul r1.xyz, r1, r1
    mul_pp r0.xyz, r0, r1
    dp3_pp r0.x, v1, r0
    mov r0.y, c3.y
    add r0.z, r0.y, c5.x
    cmp_sat r0.y, c5.x, r0.z, r0.y
    texld r1, v4, s1
    mul r0.y, r0.y, r1.w
    mul r1.xyz, r1, c9.w
    mad r0.yzw, r0.y, c8.xxyz, -r1.xxyz
    mad r0.yzw, r1.w, r0, r1.xxyz
    mul r1.xyz, r0.yzww, r1
    mul_pp r1.xyz, r1, v0
    mul_pp r1.xyz, r1, c3.w
    mul_pp r1.xyz, r0.x, r1
    dp2add_sat_pp r3.x, r2.yzzw, c9, c9.z
    dp3_sat_pp r3.y, r2, c10
    dp3_sat_pp r3.z, r2.yzxw, c10.yzww
    mul_pp r2.xyz, r3, r3
    max_pp r3.xyz, r2, c1.w
    dp3_pp r0.x, v1, r3
    mul r2.xy, c3.w, v4
    texld r2, r2, s3
    mul r2.xyz, r2, c7.w
    mul r0.yzw, r0, r2.xxyz
    mov r2.yz, c1
    add r2.xyw, -r2.y, -c0.xyzz
    mul_pp r0.yzw, r0, r2.xxyw
    mul_pp r2.xyw, r0.yzzw, v0.xyzz
    mad_pp r1.xyz, r2.xyww, r0.x, r1
    mad r2.xy, v4, r2.z, c4
    texld r2, r2, s2
    add r0.x, r2.y, r2.y
    mul r0.x, r1.w, r0.x
    mul r2.xyz, r1.w, c3
    mad r2.xyz, r0.x, c7, r2
    mov r3.xyz, c0
    mad_pp r2.xyz, c5.x, r2, r3
    add_pp r1.xyz, r1, r2
    mad_pp oC0.xyz, r0.yzww, c6, r1
    rcp r0.x, v2.w
    mad_pp oC0.w, c2.x, r0.x, c2.y

// approximately 63 instruction slots used (4 texture, 59 arithmetic)