Difference between revisions of "3D Objects"

From Wolfire Games Wiki
Jump to: navigation, search
(Tags: replaced normal mapping link to blog post)
(Adds in the missing images.)
Line 31: Line 31:
  
 
'''<flags no_collision>''' - turns physics calculations on/off, true = off.
 
'''<flags no_collision>''' - turns physics calculations on/off, true = off.
 
  
 
''NOTE:''
 
''NOTE:''
Line 40: Line 39:
  
 
===Model and Texture Requirements===
 
===Model and Texture Requirements===
 +
[[Image:SimpleObject.jpg|thumb|Simple object and texture UV layout]]
  
 
Models need to be constructed from squares and triangles only, so textures need to be square and not just “powers of 2”. (512x512 or 1024x1024 not 512x1024 or 1024x2048)
 
Models need to be constructed from squares and triangles only, so textures need to be square and not just “powers of 2”. (512x512 or 1024x1024 not 512x1024 or 1024x2048)
 
<pre>IMAGE MISSING, UNABLE TO UPLOAD</pre>
 
Simple object and texture UV layout
 
  
 
==Alternative object System==
 
==Alternative object System==
Line 55: Line 52:
  
 
'''YourObjectHULL.obj''' - same as _COL but has extra info, used with weapons
 
'''YourObjectHULL.obj''' - same as _COL but has extra info, used with weapons
 
  
 
''NOTE:''
 
''NOTE:''
  
 
''The suffix formats are inconsistent, _COL is placed before the file extension while _UV2 is place after, and HULL doesn’t even have an underscore to separate it from the file name!''
 
''The suffix formats are inconsistent, _COL is placed before the file extension while _UV2 is place after, and HULL doesn’t even have an underscore to separate it from the file name!''
 
  
 
===Physics objects (_COL)===
 
===Physics objects (_COL)===
Simplified geometry such as boxes an cylinders which are used for collision detection, they are aligned to your object based on “relative position” in your 3D program so you should place the physics mesh on top of your render mesh upon export:
+
[[Image:PhysicsObject.jpg|thumb|Physics mesh should be placed on top of the render mesh]]
  
<pre>IMAGE MISSING, UNABLE TO UPLOAD</pre>
+
Simplified geometry such as boxes an cylinders which are used for collision detection, they are aligned to your object based on “relative position” in your 3D program so you should place the physics mesh on top of your render mesh upon export.
Physics mesh should be placed on top of the render mesh
 
  
 
===Shadow UV objects (_UV2)===
 
===Shadow UV objects (_UV2)===
 +
[[Image:UVObject.jpg|thumb|Color texture UVs left, shadow UVs right, each face needs its own UV space]]
 +
 
These objects tell the engine how to place the shadow map on the rendered object if the original UV layout isn’t appropriate, the shadow maps require UV layouts with no over-lapping faces, this can usually be achieved using the “automatic unwrapping” tools found in most 3D applications.
 
These objects tell the engine how to place the shadow map on the rendered object if the original UV layout isn’t appropriate, the shadow maps require UV layouts with no over-lapping faces, this can usually be achieved using the “automatic unwrapping” tools found in most 3D applications.
 
<pre>IMAGE MISSING, UNABLE TO UPLOAD</pre>
 
Color texture UVs left, shadow UVs right, each face needs its own UV space.
 
  
 
===Hull objects (HULL)===
 
===Hull objects (HULL)===
 +
[[Image:HullObject.jpg|thumb|Hull objects are placed over render mesh like physics objects]]
 
They are very similar to physics objects but are used for items and weapons, the only difference is that they contain a free-floating triangle which defines the object’s center of gravity.
 
They are very similar to physics objects but are used for items and weapons, the only difference is that they contain a free-floating triangle which defines the object’s center of gravity.
 
<pre>IMAGE MISSING, UNABLE TO UPLOAD</pre>
 
Hull objects are placed over render mesh like physics objects.
 
  
  
 
==Items and Weapons==
 
==Items and Weapons==
 +
[[Image:Weapons.jpg|thumb|Example weapons, handles show the location of characters hands]]
  
 
Items and Weapons are aligned to the character based on their position relative to the center of the scene in your 3D app, you should load the .obj files of the example objects for reference. To make an object “pick-up-able” you need another .XML file that you load in place of the regular object properties file, it stores the info needed that is not defined in the regular object properties file:
 
Items and Weapons are aligned to the character based on their position relative to the center of the scene in your 3D app, you should load the .obj files of the example objects for reference. To make an object “pick-up-able” you need another .XML file that you load in place of the regular object properties file, it stores the info needed that is not defined in the regular object properties file:
Line 107: Line 99:
  
 
'''<anim_override idle>''' - overrides the idle animation of a character holding the item.
 
'''<anim_override idle>''' - overrides the idle animation of a character holding the item.
 
  
 
''NOTE:''
 
''NOTE:''
Line 114: Line 105:
  
 
''<anim_override idle> is only used for 2-handed weapons at the moment.''
 
