-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adminotech - Implement Ogre Instancing #680
Conversation
…uction managed by OgreWorld.
… can start. Next I need to figure out the instancing shaders etc. All of this is still very much WIP.
… more logic to the instance state objects in OgreWorld, including optimization runs after 5 seconds after creations/deletions have been done.
…instead of the deprecated GetEntity(). Check that all these places have proper null checking in preparation for instancing.
…ne() and GetAttachementEntity().
…ouse to reset any active camera.
…perty/slots. Add function that can set mesh refs instances as static, this can boost performance quite a bit but is hard to automatically detect (if static any movement wont be updated) so lets leave it to script logic to tell the rendering what instance meshes wont be touched. Improve destroying instances so that the manager gets cleared once it has 0 instances left.
…eparated from the supershader for now.
…s to test performance with both instancing on and off and toggling static instancing.
…sh targets with ref and submesh. Fix that meshes that are set as static also create new instances (with all of its submesh/material combos) as static. Added a getter for static instancing for a particular mesh ref.
…ill usually override both or none so this makes the output cleaner to read. Fix documentation that CreateInstance can return null in error situations with given input.
…fied from the Ogre 3D example assets and note the original author Matias N. Goldberg.
… empty targets into the internal lists. Now if create and destroy are used in pair correctly, there is nothing left for dtor to cleanup. Fixed typo in script UI.
…ncing is used. Add todo tag to SetMaterial. Implementing this might be quite heavy with instancing as it involved completely destroying the current instances with this material and creating new with 'instancing supported highlight material'.
…state book keeping. This fixes meshes with multiple submeshes in them and makes the internals a faster when instances are destroyed by EC_Mesh.
Adminotech@b3f7250 Makes a bit of overhaul to my OgreWorld internals. Fixes things with multiple submeshes and should speed up DestroyInstance() a bit, less things to loop around. Hopefully this will get cleanly merged to lasses work that is making all (most at least) our super shaders available for instancing, which is a super exiting feature for artists! My thing was kind of restricted demo phase in terms of shaders :) |
…needed test code for multi submesh creation.
Multi-submesh support looks solid now. Draw distance & draw shadows settings are not being used in instanced entities though. |
https://github.com/realXtend/naali/pull/680/files#L13R966 Hmm, I did implement and even test it by selecting a bunch of ents in the instancing test scene, setting their draw distance to 10 and they dissapeared. Came back when a high enough distance was used, or set to 0. It should sync that in both creation and any time the attribute changes. |
Sorry, when retesting, draw distance worked correctly. Shadow casting is only changeable per instance batch, so it is now locked on. |
Thanks @cadaver for the quick work and great job on cloning the super shaders with instancing support! This is huge plus for maintainability of the super shader. |
Implements Ogre instancing support for Tundra in
EC_Mesh
andOgreWorld
.Implemented now
useInstancing
attribute for EC_Mesh.OgreEntity()
may return null if instancing is used. Created newOgreInstancedEntity()
for these situations. I've checked all core c++ code that nothing blindly uses the OgreEntity() ptr.CreateInstance()
andDestroyInstances()
functions that must be used by eg.EC_Mesh
in pair to keep OgreWorld internal state in sync.IsDebugInstancingEnabled()
andSetDebugInstancingEnabled(enabled)
and a qt property (just like PhysicsWorld does).IsInstancingStatic(meshRef)
andSetInstancingStatic(meshRef, static)
. This can make the rendering dramatically faster in cases where the instances are not moved. This must be decided by a inworld script, it is too bug prone to automate in OgreWorld. If you know a) you have huge amount of instances b) you are not going to move them via EC_Mesh transform or EC_Placeacble, either for scripts or via clients, you should go ahead and set static to true.bin/scenes/Instancing/scene.txml
Needs work!?
I've sent this pull request in good time so people have time to review it before merging talk becomes relevant. Any feedback on the code in general and API in OgreWorld would be appreciated!