RTSS PSSM shadows on terrain

Problems building or running the engine, queries about how to use features etc.
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: RTSS PSSM shadows on terrain

Post by bstone »

Load it into Max or Blender and export from there using one of the available plugins.
User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
x 80
Contact:

Re: PSSM on terrain: no shadow on shadowtexture 0

Post by duststorm »

Shtuka wrote:how can I convert those *.obj files into Ogre meshes?
Using the Ogre exporter for your favourite 3D modeling tool. Any 3D editor can import .obj files.
I used Blender for this.

The basic workflow is: import .obj > clean up and prepare for use in Ogre > export to ogre .mesh
Don't underestimate the work needed for properly preparing your assets for use in Ogre, though. In many cases there still is a substantial amount of work needed for any downloaded assets before they fit in your content pipeline. This goes double for animated meshes.
Developer @ MakeHuman.org
Shtuka
Greenskin
Posts: 146
Joined: Mon Jan 10, 2011 7:39 pm
x 9

Re: RTSS PSSM shadows on terrain

Post by Shtuka »

Thanks to both of you!
Blender+C++
Gremlin
Posts: 171
Joined: Tue Jan 03, 2012 1:38 am
Location: Brazil
x 3

Re: RTSS PSSM shadows on terrain

Post by Blender+C++ »

hey DustStorm,
how is it going?
Dude im trying to use your RTSS shadow code in order to give shadows to my game project, i must aware you that i am pretty noob so probably the reason why im having problems to apply your shadow code to my game project,ok here s the problem, i dont know anything about shaders and i know the basic of the basics about materials, so for the terrain , im not using the standard ogre terrain, i mean i am but instead of creating the terrain like the standards i am creating it like this(i use artifex terra terrain, for terrain modeling):