''<anim_override idle> is only used for 2-handed weapons at the moment.''
 
 
<pre>IMAGE MISSING, UNABLE TO UPLOAD</pre>
 
Example weapons, handles show the location of characters hands
 
  
 
''NOTE:''
 
''NOTE:''
  
 
''There is a bug that makes weapons turn invisible when loading levels with them already in it, you can fix this by having the “regular-object" version somewhere in the level as well.''
 
''There is a bug that makes weapons turn invisible when loading levels with them already in it, you can fix this by having the “regular-object" version somewhere in the level as well.''
 
  
 
==Shaders==
 
==Shaders==
Line 133: Line 119:
 
'''CubemapObjItem''' - object-space version of CubemapItem.
 
'''CubemapObjItem''' - object-space version of CubemapItem.
  
 +
[[Image:CubemapAlpha.jpg|thumb|CubemapAlpha]]
 
'''CubemapAlpha''' - has transparency controlled by the color texture’s alpha channel, cube map and shine are controlled by the normal-map texture’s alpha channel instead. CubemapAlpha has depth sorting issues with other transparent objects, enabling anti-aliasing fixes this somewhat.
 
'''CubemapAlpha''' - has transparency controlled by the color texture’s alpha channel, cube map and shine are controlled by the normal-map texture’s alpha channel instead. CubemapAlpha has depth sorting issues with other transparent objects, enabling anti-aliasing fixes this somewhat.
  
 
'''CubemapObjChar''' - used for characters, shine is sharp, uses object space normals. There is no tangent-space version of CubemapObjChar and no object-space version of CubemapAlpha at the moment.
 
'''CubemapObjChar''' - used for characters, shine is sharp, uses object space normals. There is no tangent-space version of CubemapObjChar and no object-space version of CubemapAlpha at the moment.
  
 +
[[Image:Translucency.jpg|thumb|Translucency (Plant Shader)]]
 
'''Plant''' - has transparency like CubemapAlpha but no cube map/shine. Translucency texture increases the brightness of the object while ignoring diffuse lighting, black = no effect. Wind texture defines intensity of a vertex ripple effect, black = no ripple. Both textures are linked in the object definition file using the <TranslucencyMap> and <WindMap> tags.
 
'''Plant''' - has transparency like CubemapAlpha but no cube map/shine. Translucency texture increases the brightness of the object while ignoring diffuse lighting, black = no effect. Wind texture defines intensity of a vertex ripple effect, black = no ripple. Both textures are linked in the object definition file using the <TranslucencyMap> and <WindMap> tags.
 
<pre>IMAGE MISSING, UNABLE TO UPLOAD</pre>
 
CubemapAlpha
 
 
<pre>IMAGE MISSING, UNABLE TO UPLOAD</pre>
 
Translucency (Plant Shader)
 
 
  
 
==Materials==
 
==Materials==
 
+
[[Image:Materials.jpg|thumb|Sound tiles]]
 
These are the sounds made and the particles emitted when you hit an object. I’ve set up some tiles for you to walk on to preview each material, here is a list:
 
These are the sounds made and the particles emitted when you hit an object. I’ve set up some tiles for you to walk on to preview each material, here is a list:
  
Line 163: Line 144:
 
: Snow
 
: Snow
 
: Wood
 
: Wood
 
<pre>IMAGE MISSING, UNABLE TO UPLOAD</pre>
 
Sound tiles
 
  
 
Note that some of these don’t emit particles.
 
Note that some of these don’t emit particles.

Revision as of 12:49, 3 September 2015

based on this forum post by member Markuss. There is a linked .zip file attached to the forum post. it can be found here: http://www.markstockton.com/misc/Guide/Examples.zip

Basics

In Overgrowth 3D models use the .OBJ format but the material counter-part (.MTL) is not used, instead an “object properties file” stores links to model and texture files as well as some other information. This is the file you choose when loading an object, it uses the .XML format and can be read/created in any text editor:

<?xml version="1.0" ?>
<Object>
	<Model>Data/Custom/Markuss/Examples/Models/SimpleObject.obj</Model>
	<ColorMap>Data/Custom/Markuss/Examples/Textures/SimpleObject_Color.tga</ColorMap>
	<NormalMap>Data/Custom/Markuss/Examples/Textures/Blank_Norm.tga</NormalMap>
  	<ShaderName>cubemap</ShaderName>
	<MaterialPath>Data/Materials/default.xml</MaterialPath>
</Object>

Tags

<Model> - links to the model file (.OBJ)

<ColorMap> - links to the color texture file (.TGA .TIF)

<NormalMap> - links to the normal map texture file (.TGA .TIF)

<ShaderName> - refers to internal shader file (.FRAG .VERT, in Data/GLSL/), defines how object is rendered.

<MaterialPath> - links to internal material file (.XML), defines sound made by hitting the object.

Additional tags

<flags no_collision> - turns physics calculations on/off, true = off.

NOTE:

