Scene Loader Shadow technique and shadow color help

Evak

23-10-2007 03:20:49

We have gotten almost everything working with the scene loader, except that we arent able to get the sceneloader created scene manager to read the shadow type or color from the OSM file.

Everything else works and it hasn't really been a problem in the past since we could just add a line of code to get the correct technique.

A few builds back we were able to get the shadow color after manualy adding the technique, but this no longer works.

Were a bit uncertain why the shadow technique doesn't work when everything else does.

------------------------
On a different but related note. We have been developing an OSM editor that is quite far along now. The shadows being one of the last problems

What we noticed when loading multiple OSM's, only the first loaded OSM shadows color registered in the viewport. With sny OSM's merged into the list, the shadow colors were ignored.

Since we havent got the OSM shadow techniques to work correctly, we may be at fault. But it would be nice if the last OSM's shadow values were the ones used.

Any help on the matter of shadow techniques not loading would be helpfull.

Evak

23-10-2007 03:24:19

I had a quick look at the source in a text editor, and one thing that seemed odd was that the shadow type cases were block commented out.

I'm not a coder so I can't tell if they are needed or just there for reference purposes.

// Create SceneManager
Ogre::SceneNode* OSMScene::createSceneManager(TiXmlElement* sceneProp, bool& bHandled)
{
assert(sceneProp);

// Scene manager
TiXmlElement* sceneMgrElem = sceneProp->FirstChildElement("sceneManager");
int type = Ogre::StringConverter::parseInt(sceneMgrElem->Attribute("type"));
Ogre::SceneType sceneType = static_cast<Ogre::SceneType>(1 << (type - 1));
mSceneMgr = Ogre::Root::getSingleton().createSceneManager(sceneType);
assert(mSceneMgr);

SceneNode* pSceneRoot = mSceneMgr->getRootSceneNode()->createChildSceneNode();
assert(pSceneRoot);

// Scene shadows
TiXmlElement* shadowsElem = sceneProp->FirstChildElement("shadowTechnique");
if(shadowsElem)
{
int type = StringConverter::parseInt(shadowsElem->Attribute("type"));
Ogre::ShadowTechnique shadowType = static_cast<Ogre::ShadowTechnique>(type);

/*
ShadowTechnique shadowType = Ogre::SHADOWTYPE_NONE;

switch(type)
{
case 1:
shadowType = Ogre::SHADOWTYPE_STENCIL_MODULATIVE;
break;

case 2:
shadowType = Ogre::SHADOWTYPE_STENCIL_ADDITIVE;
break;

case 3:
shadowType = Ogre::SHADOWTYPE_TEXTURE_MODULATIVE;
break;

case 4:
shadowType = Ogre::SHADOWTYPE_TEXTURE_ADDITIVE;
break;
}
*/

mSceneMgr->setShadowTechnique(shadowType);

int tex_size = StringConverter::parseInt(shadowsElem->Attribute("tex_size"));
int tex_count = StringConverter::parseInt(shadowsElem->Attribute("tex_count"));

mSceneMgr->setShadowTextureSettings(tex_size, tex_count);

// Shadow Color
TiXmlElement* colorElem = shadowsElem->FirstChildElement("color");
if(colorElem)
{
ColourValue color;
color.r = StringConverter::parseReal(colorElem->Attribute("r"));
color.g = StringConverter::parseReal(colorElem->Attribute("g"));
color.b = StringConverter::parseReal(colorElem->Attribute("b"));

mSceneMgr->setShadowColour(color);
}
}


Looks like our C++ coder will be looing at it again.

Evak

24-10-2007 15:13:28

They said they can see where the code was changed from case to static which could cause problems if we uncommented. Could I check that it worked for everyone else?

Looks like we will be trying uncommenting it, just incase.

Lioric

24-10-2007 16:24:59

For your version, that part should be commented (it is used by the new 2 version)

I will review why the shadows are not working in your applications

When you load the scene, are you passing your scene manager object to the osm scene loader? or you are using a new auto created scene manager for each loaded scene

Evak

24-10-2007 18:03:54

Were using an Ofusion autocreated scene manager in order to get the background color and other settings to work.

The problem with the shadow techniques not loading crops up even when only one osm is loaded, and it inherits the osm loader's scenemanager through getSceneManager, shadows do not work unless the technique is set manually in code.

Evak

27-10-2007 22:04:30

Should I put this in a support ticket?

Originaly I wanted to find out if anyone else was having problems with the shadow techniques working. Might be better to post a support ticket though...

Evak

02-11-2007 20:51:38

Any news on this?

Lioric

03-11-2007 02:22:13

Open a support ticket for this issue to be handled faster

Odog87

05-11-2007 19:20:05

We are having a similar problem. We are using eihort (and OSM files), and we cannot get shadows to load

Evak

05-11-2007 20:35:58

I sent a ticket and got a response from Lioric. He found the problem and is checking out some of the other scene parameters before updating the scene loader.

It's something to do with changes in edgelist calculations between 1.2 and 1.4 versions of ogre.