|
| 1 | +Fragment Shader |
| 2 | +=============== |
| 3 | + |
| 4 | +The :doc:`/types/Renderable/index` :doc:`/entity_component_system/component/index` accepts custom fragment shaders. |
| 5 | + |
| 6 | +These fragment shaders are written in GLSL and have some special variables. |
| 7 | + |
| 8 | +Inputs |
| 9 | +------ |
| 10 | + |
| 11 | +.. list-table:: |
| 12 | + :width: 100% |
| 13 | + :header-rows: 1 |
| 14 | + :class: code-table |
| 15 | + |
| 16 | + * - Name |
| 17 | + - Type |
| 18 | + - Description |
| 19 | + * - NtshEngn_position |
| 20 | + - vec3 |
| 21 | + - The fragment's position, in **world-space**. |
| 22 | + * - NtshEngn_normal |
| 23 | + - vec3 |
| 24 | + - The fragment's normal. |
| 25 | + * - NtshEngn_tangent |
| 26 | + - vec3 |
| 27 | + - The fragment's tangent. |
| 28 | + * - NtshEngn_bitangent |
| 29 | + - vec3 |
| 30 | + - The fragment's bitangent. |
| 31 | + * - NtshEngn_uv |
| 32 | + - vec2 |
| 33 | + - The fragment's texture coordinates. |
| 34 | + * - NtshEngn_tbn |
| 35 | + - mat3 |
| 36 | + - The fragment's Tangent-Bitangent-Normal matrix. |
| 37 | + * - NtshEngn_diffuseTextureSampler |
| 38 | + - sampler2D |
| 39 | + - The object's material's diffuse texture. |
| 40 | + * - NtshEngn_normalTextureSampler |
| 41 | + - sampler2D |
| 42 | + - The object's material's normal texture. |
| 43 | + * - NtshEngn_metalnessTextureSampler |
| 44 | + - sampler2D |
| 45 | + - The object's material's metalness texture. |
| 46 | + * - NtshEngn_roughnessTextureSampler |
| 47 | + - sampler2D |
| 48 | + - The object's material's roughness texture. |
| 49 | + * - NtshEngn_occlusionTextureSampler |
| 50 | + - sampler2D |
| 51 | + - The object's material's occlusion texture. |
| 52 | + * - NtshEngn_emissiveTextureSampler |
| 53 | + - sampler2D |
| 54 | + - The object's material's emissive texture. |
| 55 | + * - NtshEngn_emissiveFactor |
| 56 | + - float |
| 57 | + - The object's material's metalness factor. |
| 58 | + * - NtshEngn_alphaCutoff |
| 59 | + - float |
| 60 | + - The object's material's alpha cutoff. |
| 61 | + * - NtshEngn_scaleUV |
| 62 | + - vec2 |
| 63 | + - The object's material's UV scale. |
| 64 | + * - NtshEngn_offsetUV |
| 65 | + - vec2 |
| 66 | + - The object's material's UV offset. |
| 67 | + * - NtshEngn_useTriplanarMapping |
| 68 | + - bool |
| 69 | + - ``true`` if the object's material uses triplanar mapping, else, ``false``. |
| 70 | + * - NtshEngn_directionalLightCount |
| 71 | + - uint |
| 72 | + - The number of directional lights in the scene. |
| 73 | + * - NtshEngn_directionalLight(i) |
| 74 | + - :doc:`/types/Light/index` |
| 75 | + - The *i*th directional light. |
| 76 | + * - NtshEngn_pointLightCount |
| 77 | + - uint |
| 78 | + - The number of point lights in the scene. |
| 79 | + * - NtshEngn_pointLight(i) |
| 80 | + - :doc:`/types/Light/index` |
| 81 | + - The *i*th point light. |
| 82 | + * - NtshEngn_spotLightCount |
| 83 | + - uint |
| 84 | + - The number of spot lights in the scene. |
| 85 | + * - NtshEngn_spotLight(i) |
| 86 | + - :doc:`/types/Light/index` |
| 87 | + - The *i*th spot light. |
| 88 | + * - NtshEngn_ambientLightCount |
| 89 | + - uint |
| 90 | + - The number of ambient lights in the scene. |
| 91 | + * - NtshEngn_ambientLight(i) |
| 92 | + - :doc:`/types/Light/index` |
| 93 | + - The *i*th ambient light. |
| 94 | + * - NtshEngn_time |
| 95 | + - float |
| 96 | + - The time since the application's launch, in **seconds**. |
| 97 | + * - NtshEngn_cameraPosition |
| 98 | + - vec3 |
| 99 | + - The camera's position, in **world-space**. |
| 100 | + * - NtshEngn_useReversedDepth |
| 101 | + - bool |
| 102 | + - ``true`` if the graphics module uses reversed depth (*1* is close, *0* is far), else, ``false`` (*0* is close, *1* is far). |
| 103 | + |
| 104 | +Inputs |
| 105 | +------ |
| 106 | + |
| 107 | +.. list-table:: |
| 108 | + :width: 100% |
| 109 | + :header-rows: 1 |
| 110 | + :class: code-table |
| 111 | + |
| 112 | + * - Name |
| 113 | + - Type |
| 114 | + - Description |
| 115 | + * - NtshEngn_outColor |
| 116 | + - vec4 |
| 117 | + - The output color. |
| 118 | + * - NtshEngn_outDepth |
| 119 | + - float |
| 120 | + - The output depth. |
0 commit comments