Difference between revisions of "HPL3/Materials/Working with Materials"

From Frictional Wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{wip}}
+
In HPL3, materials are used on every 3D object, be it a model, entity, terrain or even a 2D plane.
 
 
In HPL3, materials are used only every 3D object, be it a model, entity, terrain or even a 2D plane.
 
 
Materials are created using the Material Editor, and then assigned to the 3D object. There are several ways to assign a material to a 3D object, depending on the type of object.
 
Materials are created using the Material Editor, and then assigned to the 3D object. There are several ways to assign a material to a 3D object, depending on the type of object.
  
Line 9: Line 7:
 
==Assigning Materials to Static Objects==
 
==Assigning Materials to Static Objects==
 
In order to assign a material to a static object, you need to make sure that:
 
In order to assign a material to a static object, you need to make sure that:
#The diffuse texture is assigned to the model file. For example, a <code>dae</code> file should have a texture assignment like so:
 
##
 
  
 +
#The diffuse texture is assigned to the model file. For example, a <code>dae</code> file should have a texture assignment like so: <syntaxhighlight lang="xml">
 +
  <library_images>
 +
    <image id="Map #1-image" name="Map #1">
 +
      <init_from>file://path_to_texture_file/my_texture_file.dds</init_from>
 +
    </image>
 +
  </library_images>
 +
</syntaxhighlight>
 +
#The material file name must have the same name as the base texture file (diffuse). For example, if your texture file is called <code>my_texture_file.dds</code>, the material file should be named <code>my_texture_file.mat</code>. This way, the game will automatically know what material file to pick for the static object.
 +
 +
<br>
 +
{{tip|Multiple static objects can reference to the same material file/texture if needed.}}
  
 
==See More==
 
==See More==
* [[HPL3/Modeling/Static_Objects|Static Objects]]
+
 
 +
*[[HPL3/Modeling/Static_Objects|Static Objects]]
  
 
[[Category:HPL3 Materials]]
 
[[Category:HPL3 Materials]]
 
[[Category:English]]
 
[[Category:English]]

Latest revision as of 07:31, 9 September 2020

In HPL3, materials are used on every 3D object, be it a model, entity, terrain or even a 2D plane. Materials are created using the Material Editor, and then assigned to the 3D object. There are several ways to assign a material to a 3D object, depending on the type of object.

Assigning Materials to Entities

In order to assign a material to an entity, you need to use the Model Editor. By selecting the mesh, you will have the option to add an existing .mat file.

Assigning Materials to Static Objects

In order to assign a material to a static object, you need to make sure that:

  1. The diffuse texture is assigned to the model file. For example, a dae file should have a texture assignment like so:
      <library_images>
        <image id="Map #1-image" name="Map #1">
          <init_from>file://path_to_texture_file/my_texture_file.dds</init_from>
        </image>
      </library_images>
    
  2. The material file name must have the same name as the base texture file (diffuse). For example, if your texture file is called my_texture_file.dds, the material file should be named my_texture_file.mat. This way, the game will automatically know what material file to pick for the static object.


Icon tip.png Tip: Multiple static objects can reference to the same material file/texture if needed.

See More