[Orxonox-commit 3673] r8357 - in data/branches/environment: materials programs

marwegma at orxonox.net marwegma at orxonox.net
Thu Apr 28 17:41:04 CEST 2011


Author: marwegma
Date: 2011-04-28 17:41:04 +0200 (Thu, 28 Apr 2011)
New Revision: 8357

Added:
   data/branches/environment/materials/Godrays.compositor
Modified:
   data/branches/environment/materials/Godrays.material
   data/branches/environment/programs/Godrays_blur.cg
   data/branches/environment/programs/Godrays_raw.cg
Log:
Godrays.compositor added, extended Godrays.material, unified the Godrays code a bit.

Added: data/branches/environment/materials/Godrays.compositor
===================================================================
--- data/branches/environment/materials/Godrays.compositor	                        (rev 0)
+++ data/branches/environment/materials/Godrays.compositor	2011-04-28 15:41:04 UTC (rev 8357)
@@ -0,0 +1,63 @@
+compositor Godrays
+{
+    technique
+    {
+        texture rt_scene target_width target_height PF_A8R8G8B8
+        
+        target rt_scene
+        {
+            input previous
+        }
+
+        texture rt_raw target_width target_height PF_A8R8G8B8
+        
+        target rt_raw
+        {
+            clear
+            {
+                buffers colour
+                colour_value 0.0 0.0 0.0 1.0 // Clear by sky colour. Default is black.
+            }
+
+            render_scene // render_custom?
+            {
+                first_render_queue 40
+                last_render_queue 40
+
+                material Godrays/Raw/Obstacle
+            }
+
+            render_scene
+            {
+                first_render_queue 60
+                last_render_queue 60
+
+                material Godrays/Raw/Sun
+            }
+        }
+
+        texture rt_blur target_width target_height PF_A8R8G8B8
+
+        target rt_blur
+        {
+            render_quad
+            {
+                material Godrays/Blur
+
+                input 0 rt_raw
+            }
+        }
+        
+
+        target_output
+        {
+            render_quad
+            {
+                material Godrays/Combine
+                
+                input 0 rt_blur
+                input 1 rt_godrays
+            }
+        }
+    }
+}
\ No newline at end of file

Modified: data/branches/environment/materials/Godrays.material
===================================================================
--- data/branches/environment/materials/Godrays.material	2011-04-28 14:29:37 UTC (rev 8356)
+++ data/branches/environment/materials/Godrays.material	2011-04-28 15:41:04 UTC (rev 8357)
@@ -1,5 +1,5 @@
 /**
-*
+* 
 * \author Markus Wegmann
 *
 **/
@@ -30,29 +30,47 @@
 }
 
 
-fragment_program GodrayBlurFragmentProgram cg
+fragment_program GodraysBlurFragmentProgram cg
 {
     source Godrays_blur.cg
-    entry_point godray_blur
-    profiles ps_3_0 fp40
+    entry_point godrays_blur
+    profiles fp40 ps_3_0
 }
 
 
-material Godrays/Blur/RadialBlur
+
+material Godrays/Blur
 {
     technique
     {
         
         pass
         {
-            fragment_program_ref GodrayBlurFragmentProgram
+            fragment_program_ref GodraysBlurFragmentProgram
             { 
                 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.
             }
         }
     }
 }
+
+fragment_program GodraysCombineFragmentProgram cg
+{
+    source Godrays_blur.cg
+    entry_point godrays_combine
+    profiles fp40 ps_3_0
+}
+
+material Godrays/Combine
+{
+    technique
+    {
+        pass
+        {  
+            fragment_program_ref GodraysCombineFragmentProgram { }
+        }
+    }
+}

Modified: data/branches/environment/programs/Godrays_blur.cg
===================================================================
--- data/branches/environment/programs/Godrays_blur.cg	2011-04-28 14:29:37 UTC (rev 8356)
+++ data/branches/environment/programs/Godrays_blur.cg	2011-04-28 15:41:04 UTC (rev 8357)
@@ -1,6 +1,6 @@
 /**
 *
-* \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.
+* \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, what is irrelevant in Ogre when doing a "render_quad"-pass... just to say!
 *
 * \author Markus Wegmann
 *
@@ -26,7 +26,7 @@
 
 //// Fragment Shader ////
 
-void godray_blur(
+void godrays_blur(
         OneTexelVertex IN,
 		
         out float4 oColor: COLOR,
@@ -65,7 +65,7 @@
 }
 
 
-void combineRenderAndGodrays(
+void godrays_combine(
 	OneTexelVertex IN,
 
     out float4 color : COLOR,
@@ -102,9 +102,9 @@
 	string UIWidget = "Color";
 > = {0f,0f,0f,1.0f};
 
-float GodrayExposure = 1f;
-float GodrayDecay = 0.1f;
-float GodrayDensity = 0.7f;
+float GodraysExposure = 1f;
+float GodraysDecay = 0.1f;
+float GodraysDensity = 0.7f;
 
 texture ScnTarget : RenderColorTarget <
 	float2 ViewPortRatio = {1,1};
@@ -121,15 +121,15 @@
     MagFilter = Linear;
 };
 
-texture GodrayTarget : RenderColorTarget <
+texture GodraysTarget : RenderColorTarget <
 	float2 ViewPortRatio = {1,1};
     int MipLevels = 1;
     string Format = "X8R8G8B8" ;
     string UIWidget = "None";
 >;
 
-sampler2D GodrayDecal = sampler_state {
-    Texture = <GodrayTarget>;
+sampler2D GodraysDecal = sampler_state {
+    Texture = <GodraysTarget>;
 	WrapS = ClampToEdge;
     WrapT = ClampToEdge;
     MinFilter = Linear;
@@ -187,11 +187,11 @@
 		BlendEnable = false;
 		
 		VertexShader = compile vp40 ScreenQuadVS();
-    	FragmentProgram = compile fp40 godray_blur(
+    	FragmentProgram = compile fp40 godrays_blur(
             ProjSunLightPosition,
-			GodrayExposure, 
-			GodrayDecay, 
-			GodrayDensity,
+			GodraysExposure, 
+			GodraysDecay, 
+			GodraysDensity,
 			ScnDecal);
   	}
 	
@@ -207,9 +207,9 @@
 		BlendEnable = false;
 		
 		VertexShader = compile vp40 ScreenQuadVS();
-    	FragmentProgram = compile fp40 combineRenderAndGodrays(
+    	FragmentProgram = compile fp40 godrays_combine(
 			ScnDecal,
-			GodrayDecal);
+			GodraysDecal);
   	}
 }
 

Modified: data/branches/environment/programs/Godrays_raw.cg
===================================================================
--- data/branches/environment/programs/Godrays_raw.cg	2011-04-28 14:29:37 UTC (rev 8356)
+++ data/branches/environment/programs/Godrays_raw.cg	2011-04-28 15:41:04 UTC (rev 8357)
@@ -24,7 +24,7 @@
 }
 
 
-void black_shader(
+void obstacle_shader(
     float4 position : POSITION,
 
     out float4 oPosition : POSITION,
@@ -83,7 +83,7 @@
 			BlendEnable = true;
 			CullFaceEnable = true;
 		
-			VertexProgram = compile vp40 black_shader(WvpXf);
+			VertexProgram = compile vp40 obstacle_shader(WvpXf);
   		}
 }
 




More information about the Orxonox-commit mailing list