Bounding Box

Started by cyberkilla, January 11, 2007, 04:15:15 AM

Previous topic - Next topic

cyberkilla

Hey:)

Does the bounding box( which tells me not to call it too much ), change values
as a sequence of key frame animation is played out?

I would assume so, because my "dirty rectangle" clipping doesn't cover the avatar when he lifts his arms:).

If this is so, how can I make sure I have the right bounding box, without a major speed slowdown? I would appreciate any help on this;).
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

Yes, it changes when doing a keyframe animation. In fact it's interpolated like the rest of the mesh is. I'll have a look if i can add a kind of getDirtyBoundingBox() to get the actual bounding box without recalculating it. For now, just stick with getBoundingBox(). The calculation isn't THAT heavy. It should not matter performance wise unless the mesh is quite big and/or you are doing it on hundreds of meshes.

cyberkilla

Ah thats good:) Ill try it.

It is clearly done in another game, similar to mine, so it must be possible.

The meshes are less than 500 vertexes, I think. And im expecting around 6 models on the screen at the same time.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

Yup, works perfectly, and I don't notice any significant speed decrease:).

However, I have only tested with one model on the screen, so I may still have to work out some manual, and rather costly guessed bounding box.
One that I found to encapsulate the whole model, whatever it may be doing.

At least its an option:)

As I said, Im not expecting a huge number of models onscreen simultaneously,
so I have my fingers crossed that its not a problem:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

I've looked into it and now i know, why i'm calculating the box each time you are calling this method... :wink: It's not that easy to return the actual bounding box without recalculating it, so i'll skip this as long as it's not a problem. It shouldn't be one IMHO.

cyberkilla

Yes indeed:)

I fully understand why it must be done.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

Does the bounding box encapsulate the child objects too?
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

No, they have a box of their own.

cyberkilla

Okay:) Thanks:)

Ah, I guess ill have to work this into my equations also:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

Ah, one more little thing:)...

How is object space worked out? Is the calculated center of the mesh (0,0)?
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

No, object space remains unchanged. It's the space the object was saved in the modeler.

cyberkilla

Excellent:)

Im making a small utility with a slider control, to manually set the base y:)

Ill have a screenshot on my project thread soon.

It works Egon, and so far, it seems more than fast enough.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

This is strange! When I try to use a model with UV Mapping(1 texture),
the object space seems to be destroyed:(.

I have 2 models without UV Mapping, and they work fine.
I also have another model WITH UV Mapping, and its object space appears in the center of the model.
Before trying to use a texture, it worked fine too:(.


You know I spoke to you about getting the base of the models?
Well, in blender, you can put the mesh above the origin point, so the feet are just above it. In the game, I always use this point to keep the models on the ground.

No doubt other games do this too, because I see a lot of the models ive downloaded do the same.

Have you any idea what is happening Egon? Sorry for the extra problems:)

EDIT:
Just to clarify, the origin point of the model, which is supposed to be just below its feet, is in the center of the model instead.
It only happens with models with UV maps/texture.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

There is no difference between loading a model with or without u/v as far as i can see. Can you provide me with a test case? Ideally two models and some code that shows the problem.

cyberkilla

Yes, I will try to get something together. Thanks again!

This is strange. Perhaps there is another reason, but, I know for certain that the only thing modified on the model is the uv map, and a texture.

The result is that the origin point appears to move into the center of the models mesh, instead of where it was placed on the modeler.

I was inaccurate when I said it destroyed the object space:).


You see, I position the camera so this origin point(which I use for base of model),
is near the bottom of the camera view. This position does not change, even when it is broken.

The model, however, is no longer standing above this point, but is centered to it.


EDIT: This has grew even more complicated Egon. I fear it might be my fault now;).
I really hate it when you spend 3 hours trying to find out what is causing "x" problem, when you look again from another angle, and it turns out its not even the same problem:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG