struct VertexOut { float4 VertexPosition :POSITION; float2 TexCoord :TEXCOORD; float4 Color1 :COLOR; }; /* Vertex program for displaying particle system with rectangle rendertexture */ VertexOut VertexProgram( float4 Position :POSITION, float4 Texcoord: TEXCOORD, uniform float transparency, uniform float4x4 ModelViewProj :state.matrix.mvp ) { VertexOut Out; Out.VertexPosition=mul(ModelViewProj, Position); Out.TexCoord=Texcoord.xy; Out.Color1=float4(transparency,transparency,transparency,transparency); float z=(Out.VertexPosition.z/Out.VertexPosition.w+1)/2; float4 planes=float4(0.33,0.5,0.66,1); if(z>planes.x) { Out.Color1.r=0; } if(z>planes.y) { Out.Color1.g=0; } if(z>planes.z) { Out.Color1.b=0; } return Out; } /* Fragment program for displaying particle system with rectangle rendertexture */ void FragmentProgram( VertexOut In, uniform sampler2D Texture, uniform samplerRECT PhaseTexture, uniform float Albedo, uniform float Symmetry, out float4 Color:COLOR ) { float4 extintion=tex2D(Texture,In.TexCoord).r*In.Color1; float scattered=Albedo*texRECT(PhaseTexture,float2(Symmetry,1)*256)/1.5; Color=1-extintion+extintion*scattered; //Color=float4(0,0,0,0); }