Caelum - [WARNING: Screenshot intensive]

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
netskate
Greenskin
Posts: 120
Joined: Fri Sep 05, 2008 3:10 pm

Post by netskate »

cdleonard wrote: You have to do your own fading here.
I finish to write my own fading function, I think you could be integrate it into caelum, anyway I wrote it for my own application, if you are interested please contact me.

I'm downloading new caelum from repository, I'm happy to see new changes.

ps: where can I find the changelog?
-- N3tsk4t3 --
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Post by calsmurf2904 »

ok...some issues :
I have a Intel GMA950 Integrated Graphics Card so I don't have those fancy things the newest graphics cards has.
I got PixelShader support to 2.0 and VertexShader support to 3.0
However the clouds in caelum uses PS3.0
I tried to lower it to PS2.0 but that gave me some errors :

Code: Select all

22:50:32: Parsing script LayeredClouds.material
22:50:32: OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program CaelumLayeredCloudsFP: CG ERROR : The compile returned an error.
(203) : warning C7011: implicit cast from "float4" to "float3"
(203) : warning C7011: implicit cast from "float4" to "float3"
(203) : warning C7011: implicit cast from "float4" to "float3"
(203) : warning C7011: implicit cast from "float4" to "float3"
(0) : error C6003: Arithmetic instruction limit of 64 exceeded; 88 arithmetic instructions needed to compile program
 in CgProgram::loadFromSource at c:\ogrewin1.6\ogre\plugins\cgprogrammanager\src\ogrecgprogrammanagerdll.cpp (line 66)
22:50:32: High-level program CaelumLayeredCloudsFP encountered an error during loading and is thus not supported.
OGRE EXCEPTION(7:InternalErrorException): Unable to compile Cg program CaelumLayeredCloudsFP: CG ERROR : The compile returned an error.
(203) : warning C7011: implicit cast from "float4" to "float3"
(203) : warning C7011: implicit cast from "float4" to "float3"
(203) : warning C7011: implicit cast from "float4" to "float3"
(203) : warning C7011: implicit cast from "float4" to "float3"
(0) : error C6003: Arithmetic instruction limit of 64 exceeded; 88 arithmetic instructions needed to compile program
 in CgProgram::loadFromSource at c:\ogrewin1.6\ogre\plugins\cgprogrammanager\src\ogrecgprogrammanagerdll.cpp (line 66)
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(44): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(45): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(46): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(49): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(53): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(55): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(58): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(60): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(63): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(65): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(69): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(72): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(75): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(77): setting of constant failed
22:50:32: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at c:\ogrewin1.6\ogre\ogremain\src\ogregpuprogram.cpp (line 1085)
22:50:32: Compiler error: invalid parameters in LayeredClouds.material(78): setting of constant failed
the rest is working....the only thing that isn't working are the clouds.
I use Caelum SVN Trunk.
I tried the same code on my parents pc (wich have PS3.0 and VS3.0)
and there it worked perfectly.
Does anyone know if i can bypass these issues to make it support PS2.0 ?

My LayeredClouds.material :

Code: Select all

//
//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 CaelumLayeredClouds.cg
	entry_point LayeredClouds_vp
	profiles vs_3_0 vp40 arbvp1
	compile_arguments -posinv
	
	default_params
	{
		param_named_auto worldViewProj worldviewproj_matrix
		param_named sunDirection float3 -1 -1 0
	}
}

fragment_program CaelumLayeredCloudsFP cg
{
	source CaelumLayeredClouds.cg
    entry_point LayeredClouds_fp
    profiles ps_2_0 fp40 arbfp1

    default_params
    {
        // Caelum sky properties
        param_named sunLightColour float4 1 1 1 1
        param_named sunSphereColour float4 1 1 1 1
        param_named sunDirection float4 1 1 1 1
        
        // Fog colour; used as the base cloud colour.
        param_named fogColour float4 0 0 0 0
        
        
        // 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
        
        param_named_auto camera_position camera_position    
        param_named layerHeight float 0    
    }
}

