MeshCullBox issue

Blitz3D Forums/Blitz3D Programming/MeshCullBox issue

jfk EO-11110(Posted 2009) [#1]
I am having problems using MeshCullBox. Is there something special I don't know about the command? What I am currently doing is this:

I am determining the real world width, height and depth of an animated model, based on recursive vertex checks. With these values I then FitMesh a cube that I parent to the animated mesh, for visual debugging purposes (alpha 0.3 etc.). This works fine and the Boxes fit as they should (around some NPCs in the game).

Now I take exactly the same values and use them with MeshCullBox. Surprisingly this works with some NPC meshes, and doesn't with some others. Some are culled when I get closer than a given distance, some even are culled when I only look up or down, or when theit top pivot is offscreen.
I have no idea what's going on. Am I right that the parameters for FitMesh should also work with MeshCullBox??


John Blackledge(Posted 2009) [#2]
I have difficulty imagining the problem, but...
Could it be that the origin point is actually away from the model?

I've seen a lot of models produced in 3DS or AutoCad where the origin point is way outside of the model. Could this explain the problem you have?


puki(Posted 2009) [#3]
I'd assume you have to use offsets for correct use.

Fitmesh works on the basis of the geometry of the mesh - all factors are related to the mesh itself.

MeshCullBox works on the basis of the bounding box of the mesh, not the actual mesh. In addition, it relates to corners.

I'd assume you have to calculate the two to work together due to MeshCullBox working on the principle of corners.


EDIT:
ps, I just made that up (based on the commands) - I have no actual idea of whether it is true or not.


FlagDKT(Posted 2009) [#4]
Do you use b3d exporter under 3dsmax?


jfk EO-11110(Posted 2009) [#5]
Thanks for the replies. Using Offsets may be hard. What is surprising is the fact that it works with some B3Ds and not with some others. Theirs pivots are all the same, so this isn't the problem.

The default "guessimated" Boxes usually work fine, but there's this sitation when en NPC lies on the ground, that's when he starts "blinking".

I also tried to set it to all children as well, with no success. There is a pivot ontop of the NPC AniMesh, but that shouldn't be the cause, or?

The Synthax is clear: x,y,z,w,h,d... there isn't much space for interpretation and I think Mark implemented it according to the blitz3d standarts.

It's a .B3D that was imported as .X and then exported by Fragmotion. But for some reason I also had similar artefacts with a B3D that was exported by CharacterFX.

Still top ranking on the todo list...


big10p(Posted 2009) [#6]
I suspect the x,y,z,w,h,d parameters work in the same way as they do with EntityBox, which can be a little confusing.

Basically, you define the box by specifying x,y,z as relative coords from the mesh origin to one (any) corner of the box, then specify w,h,d as relative coords from that corner, to the opposite corner of the box.

For example, to set a cull box to fit a standard blitz cube, you would set x,y,z,w,h,d to -1,-1,-1,2,2,2. Or, you could set them to 1,1,1,-2,-2,-2.


jfk EO-11110(Posted 2009) [#7]
That's what I did. The parameters for -1,-1,-1,2,2,2 were calculated from the min and max vertex coords. I also tried negative values. I even tried to set a simple box like -5,-5,-5,10,10,10 and it didn't make a diffrence, still only the feet of the NPC decided if it was displayed or not, or in other words: as soon as the feet are offscreen, the entire NPC is hidden.

That's what's so surprising, that it didn't make a diffrence. (well with the negative Values there was a diffrence, but it somehow didn't work as well).

I start thinking there must be a problem with the bones hierarchy, with the way nodes are nested in the file. Next I'll try to set the MushCullBox to the NOCs parent pivot. Then again, that's not a mesh but a Pivot...hmmm. maybe I should use CreateMesh instead of CreatePivot there, this could be a solution...we'll see.

Edit: didn't help.