Changeset 1339 for GTP/trunk/App
- Timestamp:
- 09/11/06 23:09:16 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_HPS_Smoke_S.hlsl
r1336 r1339 2 2 struct VS_OUT 3 3 { 4 float4 hPosition : POSITION; 5 float4 cPosition : TEXCOORD0; 6 float radius : TEXCOORD2; 7 float4 texCoord : TEXCOORD1; 4 float4 hPosition : POSITION; 5 float4 cPosition : TEXCOORD1; 6 float2 texCoord : TEXCOORD0; 7 float r : TEXCOORD2; 8 float4 center : TEXCOORD3; 8 9 }; 9 10 10 VS_OUT VP(float4 mPosition : POSITION, 11 uniform float4x4 worldView, 12 uniform float4x4 Proj, 13 uniform float4x4 worldViewProj 14 float2 texCoord :TEXCOORD0) 11 VS_OUT HPS_Smoke_S_VS (float4 position : POSITION, 12 float4 texCoord : TEXCOORD0, 13 14 uniform float4x4 worldView, 15 uniform float4x4 Proj, 16 uniform float4x4 worldViewProj) 15 17 { 16 VS_OUT Out; 17 Out.texCoord.xy = texCoord; 18 Out.texCoord.zw = (texCoord * 2.0) - 1.0; 18 VS_OUT OUT; 19 20 float2 offset = texCoord.zw; 21 float4 cPosition; 22 cPosition = mul(worldView, position); 23 OUT.center = cPosition; 24 cPosition.xy += offset; 25 OUT.cPosition = cPosition; 26 OUT.r = abs(texCoord.z); 19 27 20 float2 offset = texCoord.zw; 21 float4 cPosition = mul(worldView, mPosition); 22 cPosition.xy += offset; 23 24 Out.hPosition = mul( Proj, cPosition ); 25 Out.cPosition = cPosition; 26 Out.radius = abs(offset.x); 27 28 return OUT; 28 OUT.hPosition = mul( Proj, cPosition ); 29 30 OUT.texCoord = texCoord.xy; 31 return OUT; 32 } 33 34 35 float4 HPS_Smoke_S_PS(VS_OUT IN, 36 uniform float4x4 Proj, 37 uniform sampler2D Texture ) : COLOR 38 { 39 float4 Color = 0; 40 float f = 0; 41 float b = 1; 42 float alpha = 0; 43 44 float d = length( IN.cPosition.xyz - IN.center.xyz); 45 46 if( d < IN.r ) 47 { 48 float w = sqrt( IN.r * IN.r - d * d ); 49 float4 fPosition = IN.cPosition; 50 float4 bPosition = IN.cPosition; 51 fPosition.z -= w; 52 bPosition.z += w; 53 fPosition = mul(Proj, fPosition); 54 bPosition = mul(Proj, bPosition); 55 f = (fPosition.z / fPosition.w + 1.0) / 2.0; 56 b = (bPosition.z / bPosition.w + 1.0) / 2.0; 57 alpha = w / IN.r; 58 } 59 else 60 discard; 61 62 Color.r = f; 63 Color.g = 1 - b; 64 Color.a = alpha; 65 66 67 return Color; 29 68 } 30 31 float4 FP(VS_OUT In,32 uniform float4x4 Proj,33 uniform sampler2D Texture):COLOR34 {35 float4 color = 1;36 float front = 0;37 float back = 1;38 39 float4 tex = tex2D(Texture, In.texCoord.xy);40 float d = length(In.TexCoord.zw);41 float w = sqrt(In.radius * In.radius - d * d);42 if(d < r)43 {44 float4 positionF; float4 positionB;45 positionF = positionB = In.cPosition;46 positionF.z -= w;47 positionB.z += w;48 positionF = mul(Proj, positionF);49 positionB = mul(Proj, positionB);50 positionF = (positionF / positionF.w + 1.0) / 2.0;51 positionB = (positionB / positionB.w + 1.0) / 2.0;52 }53 color.rgb = positionF.z;54 55 return color;56 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools_HPS.material
r1336 r1339 2 2 { 3 3 source GameTools_HPS_Smoke_S.hlsl 4 entry_point VP5 target vs_ 2_04 entry_point HPS_Smoke_S_VS 5 target vs_3_0 6 6 } 7 7 … … 9 9 { 10 10 source GameTools_HPS_Smoke_S.hlsl 11 entry_point FP11 entry_point HPS_Smoke_S_PS 12 12 target ps_3_0 13 13 } 14 14 15 16 17 material HPS_SMOKE_S 18 { 19 technique 20 { 21 pass 22 { 23 vertex_program_ref HPS_Smoke_S_VS 24 { 25 param_named_auto worldViewProj worldviewproj_matrix 26 param_named_auto worldView worldview_matrix 27 param_named_auto Proj projection_matrix 28 } 29 fragment_program_ref HPS_Smoke_S_PS 30 { 31 param_named_auto Proj projection_matrix 32 } 33 34 depth_check off 35 //scene_blend_op min 36 //scene_blend_op_alpha add 37 scene_blend one one 38 39 } 40 } 41 } 42 43 44 vertex_program HPS_Smoke_L_VS hlsl 45 { 46 source GameTools_HPS_Smoke_L.hlsl 47 entry_point HPS_Smoke_L_VS 48 target vs_3_0 49 } 50 51 fragment_program HPS_Smoke_L_PS hlsl 52 { 53 source GameTools_HPS_Smoke_L.hlsl 54 entry_point HPS_Smoke_L_PS 55 target ps_3_0 56 } 57 58 59 60 material HPS_SMOKE_L 61 { 62 technique 63 { 64 pass 65 { 66 IllumTechniques 67 { 68 RenderTechnique HPS 69 { 70 particle_script GameTools/Little 71 perspective false 72 } 73 } 74 75 vertex_program_ref HPS_Smoke_L_VS 76 { 77 param_named_auto worldViewProj worldviewproj_matrix 78 param_named_auto worldView worldview_matrix 79 param_named_auto Proj projection_matrix 80 } 81 fragment_program_ref HPS_Smoke_L_PS 82 { 83 param_named_auto Proj projection_matrix 84 } 85 86 //depth_check off 87 //scene_blend_alpha add 88 89 texture_unit 90 { 91 92 } 93 94 } 95 } 96 } 97 98 99 -
GTP/trunk/App/Demos/Illum/Ogre/Media/particle/GameTools.particle
r1336 r1339 1 1 GameTools/DemoParticle1 2 2 { 3 //renderer sprite4 //material GameTools/SpriteShader5 material GameTools/HPS3 renderer sprite 4 material GameTools/SBB 5 //material GameTools/HPS 6 6 particle_width 200 7 7 particle_height 200 … … 44 44 GameTools/Big 45 45 { 46 material GameTools/HPS 46 //material GameTools/HPS 47 material HPS_SMOKE_L 47 48 //material Flare 48 49 particle_width 200 … … 87 88 GameTools/Little 88 89 { 89 material Flare 90 //material Flare 91 material HPS_SMOKE_S 92 renderer sprite 90 93 particle_width 20 91 94 particle_height 20
Note: See TracChangeset
for help on using the changeset viewer.