Page 1 of 1

Posted: Thu Mar 15, 2007 6:02 pm
by madpeople
mdl format supports LOD
its what the template.mdls are for

Code: Select all

use "effect";

frame = ModifiableNumber(0);

object =
    LODGeo(
        ImportXFile("name.x", frame),
        [
            ( 64, ImportXFile("name_static.x", frame)),
            ( 32, ImportXFile("name_a.x",      frame)),
            (  8, ImportXFile("name_b.x",      frame))
        ]
    );
i can make LOD work in mdledit with the LOD slider, though it stays on highest most of the time, only when you get further to the other end does it kick in.

how do the numbers (8,32,64) relate to range in allegiance, say at over 8k to the rock it will use the model given for 8, at 6k the 32 one, 64 3k or something

is there a function that relates them to distance? of the camera (player) in alleg to the object

do they effect performance, say if i made the lod's change quite a bit, say lowest at 3k and only reach max detail when your really close, would that yield better performance? or is putting loads of LOD versions in one file not worth the increased file size?

i'm deciding if i should include different LODs in my rocks, whether i should make versions with no different LODs, or perhaps a multi LOD version too?


also, CVH boxes

would it be bad if i were to use multiple cvh boxes on my rocks? (i know allegiance supports multiple cvh boxes)

right now i'm using a single 100 vert cvh box, but i could get it to fit better if i used more.

how much of an impact to people would increased numbers of cvh boxes make, even if the total number of verts remained the same

%^&* this was supposed to go into misc dev...

Posted: Thu Mar 15, 2007 11:56 pm
by asheron2k
100...vert...cvh
please dont say that
how could you possibly need that many(for a rock)

general rules:
all groups need to be convex
they don't need to be form-fitting
and should use as few verts as possible

only group if you need to make a non convex shape

Posted: Fri Mar 16, 2007 12:08 am
by madpeople
asheron2k wrote:QUOTE (asheron2k @ Mar 15 2007, 11:56 PM) 100...vert...cvh
please dont say that
how could you possibly need that many(for a rock)
i was going on the original rocks
they have about 80 polys / verts and i think their hitbox is basically exactly the same as the rock because the original rock is convex
QUOTE general rules:
all groups need to be convex -well, yeah it is what cvh means /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
they don't need to be form-fitting -not totally, but people complain about hitting invisible walls, closer is better
and should use as few verts as possible -yes, less calculations... i can enter how many i want to use (i've got a nifty little tool that can make them)

only group if you need to make a non convex shape- my rocks are different to the originals in that they are not totally convex[/quote]
the 100 was arbitrary it can be changed, but anyway back on topic... /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

Posted: Fri Mar 16, 2007 2:37 am
by asheron2k
originals are 42 vert for cvh
and 74 vert for model

and the 2^n numbers for the lod might be texture widths(it might scale down the textures)(some low lod groups have no texture assigned)

EDIT: After looking at the code mdv's is more better correct

Posted: Fri Mar 16, 2007 3:00 am
by mdvalley
I think the number refers to the size of the object on screen in pixels (possibly with some multiplier). I know that bigger numbers translate to more polys, but I'm fuzzy on the details.

And keep in mind that increasing the cvh poly count translates into increased CPU usage for both the clients and the server.

Posted: Fri Mar 16, 2007 10:27 am
by madpeople
mdvalley wrote:QUOTE (mdvalley @ Mar 16 2007, 03:00 AM) I think the number refers to the size of the object on screen in pixels (possibly with some multiplier). I know that bigger numbers translate to more polys, but I'm fuzzy on the details.
the numbers don't refer to poly counts, i think they may be referring to the distance the LOD level kicks in (from moving the lod slider in mdledit), but i'm not totally sure. but its not poly counts

Code: Select all

            ( 64, ImportXFile("name_static.x", frame)),
            ( 32, ImportXFile("name_a.x",      frame)),
            (  8, ImportXFile("name_b.x",      frame))
the name_a.x and name_b.x are reduced poly count models of the original, their poly count is reduced with xmunge - reduce

Code: Select all

xmunge -reduce 0.5   %1flat_pm.x %1_a.x
xmunge -reduce 0.01  %1flat_pm.x %1_b.x
the templates tell mdlc which models to put in the final mdl file, but i'm not sure what exactly the numbers do, i think they are related to the distance you have to be at for it to change, but i'm not 100% sure how exactly.
i'm thinking of trying to improvise in-game model animation:
when your far away the model has a force field over its door, but when you get closer it switches to a model that doesn't have that shield over the door
you could do more complex things, but they would behave funny and would need huge .mdl files with many many LOD models in, so it couldn't be used for any smooth movement
QUOTE And keep in mind that increasing the cvh poly count translates into increased CPU usage for both the clients and the server.[/quote]

that i know, but what about an increased number of cvh boxes, but keeping the vert count the same?
i know it would result in a increase, but how much

not counting milkshape, what can i use to see the cvh box of a model (something like mdledit or dxview but for .cvh files

Posted: Fri Mar 16, 2007 5:46 pm
by asheron2k
Trust mdv on this one... if you look at the relevant code you will see his comments on it.
It appears to be based on a quick estimate of an objects radius in pixels(fairly quick to compute if you have an absolute radius(which it looks like the scale modifier gives) and a distance)

cvh files are plain text so wordpad will work /tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" />

Posted: Fri Mar 16, 2007 8:36 pm
by madpeople
i did notice the rock got smaller with Lower LOD, but i thought that was part of Xmunge -reduce 's effect, it cut parts of the rock off to leave flat bits.
but the 8 one wasn't 8 times smaller

does that mean i could have a template like

Code: Select all

use "effect";

frame = ModifiableNumber(0);

object =
    LODGeo(
        ImportXFile("name.x", frame),
        [
            ( 64, ImportXFile("name_static.x", frame)),
            ( 64, ImportXFile("name_a.x",      frame)),
            ( 64, ImportXFile("name_b.x",      frame))
        ]
    );
does the number have to be a power of 2?
i'm guessing it does since all the ones ms used were

my main questions are still,
is there any point in me using LOD? ... when i can just make multiple versions (and plan to do so) of the same object at different LODs so people can choose the right one

and

how much of a performance hit would instead of using a single cvh box with n verts, i use say 2 cvh boxes with n/2 verts? or to extend that, 3 cvh boxes with n/3 verts each... (perhaps if i say polys instead of verts in the above?)