Hello.
I tried to use Instancing in simple application based on BaseApplication.h/BaseApplication.cpp.
I got Ogre 1.9 from Mercurial, built it, ran SampleBrowser - instancing worked great.
Created a small application then .
It shows a triangle. When I use Ogre::SceneNode::attachObject - everything works good.
Then I tried to use instancing. Copied buildInstancedMaterial and setupInstancedMaterialToEntity and most of locateResources from Samples, applied them.
Tried instancing - no go.
Log shows a lot of shader problems (Cg mostly) and of course "Pass 0: Vertex program Instancing cannot be used - not supported." - the reason why instancing does not work.
But why shaders don't work - I don't understand. There're no tutorials about shaders, wiki says about shaders themselves only, not about "how to enable them in Ogre". - FIXED
The log is attached .
Moreover, it does not start with OpenGL renderer - says "OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource DualQuaternion.cg in resource group Popular or any other group. in ResourceGroupManager::openResource at .\src\OgreResourceGroupManager.cpp (line 756)". - FIXED
Please help me with instancing.
Thank you.
[1.9] Instancing problems, D3D9 and OGL
-
- Gnoblar
- Posts: 3
- Joined: Tue Jan 19, 2016 11:10 pm
Re: [1.9] Instancing problems, D3D9 and OGL
I found the way - it is crucial to call setPosition for each InstancedObject of each InstancedGeometry::BatchInstance because otherwise TransformMatrix is not calculated, and the default TransformMatrix is not IDENTITY but ZERO.
But there's one more problem. Material has red ambient colour but resulted image is white. Probably it should work with textures only.
But there's one more problem. Material has red ambient colour but resulted image is white. Probably it should work with textures only.
- Attachments
-
- ogreinst.cpp
- (8.53 KiB) Downloaded 16 times
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: [1.9] Instancing problems, D3D9 and OGL
In Ogre 1.9, we strongly recommend to use the new instancing system (see NewInstancing sample) and not the old one. The old one had a lot of problems.
-
- Gnoblar
- Posts: 3
- Joined: Tue Jan 19, 2016 11:10 pm
Re: [1.9] Instancing problems, D3D9 and OGL
Thank you, new instancing is working rather good, not without limitations of course.
- Attachments
-
- ogreinst.cpp
- (6.49 KiB) Downloaded 19 times