• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

What Does Calculate Extends in Magos Actually do?

Status
Not open for further replies.
Level 29
Joined
Jul 29, 2007
Messages
5,174
It re-calculates the extents, which define the bounding sphere (or cube) of a model, which in turn is used for selection and pathing.
The idea is to get the smallest and biggest coordinates for each of the axes, by looping over all of the vertices, and that's your extent (the distance between the two resulting vertices is also saved).
 
It re-calculates the extents, which define the bounding sphere (or cube) of a model, which in turn is used for selection and pathing.
The idea is to get the smallest and biggest coordinates for each of the axes, by looping over all of the vertices, and that's your extent (the distance between the two resulting vertices is also saved).

So Does it have something that changes the Unit's Health bar height? Some times my model's Health bar get super high and I don't know how to fix... Does it Relate to Calculate extends?
 
The model extends are mainly for telling the game weather the model collides with the camera bounds. For instance, if you have a very large model, it's extents will have to be scaled appropriately, otherwise it will not render when the models origin point is outside of view. Extents are also used for selection - the game first checks if the mouse collides with the extents, and if it does, it checks for any bounding shapes for more precise collision.
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
The model extends are mainly for telling the game weather the model collides with the camera bounds.
Can you explain a bit more about the rendering process? I.e. when a model is rendered/not rendered and what factors decide this. I had issues in many maps where models are not rendered though they should be (e.g. here on the right side of the screen). Is this only because of the model extents or is there some bug in wc3?
 
Can you explain a bit more about the rendering process? I.e. when a model is rendered/not rendered and what factors decide this. I had issues in many maps where models are not rendered though they should be (e.g. here on the right side of the screen). Is this only because of the model extents or is there some bug in wc3?

Yes, it is as you linked (the big tower disappears). The camera uses the bounding box/sphere to determine whether a model should be rendered on screen (taken from the object's coordinates). If you extend that bounding sphere, you can avoid those "disappearing" models (since it'll still be considered in the field of view). But it isn't always the best idea--in cases like the video you linked, if you extended the bounding sphere, the camera might clip into the model which would look strange to the viewer.

But you should extend the bounding sphere if you scale the model in the editor. I don't think wc3 actually takes into account scaling when it checks model extents, so increasing the extents manually will give you a better result. Unfortunately you'll run into issues when you use the same model with many different scales, in which case you should just choose the extents of the largest scaled object.

I don't know which tools allow you to set extents manually (magos' editor might). But it should be easy to write a program that sets it if you need that feature. (and if you set new extents, you would just multiply the old extents by the scaling value, e.g. extent * 1.25 if you are scaling the model 1.25 in the editor).
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
I don't think wc3 actually takes into account scaling when it checks model extents
Here we go, that's (kind of) the bug I wanted! There seems to be more to the story though.
The collision spheres/boxes are scaled with scaling value but it seems the model extents are not or only partially. For example until a certain scaling value the hp bar height increases. If you increase scaling value above that the hp bar stays at the max height. Maybe that's also the case with the extents and therefore the model rendering.
 
I don't think this is your problem. Extents should scale fine, but inaccuracies will become more evident at large scales. Also note that destructables have a hardcoded maximum for their extents, so they might dissapear even though you set their extents to something very high. In those cases it is best to use doodads if possible, since they don't have this problem.

It is possible to set extents manually in magos model editor. Just open the model, then go to edit>model properties, and there you have your extents.
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
I don't think this is your problem. Extents should scale fine,
I was talking about ingame scaling, i.e. scaling value in Object Editor or scaling via trigger.
That's what Purges quote was about, right?
I don't think wc3 actually takes into account scaling when it checks model extents
 
Last edited:
Yes, that is what i was refering to - i do believe that scaling a unit in the object editor also scales extents, i doubt Blizzard would have missed this. Instead, think of it like this: when a model is scaled very small, the distance between the origin and the edge of the extents is so small, that you will not really notice when the origin goes outside of camera bounds. On models that are scaled very large, it's much more noticeable.
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
Yes, that is what i was refering to - i do believe that scaling a unit in the object editor also scales extents, i doubt Blizzard would have missed this. Instead, think of it like this: when a model is scaled very small, the distance between the origin and the edge of the extents is so small, that you will not really notice when the origin goes outside of camera bounds. On models that are scaled very large, it's much more noticeable.

What I know for sure is if you place a huge Bloodmage with scaling value 40, the mouse hover detection will work fine anywhere on the model as long as it is rendered. The problem is if a small region around the center is not in the camera field anymore the model won't be rendered.

So my guess was that extents are only scaled up to a certain value. (The health bar that has a max height would confirm this).

Either that or rendering is completely independent from extents and collision shapes and just always is some kind of shape around the object..
 
Status
Not open for further replies.
Top