Question about use of instancedentity

Problems building or running the engine, queries about how to use features etc.
Post Reply
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Question about use of instancedentity

Post by Niubbo »

Ogre Version: 1.12.8
Operating System: win10
Render System: dx9

I have a question about the limit of use of instancedentity ; I saw the class instancedentity doesn't permit to access the subentities or change the material attached, and the reason seems clear to me, being generated all the instances from a single mesh changes them individually makes no sense and is not possible. Clarified this my question is: in the case of entity changing material or setting visibile or not part of subentities from the point of view of performance is better work with the normal entities or destroy and creates the instanceentities after the change of meshes? I suppose the first is better. thanks
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: Question about use of instancedentity

Post by sercero »

Hello,

Can you rephrase que question?

Is is not very clear.

It seems that you are asking if working around the limitations of instanced entities will lead to worse performance than using regular entities.

Am I right?
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Re: Question about use of instancedentity

Post by Niubbo »

Sorry, the problem is linked to the other question about the trimmed sprites. Essentially I assume the necessity to change the vertex position of the entity every frame for dimension\position change. In a normal entity I saw you can do accessing the subentities, but I saw this is not possible with instancedentities.

Assuming this necessity my question is if from the point of view of performance is better works with normal entities or destroy and recreate instancedentities every frame after changing the original mesh. thanks
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: Question about use of instancedentity

Post by sercero »

Can't you change the position of the vertices through the shader, or is it a more permanent change?

Anyway, it seems somewhat advanced for my knowledge. Good luck!
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Re: Question about use of instancedentity

Post by Niubbo »

no is dynamic change every frame, is the classical animation done with spritesheets. I still don't know very well the use of shaders also if I understood how they works, I want first to make it work with the normal code.
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: Question about use of instancedentity

Post by sercero »

You have:
- Skeletal animation
- Morph Animation
- Pose Animation

https://ogrecave.github.io/ogre/api/1.1 ... ation.html

I don't remember which ones were supported by instancing, I think that it depends on the instancing technique.

It is highly recommended that you learn about shaders, here is a very good resource: https://learnopengl.com/
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Question about use of instancedentity

Post by paroj »

spritesheet animation is texture animation. See the Smoke sample for how to use it with Ogre Particles/ Billboards.
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Re: Question about use of instancedentity

Post by Niubbo »

thanks but is not exactly the same case of particle; just to do an example, you have sprite sheet with the different frames of a man walking; the original frame dimension before the packing is 300x300 (call it original dimension), after the packing all the alpha space is trimmed so every frame is now of different dimensions (call it real dimension) in the sheet on the base of how much alpha zone has been trimmed.

Now if the case was limited to a single texture image is possible to manage it with billboardset, using the "real dimension" in the billboard and change his dimension every cycle on the base of next frame dimension (using the center-bottom origin type in order to have the man walking on the ground without calculate the distance from ground the center of billboard), probably also using the texture animation is possible, still to check the details of technique.

The real problem is that now, on the man walking image, I need to add the jacket images from another texture sheet, each frame corresponding to a different moment of walking man. the original dimension of jacket frames were 100x100 and of course the real dimensions are all differents. So i have to do math calculation using the texturepacker files information linked to packed dds files to overlap them correctly (from here the necessity to keep count of the offset of center of real dimension respect the center of original dimension)

In theory I could use a second billboardset and overlap the billboards of two images, but it seems me expensive if the number of sprites is big on the scene.

I would like to try to build a simplified version of original billboardset in order to do the same overlap but using more than 1 texture coordinates (in order to manage a multitexture material) and overlap billboards of the same set.
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: Question about use of instancedentity

Post by sercero »

Niubbo,

Have you looked at the Godot engine?

I ask because people say that is has a very good 2D support (it also has 3D and they can be used in unison).

I'm telling you this because it seems that Godot might be a better fit for what you are trying to do than OGRE.
Niubbo
Goblin
Posts: 211
Joined: Sat Jan 23, 2016 11:26 am
x 17

Re: Question about use of instancedentity

Post by Niubbo »

Well is not a real project is more a learning project. I understand Ogre is more complex to use that one of full engine like godot, panda and unity, but exactly for this you learn a lot more about the game programming concept also if perhaps is the harder and longer way.
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: Question about use of instancedentity

Post by sercero »

Respect! 8)
Post Reply