[Orxonox-commit 6427] r11084 - in data/trunk: images/effects images/textures materials programs

landauf at orxonox.net landauf at orxonox.net
Sat Jan 23 20:41:19 CET 2016


Author: landauf
Date: 2016-01-23 20:41:18 +0100 (Sat, 23 Jan 2016)
New Revision: 11084

Added:
   data/trunk/images/effects/backlightflare_glow.png
   data/trunk/images/effects/backlighttrail_glow.png
   data/trunk/images/effects/bigflare1_glow.png
   data/trunk/images/effects/explosion3_glow.png
   data/trunk/images/textures/laserbeam_glow.png
   data/trunk/materials/glow.compositor
   data/trunk/materials/glow.program
   data/trunk/programs/glow.cg
Modified:
   data/trunk/materials/Flares.material
   data/trunk/materials/PE_materials.material
   data/trunk/materials/Trail.material
   data/trunk/materials/laserbeam.material
Log:
added glow shader & textures

Added: data/trunk/images/effects/backlightflare_glow.png
===================================================================
(Binary files differ)


Property changes on: data/trunk/images/effects/backlightflare_glow.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: data/trunk/images/effects/backlighttrail_glow.png
===================================================================
(Binary files differ)


Property changes on: data/trunk/images/effects/backlighttrail_glow.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: data/trunk/images/effects/bigflare1_glow.png
===================================================================
(Binary files differ)


Property changes on: data/trunk/images/effects/bigflare1_glow.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: data/trunk/images/effects/explosion3_glow.png
===================================================================
(Binary files differ)


Property changes on: data/trunk/images/effects/explosion3_glow.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: data/trunk/images/textures/laserbeam_glow.png
===================================================================
(Binary files differ)


Property changes on: data/trunk/images/textures/laserbeam_glow.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: data/trunk/materials/Flares.material
===================================================================
--- data/trunk/materials/Flares.material	2016-01-21 12:59:04 UTC (rev 11083)
+++ data/trunk/materials/Flares.material	2016-01-23 19:41:18 UTC (rev 11084)
@@ -125,8 +125,26 @@
 			{
 				texture backlightflare.png
 			}
+
+			emissive 1 1 1
 		}
 	}
+
+	technique
+	{
+		scheme glow
+		pass
+		{
+			texture_unit
+			{
+				texture backlightflare_glow.png
+			}
+			ambient 1 1 1
+			diffuse 1 1 1
+			specular 0 0 0 1
+			emissive 1 1 1
+		}
+	}
 }
 
 material Flares/ThrusterFlare1
@@ -143,8 +161,26 @@
 			{
 				texture bigflare1.png
 			}
+
+			emissive 1 1 1
 		}
 	}
+
+	technique
+	{
+		scheme glow
+		pass
+		{
+			texture_unit
+			{
+				texture bigflare1_glow.png
+			}
+			ambient 1 1 1
+			diffuse 1 1 1
+			specular 0 0 0 1
+			emissive 1 1 1
+		}
+	}
 }
 
 material Flares/LightningBall_1

Modified: data/trunk/materials/PE_materials.material
===================================================================
--- data/trunk/materials/PE_materials.material	2016-01-21 12:59:04 UTC (rev 11083)
+++ data/trunk/materials/PE_materials.material	2016-01-23 19:41:18 UTC (rev 11084)
@@ -194,8 +194,26 @@
 			{
 				texture explosion3.png
 			}
+
+			emissive 1 1 1
 		}
 	}
+
+	technique
+	{
+		scheme glow
+		pass
+		{
+			texture_unit
+			{
+				texture explosion3_glow.png
+			}
+			ambient 1 1 1
+			diffuse 1 1 1
+			specular 0 0 0 1
+			emissive 1 1 1
+		}
+	}
 }
 
 material PE/ringflare

Modified: data/trunk/materials/Trail.material
===================================================================
--- data/trunk/materials/Trail.material	2016-01-21 12:59:04 UTC (rev 11083)
+++ data/trunk/materials/Trail.material	2016-01-23 19:41:18 UTC (rev 11084)
@@ -13,8 +13,26 @@
 			{
 				texture backlighttrail.png
 			}
+
+			emissive 1 1 1
 		}
 	}
+
+	technique
+	{
+		scheme glow
+		pass
+		{
+			texture_unit
+			{
+				texture backlighttrail_glow.png
+			}
+			ambient 1 1 1
+			diffuse 1 1 1
+			specular 0 0 0 1
+			emissive 1 1 1
+		}
+	}
 }
 
 

