Graphics:Models: Difference between revisions

From Adonthell
Jump to navigation Jump to search
m Reverted edits by Asipicabad (talk) to last revision by Ksterker
Added section about engine limits
 
(2 intermediate revisions by the same user not shown)
Line 16: Line 16:


To aid with the construction of models, the <tt>modeller</tt> tool has been created. There is a [[Tools:Modeller:Tutorial|tutorial]] providing step-by-step instructions to its basic functionality and a more detailed [[Tools:Modeller:Editing|reference]] explaining all of its features.
To aid with the construction of models, the <tt>modeller</tt> tool has been created. There is a [[Tools:Modeller:Tutorial|tutorial]] providing step-by-step instructions to its basic functionality and a more detailed [[Tools:Modeller:Editing|reference]] explaining all of its features.
== Restrictions ==
{| style="float: right; margin-left:0.2em; border: 1px solid #BBB;"
|- style="font-size: 87%;"
| valign="top" |[[Image:Wall no overlap.png|240px]]<br />Wall and ceiling don't overlap
|}
{| style="float: right; margin-left:0.2em; border: 1px solid #BBB;"
|- style="font-size: 87%;"
| valign="top" |[[Image:Wall overlap.png|240px]]<br />Wall and ceiling intersect
|}
While one can create models in any possible shape and size, the way a scene is rendered imposes some restrictions on that freedom. The most important restriction is to avoid overlap or intersections of two models when placed next to each other. Consider the  example of a wall corner and a ceiling tile on the right (presented in a more 3D-ish view to better illustrate the situation):
In the first picture, a ceiling tile aligned to grid will intersect with the inner part of the wall. During rendering, this may cause parts of the wall to appear on top of the ceiling.
The solution to this problem can be seen in the second picture, where the wall has been split into an outer and inner part, that allows the ceiling tile to rest on top of the inner wall.


== Conventions ==
== Conventions ==
Line 23: Line 40:
=== Floor ===
=== Floor ===


Floor tiles should have a length of 64px and a width of 48px or multiples thereof. 64px by 96px and 128px by 96px are common sizes.
Floor tiles should have a length of 48px and a width of 36px or multiples thereof. 48px by 72px and 96px by 72px would be common sizes. The height of floor tiles is 8px. (Zero height floors are not supported by the engine).


The height of floor tiles is 5px, with an offset of -5px. That means, a ground tile places at z = 0 will have its surface at z = 0 as well, which is more convenient when building maps.  
=== Walls ===
 