material CaelumLayeredClouds
{
	technique
	{
		pass
		{
			lighting off
			depth_check on                                     
			depth_write off
			scene_blend alpha_blend
			fog_override true
			cull_hardware none

			vertex_program_ref CaelumLayeredCloudsVP
			{
			}
			
			fragment_program_ref CaelumLayeredCloudsFP
			{
			}

			texture_unit Cloud1
			{
				texture noise1.dds
                filtering trilinear
                tex_coord_set 0
			}
			
			texture_unit Cloud2
			{
				texture noise2.dds
                filtering trilinear
                tex_coord_set 1
			}
			
			texture_unit Detail
			{
				texture noise4.dds
                tex_coord_set 2
			}
		}
	}
}
nath31337
Kobold
Posts: 25
Joined: Sun Jul 27, 2008 2:42 am
Location: Canada

Post by nath31337 »

i still didnt get how to make a custom material for the terrain lighting, and im still trying to make fog and precipitation appear :(

help please :roll:
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Post by xadhoom »

Small suggestion!
I experienced while working with NvPerfHUD that the caelum stars and sky are drawn first. This is not very clever because everything rendered afterwards will
override more or less pixels (maybe all of them e.g. if you look at the ground in the demo). This leads to a pixelshader calculation overhead which should be avoided.

Maybe it is possible to ensure that caelum is drawn at the end of the queue before transparent objects are drawn...
DragonM
Gnoblar
Posts: 22
Joined: Mon Jul 21, 2008 4:35 am
x 7

Post by DragonM »

nath31337 wrote:i still didnt get how to make a custom material for the terrain lighting, and im still trying to make fog and precipitation appear :(

help please :roll:
The best thing to do to figure out how to use Caelum is to examine the Demo and the Lab programs.

In your case, you need to make 2 changes to your terrain.cfg file (whatever its name may be). At the very end, the sample Ogre terrain file makes mention of custom materials. Use these lines from the Caelum demos:

Code: Select all

# Custom material. Does use vertex normals.
CustomMaterialName=CaelumSample/Terrain
VertexNormals=yes
The other change you have to make is to edit one line from:

Code: Select all

# Use vertex program to morph LODs, if available
VertexProgramMorph=yes
to

Code: Select all

# Use vertex program to morph LODs, if available
VertexProgramMorph=no
Terrain renders all whacky if you try to mix the Caelum shaders and the default Ogre terrain morph shaders.



I have my own question. Has anyone worked out how to get Caelum lighting changes to apply to billboards being rendered by terrain renderers? Distant trees and close up grass stay electric green at night, and I'm wondering if anyone has managed to feed a lighting/color change into their shader.

DM
User avatar
netskate
Greenskin
Posts: 120
Joined: Fri Sep 05, 2008 3:10 pm

Post by netskate »

I have my own question. Has anyone worked out how to get Caelum lighting changes to apply to billboards being rendered by terrain renderers? Distant trees and close up grass stay electric green at night, and I'm wondering if anyone has managed to feed a lighting/color change into their shader.
I'll working on it after I've finished my weather manager. I asked this to the paged geometry forum and john told me some suggests.

this is the thread ( sorry for crossposting):

http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=8232

if you have any news, please tell me, I'll working on it in a few days (I hope)
-- N3tsk4t3 --
nath31337
Kobold
Posts: 25
Joined: Sun Jul 27, 2008 2:42 am
Location: Canada

Post by nath31337 »

Thanks dragonM but the terrain is all black and dosent change color. Ill try to figure it out but if you could help me i'd appreciate
User avatar
netskate
Greenskin
Posts: 120
Joined: Fri Sep 05, 2008 3:10 pm

Post by netskate »

can I ask to someone how could I simulate a "flash" of a lightning in the sky?

I add to my lightning a spot light e and a directional light, but they affect only terrain and objects, I would that they affect also sky brightness.

I made it with a overlay fade but when it's night all ok, but when is day flash has nosense, so I would know if there is a function that easily return true if is day, or false if is night...
-- N3tsk4t3 --
nath31337
Kobold
Posts: 25
Joined: Sun Jul 27, 2008 2:42 am
Location: Canada

Post by nath31337 »

i did what DragonM told me about the terrain but my terrain is still all black, i still didnt figure it out. Can anyone help me :)
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Post by calsmurf2904 »

mmm...look in the caelumsample.material there is a example for terrain.
User avatar
netskate
Greenskin
Posts: 120
Joined: Fri Sep 05, 2008 3:10 pm

Post by netskate »

I would retrieve sun position coordinates...

I think I had to use this method:
CaelumSystem->getSunDirection(Caelum::LongReal jday);

Suppose to call this every frame into framestarted... how can I get the current position of the sun?

ps: I need also current light color and current colour of sun's sprite
-- N3tsk4t3 --
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

netskate wrote:I would retrieve sun position coordinates...

I think I had to use this method:
CaelumSystem->getSunDirection(Caelum::LongReal jday);

Suppose to call this every frame into framestarted... how can I get the current position of the sun?

ps: I need also current light color and current colour of sun's sprite
Something like:

Code: Select all

Ogre::Vector3 CaelumSunPosition = CameraPos - CaelumSphereRadius*CaelumSystem->getSunDirection(...);
User avatar
netskate
Greenskin
Posts: 120
Joined: Fri Sep 05, 2008 3:10 pm

Post by netskate »

and what I had to pass to getSunDirection()?
-- N3tsk4t3 --
Illidanz
Kobold
Posts: 34
Joined: Fri Aug 22, 2008 7:58 am

Post by Illidanz »

netskate wrote:and what I had to pass to getSunDirection()?
I use that function from the Nature demo (you can find it in the Showcase forum). Not sure if it's the best method but well, it works

Code: Select all

	Ogre::Vector3 sunPosition = camera->getDerivedPosition();
	sunPosition -= mCaelumSystem->getSun()->getLightDirection() * 80000;
User avatar
netskate
Greenskin
Posts: 120
Joined: Fri Sep 05, 2008 3:10 pm

Post by netskate »

good, it works.

now I stuck with light color of sun, the getsunlight want also a jday, so I still don't know how pass it the "now" value.
-- N3tsk4t3 --
Illidanz
Kobold
Posts: 34
Joined: Fri Aug 22, 2008 7:58 am

Post by Illidanz »

netskate wrote:good, it works.

now I stuck with light color of sun, the getsunlight want also a jday, so I still don't know how pass it the "now" value.
Maybe you need this:

Code: Select all

Ogre::ColourValue sunColor = mCaelumSystem->getSun()->getLightColour();
User avatar
netskate
Greenskin
Posts: 120
Joined: Fri Sep 05, 2008 3:10 pm

Post by netskate »

uhm, I need color of his light and color of the sprite also...

I would update this hydrax values:
hmHydrax->setSunArea();
hmHydrax->setSunColor();
hmHydrax->setSunPosition();
hmHydrax->setWaterColor();

with respective caelum value then I think:

sunposition it's ok with code posted before
sunArea - I thought of give it a max and min value and interpolate it in base of Y value of the sun position (think is a good idea?)
sunColor - give it the sun sprite color (red at sunset etc etc)
watercolor - I thought at sun light colour

what do you think about? maybe I interpretate bad these values..
-- N3tsk4t3 --
User avatar
Xavyiy
OGRE Expert User
OGRE Expert User
Posts: 847
Joined: Tue Apr 12, 2005 2:35 pm
Location: Albacete - Spain
x 87

Post by Xavyiy »

Water colour must be the same all the time(blue!), you can multiply the colour for X value depending of the day time, but not set as water colour the sun colour ;)
User avatar
netskate
Greenskin
Posts: 120
Joined: Fri Sep 05, 2008 3:10 pm

