/** * * \brief * Godrays_*.cg is a radial blur based shader implementation of the natural effects of godrays (ray light scattering). * Godrays_raw.cg includes the shader programs for the preparating step. Is only of representative use. * * \author Markus Wegmann * **/ void sun_shader( float4 position : POSITION, float4 normal: NORMAL, out float4 oPosition : POSITION, out float4 oColor : COLOR, uniform float4x4 modelViewProj, uniform float4 sunColor) { oPosition = mul(modelViewProj, position); oColor = 2 * normalize(sunColor); } void obstacle_shader( float4 position : POSITION, out float4 oPosition : POSITION, out float4 oColor: COLOR0, uniform float4x4 modelViewProj) { oPosition = mul(modelViewProj, position); oColor = float4 (0, 0, 0, 1); } /* CgFx based code //// Variables //// ///////////////////////////////////////////////////////////////////////////////////// float4 SunLightColor : Specular < string UIName = "Lamp 0 Color"; string Object = "Pointlight0"; string UIWidget = "Color"; > = {0.3, 0.42, 1, 1}; //// UN-TWEAKABLES - AUTOMATICALLY-TRACKED TRANSFORMS //// float4x4 WorldITXf : WorldInverseTranspose < string UIWidget="None"; >; float4x4 WvpXf : WorldViewProjection < string UIWidget="None"; >; float4x4 VpXf : ViewProjection < string UIWidget="None"; >; float4x4 WorldXf : World < string UIWidget="None"; >; float4x4 ViewIXf : ViewInverse < string UIWidget="None"; >; //// Techniques //// technique SunShader { pass p0 < string Script = "Draw=geometry;"; > { DepthTestEnable = true; DepthMask = true; BlendEnable = true; CullFaceEnable = true; VertexProgram = compile vp40 sun_shader(WvpXf, SunLightColor); } } technique BlackShader { pass p0 < string Script = "Draw=geometry;"; > { DepthTestEnable = true; DepthMask = true; BlendEnable = true; CullFaceEnable = true; VertexProgram = compile vp40 obstacle_shader(WvpXf); } } */