[Orxonox-commit 3190] r7883 - in data/trunk: materials programs

landauf at orxonox.net landauf at orxonox.net
Mon Feb 14 12:15:39 CET 2011


Author: landauf
Date: 2011-02-14 12:15:39 +0100 (Mon, 14 Feb 2011)
New Revision: 7883

Added:
   data/trunk/programs/BloomFP.cg
Modified:
   data/trunk/materials/Bloom.material
   data/trunk/materials/Shaders.compositor
Log:
no fucking clue what I'm doing here, but it looks like I just fixed the Bloom shader in combination with a GUI

(the old implementation used a material with alpha_blend for the compositor's output, hence Ogre rendered the GUI first and the shader afterward. the new implementation uses a cg program to create the bloom effect which seems to work)

Modified: data/trunk/materials/Bloom.material
===================================================================
--- data/trunk/materials/Bloom.material	2011-02-14 08:00:48 UTC (rev 7882)
+++ data/trunk/materials/Bloom.material	2011-02-14 11:15:39 UTC (rev 7883)
@@ -68,7 +68,7 @@
 			}
 			texture_unit RT
 			{
-                tex_coord_set 0
+				tex_coord_set 0
 				tex_address_mode clamp
 				filtering linear linear linear
 			}
@@ -91,7 +91,7 @@
 			}
 			texture_unit RT
 			{
-                tex_coord_set 0
+				tex_coord_set 0
 				tex_address_mode clamp
 				filtering linear linear linear
 			}
@@ -119,7 +119,7 @@
 			}
 			texture_unit
 			{
-                tex_coord_set 0
+				tex_coord_set 0
 				tex_address_mode clamp
 				filtering linear linear linear
 			}
@@ -143,7 +143,7 @@
 			}
 			texture_unit
 			{
-                tex_coord_set 0
+				tex_coord_set 0
 				tex_address_mode clamp
 				filtering linear linear linear
 			}
@@ -151,28 +151,45 @@
 	}
 }
 
-/// Overlay quad
+fragment_program Ogre/Compositor/BloomFP cg
+{
+	source BloomFP.cg
+	entry_point Bloom_ps
+	profiles ps_2_0 arbfp1
+}
+
 material Ogre/Compositor/BloomBlend
 {
-    technique
-    {
-        pass
-        {
-            lighting on
-            diffuse 0.0 0.0 0.0 0.5
-            specular 0.0 0.0 0.0 0.0
-            ambient 0.0 0.0 0.0
-            emissive 1.0 1.0 1.0
-            cull_hardware none
-            depth_check off
-            scene_blend alpha_blend
+	technique
+	{
 
-            texture_unit
-            {
-                tex_coord_set 0
+		pass
+		{
+			cull_hardware none
+			cull_software none
+			depth_func always_pass
+
+			vertex_program_ref Ogre/Compositor/StdQuad_Tex2a_vp
+			{
+			}
+
+			fragment_program_ref Ogre/Compositor/BloomFP
+			{
+			}
+
+			texture_unit
+			{
+				tex_coord_set 0
 				tex_address_mode clamp
-				filtering linear linear linear
-            }
-        }
-    }
+				filtering trilinear
+			}
+
+			texture_unit
+			{
+				tex_coord_set 0
+				tex_address_mode clamp
+				filtering trilinear
+			}
+		}
+	}
 }

Modified: data/trunk/materials/Shaders.compositor
===================================================================
--- data/trunk/materials/Shaders.compositor	2011-02-14 08:00:48 UTC (rev 7882)
+++ data/trunk/materials/Shaders.compositor	2011-02-14 11:15:39 UTC (rev 7883)
@@ -5,10 +5,11 @@
     technique
     {
         // Temporary textures
-        texture rt0 128 128 PF_A8R8G8B8
-        texture rt1 128 128 PF_A8R8G8B8
+        texture rt_output target_width target_height PF_R8G8B8
+        texture rt0 128 128 PF_R8G8B8
+        texture rt1 128 128 PF_R8G8B8
 
-        target rt1
+        target rt_output
         {
             // Render output from previous compositor (or original scene)
             input previous
@@ -23,7 +24,7 @@
             {
                 // Renders a fullscreen quad with a material
                 material Ogre/Compositor/Blur0
-                input 0 rt1
+                input 0 rt_output
             }
         }
 
@@ -43,13 +44,14 @@
         target_output
         {
             // Start with clear output
-            input previous
+            input none
             // Draw a fullscreen quad
             pass render_quad
             {
                 // Renders a fullscreen quad with a material
                 material Ogre/Compositor/BloomBlend
-                input 0 rt1
+                input 0 rt_output
+                input 1 rt1
             }
         }
     }

Added: data/trunk/programs/BloomFP.cg
===================================================================
--- data/trunk/programs/BloomFP.cg	                        (rev 0)
+++ data/trunk/programs/BloomFP.cg	2011-02-14 11:15:39 UTC (rev 7883)
@@ -0,0 +1,7 @@
+sampler RT1 : register(s0);
+sampler RT2 : register(s1);
+
+float4 Bloom_ps (float2 iTexCoord : TEXCOORD0) : COLOR
+{
+	return 0.5*tex2D(RT1, iTexCoord) + 0.5*tex2D(RT2, iTexCoord);
+}




More information about the Orxonox-commit mailing list