[Orxonox-commit 3661] r8346 - in data/branches/environment: materials programs
marwegma at orxonox.net
marwegma at orxonox.net
Wed Apr 27 21:30:08 CEST 2011
Author: marwegma
Date: 2011-04-27 21:30:08 +0200 (Wed, 27 Apr 2011)
New Revision: 8346
Added:
data/branches/environment/materials/Godrays.material
Modified:
data/branches/environment/programs/Godrays_blur.cg
data/branches/environment/programs/Godrays_raw.cg
Log:
Godrays.material added. Compositor script will follow.
Added: data/branches/environment/materials/Godrays.material
===================================================================
--- data/branches/environment/materials/Godrays.material (rev 0)
+++ data/branches/environment/materials/Godrays.material 2011-04-27 19:30:08 UTC (rev 8346)
@@ -0,0 +1,58 @@
+/**
+*
+* \author Markus Wegmann
+*
+**/
+
+
+material Godrays/Raw/Sun // Renders the sun as a single colored sphere. Z-buffering is enabled.
+{
+ technique
+ {
+ pass
+ {
+ ambient 1.0 1.0 1.0 1.0
+ lightning off
+ }
+ }
+}
+
+material Godrays/Raw/Obstacle // Renders the sun as a single colored sphere. Z-buffering is enabled.
+{
+ technique
+ {
+ pass
+ {
+ ambient 0.0 0.0 0.0 1.0
+ lightning off
+ }
+ }
+}
+
+
+fragment_program GodrayBlurFragmentProgram cg
+{
+ source Godrays_blur.cg
+ entry_point godray_blur
+ profiles ps_3_0 fp40
+}
+
+
+material Godrays/Blur/RadialBlur
+{
+ technique
+ {
+
+ pass
+ {
+ fragment_program_ref GodrayBlurFragmentProgram
+ {
+ param_indexed 0 float2 0.0 0.0
+ param_indexed 1 float 1.0
+ param_indexed 2 float 0.1
+ param_indexed 3 float 0.7
+ // The raw decal has to be loaded manually by api.
+ }
+ }
+ }
+}
Modified: data/branches/environment/programs/Godrays_blur.cg
===================================================================
--- data/branches/environment/programs/Godrays_blur.cg 2011-04-27 13:58:12 UTC (rev 8345)
+++ data/branches/environment/programs/Godrays_blur.cg 2011-04-27 19:30:08 UTC (rev 8346)
@@ -1,8 +1,8 @@
/**
*
-* @brief Godrays_*.cg is a radial blur based shader implementation of the natural effects of godrays (ray light scattering).
+* \brief Godrays_*.cg is a radial blur based shader implementation of the natural effects of godrays (ray light scattering). The vertex function ScreenQuadVS() skips the default wvp-transform, that is irrelevant for screenspace effects.
*
-* @author Markus Wegmann
+* \author Markus Wegmann
*
**/
@@ -24,41 +24,21 @@
return OUT;
}
-OneTexelVertex ScreenQuadVSWithLightPosition(
- float3 Position : POSITION,
- float2 UV : TEXCOORD0,
-
- uniform float4x4 viewProj,
- uniform float4 sunLightPosition,
-
- out float2 projSunLightPosition : TEXCOORD1
-) {
- OneTexelVertex OUT = (OneTexelVertex)0;
- OUT.Position = float4(Position, 1);
- OUT.UV = float2(UV.xy);
-
- projSunLightPosition = (mul(viewProj, float4(0,0,0,1))).xy;
- projSunLightPosition = float2(0.5, 0.5) + projSunLightPosition / 35;
-
- return OUT;
-}
-
//// Fragment Shader ////
void godray_blur(
OneTexelVertex IN,
-
- float2 projSunLightPosition : TEXCOORD1,
out float4 oColor: COLOR,
+ uniform float2 projSunLightPosition,
uniform float exposure,
uniform float decay,
uniform float density,
uniform sampler2D decal)
{
- const int NUM_SAMPLES = 36;
+ const int NUM_SAMPLES = 35;
float2 texCoord = IN.UV;
@@ -112,10 +92,10 @@
string Script = "Technique=Main;";
> = 0.8;
-float4 SunLightPosition : Position <
+float2 ProjSunLightPosition : Position <
string UIName = "Sun Light Position";
string Space = "World";
-> = {0, 0, 0, 1};
+> = {0, 0};
float4 SkyColor <
string UIName = "Sky Color";
@@ -181,11 +161,6 @@
string UIWidget = "None";
> = 1.0;
-float2 ViewportSize : VIEWPORTPIXELSIZE <
- string UIName="Screen Size";
- string UIWidget="None";
->;
-
technique Main <
string Script =
"RenderColorTarget0=ScnTarget;"
@@ -211,8 +186,9 @@
DepthMask = false;
BlendEnable = false;
- VertexShader = compile vp40 ScreenQuadVSWithLightPosition(VpXf, SunLightPosition);
+ VertexShader = compile vp40 ScreenQuadVS();
FragmentProgram = compile fp40 godray_blur(
+ ProjSunLightPosition,
GodrayExposure,
GodrayDecay,
GodrayDensity,
Modified: data/branches/environment/programs/Godrays_raw.cg
===================================================================
--- data/branches/environment/programs/Godrays_raw.cg 2011-04-27 13:58:12 UTC (rev 8345)
+++ data/branches/environment/programs/Godrays_raw.cg 2011-04-27 19:30:08 UTC (rev 8346)
@@ -1,10 +1,10 @@
/**
*
-* @brief
+* \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.
+* Godrays_raw.cg includes the shader programs for the preparating step. Is only of representative use.
*
-* @author Markus Wegmann
+* \author Markus Wegmann
*
**/
More information about the Orxonox-commit
mailing list