“<ShaderName>” used to be “<ShaderPath>” and contained the full link instead of just the file name, expect similar update for “<MaterialPath>”.

Look at the example plant object for usage of the <flags no_collision> tag.

Model and Texture Requirements

Simple object and texture UV layout

Models need to be constructed from squares and triangles only, so textures need to be square and not just “powers of 2”. (512x512 or 1024x1024 not 512x1024 or 1024x2048)

Alternative object System

The engine automatically generates a simplified physics object and uses the object’s UV layout to place the shadow maps, these can be overridden by providing alternative .OBJ files that contain the desired information. These objects are placed in the same folder and share the same name as the original .OBJ file with a suffix to tell the engine what data they hold:

Suffixes

YourObject_COL.obj - contains simplified geometry for physics calculations

YourObject.obj_UV2 - contains same object but with no overlapping UVs

YourObjectHULL.obj - same as _COL but has extra info, used with weapons

NOTE:

The suffix formats are inconsistent, _COL is placed before the file extension while _UV2 is place after, and HULL doesn’t even have an underscore to separate it from the file name!

Physics objects (_COL)

Physics mesh should be placed on top of the render mesh

Simplified geometry such as boxes an cylinders which are used for collision detection, they are aligned to your object based on “relative position” in your 3D program so you should place the physics mesh on top of your render mesh upon export.

Shadow UV objects (_UV2)

Color texture UVs left, shadow UVs right, each face needs its own UV space

These objects tell the engine how to place the shadow map on the rendered object if the original UV layout isn’t appropriate, the shadow maps require UV layouts with no over-lapping faces, this can usually be achieved using the “automatic unwrapping” tools found in most 3D applications.

Hull objects (HULL)

Hull objects are placed over render mesh like physics objects

They are very similar to physics objects but are used for items and weapons, the only difference is that they contain a free-floating triangle which defines the object’s center of gravity.


Items and Weapons

Example weapons, handles show the location of characters hands

Items and Weapons are aligned to the character based on their position relative to the center of the scene in your 3D app, you should load the .obj files of the example objects for reference. To make an object “pick-up-able” you need another .XML file that you load in place of the regular object properties file, it stores the info needed that is not defined in the regular object properties file:

<?xml version="1.0" ?>
<item>
    <type>weapon</type>
    <appearance obj_path = "Data/Custom/Markuss/Examples/1-Handed.xml"/>
    <grip ik_attach = "rightarm"
          anim = "Data/Animations/r_dogweapongrip.anm"/>
    <physics mass = "1 kg"/>
</item>

Item properties file

Tags

<type> - defines what type of item the object is.

<appearance obj_path> - links to the regular object definition file.

<grip ik_attach anim> - defines what bone the object is attached to, links to an animation file.

<physics mass> - changes the pitch(?) of the sound made by the object hitting things.

<anim_override idle> - overrides the idle animation of a character holding the item.

NOTE:

Not sure what the animation file in <grip ik_attach anim> does.

<anim_override idle> is only used for 2-handed weapons at the moment.

NOTE:

There is a bug that makes weapons turn invisible when loading levels with them already in it, you can fix this by having the “regular-object" version somewhere in the level as well.

Shaders

Cubemap – closest thing to a “standard shader”, it has a cube-map based on the sky texture and a specular shine, the visibility of the cube map and shine is controlled with color texture’s alpha channel, white = fully reflective and shiny. Similarly, the normal-map texture’s alpha channel controls where color tinting happens, white = full effect. The cube map’s visibility is inversely affected by the brightness of the texture, you should make the color texture close to black for materials that are reflective such as chrome and glass.

CubemapObj - same as Cubemap but uses object-space normal maps instead of tangent space.

CubemapItem - same as Cubemap but the shine is sharper.

CubemapObjItem - object-space version of CubemapItem.

CubemapAlpha

CubemapAlpha - has transparency controlled by the color texture’s alpha channel, cube map and shine are controlled by the normal-map texture’s alpha channel instead. CubemapAlpha has depth sorting issues with other transparent objects, enabling anti-aliasing fixes this somewhat.

CubemapObjChar - used for characters, shine is sharp, uses object space normals. There is no tangent-space version of CubemapObjChar and no object-space version of CubemapAlpha at the moment.

Translucency (Plant Shader)

Plant - has transparency like CubemapAlpha but no cube map/shine. Translucency texture increases the brightness of the object while ignoring diffuse lighting, black = no effect. Wind texture defines intensity of a vertex ripple effect, black = no ripple. Both textures are linked in the object definition file using the <TranslucencyMap> and <WindMap> tags.

Materials

Sound tiles

These are the sounds made and the particles emitted when you hit an object. I’ve set up some tiles for you to walk on to preview each material, here is a list:

Cloth_Fabric
Cloth_Leather
Default
Dirt
DirtyRock
Drygrass
Grass
Gravel
Rock
Rocks
Sand
Snow
Wood

Note that some of these don’t emit particles.