Difference between revisions of "User:4everAwake"
From Bo3b's School for Shaderhackers
4everAwake (Talk | contribs) |
4everAwake (Talk | contribs) |
||
(3 intermediate revisions by one user not shown) | |||
Line 71: | Line 71: | ||
<br> | <br> | ||
[[File:TheBall03 4ever.jpg|700px]] | [[File:TheBall03 4ever.jpg|700px]] | ||
+ | <br> | ||
+ | == Lesson 4 == | ||
+ | <nowiki>[General] | ||
+ | UseRenderedShaders=true | ||
+ | DumpAll=false | ||
+ | DefVSConst1 = 220 | ||
+ | DefPSConst1 = 220 | ||
+ | PresetsKeysList = 1;2; | ||
+ | |||
+ | [KEY1] | ||
+ | ;'Q' key (toggles bloom) | ||
+ | Key = 81 | ||
+ | Presets = 1;2; | ||
+ | Type = 1 | ||
+ | |||
+ | [PRES1] | ||
+ | Const1 = 0x3f800000 | ||
+ | |||
+ | [PRES2] | ||
+ | Const1 = 0x00000000 | ||
+ | UseByDef=True | ||
+ | |||
+ | [KEY2] | ||
+ | ;'U' key (toggles fog) | ||
+ | Key = 81 | ||
+ | Presets = 3;4; | ||
+ | Type = 1 | ||
+ | |||
+ | [PRES3] | ||
+ | Const2 = 0x3f800000 | ||
+ | |||
+ | [PRES4] | ||
+ | Const2 = 0x00000000 | ||
+ | UseByDef=True</nowiki> | ||
+ | <br> | ||
+ | == Lesson 5 == | ||
+ | fixed water reflection: | ||
+ | <br> | ||
+ | [[File:TheBall05 4ever.jpg|700px]] | ||
+ | <br> | ||
+ | == Lesson 6 == | ||
+ | fixed oil pool: | ||
+ | <br> | ||
+ | [[File:TheBall06 4ever.jpg|700px]] | ||
+ | <br> |
Latest revision as of 08:23, 23 September 2014
Lesson 0
Lesson 1
// The Ball- This shader controls DOF // Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022 // // Parameters: // // float4 SampleOffsets[2]; // // // Registers: // // Name Reg Size // ------------- ----- ---- // SampleOffsets c6 2 // vs_3_0 dcl_position v0 dcl_texcoord v1 dcl_texcoord o0 dcl_texcoord1 o1 dcl_position o2 add o0, c6, v1.xyyx add o1, c7, v1.xyyx mov o2, v0 // approximately 3 instruction slots used
Lesson 2
Lesson 3
//PS A977E84A ps_3_0 def c1, 0.5, 1, -0.5, 0 def c2, 3, 0, 0, 0 def c200, 0, 1, 0.0625, 0 // x=0 for comparison to Const1 dcl_texcoord v0.xy dcl_texcoord1 v1 dcl_texcoord2 v2.y dcl_texcoord4 v3.w dcl_2d s0 add r0.xy, c1.z, v0 mov r0.w, c1.w dp2add r1.x, c5, r0, r0.w dp2add r1.y, c6, r0, r0.w add r0.xy, r1, c1.x texld r0, r0, s0 mad_sat r0.y, v2.y, -c1.x, c1.y mul r0.yzw, r0.y, v1.xxyz mul r0.yzw, r0, v1.w mul_sat r0.xyz, r0.yzww, r0.x mul r1.xyz, r0, c4 mad r0.xyz, c4, -r0, r0 mad r0.xyz, c8.x, r0, r1 mul r0.xyz, r0, c4.w mul r0.xyz, r0, c7 mov r1.x, c2.x mad_pp r0.xyz, r0, r1.x, c0 mul_pp oC0.xyz, r0, v3.w mov oC0.w, c1.w mov r30.x, c220.x if_eq r30.x, c200.x mov oC0.xyzw, c200.ywyw //if button is held, change color endif
Lesson 4
[General] UseRenderedShaders=true DumpAll=false DefVSConst1 = 220 DefPSConst1 = 220 PresetsKeysList = 1;2; [KEY1] ;'Q' key (toggles bloom) Key = 81 Presets = 1;2; Type = 1 [PRES1] Const1 = 0x3f800000 [PRES2] Const1 = 0x00000000 UseByDef=True [KEY2] ;'U' key (toggles fog) Key = 81 Presets = 3;4; Type = 1 [PRES3] Const2 = 0x3f800000 [PRES4] Const2 = 0x00000000 UseByDef=True