Wall tiles come in two variations. Inside walls have a height of 88px, outside walls have a height of 96px. The remaining dimensions can be had from the templates available for [https://github.com/ksterker/wastesedge/tree/master/gfx48/map/wall/inside/template inside] and [https://github.com/ksterker/wastesedge/tree/master/gfx48/map/wall/outside/template outside] walls.
 
Wall tiles follow a specific naming scheme that can be gleaned from the picture below. Filenames for inside walls (shown in turquoise) begin with '''"ins-"''', while filenames for outside walls (shown in purple) begin with '''"out-"'''. This is then followed by 3 characters: The first denotes if it is a straight '''(S)''', inside corner '''(I)''' or outside corner '''(O)'''. The 2nd denotes front '''(F)''' or back '''(B)''' or is '''(x)''' if it is neither/irrelevant. The 3rd then if left '''(L)''', right '''(R)''' or neither '''(x)'''.


=== Walls ===
[[Image:Wall plan.png|center|frame|Parts and naming of wall tiles]]


Wall tiles in general have a height of 100px.
The parts of a particular kind of wall (stone, wood, etc.) are grouped in a folder. Adding that to the individual filenames is therefore redundant. Finally, if there are variations of certain parts, then "_variation-name" can be appended. E.g.:


* '''Horizontal walls''' are named ''wall-h'' and have a length of 128px and a width of 10px. There can be a ''wall-h-small'' variant that has a length of 64px instead.
  ...
* '''Vertical walls''' are named ''wall-v'' and have a length of 12px and a width of 96px. Again, a small variant would be named ''wall-v-small'' and have a width of 48px.
  |
* '''Corner and intersections''' are shown in the image below. [[Image:Wall-tiles.png|center|frame|Wall tiles seen from above]]The dark areas indicate shadows that can be added for ground-level wall models. They need to be an extra sprite with a non-solid shape of height 2px and length and width as indicated by the image above. Dotted lines indicate where multiple sprites are required to compose that particular wall model, as the renderer will not be able to handle it correctly otherwise.
  +- wall
        +- stone
                +- out-SBx.png
                +- out-SBx_cracked.png
                +- out-SBx_double_with_window.png


=== Doorways ===
=== Doorways ===


Doorways are handled mostly like walls, except they are called ''doorway-h'' or ''doorway-v''. They have the size of horizontal or vertical walls, with an opening of 64px for horizontal and 48px for vertical doors. In both cases, the height of the opening should be 90px. For vertical doorways, a matching shadow will help indicate where the opening is located as it will not be directly visible with the top-down view that Adonthell uses.
Doorways are handled mostly like walls, except they are prefixed with ''_doorway''. They have the size of horizontal or vertical walls, with an opening of 48px for horizontal and 36px for vertical doors. In both cases, the height of the opening should be at least 64px. For vertical doorways, some indication is needed to help locate the actual opening, as it will not be directly visible with the top-down view that Adonthell uses.


[[Category:Modeller]]
[[Category:Modeller]]
[[Category:Graphics]]
[[Category:Graphics]]

Latest revision as of 13:05, 15 January 2012

By augmenting a sprite with additional information, we can create an object that is ready for placement on the map: a model.

Purpose of Models

A model combines the graphical representation of an object with a physical shape. As explained in the chapter about in-game graphics, sprites are drawn to give a 3-dimensional appearance to the game world. Internally, the engine uses indeed a (simple) 3-dimensional representation for the purpose of collision detection and rendering. The shape of each model is used to build this internal 3D representation and the sprite is used to visualize it on screen.

As such, it is important to understand how sprite and shape fit together, as only precisely built models will ensure a game world where characters won't get stuck or fall through the ground and where objects are rendered without glitches.

Construction of Models

Example Models

Since the 3D representation will not be visible directly, it does not have to be very detailed. Therefore, the basic shape is a simple cube. It can be deformed to match the actual sprite and, where necessary, multiple cubes can be used to represent more complex sprites.

For non-rectangular sprites, individual corners of the cube can be moved freely in space and even onto each other to make diagonal or triangular shapes. Note however that it is not allowed to make completely flat (i.e. two-dimensional) shapes, as collision detection will not function properly around those. So even floor tiles will have to have a certain height.

To align a sprite with the shapes, an additional offset can be specified. This offset is only 2-dimensional, since from the renderers perspective, depth and height (y and z axis) are the same.

To aid with the construction of models, the modeller tool has been created. There is a tutorial providing step-by-step instructions to its basic functionality and a more detailed reference explaining all of its features.

Restrictions


Wall and ceiling don't overlap

Wall and ceiling intersect

While one can create models in any possible shape and size, the way a scene is rendered imposes some restrictions on that freedom. The most important restriction is to avoid overlap or intersections of two models when placed next to each other. Consider the example of a wall corner and a ceiling tile on the right (presented in a more 3D-ish view to better illustrate the situation):

In the first picture, a ceiling tile aligned to grid will intersect with the inner part of the wall. During rendering, this may cause parts of the wall to appear on top of the ceiling.

The solution to this problem can be seen in the second picture, where the wall has been split into an outer and inner part, that allows the ceiling tile to rest on top of the inner wall.

Conventions

All models created for Adonthell should adhere to the standards described below, as it will ensure that everything will line up correctly.

Floor

Floor tiles should have a length of 48px and a width of 36px or multiples thereof. 48px by 72px and 96px by 72px would be common sizes. The height of floor tiles is 8px. (Zero height floors are not supported by the engine).

Walls

Wall tiles come in two variations. Inside walls have a height of 88px, outside walls have a height of 96px. The remaining dimensions can be had from the templates available for inside and outside walls.

Wall tiles follow a specific naming scheme that can be gleaned from the picture below. Filenames for inside walls (shown in turquoise) begin with "ins-", while filenames for outside walls (shown in purple) begin with "out-". This is then followed by 3 characters: The first denotes if it is a straight (S), inside corner (I) or outside corner (O). The 2nd denotes front (F) or back (B) or is (x) if it is neither/irrelevant. The 3rd then if left (L), right (R) or neither (x).

Parts and naming of wall tiles

The parts of a particular kind of wall (stone, wood, etc.) are grouped in a folder. Adding that to the individual filenames is therefore redundant. Finally, if there are variations of certain parts, then "_variation-name" can be appended. E.g.:

 ...
  |
  +- wall
        +- stone
               +- out-SBx.png
               +- out-SBx_cracked.png
               +- out-SBx_double_with_window.png

Doorways

Doorways are handled mostly like walls, except they are prefixed with _doorway. They have the size of horizontal or vertical walls, with an opening of 48px for horizontal and 36px for vertical doors. In both cases, the height of the opening should be at least 64px. For vertical doorways, some indication is needed to help locate the actual opening, as it will not be directly visible with the top-down view that Adonthell uses.