[REFERENCE] Models & Textures

Discussion in 'Mod Discussions' started by Raevn, June 16, 2013.

  1. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    This post summarise the requirements for models used within Planetary Annihilation. This is not dealing with the technical aspects of the model format; rather this is about how to properly build a model for use in game.

    A model requires the model file itself, which has the extension .papa. Each model also has three .png texture files. The particulars of these two components are explained below.

    While testing, it is helpful to take advantage of the fact that Planetary Annihilation will re-load files if it detects a change, so you do not need to exit and restart to see changes.

    Models:
    Models are made up of a mesh and an underlying bone structure. There are four default bones for each model:
    • "<unit name>_mesh"
    • "Solid"
    • "DiffuseColor"
    • "bone_root"
    The actual name of the <unit name> bone doesn't seem to matter (the anti-air tower has "laser_defense_mesh", for example). The purpose of "Solid" and "DiffuseColor" are not clear. Finally, "bone_root" is the parent bone for all subsequent bones. These four bones all reside at coordinate {0,0,0}. Further bones are used for weapons & animations; whenever a "point" on the model is required (such as where to aim from).

    [​IMG]
    The Model and Bone structure of the Spinner AA vehicle. Note the multiple bones at the origin {0,0,0}. Click for a larger version.

    Note the directions of the arrows in the above picture so that your model is correctly oriented. The red arrow is X, the Blue arrow is Z and the green arrow is Y. Models should face towards negative Y, with the Z axis up.

    Models can be imported using the Blender importer, available from this thread: viewtopic.php?f=72&t=47964. The tool papatran.exe can be used to create .papa files (see viewtopic.php?f=72&t=48386).

    Textures
    There are three texture files that accompany each model:
    • <model_name>_diffuse.png
    • <model_name>_mask.png
    • <model_name>_material.png

    [​IMG]
    Diffuse, Mask and Material Textures for the Spinner AA vehicle.

    Diffuse is the standard texture, except where it intersects with the mask.
    The mask and material textures alter the diffuse based on the values of the RGBA channels as follows:

    Mask Texture

    (#FF0000) Red: Player Primary Colour Shown (based on greyscale)
    (#00FF00) Green: Player Secondary Colour Shown (based on greyscale)
    (#0000FF) Blue: Emissive mask (final diffuse color * 2, ignores lighting) [see this post]
    Alpha Channel: Approxmated distance field [see this post]

    Red and Green areas will use the same area on the diffuse to determine how much of the player colour to show. White and black will appear white and black, but in between will show a gradient, such that half way (Red = 128) will show the team colour as expected.

    Material Texture

    (#FF0000) Red: Specular Mask
    (#00FF00) Green: Specular Sharpness
    (#0000FF) Blue: Unused
    Alpha Channel: Unused
    Last edited: July 1, 2014
  2. acey195

    acey195 Member

    Messages:
    396
    Likes Received:
    16
    I think the blue mask is for the lights (so they can turn off and on during the nights)
  3. pantsburgh

    pantsburgh Active Member

    Messages:
    151
    Likes Received:
    39
    The mask blue areas do not receive lighting. They stay 100% the diffuse texture color no matter if they are in light/highlight/shadow. These are used for lights, and anything glowing (green areas on factories/constructors).

    I can confirm there is specular going on, so I assume this is the alpha channel on the diffuse.

    I'm not sure what the material map is for, but my guess is it has something to do with the under-construction shader. I think the green channel might color the faces when the faces fill in green. The red channel also has info on it, and I have no idea what that is for. The blue channel appears empty (all black). Edit: Maybe this entire map is just the diffuse map for the construction shader? If the green they chose isn't 0,255,0 then that would explain the tiny bit of info on the red channel and empty blue channel.
  4. acey195

    acey195 Member

    Messages:
    396
    Likes Received:
    16
    in that case the blue mask is an emissive mask, although the difference between unlit and emissive is not huge.
  5. pantsburgh

    pantsburgh Active Member

    Messages:
    151
    Likes Received:
    39
    Yeah I couldn't remember the right word for it.

    Edit: Ok I got it mostly figured out.

    Diffuse alpha affects the building material. Fully opaque (255/white) on the alpha channel is what paints the wireframe on the building. I painted some fully opaque pink on the diffuse (bottom right) and you'll see it reflects on the in-progress model (top center).

    Material red & green are some sort of specular/gloss map. If the blue channel is being used I couldn't see any changes from it. Red alone places a light checker across the entire building (even in shadows). Green alone does nothing. Both together results in gloss and some sort of edge detection which may or may not be intended.

    Attached Files:

    Last edited: June 17, 2013
  6. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    Alpha of the diffuse is an approximated distance field created with a photoshop edge glow from the model's UVs used for the wireframe rendering.

    I'm hoping this will be generated by the game instead of approximated in photoshop by the time the game is finished.

    Also, that diffuse example shown in your thread has the alpha modifying the color (treating it as premultiplied). This is default behavior for several programs when handling PNG files, and is wrong for the way we're using alpha and why I suggested using SuperPNG for Photoshop or importing Alpha as a separate channel if using something like Gimp.


    Mask texture is as described by those in the channel.
    Red = Primary color mask
    Green = Secondary color mask
    Blue = Emissive mask (final diffuse color * 2, ignores lighting)

    Primary and secondary colors are blended with the diffuse texture by way of an equivalent to the Photoshop overlay blend mode. ie: Whites stay white, blacks stay black. 50% grey = color. You can do team colored emissive by having areas of purple (red & blue) or teal (green & blue).


    Material texture:
    Red = Specular mask
    Green = Specular sharpness
    Blue = Unused (for now)
    Quitch likes this.
  7. pantsburgh

    pantsburgh Active Member

    Messages:
    151
    Likes Received:
    39
    Why are you reading the forums on a Sunday? Go drink beer!

    Thanks for explaining; it all makes sense now.
  8. KNight

    KNight Post Master General

    Messages:
    7,681
    Likes Received:
    3,268
    Do we know if there is any scrolling for tracks and wheels like in SupCom yet?

    Mike
  9. kvalheim

    kvalheim Post Master General

    Messages:
    1,726
    Likes Received:
    645
    Who needs wheels in the future?
  10. KNight

    KNight Post Master General

    Messages:
    7,681
    Likes Received:
    3,268
    Scout Vehicle, AA Truck and T2 Tank Fabber Apparently.

    Mike
  11. stormingkiwi

    stormingkiwi Post Master General

    Messages:
    3,266
    Likes Received:
    1,355
    Ok... Let's say hypothetically I want to create a new vehicle (and the server tools are available)

    What do I do? Where do I start?
  12. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    1. First you have to create a model. This should have a base bone and a tool bone at the very least
    2. Make a unit info json file. This file follows the json format. Look at another units file and it will pretty much make sense.
      1. Unit tool: The thing on the unit that performs actions, on a fabber this us the fabber arm. On a tank its the gun. I would just find a pre-existing tool and use that. In your model you will have to name your tool bone a certain name for the tool in the json file to bind to it.
  13. stormingkiwi

    stormingkiwi Post Master General

    Messages:
    3,266
    Likes Received:
    1,355
    1. Ok. So what does that have to entail. Does the JSON contain all the degrees of freedom, or are all of that contained in the bones.
    What tool is used to create the bones - some kind of CAD software yeah? Any kind, or specifically one programme?
  14. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    Use a modeling software like Blender to create the model. In modeling the term bones is used to represent an object that has vertices bound to it. These are created in a program called blender. If this doesn't make any sense than check out the tutorials at Blender Cookie.

    The JSON holds the game information about the unit. Like how much it costs, how much it uses, movement, the 3d model to display.

    I would recomend learning how to use blender and be farmiliar with 3d modeling. Be able to model household items.
  15. stormingkiwi

    stormingkiwi Post Master General

    Messages:
    3,266
    Likes Received:
    1,355
    Done, I work with CAD as part of my degree.

    Odd terminology that appears specific to Blender. You create the model using Papa. And then you apply constraints right? So it's just normal CAD.

    Sweet alright. So model controls the way a model looks and JSON controls the model, right? If you swapped the ant and dox models the dox would roll like a tank and the ant would walk like a dox.
  16. Dementiurge

    Dementiurge Post Master General

    Messages:
    1,094
    Likes Received:
    693
    Bones are common terminology for games and skeletal animation (which is preferred over per-polygon animation by just about everyone).

    The Blender-specific version is an armature.
  17. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
  18. Nicb1

    Nicb1 Post Master General

    Messages:
    1,010
    Likes Received:
    1,286
    Quick question. I have practically no experience with creating texture and just wanted to ask how did you achieve the gradients in the diffuse layer (Preferably in photoshop)?
  19. shikkai123

    shikkai123 New Member

    Messages:
    1
    Likes Received:
    0
    As a industrial designer and a guy that knows his way around 3d software etc pretty well, how easy is it to start adding in own units and testing them in pte mode? I absolutely love the game, the style, low poly modelling and just pure adrenaline rush of fighting off one battle just to be blind-sided by another attack. So I obviously want to start tinkering around and building and designing my own units and buildings and textures and effects.

    Any good advice, tuts , links, anything would be greatly appreciated

    Thanks in advance
  20. Diaboy

    Diaboy Active Member

    Messages:
    110
    Likes Received:
    63
    Just as a note, is the approximated distance field not in the diffuse rather than the mask texture?

Share This Page