This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
ded:model [2017-03-17 08:52] – [MD2/DMD model definition (Doomsday 1.x)] skyjake | ded:model [2017-03-19 20:32] (current) – [MD2/DMD model definition (Doomsday 1.x)] skyjake | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== MD2/DMD model definition (Doomsday 1.x) ====== | ||
+ | |||
+ | A single 3D model is represented by a collection of one to eight " | ||
+ | |||
+ | Doomsday 2 supports more powerful [[assets: | ||
+ | |||
+ | |||
+ | ===== Flag usage ===== | ||
+ | |||
+ | Stated at definition " | ||
+ | < | ||
+ | Model { | ||
+ | Flags = flag; | ||
+ | }</ | ||
+ | |||
+ | Stated at //Sub{}// level scopes them to only that sub-model: | ||
+ | < | ||
+ | Model { | ||
+ | Sub { | ||
+ | Flags = flag; | ||
+ | }; | ||
+ | }</ | ||
+ | |||
+ | Submodel flags are XOR'd with the main model flags. This means the sub-model flags can be used to turn off or on flags that affect all sub-models. | ||
+ | |||
+ | For example: | ||
+ | | ||
+ | Model | ||
+ | { | ||
+ | Flags = shadow1; | ||
+ | Sub { Flags = shadow1; }; # Not shadowed at all. | ||
+ | Sub { Flags = fullbright; }; # Shadowed and fullbright. | ||
+ | Sub { }; # Just shadowed. | ||
+ | } | ||
+ | |||
+ | |||
+ | ===== Animation ===== | ||
+ | |||
+ | Inter and Interpolate can be used together. You can for example assign two | ||
+ | model frames to span across three states: | ||
+ | | ||
+ | : (Frame 1) : (Frame 2) : | ||
+ | : : | ||
+ | +-----------+-----------+-----------+ Time--> | ||
+ | | (State 1) | (State 2) | (State 3) | | ||
+ | |0 | ||
+ | D1----------D2----D3----D4----------+ | ||
+ | : : | ||
+ | : : | ||
+ | : : | ||
+ | : : | ||
+ | : : | ||
+ | : 2nd defn: S2, Inter=0, Interpolate {0.666 1.333} | ||
+ | : | ||
+ | 1st definition: S1, Inter=0, Interpolate {0 0.666} | ||
+ | |||
+ | |||
+ | Note the 2nd definition' | ||
+ | definition' | ||
+ | 2nd definition only extends from Inter=0 to Inter=0.5, but we want that at | ||
+ | Inter=0.5 the interpolation visually reaches its end (frame 1 ends and | ||
+ | frame 2 begins): point 0.5 in the range {0.666 1.333} is one. The 3rd | ||
+ | definition' | ||
+ | from Inter=0.5 and visually from the beginning (i.e. zero). When 0.5 is | ||
+ | scaled to the range {-0.333 0.333} we get the zero we wanted. | ||
+ | |||
+ | |||
+ | ===== Syntax ===== | ||
+ | | ||
+ | < | ||
+ | { | ||
+ | ID = ""; | ||
+ | State = ""; | ||
+ | Off = 0; | ||
+ | Group = ""; | ||
+ | | ||
+ | Inter = 0.0; | ||
+ | | ||
+ | Flags = flaga | flagb | flagc; | ||
+ | Skin tics = 0; | ||
+ | Scale = 1.0; | ||
+ | Scale XYZ { 1.0 1.0 1.0 }; | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | Sub # A sub-model begins. ' | ||
+ | { | ||
+ | # There must be at least one sub-model per definition | ||
+ | # (up to eight are supported). | ||
+ | File = ""; | ||
+ | Frame = ""; | ||
+ | Frame range = 0; | ||
+ | Flags = ""; | ||
+ | | ||
+ | Shiny reaction = 1.0; | ||
+ | Skin = 0; | ||
+ | Skin range = 0; | ||
+ | Skin file = ""; | ||
+ | | ||
+ | | ||
+ | Shiny skin = ""; | ||
+ | Shiny = 0.0; | ||
+ | Shiny color { 1.0 1.0 1.0 }; | ||
+ | | ||
+ | | ||
+ | | ||
+ | Parm = 0.0; | ||
+ | }; | ||
+ | } | ||
+ | |||
+ | If the **Copy** attribute is used, all the data of the previous definition is copied to this one. For the first definition in a file **Copy** has no effect. | ||
+ | |||
+ | A model definition must define at least one sub-model (up to a maximum of eight). | ||
+ | |||
+ | You can set flags in both the main Model definition and the Sub-model definitions. | ||
+ | |||
+ | |||
+ | ==== ID ==== | ||
+ | |||
+ | The identifier of this definition. You can only set either the ID key or the State key, not both. Models with an ID can't be assigned to Thing States. | ||
+ | |||
+ | |||
+ | ==== State ==== | ||
+ | |||
+ | The State this model will be used with. You can only set either the ID key or the State key, not both. | ||
+ | |||
+ | |||
+ | ==== Off ==== | ||
+ | |||
+ | Offset to state index. Use carefully! If State indices change you'll be in a lot of trouble. | ||
+ | |||
+ | |||
+ | ==== Group ==== | ||
+ | |||
+ | One or more group IDs (mg_*). Optional. | ||
+ | |||
+ | |||
+ | ==== Selector ==== | ||
+ | |||
+ | A custom value which can be used by the Game for various purposes, like alternative models for some objects. | ||
+ | |||
+ | |||
+ | ==== Inter ==== | ||
+ | |||
+ | Possible values: 0-1. Determines the point during the interpolation between states when this definition becomes valid. Can be used to assign several different model frames to a single State. | ||
+ | |||
+ | **Note**: Sub-models are sorted by definition order when drawing so // | ||
+ | |||
+ | |||
+ | ==== Interpolate ==== | ||
+ | |||
+ | Range of interpolation. Specifies the range of the visual interpolation of the model during the State. Can be used to extend the interpolation of one model frame onto multiple States (by defining a sub-0..1 range). Always define full ranges that begin from zero and end to one. | ||
+ | |||
+ | When the **worldtime** flag is used, this statement has a different meaning: | ||
+ | | ||
+ | Interpolate { < | ||
+ | |||
+ | * //< | ||
+ | * //< | ||
+ | |||
+ | |||
+ | ==== Flags ==== | ||
+ | |||
+ | Flags for the whole model, including all the submodels. | ||
+ | |||
+ | ^ Name^ Purpose | | ||
+ | | alignpitch| Aligns pitch rotation of the model with the camera. | | ||
+ | | alignyaw| Aligns yaw rotation of the model with the camera. | | ||
+ | | autoscale| The model is automatically scaled to match the dimensions of the original sprite. | | ||
+ | | brightshadow| The model is rendered with additive blending and 80% translucency. | | ||
+ | | brightshadow2| The model is rendered with additive blending (equivalent to // | ||
+ | | darkshadow| The model is rendered with inverse-additive blending (equivalent to // | ||
+ | | fullbright| The model is rendered with the maximum light level (corresponds sector light level 255) regardless of the sector it's currently in. | | ||
+ | | idangle| The model gets a unique yaw angle offset calculated from the ID number of the object. | | ||
+ | | idframe| An offset derived from the ID number of the object is added to the current frame index of the object. [[# | ||
+ | | idskin| Assigns a unique skin selection based on the ID of the model' | ||
+ | | litshiny| Lighting should be applied to the model' | ||
+ | | movpitch| Enables model' | ||
+ | | movyaw| Enables model' | ||
+ | | nointerpol| Disable model vertex interpolation. | | ||
+ | | nomaxz| Model is used at all distances regardless of the model visibility settings. | | ||
+ | | noptc| Disables emission of particles for particle generators associated with the model. | | ||
+ | | notexcomp| Disable texture compression of all the skins of the model associated with this definition. | | ||
+ | | noz| The model is rendered with Z-buffer writes disabled. | | ||
+ | | ptoffsub1| The center of submodel #1 is the spawn origin for particle generators. | | ||
+ | | selskin| Enable skin selection with [[# | ||
+ | | shadow1| The model is rendered with 33% translucency. When using this flag the value of the [[# | ||
+ | | shadow2| The model is rendered with 66% translucency. When using this flag the value of the [[# | ||
+ | | skintrans| Skin selection is determined by the color translation of the original sprite. | | ||
+ | | specular| Enable specular highlighting when rendering the model. | | ||
+ | | spin| Enable model spinning. Useful for showcasing items etc. | | ||
+ | | twosided| The model is rendered with both sides of each face drawn. Useful for simple models with texturized planes in which both both sides must be visible. | | ||
+ | | worldtime| Model' | ||
+ | |||
+ | |||
+ | |||
+ | ==== Skin tics ==== | ||
+ | |||
+ | Skin cycle: this many tics for each skin. | ||
+ | |||
+ | |||
+ | ==== Scale ==== | ||
+ | |||
+ | Scaling factor for the whole model (all submodels affected). Uniformly sets *all* components of [[# | ||
+ | |||
+ | |||
+ | ==== Scale XYZ ==== | ||
+ | |||
+ | Scaling factors for the whole model (all submodels affected). | ||
+ | |||
+ | |||
+ | ==== Resize ==== | ||
+ | |||
+ | Automatic resizing to the given height. The whole model will be scaled (only along the Y axis). | ||
+ | |||
+ | |||
+ | ==== Offset ==== | ||
+ | |||
+ | Offset to model Y coordinate, applied when rendering. Affects all submodels. Modifies the Y component of [[# | ||
+ | |||
+ | |||
+ | ==== Offset XYZ ==== | ||
+ | |||
+ | Offset to model X, Y and Z coordinates, | ||
+ | |||
+ | |||
+ | ==== Sprite ==== | ||
+ | |||
+ | |||
+ | ==== Sprite frame ==== | ||
+ | |||
+ | For auto-scaling: | ||
+ | |||
+ | |||
+ | ==== Shadow radius ==== | ||
+ | |||
+ | With the default value of zero the shadow radius is automatically calculated based on the visual bounds of the object/ | ||
+ | |||
+ | |||
+ | ==== Sub (or Md2) ==== | ||
+ | |||
+ | There can be eight Sub blocks in a Model definition. Each block defines one sub-model. | ||
+ | |||
+ | |||
+ | === File === | ||
+ | |||
+ | Model file, e.g. " | ||
+ | |||
+ | |||
+ | === Frame === | ||
+ | |||
+ | Name of the animation frame within the model file to use. | ||
+ | |||
+ | |||
+ | === Frame range === | ||
+ | |||
+ | Used with the // | ||
+ | |||
+ | |||
+ | === Flags === | ||
+ | |||
+ | Flags (with the prefix df_*) that affect this sub-model only. A //XOR// operation is done with the [[# | ||
+ | |||
+ | |||
+ | === Blending mode === | ||
+ | |||
+ | Blending mode for this submodel. One of the bm_* flags. Note that blending modes set by the flags override this setting. | ||
+ | |||
+ | |||
+ | === Shiny reaction === | ||
+ | |||
+ | A factor that modifies how shiny coordinates are calculated for the submodel. Values below 1.0 will reduce the effect rotation of the model has on the shiny coordinates. | ||
+ | |||
+ | |||
+ | === Skin === | ||
+ | |||
+ | The index number of the skin to use. | ||
+ | |||
+ | |||
+ | === Skin range === | ||
+ | |||
+ | Size of the skin cycling range. The first skin in the range is the one specified by Skin, and the last one is //(Skin) + (Skin range) - 1//. | ||
+ | |||
+ | |||
+ | === Skin file === | ||
+ | |||
+ | File name of the skin. This can be any image file on the model path. If a skin file is specified, the skin number is ignored. If skins are defined in the model file then it is not necessary to use this parameter (though it may be used to override). | ||
+ | |||
+ | |||
+ | === Offset XYZ === | ||
+ | |||
+ | Offset to submodel X, Y and Z coordinates, | ||
+ | |||
+ | |||
+ | === Transparent === | ||
+ | |||
+ | Translucency of the sub-model: 0=opaque, 1=transparent. The level of translucency defined here is not used with // | ||
+ | |||
+ | |||
+ | === Shiny skin === | ||
+ | |||
+ | |||
+ | === Shiny === | ||
+ | |||
+ | |||
+ | === Shiny color === | ||
+ | |||
+ | |||
+ | === Selskin mask === | ||
+ | |||
+ | // | ||
+ | |||
+ | |||
+ | === Selskin shift === | ||
+ | |||
+ | After doing an //AND// operation with the selskin mask, the resulting value is shifted to the right this many bits. Negative values shift to the left. | ||
+ | |||
+ | |||
+ | === Selskins === | ||
+ | |||
+ | At most 8 skin numbers for use with [[# | ||
+ | |||
+ | |||
+ | === Parm === | ||
+ | |||
+ | Custom parameter. | ||
+ | |||
+ | |||
+ | |||