New InstanceManager: Instancing done the right way

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Nickak2003
Halfling
Posts: 87
Joined: Thu Jun 10, 2004 4:19 am
Contact:

Re: New InstanceManager: Instancing done the right way

Post by Nickak2003 » Wed Jan 13, 2016 8:11 pm

Ok so the problem was I had listed all of the various shader resource directories to include and I guess they were interfering. I removed all but the glsl directory technique 0 works fine. technique 1, VTF, does not work, the program crashes, with the following error:

Code: Select all

Vertex Program:Ogre/Instancing/VTF/shadow_caster_glsl_vs Fragment Program:Ogre/Instancing/shadow_caster_glsl_ps GLSL link result : 
Exception thrown at 0x000001CA59D700E7 in testgamelib.exe: 0xC0000005: Access violation writing location 0x00000000EDBCCAC8.
Check hardware support says that VTF is supported on this machine.

*edit the error seems to happen after frame started. The actual instances were created no problem.

How does the demo browser work such that all of the various shader resource directories are included?
0 x

jho
Gnoblar
Posts: 5
Joined: Thu Apr 07, 2016 10:26 am

Re: New InstanceManager: Instancing done the right way

Post by jho » Thu Apr 07, 2016 10:43 am

Hi Ogre folks!

I'm trying to achieve instancing, to render a lot of entities. I'm quite new to the 3D/Shaders/... thing, so I tried for a start to mimic dark_sylinc's test source code and the NewInstancing demo. Here is my test instancing section:

Code: Select all

	mSceneMgr->setAmbientLight( ColourValue(1, 1, 1) );
	mCamera->getViewport()->setClearEveryFrame( true );

	const int numW = 10;
	const int numH = 10;

	InstanceManager *instanceManager = mSceneMgr->createInstanceManager( "MyInstanceMgr", "cube.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::TextureVTF, 300, IM_USEALL );
	//InstanceManager *instanceManager = mSceneMgr->createInstanceManager( "MyInstanceMgr", "cube.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, InstanceManager::HWInstancingBasic, 30, IM_USEALL);
	//InstanceManager *instanceManager = mSceneMgr->createInstanceManager( "MyInstanceMgr", "cube.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, Ogre::InstanceManager::ShaderBased, 80, IM_USEALL );
	for( int i=0; i<numH; ++i )
	{
		for( int j=0; j<numW; ++j )
		{
			InstancedEntity *ent = instanceManager->createInstancedEntity( "Examples/Instancing/VTF/Robot" );
			//InstancedEntity *ent = instanceManager->createInstancedEntity( "Examples/Instancing/HWBasic/Robot" );
			//InstancedEntity *ent = instanceManager->createInstancedEntity( "Examples/Instancing/ShaderBased/Robot" );
			SceneNode *sceneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
			sceneNode->attachObject( ent );
			sceneNode->setPosition( 8 * i, 5, 8 * j );
			m_instances.push_back( ent );
		}
	}

	instanceManager->defragmentBatches( true );

	mCamera->setPosition( 0, 0, -10 );
	mCamera->lookAt( 0, 0, 10 );
As you can see, I've made attempts with 3 materials from 3 techniques of "NewInstancing" from the Ogre samples.

My problem is that all fail.

1st (Texture VTF) fails with:

Code: Select all

WARNING: material MyInstanceMgr/InstanceBatch_0/VTFMaterialCaster0 has no supportable Techniques and will be blank. Explanation: 
Pass 0: Fragment program Ogre/Instancing/shadow_caster_ps cannot be used - not supported.
First-chance exception at 0x7696c52f in OgreProject.exe: Microsoft C++ exception: Ogre::RenderingAPIException at memory location 0x0032e90c..
2nd (Shader) fails with:

Code: Select all

WARNING: material Examples/Instancing/ShaderBased/shadow_caster has no supportable Techniques and will be blank. Explanation: 
Pass 0: Fragment program Ogre/Instancing/shadow_caster_ps cannot be used - not supported.
First-chance exception at 0x7696c52f in OgreProject.exe: Microsoft C++ exception: Ogre::InvalidParametersException at memory location 0x0047e988..
I 'm certainly missing something here.
I'm using OgreSDK 1.9, Win7 with a lousy Intel HD chip. But the SampleBrowser demos are running fine on it.

Many thanks in advance,

// jho
0 x

Post Reply