Post by netskate »

before I set it to ambientlight value and it's not look so bad, I'll make some trying :)
-- N3tsk4t3 --
User avatar
netskate
Greenskin
Posts: 120
Joined: Fri Sep 05, 2008 3:10 pm

Post by netskate »

I have 3 problems with caelum, see the screenshot:

ImageImage

1. there's a black line in the horizon, the cause is that caelum horizon change colour and hydrax (an infinite plane) reflects the darkness of caelum.

2. I use hydrax as infinite plane, so when sun sets it fall into the water, is it possible to make it sets correctly?

3. I have already checked the sun texture and (out the sphere) background is transparency. but when sun sets we can see all the texture, a square.

can anyone help me?
-- N3tsk4t3 --
nath31337
Kobold
Posts: 25
Joined: Sun Jul 27, 2008 2:42 am
Location: Canada

Post by nath31337 »

if i want to count the number of days passed, do i have to check the sun position all the time until it reaches a precise position then i increment?
User avatar
netskate
Greenskin
Posts: 120
Joined: Fri Sep 05, 2008 3:10 pm

Post by netskate »

I solved the first problem.

So, how can I move sun far enough to don't see it fall into water?
-- N3tsk4t3 --
nath31337
Kobold
Posts: 25
Joined: Sun Jul 27, 2008 2:42 am
Location: Canada

