Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // MATERIAL
- vertex_program snowshader_VS cg
- {
- source snowshader.cg
- entry_point snowshader_vp
- profiles vs_1_1
- default_params
- {
- param_named_auto worldViewProj worldviewproj_matrix
- param_named_auto eyePosition camera_position_object_space
- }
- }
- fragment_program snowshader_PS cg
- {
- source snowshader.cg
- entry_point snowshader_fp
- profiles ps_1_1
- default_params
- {
- param_named_auto scroll time_0_x 20
- param_named speed float 0.05
- }
- }
- material particle_snowflakes_shader
- {
- receive_shadows off
- technique
- {
- pass
- {
- scene_blend alpha_blend
- lighting off
- fog_override true
- cull_hardware none
- cull_software none
- depth_write off
- vertex_program_ref snowshader_VS
- {
- }
- fragment_program_ref snowshader_PS
- {
- }
- texture_unit
- {
- texture particle_snowflakes3.png
- }
- }
- }
- }
- material particle_snowflakes_basic
- {
- receive_shadows off
- technique
- {
- pass
- {
- scene_blend alpha_blend
- lighting off
- fog_override true
- cull_hardware none
- cull_software none
- depth_write off
- texture_unit
- {
- texture particle_snowflakes3.png
- scroll_anim 0.1 0.7
- }
- }
- }
- }
- // CG
- void snowshader_vp(
- float4 in_POSITION : POSITION,
- float2 in_UV0 : TEXCOORD0,
- float3 in_COLOR : COLOR,
- out float4 out_POSITION : POSITION,
- out float2 out_UV0 : TEXCOORD0,
- out float4 out_COLOR : COLOR,
- uniform float4x4 worldViewProj,
- uniform float4 eyePosition
- )
- {
- out_POSITION = mul(worldViewProj, in_POSITION);
- out_UV0 = in_UV0;
- float A = max(0, 1-((distance(eyePosition, in_POSITION)-6000)/2000));
- out_COLOR = float4(in_COLOR, A);
- }
- void snowshader_fp(
- float2 fp_in_UV0 : TEXCOORD0,
- float4 fp_in_COLOR : COLOR,
- out float4 fp_out_COLOR : COLOR,
- float scroll,
- float speed,
- uniform sampler2D texture
- )
- {
- fp_in_UV0.y += scroll * speed;
- fp_out_COLOR = tex2D(texture, fp_in_UV0);
- /* fp_out_COLOR.a = 1; fp_in_COLOR.a; */
- }
Advertisement
Add Comment
Please, Sign In to add comment