Code: Select all

 mCamera->setNearClipDistance(5);
    mCamera->setFarClipDistance(5000);
	
    if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_INFINITE_FAR_PLANE))
    {
        mCamera->setFarClipDistance(0);   // enable infinite far clip distance if we can
    }
 
    Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering(Ogre::TFO_ANISOTROPIC);
    Ogre::MaterialManager::getSingleton().setDefaultAnisotropy(7);
		
	 mTerrainGlobals = OGRE_NEW Ogre::TerrainGlobalOptions(); 
    mTerrainGroup = OGRE_NEW Ogre::TerrainGroup(mSceneMgr, Ogre::Terrain::ALIGN_X_Z, 513, 5000.0f);
    mTerrainGroup->setOrigin(Ogre::Vector3::ZERO);    
	setupTerrainShadows(true);
    
    // Init custom materialgenerator
    TerrainMaterialGeneratorPtr terrainMaterialGenerator;
    // Set Ogre Material    
    TerrainMaterial *terrainMaterial = OGRE_NEW TerrainMaterial("ETTerrainMaterial",true,true);         
    terrainMaterialGenerator.bind( terrainMaterial );                 
	mTerrainGlobals->setDefaultMaterialGenerator( terrainMaterialGenerator );
	    
	// Configure terrain globals
    //mTerrainGlobals->setMaxPixelError(8);

    Ogre::Terrain::ImportData& defaultimp = mTerrainGroup->getDefaultImportSettings();
    defaultimp.terrainSize = 513;
    defaultimp.worldSize = 5000.0f;
    defaultimp.inputScale = 1667;
    defaultimp.minBatchSize = 33;
    defaultimp.maxBatchSize = 65; 

	// Load terrain from heightmap
    Ogre::Image img;
    img.load("ETterrain.png", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    mTerrainGroup->defineTerrain(0, 0, &img);
 
    // sync load since we want everything in place when we start
    mTerrainGroup->loadTerrain(0,0,false);
since im using the artifex material im not sure if your shadows will work in my game but im giving it a try,but the problem is it wont compile and these are the errors i get(OgreTerrainRTSSMaterialGenerator.cpp):
first error:

Code: Select all

Error	9	error C2039: '{ctor}' : is not a member of 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	c:\users\1accusr\documents\visual studio 2012\projects\ogresceneeditor\ogresceneeditor\src\ogreterrainrtssmaterialgenerator.cpp	33	1	OgreSceneEditor
second error:

Code: Select all

Error	11	error C2437: 'SM2Profile' : already initialized	c:\users\1accusr\documents\visual studio 2012\projects\ogresceneeditor\ogresceneeditor\src\ogreterrainrtssmaterialgenerator.cpp	34	1	OgreSceneEditor
and the last error:

Code: Select all

Error	10	error C2512: 'Ogre::TerrainMaterialGeneratorA::SM2Profile' : no appropriate default constructor available	c:\users\1accusr\documents\visual studio 2012\projects\ogresceneeditor\ogresceneeditor\src\ogreterrainrtssmaterialgenerator.cpp	34	1	OgreSceneEditor
if i remove this line:

Code: Select all

TerrainRTSSMaterialGenerator::SM2Profile::SM2Profile(TerrainMaterialGenerator* parent, const String& name, const String& desc)
        : TerrainMaterialGeneratorA::SM2Profile::SM2Profile(parent, name, desc)
    {

    }
which is something totally stupid then it wont throw me those 3 errors however it throws me LINK erros related to Dlls from that class....
i fixed only one error tho, it was complaining about this line : addTechnique(mat, terrain, LOW_LOD); , LOW_LOD is a protected enum so i just set it to public then it didnt bother me anymore however i really dont know how to fix those errors i mentioned above cause im really a newbie!
i have another question for you but i will leave it for a later oportunity after you reply this one!!
Any help is greatly appreciated bro..
Thanks in advance,
Romulo ROmero

PS: i first sent you a PM just in case you miss this post, thanks!
namwenio
Halfling
Posts: 74
Joined: Fri Jun 21, 2013 2:12 am
x 3

Re: RTSS PSSM shadows on terrain

Post by namwenio »

I'm also getting 16 errors on compile, using Ogre 1.9

Code: Select all

Error	1	error C2039: '{ctor}' : is not a member of 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	33
Error	8	error C2248: 'LOW_LOD' : cannot access protected enumerator declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	409
Error	13	error C2248: 'LOW_LOD' : cannot access protected enumerator declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	497
Error	16	error C2248: 'LOW_LOD' : cannot access protected enumerator declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	558
Error	4	error C2248: 'Ogre::TerrainMaterialGeneratorA::SM2Profile::isShadowingEnabled' : cannot access protected member declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	258
Error	11	error C2248: 'Ogre::TerrainMaterialGeneratorA::SM2Profile::isShadowingEnabled' : cannot access protected member declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	431
Error	15	error C2248: 'Ogre::TerrainMaterialGeneratorA::SM2Profile::isShadowingEnabled' : cannot access protected member declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	544
Error	5	error C2248: 'RENDER_COMPOSITE_MAP' : cannot access protected enumerator declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	280
Error	6	error C2248: 'RENDER_COMPOSITE_MAP' : cannot access protected enumerator declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	360
Error	7	error C2248: 'RENDER_COMPOSITE_MAP' : cannot access protected enumerator declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	374
Error	9	error C2248: 'RENDER_COMPOSITE_MAP' : cannot access protected enumerator declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	418
Error	10	error C2248: 'RENDER_COMPOSITE_MAP' : cannot access protected enumerator declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	423
Error	12	error C2248: 'RENDER_COMPOSITE_MAP' : cannot access protected enumerator declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	458
Error	14	error C2248: 'RENDER_COMPOSITE_MAP' : cannot access protected enumerator declared in class 'Ogre::TerrainMaterialGeneratorA::SM2Profile'	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	529
Error	3	error C2437: 'SM2Profile' : already initialized	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	34
Error	2	error C2512: 'Ogre::TerrainMaterialGeneratorA::SM2Profile' : no appropriate default constructor available	d:\realmzero\rzclient\rzclient\src\ogreterrainrtssmaterialgenerator.cpp	34
namwenio
Halfling
Posts: 74
Joined: Fri Jun 21, 2013 2:12 am
x 3

Re: RTSS PSSM shadows on terrain

Post by namwenio »

Got rid of 3 errors by:

changing

Code: Select all

TerrainRTSSMaterialGenerator::SM2Profile::SM2Profile(TerrainMaterialGenerator* parent, const String& name, const String& desc)
        : TerrainMaterialGeneratorA::SM2Profile::SM2Profile(parent, name, desc)
    {

    }
to:

Code: Select all

TerrainRTSSMaterialGenerator::SM2Profile::SM2Profile(TerrainMaterialGenerator* parent, const String& name, const String& desc)
        : TerrainMaterialGeneratorA::SM2Profile(parent, name, desc)
    {

    }
The protection errors still exist and I cannot figure out how to get rid of them. Doesn't make since due to the fact that the classes are derived from the class in which the variables are trying to be accessed.




This may also help, when I statically set all of the protected enumerations it's trying to set and get rid of those errors, I get the following link errors:

Code: Select all

Error	1	error LNK2001: unresolved external symbol "protected: virtual class Ogre::SharedPtr<class Ogre::HighLevelGpuProgram> __thiscall Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperGLSLES::createVertexProgram(class Ogre::TerrainMaterialGeneratorA::SM2Profile const *,class Ogre::Terrain const *,enum Ogre::TerrainMaterialGeneratorA::SM2Profile::TechniqueType)" (?createVertexProgram@ShaderHelperGLSLES@SM2Profile@TerrainMaterialGeneratorA@Ogre@@MAE?AV?$SharedPtr@VHighLevelGpuProgram@Ogre@@@4@PBV234@PBVTerrain@4@W4TechniqueType@234@@Z)	D:\RealmZero\rzClient\rzClient\OgreTerrainRTSSMaterialGenerator.obj
Error	2	error LNK2001: unresolved external symbol "protected: virtual class Ogre::SharedPtr<class Ogre::HighLevelGpuProgram> __thiscall Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperGLSLES::createFragmentProgram(class Ogre::TerrainMaterialGeneratorA::SM2Profile const *,class Ogre::Terrain const *,enum Ogre::TerrainMaterialGeneratorA::SM2Profile::TechniqueType)" (?createFragmentProgram@ShaderHelperGLSLES@SM2Profile@TerrainMaterialGeneratorA@Ogre@@MAE?AV?$SharedPtr@VHighLevelGpuProgram@Ogre@@@4@PBV234@PBVTerrain@4@W4TechniqueType@234@@Z)	D:\RealmZero\rzClient\rzClient\OgreTerrainRTSSMaterialGenerator.obj
Error	3	error LNK2001: unresolved external symbol "protected: virtual void __thiscall Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperGLSLES::generateVpHeader(class Ogre::TerrainMaterialGeneratorA::SM2Profile const *,class Ogre::Terrain const *,enum Ogre::TerrainMaterialGeneratorA::SM2Profile::TechniqueType,class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?generateVpHeader@ShaderHelperGLSLES@SM2Profile@TerrainMaterialGeneratorA@Ogre@@MAEXPBV234@PBVTerrain@4@W4TechniqueType@234@AAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)	D:\RealmZero\rzClient\rzClient\OgreTerrainRTSSMaterialGenerator.obj
Error	4	error LNK2001: unresolved external symbol "protected: virtual void __thiscall Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperGLSLES::generateFpHeader(class Ogre::TerrainMaterialGeneratorA::SM2Profile const *,class Ogre::Terrain const *,enum Ogre::TerrainMaterialGeneratorA::SM2Profile::TechniqueType,class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?generateFpHeader@ShaderHelperGLSLES@SM2Profile@TerrainMaterialGeneratorA@Ogre@@MAEXPBV234@PBVTerrain@4@W4TechniqueType@234@AAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)	D:\RealmZero\rzClient\rzClient\OgreTerrainRTSSMaterialGenerator.obj
Error	5	error LNK2001: unresolved external symbol "protected: virtual void __thiscall Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperGLSLES::generateVpLayer(class Ogre::TerrainMaterialGeneratorA::SM2Profile const *,class Ogre::Terrain const *,enum Ogre::TerrainMaterialGeneratorA::SM2Profile::TechniqueType,unsigned int,class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?generateVpLayer@ShaderHelperGLSLES@SM2Profile@TerrainMaterialGeneratorA@Ogre@@MAEXPBV234@PBVTerrain@4@W4TechniqueType@234@IAAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)	D:\RealmZero\rzClient\rzClient\OgreTerrainRTSSMaterialGenerator.obj
Error	6	error LNK2001: unresolved external symbol "protected: virtual void __thiscall Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperGLSLES::generateFpLayer(class Ogre::TerrainMaterialGeneratorA::SM2Profile const *,class Ogre::Terrain const *,enum Ogre::TerrainMaterialGeneratorA::SM2Profile::TechniqueType,unsigned int,class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?generateFpLayer@ShaderHelperGLSLES@SM2Profile@TerrainMaterialGeneratorA@Ogre@@MAEXPBV234@PBVTerrain@4@W4TechniqueType@234@IAAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)	D:\RealmZero\rzClient\rzClient\OgreTerrainRTSSMaterialGenerator.obj
Error	7	error LNK2001: unresolved external symbol "protected: virtual void __thiscall Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperGLSLES::generateVpFooter(class Ogre::TerrainMaterialGeneratorA::SM2Profile const *,class Ogre::Terrain const *,enum Ogre::TerrainMaterialGeneratorA::SM2Profile::TechniqueType,class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?generateVpFooter@ShaderHelperGLSLES@SM2Profile@TerrainMaterialGeneratorA@Ogre@@MAEXPBV234@PBVTerrain@4@W4TechniqueType@234@AAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)	D:\RealmZero\rzClient\rzClient\OgreTerrainRTSSMaterialGenerator.obj
Error	8	error LNK2001: unresolved external symbol "protected: virtual void __thiscall Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperGLSLES::generateFpFooter(class Ogre::TerrainMaterialGeneratorA::SM2Profile const *,class Ogre::Terrain const *,enum Ogre::TerrainMaterialGeneratorA::SM2Profile::TechniqueType,class std::basic_stringstream<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?generateFpFooter@ShaderHelperGLSLES@SM2Profile@TerrainMaterialGeneratorA@Ogre@@MAEXPBV234@PBVTerrain@4@W4TechniqueType@234@AAV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)	D:\RealmZero\rzClient\rzClient\OgreTerrainRTSSMaterialGenerator.obj
Error	9	error LNK1120: 8 unresolved externals	D:\RealmZero\rzClient\rzClient\bin\Debug\\rzClient.exe	1
namwenio
Halfling
Posts: 74
Joined: Fri Jun 21, 2013 2:12 am
x 3

Re: RTSS PSSM shadows on terrain

Post by namwenio »

Still no luck fixing the protected member errors.
Post Reply