Added: data/trunk/materials/glow.compositor
===================================================================
--- data/trunk/materials/glow.compositor	                        (rev 0)
+++ data/trunk/materials/glow.compositor	2016-01-23 19:41:18 UTC (rev 11084)
@@ -0,0 +1,63 @@
+compositor Glow
+{
+	technique
+	{
+		texture rt_output target_width target_height PF_A8R8G8B8
+		texture glowMap target_width_scaled 0.25 target_height_scaled 0.25 PF_A8R8G8B8
+		texture blurX target_width_scaled 0.25 target_height_scaled 0.25 PF_A8R8G8B8
+		texture blurXY target_width_scaled 0.25 target_height_scaled 0.25 PF_A8R8G8B8
+
+		//Fetch scene contents.
+		target rt_output
+		{
+			input previous
+		}
+
+		//Get scene rendered with 'Glow' scheme
+		target glowMap
+		{
+			input none
+			material_scheme glow
+			pass clear
+			{
+			}
+			pass render_scene
+			{
+			}
+		}
+
+		//Blur it along X.
+		target blurX
+		{
+			input none
+			pass render_quad
+			{
+				material GlowCompositorMat/GlowX
+				input 0 glowMap
+			}
+		}
+
+		//Blur it along Y.
+		target blurXY
+		{
+			input none
+			pass render_quad
+			{
+				material GlowCompositorMat/GlowY
+				input 0 blurX
+			}
+		}
+
+		//add to original, and output.
+		target_output
+		{
+			input none
+			pass render_quad
+			{
+				material GlowCompositorMat/GlowBlend
+				input 0 rt_output
+				input 1 blurXY
+			}
+		}
+	}
+}

Added: data/trunk/materials/glow.program
===================================================================
--- data/trunk/materials/glow.program	                        (rev 0)
+++ data/trunk/materials/glow.program	2016-01-23 19:41:18 UTC (rev 11084)
@@ -0,0 +1,112 @@
+fragment_program GlowX_fp cg
+{
+	source glow.cg
+	entry_point GlowX_fp
+
+		default_params
+		{
+			param_named_auto invTexSize inverse_texture_size 0
+		}
+
+	profiles ps_2_0 arbfp1
+}
+
+material GlowCompositorMat/GlowX
+{
+	technique
+	{
+		pass
+		{
+			cull_hardware none
+			cull_software none
+			depth_func always_pass
+
+			fragment_program_ref GlowX_fp
+			{
+			}
+
+			texture_unit
+			{
+				tex_coord_set 0
+				tex_address_mode clamp
+				filtering linear linear linear
+			}
+		}
+	}
+}
+
+fragment_program GlowY_fp cg
+{
+	source glow.cg
+	entry_point GlowY_fp
+
+		default_params
+		{
+			param_named_auto invTexSize inverse_texture_size 0
+		}
+
+	profiles ps_2_0 arbfp1
+}
+
+material GlowCompositorMat/GlowY
+{
+	technique
+	{
+		pass
+		{
+			cull_hardware none
+			cull_software none
+			depth_func always_pass
+
+			fragment_program_ref GlowY_fp
+			{
+			}
+
+			texture_unit
+			{
+				tex_coord_set 0
+				tex_address_mode clamp
+				filtering linear linear linear
+			}
+		}
+	}
+}
+
+fragment_program GlowBlend_fp cg
+{
+	source glow.cg
+	entry_point GlowBlend_fp
+
+	profiles ps_2_0 arbfp1
+}
+
+material GlowCompositorMat/GlowBlend
+{
+	technique
+	{
+		pass
+		{
+			cull_hardware none
+			cull_software none
+			depth_func always_pass
+
+			fragment_program_ref GlowBlend_fp
+			{
+			}
+
+			texture_unit
+			{
+					tex_coord_set 0
+					tex_address_mode clamp
+					filtering trilinear
+			}
+
+			texture_unit
+			{
+					tex_coord_set 0
+					tex_address_mode clamp
+					filtering trilinear
+			}
+		}
+	}
+}


