ETL Terrain computing shadowmap crashed


31-05-2009 12:33:05

ETL terrain , no terrain shadow:

to enable the terrain shadow, like ETM:

i use the code follow:

Ogre::ColourValue color(mSunLight->getDiffuseColour().r,mSunLight->getDiffuseColour().g,mSunLight->getDiffuseColour().b);
Ogre::Vector3 direction = mSunLight->getDirection();
if(direction.x == 0.0f && direction.z == 0.0f) return;
// calculate new lightmap
ET::ColourArray2D mArray (m_LightMapSize,m_LightMapSize, Ogre::ColourValue::White);
ET::generateLightMap(mArray, m_Terrain, direction,
color, GetSceneManager()->getAmbientLight());
ET::generateShadowMap(mArray, m_Terrain, direction, color / 5.0f);
ET::boxFilter(mArray, 2);

but it crashed at ET::generateShadowMap, how to resolve ?


31-05-2009 13:00:23

I never quite finished the map generation code. The code worked kind of for me, but it's not in a particularly nice state. So it's entirely possible that it's broken.
However, since I've abandoned development of that particular ETL version, I'm afraid you'll have to debug and fix it on your own, sorry.


31-05-2009 17:00:45

i think the problem is going to be resolved soon, just need to adjust some blend parameters:



01-06-2009 11:48:14

ETL's shadowmap calculation algorithm crashes when the X and Z deltas are very low. Thats mainly because ETL follows the Light Ray in terms of X and Z, when the light is close to perpendicular to the terrain plane the X and/or Z deltas are very small and since ETL's algorithm doesnt check if the Y is out of terrain MAX/MIN Y, the algorith continues to iterate till X or Z is out of bounds and when the delta's are too small this causes too many iterations (sometimes infinite when full perpendicular) with an overflow ( = crash).

so, if you wanna fix it, examine the calculation algorithm and implement bound guards for Y.