Firefly Material Cache Object
Firefly Material Cache Object
Firefly Material Cache Object
The Material Cache object is used to store and array a collection of materials that are used to "skin" a variety of nodes. Once one has set the material image and settings, you can reference said materials numerical position in the "array" in a "set material" action is most node objects.
Actions
-
Add a new material - creates a new material at the next available material index slot. Requires you give it a name using the expression editor.
-
Copy a material - Allows using a materials index value to copy it’s contents into another material slot by selecting the new slots index.
-
Remove a material - Remove a material from the Cache by selecting the materials index value
-
Edit Material - Allows you to edit the properties of a specific material
-
Set a material’s name - allows you to set a existing material’s name
-
Set a material type - Allows a user to set or change the display type of a material, kinda like a ink effect in some regards. For instance you can change it from Solid to Transparent Add. First select the material index value, then using a value from the material table below enter the new type.
-
Set a material’s data type one - Sets an alterable value for a specific material
-
Set a material’s data type two - Sets the second alterable value for a specific material
-
Textures (1 - 4)
-
Render Target - Whether or not this texture is a target for “Render to texture” action inside the Firefly Engine.
-
Render Target Texture Size -The size of the render texture.
-
Load Image from file - Using an image selection dialog or a expression manually display a external image in the material slot
-
Load Image from Surface Object - Replace a material with a selected image from a Surface object
-
Set Anisotropic Filter -
-
Linear Filter - Sets the type of resampling / quality of the texture when resized.
-
Texture Wrap -
-
Set Mipmap Level of Detail Bias -
-
-
Set Ambient Colour - The color when the object is in shadow
-
Set Diffuse Colour - The base color of the material
-
Set Specular Colour - The color of the object at direct light
-
Set Emissive Colour - The color of the object that the material emits by itself
-
Set Shininess -
-
Set Thickness -
-
Anti Aliasing - The type of anti-aliasing that will be used for the material
-
Vertex Colour Material -
-
Render Red Mask - Sets whether or not to render the colour red
-
Render Green Mask - Sets whether or not to render the colour green
-
Render Blue Mask - Sets whether or not to render the colour blue
-
Frontface Culling - When on, the front of each face (outside of mesh) will be removed
-
Backface Culling - When on, the back of each face (inside of mesh) will be removed
-
Fog - When on, the material will be affected by the fog
-
Gouraud Shading - When on, the material will smooth the light on each connected vertices
-
Lighting - When on, adds light and shadow to the material
-
Normalize Normals - Normalises faces after scaling
-
Point Cloud -
-
Wireframe - When on, lines between vertices are only rendered
-
Z Write -
-
Z Buffer - Sets how should the material be rendered, either in front or sent to back. Defaults to Less Equal.
-
Use a Shader -
-
Shader Settings -
-
Conditions
-
On set shaders constants -
-
First Texture is Render Target - Checks if the texture is a target for the “Render to target” action from the Engine object
-
Second Texture is Render Target -
-
Third Texture is Render Target -
-
Fourth Texture is Render Target -
-
Render Red Mask - Checks if “Render Red Mask” is checked
-
Render Green Mask -
-
Render Blue Mask -
-
Render Alpha Mask -
-
Is Frontface Culling Enabled - Checks if the front of each face is removed
-
Is Backface Culling Enabled - Checks if the back of each face is removed
-
Is Fog Enabled - Checks whether the material is affected by fog
-
Is Gouraud Shading Enabled - Checks if the material smooths out faces
-
Is lighting Enabled - Checks if the material has light and shadow
-
Is Normalized Normals Enabled - Checks if the material normalises each face after scale
-
Draw as Point Cloud -
-
Draw as Wireframe - Checks if the material draws only lines between vertices.
-
Is Z Write Enabled -
-
Uses a Shader -
Expressions
-
Get a Material - Returns the fixed value of a specific material, identified by index.
-
Get number of Materials - Returns the number of materials currently inside the cache.
-
Get a Material’s index - Returns the index of the Material, found by its name.
-
Get a Material’s Name - Returns the name of the Material, found by its index.
-
Get a Material’s Type -
-
Get a Material’s Type Data One -
-
Get a Material’s Type Data Two -
-
Textures -
-
Get Ambient Colour -
-
Get Diffuse Colour -
-
Get Specular Colour -
-
Get Emissive Colour -
-
Get Shininess -
-
Get Thickness -
-
Get Anti Aliasing -
-
Get Vertex Colour Material -
-
Get Z Buffer -
-
Get Loaded Vertex Shader string -
-
Get Loaded Pixel Shader string -
-
Get Vertex Shader Entry Point -
-
Get Vertex Shader Compile Target -
-
Get Pixel Shader Entry Point -
-
Get Pixel Shader Compiled Target -
-
Get On Shader Constant Material Index -
-
Get On Shader Constant Node’s Fixed Value -
Material Types
0 | SOLID | Standard solid material. | |
Only first texture is used, which is supposed to be the diffuse material. | |||
1 | SOLID_2_LAYER | Solid material with 2 texture layers. | |
The second is blended onto the first using the alpha value of the vertex colors. This material is currently not implemented in OpenGL. | |||
2 | LIGHTMAP | Material type with standard lightmap technique. | |
There should be 2 textures: The first texture layer is a diffuse map, the second is a light map. Dynamic light is ignored. | |||
3 | LIGHTMAP_ADD | Material type with lightmap technique like LIGHTMAP. | |
But lightmap and diffuse texture are added instead of modulated. | |||
4 | LIGHTMAP_M2 | Material type with standard lightmap technique. | |
There should be 2 textures: The first texture layer is a diffuse map, the second is a light map. Dynamic light is ignored. The texture colors are effectively multiplied by 2 for brightening. Like known in DirectX as D3DTOP_MODULATE2X. | |||
5 | LIGHTMAP_M4 | Material type with standard lightmap technique. | |
There should be 2 textures: The first texture layer is a diffuse map, the second is a light map. Dynamic light is ignored. The texture colors are effectively multiplyied by 4 for brightening. Like known in DirectX as D3DTOP_MODULATE4X. | |||
6 | LIGHTMAP_LIGHTING | Like LIGHTMAP, but also supports dynamic lighting. | |
7 | LIGHTMAP_LIGHTING_M2 | Like LIGHTMAP_M2, but also supports dynamic lighting. | |
8 | LIGHTMAP_LIGHTING_M4 | Like LIGHTMAP_4, but also supports dynamic lighting. | |
9 | DETAIL_MAP | Detail mapped material. | |
The first texture is diffuse color map, the second is added to this and usually displayed with a bigger scale value so that it adds more detail. The detail map is added to the diffuse map using ADD_SIGNED, so that it is possible to add and substract color from the diffuse map. For example a value of (127,127,127) will not change the appearance of the diffuse map at all. Often used for terrain rendering. | |||
10 | SPHERE_MAP | Look like a reflection of the environment around it. | |
To make this possible, a texture called 'sphere map' is used, which must be set as the first texture. | |||
11 | REFLECTION_2_LAYER | A reflecting material with an optional non reflecting texture layer. | |
The reflection map should be set as first texture. | |||
12 | TRANSPARENT_ADD_COLOR | A transparent material. | |
Only the first texture is used. The new color is calculated by simply adding the source color and the dest color. This means if for example a billboard using a texture with black background and a red circle on it is drawn with this material, the result is that only the red circle will be drawn a little bit transparent, and everything which was black is 100% transparent and not visible. This material type is useful for particle effects. | |||
13 | TRANSPARENT_ALPHA_CHANNEL | Makes the material transparent based on the texture alpha channel. | |
The final color is blended together from the destination color and the texture color, using the alpha channel value as blend factor. Only first texture is used. If you are using this material with small textures, it is a good idea to load the texture in 32 bit mode (video::IVideoDriver::setTextureCreationFlag()). Also, an alpha ref is used, which can be manipulated using SMaterial::MaterialTypeParam. This value controls how sharp the edges become when going from a transparent to a solid spot on the texture. | |||
14 | TRANSPARENT_ALPHA_CHANNEL_REF | Makes the material transparent based on the texture alpha channel. | |
If the alpha channel value is greater than 127, a pixel is written to the target, otherwise not. This material does not use alpha blending and is a lot faster than TRANSPARENT_ALPHA_CHANNEL. It is ideal for drawing stuff like leafes of plants, because the borders are not blurry but sharp. Only first texture is used. If you are using this material with small textures and 3d object, it is a good idea to load the texture in 32 bit mode (setTextureCreationFlag()). | |||
15 | TRANSPARENT_VERTEX_ALPHA | Makes the material transparent based on the vertex alpha value. | |
16 | TRANSPARENT_REFLECTION_2_LAYER | A transparent reflecting material with an optional additional non reflecting texture layer. | |
The reflection map should be set as first texture. The transparency depends on the alpha value in the vertex colors. A texture which will not reflect can be set as second texture. Please note that this material type is currently not 100% implemented in OpenGL. | |||
17 | NORMAL_MAP_SOLID | A solid normal map renderer. | |
First texture is the color map, the second should be the normal map. Note that you should use this material only when drawing geometry consisting of vertices of type (TANGENTS). You can convert any mesh into this format using Tangents checkbox in the material. This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and falls back to a fixed function lighted material if this hardware is not available. Only two lights are supported by this shader, if there are more, the nearest two are chosen. | |||
18 | NORMAL_MAP_TRANSPARENT_ADD_COLOR | A transparent normal map renderer. | |
First texture is the color map, the second should be the normal map. Note that you should use this material only when drawing geometry consisting of vertices of type (TANGENTS). You can convert any mesh into this format using Tangents checkbox in the material. This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and falls back to a fixed function lighted material if this hardware is not available. Only two lights are supported by this shader, if there are more, the nearest two are chosen. | |||
19 | NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA | A transparent (based on the vertex alpha value) normal map renderer. | |
First texture is the color map, the second should be the normal map. Note that you should use this material only when drawing geometry consisting of vertices of type(TANGENTS). You can convert any mesh into this format using Tangents checkbox in the material. This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and falls back to a fixed function lighted material if this hardware is not available. Only two lights are supported by this shader, if there are more, the nearest two are chosen. | |||
20 | PARALLAX_MAP_SOLID | Just like NORMAL_MAP_SOLID, but uses parallax mapping. | |
Looks a lot more realistic. This only works when the hardware supports at least vertex shader 1.1 and pixel shader 1.4. First texture is the color map, the second should be the normal map. The normal map texture should contain the height value in the alpha component. The method writes this value automatically when creating normal maps from a heightmap when using a 32 bit texture. The height scale of the material (affecting the bumpiness) is being controlled by the MaterialTypeParam member. If set to zero, the default value (0.02f) will be applied. Otherwise the value set in MaterialTypeParam is taken. This value depends on with which scale the texture is mapped on the material. Too high or low values of MaterialTypeParam can result in strange artifacts. | |||
21 | PARALLAX_MAP_TRANSPARENT_ADD_COLOR | A material like PARALLAX_MAP_SOLID, but transparent. | |
Using TRANSPARENT_ADD_COLOR as base material. | |||
22 | PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA | A material like PARALLAX_MAP_SOLID, but transparent. | |
Using TRANSPARENT_VERTEX_ALPHA as base material. | |||
23 | ONETEXTURE_BLEND | BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC ) | |
Using only first texture. Generic blending method. |
Spread the word!
You can share this document using the following buttons.