// --------------------------------------------------------------------------------------- // Light shafts shaders with shadows and noise support // Inpirated on the ATI paper http://ati.amd.com/developer/gdc/mitchell_lightshafts.pdf // Ogre3D implementation by Xavier Verguín González (xavyiy [at] gmail [dot] com) [Xavyiy] // --------------------------------------------------------------------------------------- // --------------------- Light shafts material ------------------------ vertex_program LightShafts/VP/HLSL hlsl { source lightshaft/lightshaftvp.glsl target vs_2_a default_params { param_named_auto uWorld world_matrix param_named_auto uWorldViewProj worldviewproj_matrix } } vertex_program LightShafts/VP/GL glsl glsles glslang { source lightshaft/lightshaftvp.glsl default_params { param_named_auto uWorld world_matrix param_named_auto uWorldViewProj worldviewproj_matrix } } fragment_program LightShafts/FP/HLSL hlsl { source lightshaft/lightshaftfp.glsl target ps_2_a default_params { param_named_auto Time time } } fragment_program LightShafts/FP/GL glsl glsles { source lightshaft/lightshaftfp.glsl default_params { param_named_auto Time time param_named uDepthMap int 0 param_named uCookieMap int 1 param_named uNoiseMap int 2 } } fragment_program LightShafts/FP/GLSLang glslang { source lightshaft/lightshaftfp.glsl default_params { param_named_auto Time time } } vertex_program LightShafts/VP unified { delegate LightShafts/VP/HLSL delegate LightShafts/VP/GL } fragment_program LightShafts/FP unified { delegate LightShafts/FP/HLSL delegate LightShafts/FP/GLSLang delegate LightShafts/FP/GL } material SO3/LightShafts { technique { scheme SO3/LIGHTSHAFT pass { lighting off depth_write off depth_check on scene_blend add transparent_sorting off vertex_program_ref LightShafts/VP { } fragment_program_ref LightShafts/FP { param_named uAttenuation float4 1000.0 0.02 0.02 0.02 param_named uLightPosition float3 0 0 0 param_named uLightColor float4 1 1 1 1 // Light camera/frustum (near+far) clip distance param_named uLightFarClipDistance float 48 param_named_auto Time time } // Depth map, must be fill by code texture_unit { tex_address_mode clamp tex_coord_set 0 texture lightshaft/Cookie0.png } // Projector cookie texture_unit { tex_address_mode clamp texture lightshaft/Cookie0.png } // Noise texture texture_unit { tex_address_mode wrap texture lightshaft/Noise.png } } } } material SO3/LightShaftsRect { technique { scheme SO3/LIGHTSHAFT pass { lighting off depth_write off depth_check on scene_blend add transparent_sorting off vertex_program_ref LightShafts/VP { } fragment_program_ref LightShafts/FP { param_named uAttenuation float4 1000.0 0.02 0.02 0.02 param_named uLightPosition float3 0 0 0 param_named uLightColor float4 1 1 1 1 // Light camera/frustum (near+far) clip distance param_named uLightFarClipDistance float 48 param_named_auto Time time } // Depth map, must be fill by code texture_unit { tex_address_mode clamp tex_coord_set 0 texture lightshaft/Cookie0.png } // Projector cookie texture_unit { tex_address_mode clamp texture lightshaft/Cookie1.png } // Noise texture texture_unit { tex_address_mode wrap texture lightshaft/Noise.png } } } } // --------------------- Depth material ------------------------ vertex_program LightShaftsDepth/VP/HLSL hlsl { source lightshaft/lightshaftdepthvp.glsl target vs_2_a default_params { param_named_auto uWorld world_matrix param_named_auto uWorldViewProj worldviewproj_matrix } } vertex_program LightShaftsDepth/VP/GL glsl glsles glslang { source lightshaft/lightshaftdepthvp.glsl default_params { param_named_auto uWorld world_matrix param_named_auto uWorldViewProj worldviewproj_matrix } } fragment_program LightShaftsDepth/FP/HLSL hlsl { source lightshaft/lightshaftdepthfp.glsl target ps_2_a } fragment_program LightShaftsDepth/FP/GL glsl glsles glslang { source lightshaft/lightshaftdepthfp.glsl } vertex_program LightShaftsDepth/VP unified { delegate LightShaftsDepth/VP/HLSL delegate LightShaftsDepth/VP/GL } fragment_program LightShaftsDepth/FP unified { delegate LightShaftsDepth/FP/HLSL delegate LightShaftsDepth/FP/GL } material SO3/LightShaftsDepth { technique { scheme SO3/LIGHTSHAFT pass { lighting off vertex_program_ref LightShaftsDepth/VP { } fragment_program_ref LightShaftsDepth/FP { param_named uLightPosition float3 0 50 0 // Light camera/frustum (near+far) clip distance param_named uLightFarClipDistance float 48 } } } }