Revision: 561
http://python-ogre.svn.sourceforge.net/python-ogre/?rev=561&view=rev
Author: andy_miller
Date: 2008-02-03 20:24:38 -0800 (Sun, 03 Feb 2008)
Log Message:
-----------
Updated Caelum media to the latest from the SVN
Modified Paths:
--------------
trunk/python-ogre/demos/caelum/media/CaelumShaders.cg
trunk/python-ogre/demos/caelum/media/GroundFog.material
trunk/python-ogre/demos/caelum/media/GroundFog.program
trunk/python-ogre/demos/caelum/media/Haze.program
trunk/python-ogre/demos/caelum/media/LayeredClouds.material
trunk/python-ogre/demos/caelum/media/Terrain.material
Modified: trunk/python-ogre/demos/caelum/media/CaelumShaders.cg
===================================================================
--- trunk/python-ogre/demos/caelum/media/CaelumShaders.cg 2008-01-30 02:02:12 UTC (rev 560)
+++ trunk/python-ogre/demos/caelum/media/CaelumShaders.cg 2008-02-04 04:24:38 UTC (rev 561)
@@ -1,3 +1,23 @@
+/*
+This file is part of Caelum.
+See http://www.ogre3d.org/wiki/index.php/Caelum
+
+Copyright (c) 2006-2007 Caelum team. See Contributors.txt for details.
+
+Caelum is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published
+by the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Caelum is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with Caelum. If not, see <http://www.gnu.org/licenses/>.
+*/
+
half bias (half b, half x) {
return pow (x, log (b) / log (0.5));
}
@@ -145,23 +165,18 @@
sampler cloud_shape2 : register(s1);
sampler cloud_detail : register(s2);
-// Global cloud parameters.
-uniform float cloudMassInvScale;
-uniform float cloudDetailInvScale;
-
-uniform float2 cloudMassOffset;
-uniform float2 cloudDetailOffset;
-
-uniform float cloudCover;
-uniform float cloudMassBlend;
-uniform float cloudDetailBlend;
-
-uniform float cloudSharpness;
-uniform float cloudThickness;
-uniform float cloudShininess;
-
// Get cloud layer intensity at a certain point.
-float LayeredClouds_intensity(in float2 pos)
+float LayeredClouds_intensity
+(
+ in float2 pos,
+ float cloudMassInvScale,
+ float cloudDetailInvScale,
+ float2 cloudMassOffset,
+ float2 cloudDetailOffset,
+ float cloudMassBlend,
+ float cloudDetailBlend,
+ float cloudCoverageThreshold
+)
{
// Calculate the base alpha
float2 finalMassOffset = cloudMassOffset + pos;
@@ -170,7 +185,7 @@
cloudMassBlend);
float aDetail = tex2D(cloud_detail, (cloudDetailOffset + pos) * cloudDetailInvScale).r;
aCloud = (aCloud + aDetail * cloudDetailBlend) / (1 + cloudDetailBlend);
- return max(0, aCloud - (1 - cloudCover));
+ return max(0, aCloud - cloudCoverageThreshold);
}
// Entry point for Cloud vertex program.
@@ -179,52 +194,74 @@
in float4 position : POSITION,
in float2 uv : TEXCOORD0,
+ uniform float4x4 worldViewProj,
+ uniform float3 sunDirection,
+
out float4 oPosition : POSITION,
out float2 oUv : TEXCOORD0,
- out float oGlow : TEXCOORD1,
- out float3 relPosition : TEXCOORD2,
-
- uniform float4x4 worldViewProj,
- uniform float3 sunDirection
+ out float3 relPosition : TEXCOORD1,
+ out float sunGlow : TEXCOORD2
) {
- relPosition = normalize (position);
- oGlow = dot (relPosition, normalize (-sunDirection));
oPosition = mul(worldViewProj, position);
oUv = uv;
+
+ // This is the relative position, or view direction.
+ relPosition = normalize (position.xyz);
+
+ // Calculate the angle between the direction of the sun and the current
+ // view direction. This we call "glow" and ranges from 1 next to the sun
+ // to -1 in the opposite direction.
+ sunGlow = dot (relPosition, normalize (-sunDirection));
}
// Entry point for Cloud fragment program.
void LayeredClouds_fp
(
- in float2 uv : TEXCOORD0,
- in float glow : TEXCOORD1,
- in float3 relPosition : TEXCOORD2,
+ in float2 uv : TEXCOORD0,
+ in float3 relPosition : TEXCOORD1,
+ in float sunGlow : TEXCOORD2,
- uniform float cameraHeight,
- uniform float3 sunDirection,
- uniform float4 sunColour,
- uniform float4 fogColour,
+ uniform float cloudMassInvScale,
+ uniform float cloudDetailInvScale,
+ uniform float2 cloudMassOffset,
+ uniform float2 cloudDetailOffset,
+ uniform float cloudMassBlend,
+ uniform float cloudDetailBlend,
+ uniform float cloudCoverageThreshold,
+
+ uniform float4 sunColour,
+ uniform float4 fogColour,
+ uniform float cloudSharpness,
+ uniform float cloudThickness,
+
out float4 oCol : COLOR
) {
- // Initialize output.
+ // Initialize output.
oCol.rgba = float4(1, 1, 1, 0);
// Get cloud intensity.
- float intensity = LayeredClouds_intensity(uv);
+ float intensity = LayeredClouds_intensity
+ (
+ uv,
+ cloudMassInvScale,
+ cloudDetailInvScale,
+ cloudMassOffset,
+ cloudDetailOffset,
+ cloudMassBlend,
+ cloudDetailBlend,
+ cloudCoverageThreshold
+ );
// Opacity is exponential.
float aCloud = saturate(exp(cloudSharpness * intensity) - 1);
- float shine = pow(saturate(glow), 8) / 4;
+ float shine = pow(saturate(sunGlow), 8) / 4;
sunColour.rgb *= 1.5;
float3 cloudColour = fogColour.rgb * (1 - intensity / 3);
float thickness = saturate(0.8 - exp(-cloudThickness * (intensity + 0.2 - shine)));
oCol.rgb = lerp(sunColour.rgb, cloudColour.rgb, thickness);
- //oCol.rgb = thickness;
- //oCol.rgb = sunColour.rgb;
- //oCol.rgb = cloudColour.rgb;
// bottom 20th of the sky clouds vanish.
// Simple and effective.e
Modified: trunk/python-ogre/demos/caelum/media/GroundFog.material
===================================================================
--- trunk/python-ogre/demos/caelum/media/GroundFog.material 2008-01-30 02:02:12 UTC (rev 560)
+++ trunk/python-ogre/demos/caelum/media/GroundFog.material 2008-02-04 04:24:38 UTC (rev 561)
@@ -1,3 +1,23 @@
+//
+//This file is part of Caelum.
+//See http://www.ogre3d.org/wiki/index.php/Caelum
+//
+//Copyright (c) 2006-2007 Caelum team. See Contributors.txt for details.
+//
+//Caelum is free software: you can redistribute it and/or modify
+//it under the terms of the GNU Lesser General Public License as published
+//by the Free Software Foundation, either version 3 of the License, or
+//(at your option) any later version.
+//
+//Caelum is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//GNU Lesser General Public License for more details.
+//
+//You should have received a copy of the GNU Lesser General Public License
+//along with Caelum. If not, see <http://www.gnu.org/licenses/>.
+//
+
// Sample base material for using CaelumGroundFog.
material CaelumGroundFogBase
{
Modified: trunk/python-ogre/demos/caelum/media/GroundFog.program
===================================================================
--- trunk/python-ogre/demos/caelum/media/GroundFog.program 2008-01-30 02:02:12 UTC (rev 560)
+++ trunk/python-ogre/demos/caelum/media/GroundFog.program 2008-02-04 04:24:38 UTC (rev 561)
@@ -1,3 +1,23 @@
+//
+//This file is part of Caelum.
+//See http://www.ogre3d.org/wiki/index.php/Caelum
+//
+//Copyright (c) 2006-2007 Caelum team. See Contributors.txt for details.
+//
+//Caelum is free software: you can redistribute it and/or modify
+//it under the terms of the GNU Lesser General Public License as published
+//by the Free Software Foundation, either version 3 of the License, or
+//(at your option) any later version.
+//
+//Caelum is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//GNU Lesser General Public License for more details.
+//
+//You should have received a copy of the GNU Lesser General Public License
+//along with Caelum. If not, see <http://www.gnu.org/licenses/>.
+//
+
vertex_program CaelumGroundFogVP cg
{
source CaelumShaders.cg
Modified: trunk/python-ogre/demos/caelum/media/Haze.program
===================================================================
--- trunk/python-ogre/demos/caelum/media/Haze.program 2008-01-30 02:02:12 UTC (rev 560)
+++ trunk/python-ogre/demos/caelum/media/Haze.program 2008-02-04 04:24:38 UTC (rev 561)
@@ -1,3 +1,23 @@
+//
+//This file is part of Caelum.
+//See http://www.ogre3d.org/wiki/index.php/Caelum
+//
+//Copyright (c) 2006-2007 Caelum team. See Contributors.txt for details.
+//
+//Caelum is free software: you can redistribute it and/or modify
+//it under the terms of the GNU Lesser General Public License as published
+//by the Free Software Foundation, either version 3 of the License, or
+//(at your option) any later version.
+//
+//Caelum is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//GNU Lesser General Public License for more details.
+//
+//You should have received a copy of the GNU Lesser General Public License
+//along with Caelum. If not, see <http://www.gnu.org/licenses/>.
+//
+
vertex_program CaelumHazeVP cg
{
source CaelumShaders.cg
Modified: trunk/python-ogre/demos/caelum/media/LayeredClouds.material
===================================================================
--- trunk/python-ogre/demos/caelum/media/LayeredClouds.material 2008-01-30 02:02:12 UTC (rev 560)
+++ trunk/python-ogre/demos/caelum/media/LayeredClouds.material 2008-02-04 04:24:38 UTC (rev 561)
@@ -1,3 +1,23 @@
+//
+//This file is part of Caelum.
+//See http://www.ogre3d.org/wiki/index.php/Caelum
+//
+//Copyright (c) 2006-2007 Caelum team. See Contributors.txt for details.
+//
+//Caelum is free software: you can redistribute it and/or modify
+//it under the terms of the GNU Lesser General Public License as published
+//by the Free Software Foundation, either version 3 of the License, or
+//(at your option) any later version.
+//
+//Caelum is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//GNU Lesser General Public License for more details.
+//
+//You should have received a copy of the GNU Lesser General Public License
+//along with Caelum. If not, see <http://www.gnu.org/licenses/>.
+//
+
vertex_program CaelumLayeredCloudsVP cg
{
source CaelumShaders.cg
@@ -14,42 +34,46 @@
fragment_program CaelumLayeredCloudsFP cg
{
- source CaelumShaders.cg
- entry_point LayeredClouds_fp
- profiles ps_2_0 arbfp1
+ source CaelumShaders.cg
+ entry_point LayeredClouds_fp
+ profiles ps_2_0 arbfp1
- default_params
- {
- // Caelum sky properties
- param_named sunDirection float3 -1 -1 0
- param_named sunColour float4 1 1 1 1
-
- // The inverse of the cloud forms scale
- param_named cloudMassInvScale float 1.2
- // The inverse of the cloud details scale
- param_named cloudDetailInvScale float 4.8
-
- // Cloud mass offset
- param_named cloudMassOffset float2 0 0
- // Cloud details offset
- param_named cloudDetailOffset float2 0.5 0.5
-
- // Cloud coverage, between 0 and 1
- param_named cloudCover float 0.9
- // Blending factor between Cloud1 and Cloud2
- param_named cloudMassBlend float 0.9
- // Cloud detail weight.
- param_named cloudDetailBlend float 0.5
-
- // Cloud sharpness. Lower values result in softer clouds.
- param_named cloudSharpness float 4
-
- // Cloud thickness. Bigger values results in darker clouds.
- param_named cloudThickness float 3
-
- // Fog colour; used as the base cloud colour.
- param_named fogColour float4
- }
+ default_params
+ {
+ // Caelum sky properties
+ //param_named sunDirection float3 -1 -1 0
+ param_named sunColour float4 1 1 1 1
+
+ // Fog colour; used as the base cloud colour.
+ param_named fogColour float4
+
+
+ // The inverse of the cloud forms scale
+ param_named cloudMassInvScale float 1.2
+ // The inverse of the cloud details scale
+ param_named cloudDetailInvScale float 4.8
+
+ // Cloud mass offset
+ param_named cloudMassOffset float2 0 0
+ // Cloud details offset
+ param_named cloudDetailOffset float2 0.5 0.5
+
+ // Blending factor between Cloud1 and Cloud2
+ param_named cloudMassBlend float 0.9
+ // Cloud detail weight.
+ param_named cloudDetailBlend float 0.5
+
+
+ // Cloud coverage, between 0 and 1
+ param_named cloudCoverageThreshold float 0.9
+
+ // Cloud sharpness. Lower values result in softer clouds.
+ param_named cloudSharpness float 4
+
+ // Cloud thickness. Bigger values results in darker clouds.
+ param_named cloudThickness float 3
+
+ }
}
material CaelumLayeredClouds
Modified: trunk/python-ogre/demos/caelum/media/Terrain.material
===================================================================
--- trunk/python-ogre/demos/caelum/media/Terrain.material 2008-01-30 02:02:12 UTC (rev 560)
+++ trunk/python-ogre/demos/caelum/media/Terrain.material 2008-02-04 04:24:38 UTC (rev 561)
@@ -1,3 +1,23 @@
+//
+//This file is part of Caelum.
+//See http://www.ogre3d.org/wiki/index.php/Caelum
+//
+//Copyright (c) 2006-2007 Caelum team. See Contributors.txt for details.
+//
+//Caelum is free software: you can redistribute it and/or modify
+//it under the terms of the GNU Lesser General Public License as published
+//by the Free Software Foundation, either version 3 of the License, or
+//(at your option) any later version.
+//
+//Caelum is distributed in the hope that it will be useful,
+//but WITHOUT ANY WARRANTY; without even the implied warranty of
+//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//GNU Lesser General Public License for more details.
+//
+//You should have received a copy of the GNU Lesser General Public License
+//along with Caelum. If not, see <http://www.gnu.org/licenses/>.
+//
+
// Base class for materials in the caelum demo.
// They have a main pass and additional fog passes.
// Perhaps might be better to do this at runtime somehow?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|