Post by nath31337 »

i really need to know how could i count the number of days passed
DragonM
Gnoblar
Posts: 22
Joined: Mon Jul 21, 2008 4:35 am
x 7

Post by DragonM »

nath31337 wrote:i really need to know how could i count the number of days passed
Caelum's universal clock can tell you all you need to know. It tracks time by fractional Julian day. Use getJulianDay() to retrieve what day it is at any time. Simple subtraction should tell you the number of days between times you retrieve it.

DM
Ouverta
Gnoblar
Posts: 3
Joined: Mon Aug 04, 2008 9:19 pm
Location: France
Contact:

Post by Ouverta »

I'm trying to use Caelum's Precipitations system, but I can't get it to work.
I can see during the early first frame some rains dropping, but on the next frame the rain totally disappeared.

Here's my initialisation code :

Code: Select all

Caelum::CaelumSystem::CaelumComponent componentMask;
        componentMask = static_cast<Caelum::CaelumSystem::CaelumComponent> (
				Caelum::CaelumSystem::CAELUM_COMPONENT_SUN |				
                Caelum::CaelumSystem::CAELUM_COMPONENT_MOON |
                Caelum::CaelumSystem::CAELUM_COMPONENT_SKY_DOME |
                //Caelum::CaelumSystem::CAELUM_COMPONENT_IMAGE_STARFIELD |
                Caelum::CaelumSystem::CAELUM_COMPONENT_POINT_STARFIELD |
                Caelum::CaelumSystem::CAELUM_COMPONENT_CLOUDS |
				Caelum::CaelumSystem::CAELUM_COMPONENT_PRECIPITATION |
                0);
        //componentMask = CaelumSystem::CAELUM_COMPONENTS_ALL;

        // Initialise CaelumSystem.
        mCaelumSystem = new Caelum::CaelumSystem (Root::getSingletonPtr(), mScene, componentMask);
		mCaelumSystem->setEnsureSingleLightSource(true);
		mCaelumSystem->setMinimumAmbientLight(ColourValue(0.2, 0.2, 0.3, 1.0));
		mCaelumSystem->attachViewport(win->getViewport(0));
		
        // Set time acceleration.
		mCaelumSystem->getUniversalClock()->setGregorianDateTime(2000, 8, 1, 21, 0, 0);
        mCaelumSystem->getUniversalClock ()->setTimeScale (00);
		mCaelumSystem->setManageSceneFog(true);	
		mCaelumSystem->setSceneFogDensityMultiplier(0.0005);

		mCaelumSystem->getCloudSystem()->getLayer(0)->setHeight(2450);
		mCaelumSystem->getCloudSystem()->getLayer(0)->setCloudCover(0.1);
		mCaelumSystem->getCloudSystem()->createLayerAtHeight(7350);
		mCaelumSystem->getCloudSystem()->getLayer(1)->setCloudCover(0.25);
		mCaelumSystem->getSun()->setAmbientMultiplier(Ogre::ColourValue(0.5, 0.5, 0.5, 0.5));

		mCaelumSystem->setObserverLatitude(Ogre::Degree(48));
		mCaelumSystem->setObserverLongitude(Ogre::Degree(2));
		
		


		// Set precipitation		//mCaelumSystem->getPrecipitationController()->createViewportInstance(mWindow->getViewport(0));
		mCaelumSystem->getPrecipitationController()->setPresetType(PRECTYPE_RAIN);
		mCaelumSystem->getPrecipitationController()->setIntensity(0.85);
		mCaelumSystem->getPrecipitationController()->setSpeed(0.
	
			
        // Register caelum as a listener.
        mWindow->addListener (mCaelumSystem);
        Root::getSingletonPtr()->addFrameListener (mCaelumSystem);
		Root::getSingletonPtr()->addFrameListener(this);

Thanks by advance
Post Reply