Project

General

Profile

Bug #1126

MD2 model render pop

Added by bcwood16 over 11 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
2013-07-25
% Done:

0%


Description

MD2 models pop into view when centre is hidden by BSP

Especially effecting long models such as custom pipes and beams.

See attached example.

Note - long models are supported with separate collision boxes (mobj) lined up along the model. This is due to the fact the collision box can only be 'box' shaped and making one large box to cover the long model is not practical. (as far as I know this should not effect MD2 renders)

Labels: Renderer, Visual Glitch, 3D Models

Attachments:

History

#1 Updated by danij over 11 years ago

- Priority: 1 --> 5

#2 Updated by skyjake over 11 years ago

- labels: md2 pop --> Renderer, Visual Glitch, 3D Models

#3 Updated by skyjake over 11 years ago

models.cpp:973:

// Half the distance from bottom left to top right.
float radius = (def->scale[VX] * (max[VX] - min[VX]) +
def->scale[VZ] * (max[VZ] - min[VZ])) / 3.5f;

The comment says "half", yet it's actually divided by 3.5. Changing it to 2 improves the situation but doesn't remove the popping completely.

Maybe there's a further issue with the contact spreading, or the radius isn't calculated correctly for this model?

#4 Updated by danij over 11 years ago

Indeed this calculation should divide by two. I'm not sure where the 3.5 comes from. Perhaps it was originally intended as fudge factor...

I suspect the issue is either the radius calculation for the model. Or the relative position of the model vs the origin. Depending on the relative positions of the submodels, etc. The vertex coordinate ranges for each submodel should first be translated by any offset at DED level then united into a single bounding cuboid. Half the length of the diagonal of this cuboid should then yield the maximum spread range from the origin of the model, assuming it is centered on the origin (however if this is not the case then we would need to translate the origin of the spread as well).

Note that I've not looked at the model yet, or checked through the algorithm.

#5 Updated by skyjake over 8 years ago

  • Target version deleted (1.8.6)

#6 Updated by skyjake over 7 years ago

  • Target version set to Rendering

Also available in: Atom PDF