-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d69658
commit 6f9cda9
Showing
6 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
docs/content/english/Asset Management/Asset Types/shaders.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
+++ | ||
title = "Shaders" | ||
description = "" | ||
weight = 1 | ||
+++ | ||
|
||
Shaders are program snippets that run on GPU cores. They define the rendering methods. | ||
|
||
##### Material Shader Flags & Shader Combinations | ||
Shaders define material flags which can is configurable per material. Every material shader flag changes a portion of the shader code to change how the material look. For example, once the "USE_PROCEDURAL_WIND_ANIMATION" flag is enabled, material will start animate in a fixed axis with respect to the wind in the scene. | ||
|
||
##### Shader Cache | ||
Every material defines a new shader flag combination which in turns define a new shader code to be compiled. The game is shipped with a shader cache which contains all of the unique shader + material shader flag combinations in the base game. | ||
|
||
##### Bulk Shader Compilation for Mods | ||
If a module adds a good amount of new combinations, runtime shader compilation can disrupt the flow of the game tremendously. To avoid that, the mod owner should compile the unique shader + material combinations introduced within that module. In order to do that, while the module is being published via the "Publish Module" functionality in the editor, "Compile Shaders" checkbox should be checked. The shader cache will be saved into the "Modules/'ModuleName'/Shaders/D3D11" folder. Please note that the game shaders can be changed in some version updates, even though this is not very often, for those cases the old shader cache file will be invalid and not be used. To avoid that, it would be good workflow o re-create the shader cache before every upload to a new major version of the game. Shader compilation system is highly parallel and it may finish around 30 to 60 minutes depending on the multi-core performance of the CPU. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
+++ | ||
title = "Decals" | ||
|
||
[menu.main] | ||
identifier = "decal" | ||
parent = "core_components" | ||
+++ | ||
|
||
## What is a Decal? | ||
|
||
Decals are a way of projecting materials into other geometries. They can affect the following channels of the PBR shading pipeline: Albedo, Normal, Specular, Gloss and Occlusion. Thus, changing the final appearance of other meshes and materials. They can be used to add variety to the scene like dirt, mud, moss. Also, they are a usefull tool to break texture tiles on the meshes. Their projection geometries are cubes and they are projected in the Z direction. | ||
|
||
## How to Setup a Decal Material? | ||
|
||
First of all, shader of the material should be "Decal". Diffuse, NormalMap and SpecularMap can be set to any texture. The shading model will be same as "pbr_metallic". | ||
![](/img/decal/top_properties.png) | ||
|
||
#### Material Shader Flags | ||
|
||
Material shader flags dictates which shading properties will be used and the types of objects that the decal will be visible. Note: "use_albedo" is a must. A typical example for a decal material which will be visible on all of the materials is as follows. | ||
![](/img/decal/material_shader_flags.png) | ||
|
||
#### Mandatory Settings at the 'Others' Tab | ||
|
||
In order for the decal to be rendered correctly, "Cull Front Faces" and the "Don't Modify Depth Buffer" flags should be enabled. | ||
![](/img/decal/other_settings.png) | ||
|
||
## How to Setup a Decal Prefab? | ||
|
||
To create a decal entity/prefab, a specific mesh (Decal Mesh) should be added to an empty entity. Then, the material of that mesh should be chaned to the material that we prepared in the first section. Finally, under the Components/Meta Mesh/Custom Mesh Parameters, UV Scale X/Y values should be set accordingly. For a regular texture, those values should both be 1. For a atlas type texture, UV Scale and UV Offset values should be set to focus on the desired texture position inside the atlas. | ||
![](/img/decal/entity_setup.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.