Property changes on: data/trunk/materials/glow.program
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: data/trunk/materials/laserbeam.material
===================================================================
--- data/trunk/materials/laserbeam.material	2016-01-21 12:59:04 UTC (rev 11083)
+++ data/trunk/materials/laserbeam.material	2016-01-23 19:41:18 UTC (rev 11084)
@@ -12,7 +12,23 @@
 				texture laserbeam.png
 				colour_op modulate
 			}
+			emissive 1 1 1
 		}
+	}
 
+	technique
+	{
+		scheme glow
+		pass
+		{
+			texture_unit
+			{
+				texture laserbeam_glow.png
+			}
+			ambient 1 1 1
+			diffuse 1 1 1
+			specular 0 0 0 1
+			emissive 1 1 1
+		}
 	}
 }

Added: data/trunk/programs/glow.cg
===================================================================
--- data/trunk/programs/glow.cg	                        (rev 0)
+++ data/trunk/programs/glow.cg	2016-01-23 19:41:18 UTC (rev 11084)
@@ -0,0 +1,72 @@
+//A.
+float4 GlowX_fp
+	(
+		float2 uv: TEXCOORD0,
+
+		uniform sampler2D scene: register(s0),
+		uniform float4 invTexSize
+	) : COLOR
+#define RENDER_SCENE 1
+#define BLUR_RADIUS 1
+{
+	float4 colour = float4(0);
+	float blurSize = BLUR_RADIUS * invTexSize.x;
+
+	//X-blur.
+	int x = uv.x/blurSize;
+	colour += tex2D(scene, float2((x - 4.0) * blurSize, uv.y)) * 1.0/25.0;
+	colour += tex2D(scene, float2((x - 3.0) * blurSize, uv.y)) * 2.0/25.0;
+	colour += tex2D(scene, float2((x - 2.0) * blurSize, uv.y)) * 3.0/25.0;
+	colour += tex2D(scene, float2((x - 1.0) * blurSize, uv.y)) * 4.0/25.0;
+	colour += tex2D(scene, float2((x + 0.0) * blurSize, uv.y)) * 5.0/25.0;
+	colour += tex2D(scene, float2((x + 1.0) * blurSize, uv.y)) * 4.0/25.0;
+	colour += tex2D(scene, float2((x + 2.0) * blurSize, uv.y)) * 3.0/25.0;
+	colour += tex2D(scene, float2((x + 3.0) * blurSize, uv.y)) * 2.0/25.0;
+	colour += tex2D(scene, float2((x + 4.0) * blurSize, uv.y)) * 1.0/25.0;
+
+	return colour;
+}
+
+//B.
+float4 GlowY_fp
+	(
+		float2 uv: TEXCOORD0,
+ 
+		uniform sampler2D blurX: register(s0),
+		uniform float4 invTexSize
+	) : COLOR
+{
+	float4 colour = float4(0);
+	float blurSize = BLUR_RADIUS * invTexSize.y;
+
+	//Y-blur.
+	int y = uv.y/blurSize;
+	colour += tex2D(blurX, float2(uv.x, (y - 4.0) * blurSize)) * 1.0/25.0;
+	colour += tex2D(blurX, float2(uv.x, (y - 3.0) * blurSize)) * 2.0/25.0;
+	colour += tex2D(blurX, float2(uv.x, (y - 2.0) * blurSize)) * 3.0/25.0;
+	colour += tex2D(blurX, float2(uv.x, (y - 1.0) * blurSize)) * 4.0/25.0;
+	colour += tex2D(blurX, float2(uv.x, (y + 0.0) * blurSize)) * 5.0/25.0;
+	colour += tex2D(blurX, float2(uv.x, (y + 1.0) * blurSize)) * 4.0/25.0;
+	colour += tex2D(blurX, float2(uv.x, (y + 2.0) * blurSize)) * 3.0/25.0;
+	colour += tex2D(blurX, float2(uv.x, (y + 3.0) * blurSize)) * 2.0/25.0;
+	colour += tex2D(blurX, float2(uv.x, (y + 4.0) * blurSize)) * 1.0/25.0;
+
+	return colour;
+}
+
+//C.
+float4 GlowBlend_fp
+	(
+		float2 uv: TEXCOORD0,
+
+		uniform sampler2D scene: register(s0),
+		uniform sampler2D blurXY: register(s1)
+	) : COLOR
+{
+	//Add this to original, return.
+	return
+#if RENDER_SCENE
+		tex2D(scene, uv) +
+#endif
+		tex2D(blurXY, uv) * 4;
+}




More information about the Orxonox-commit mailing list