standard_material_3d.rst 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  1. .. _doc_standard_material_3d:
  2. Standard Material 3D and ORM Material 3D
  3. ========================================
  4. Introduction
  5. ------------
  6. ``StandardMaterial3D`` and ``ORMMaterial3D`` (Occlusion, Roughness, Metallic)
  7. are default 3D materials that aim to provide most of the features artists look
  8. for in a material, without the need for writing shader code. However, they can
  9. be converted to shader code if additional functionality is needed.
  10. This tutorial explains the parameters present in both materials.
  11. There are 4 ways to add these materials to an object. A material can be added in
  12. the *Material* property of the mesh. It can be added in the *Material* property of
  13. the node using the mesh (such as a MeshInstance3D node), the *Material Override* property
  14. of the node using the mesh, and the *Material Overlay*.
  15. .. image:: img/add_material.webp
  16. If you add a material to the mesh itself, every time that mesh is used it will have that
  17. material. If you add a material to the node using the mesh, the material will only be used
  18. by that node, it will also override the material property of the mesh. If a material is
  19. added in the *Material Override* property of the node, it will only be used by that node.
  20. It will also override the regular material property of the node and the material property of
  21. the mesh.
  22. The *Material Overlay* property will render a material **over** the current one being used by
  23. the mesh. As an example, this can be used to put a transparent shield effect on a mesh.
  24. BaseMaterial 3D settings
  25. ------------------------
  26. StandardMaterial3D has many settings that determine the look of a material. All of these are
  27. under the BaseMaterial3D category
  28. .. image:: img/spatial_material1.webp
  29. ORM materials are almost exactly the same with one difference. Instead of separate settings
  30. and textures for occlusion, roughness, and metallic, there is a single ORM texture. The different
  31. color channels of that texture are used for each parameter. Programs such as Substance Painter
  32. and Armor Paint will give you the option to export in this format, for these two programs it's
  33. with the export preset for unreal engine, which also uses ORM textures.
  34. Transparency
  35. ------------
  36. By default, materials in Godot are opaque. This is fast to render, but it means
  37. the material can't be seen through even if you use a transparent texture in the
  38. **Albedo > Texture** property (or set **Albedo > Color** to a transparent color).
  39. To be able to see through a material, the material needs to be made *transparent*.
  40. Godot offers several transparency modes:
  41. - **Disabled:** Material is opaque. This is the fastest to render, with all
  42. rendering features supported.
  43. - **Alpha:** Material is transparent. Semi-transparent areas are drawn with
  44. blending. This is slow to render, but it allows for partial transparency (also
  45. known as translucency). Materials using alpha blending also can't cast
  46. shadows, and are not visible in screen-space reflections.
  47. - **Alpha** is a good fit for particle effects and VFX.
  48. - **Alpha Scissor:** Material is transparent. Semi-transparent areas whose
  49. opacity is below **Alpha Scissor Threshold** are not drawn (above this
  50. opacity, these are drawn as opaque). This is faster to render than Alpha and
  51. doesn't exhibit transparency sorting issues. The downside is that this results
  52. in "all or nothing" transparency, with no intermediate values possible.
  53. Materials using alpha scissor can cast shadows.
  54. - **Alpha Scissor** is ideal for foliage and fences, since these have hard
  55. edges and require correct sorting to look good.
  56. - **Alpha Hash:** Material is transparent. Semi-transparent areas are drawn
  57. using dithering. This is also "all or nothing" transparency, but dithering
  58. helps represent partially opaque areas with limited precision depending on
  59. viewport resolution. Materials using alpha hash can cast shadows.
  60. - **Alpha Hash** is suited for realistic-looking hair, although stylized hair
  61. may work better with alpha scissor.
  62. - **Depth Pre-Pass:** This renders the object's fully opaque pixels via the
  63. opaque pipeline first, then renders the rest with alpha blending. This allows
  64. transparency sorting to be *mostly* correct (albeit not fully so, as partially
  65. transparent regions may still exhibit incorrect sorting). Materials using
  66. depth prepass can cast shadows.
  67. .. note::
  68. Godot will automatically force the material to be transparent with alpha
  69. blending if *any* of these conditions is met:
  70. - Setting the transparency mode to **Alpha** (as described here).
  71. - Setting a blend mode other than the default **Mix**
  72. - Enabling **Refraction**, **Proximity Fade**, or **Distance Fade**.
  73. Comparison between alpha blending (left) and alpha scissor (right) transparency:
  74. .. image:: img/spatial_material12.png
  75. .. warning::
  76. Alpha-blended transparency has several
  77. :ref:`limitations <doc_3d_rendering_limitations_transparency_sorting>`:
  78. - Alpha-blended materials are significantly slower to render, especially if
  79. they overlap.
  80. - Alpha-blended materials may exhibit sorting issues when transparent
  81. surfaces overlap each other. This means that surfaces may render in the
  82. incorrect order, with surfaces in the back appearing to be in front of
  83. those which are actually closer to the camera.
  84. - Alpha-blended materials don't cast shadows, although they can receive shadows.
  85. - Alpha-blended materials don't appear in any reflections (other than
  86. reflection probes).
  87. - Screen-space reflections and sharp SDFGI reflections don't appear on
  88. alpha-blended materials. When SDFGI is enabled, rough reflections are used
  89. as a fallback regardless of material roughness.
  90. Before using the **Alpha** transparency mode, always consider whether
  91. another transparency mode is more suited for your needs.
  92. .. _doc_standard_material_3d_alpha_antialiasing:
  93. Alpha Antialiasing
  94. ~~~~~~~~~~~~~~~~~~
  95. .. note::
  96. This property is only visible when the transparency mode is
  97. **Alpha Scissor** or **Alpha Hash**.
  98. While alpha scissor and alpha hash materials are faster to render than
  99. alpha-blended materials, they exhibit hard edges between opaque and transparent
  100. regions. While it's possible to use post-processing-based :ref:`antialiasing
  101. techniques <doc_3d_antialiasing>` such as FXAA and TAA, this is not always
  102. desired as these techniques tend to make the final result look blurrier or
  103. exhibit ghosting artifacts.
  104. There are 3 alpha antialiasing modes available:
  105. - **Disabled:** No alpha antialiasing. Edges of transparent materials will
  106. appear aliased unless a post-processing-based antialiasing solution is used.
  107. - **Alpha Edge Blend:** Results in a smooth transition between opaque and
  108. transparent areas. Also known as "alpha to coverage".
  109. - **Alpha Edge Clip:** Results in a sharp, but still antialiased transition
  110. between opaque and transparent areas. Also known as "alpha to coverage + alpha
  111. to one".
  112. When the alpha antialiasing mode is set to **Alpha Edge Blend** or **Alpha Edge
  113. Clip**, a new **Alpha Antialiasing Edge** property becomes visible below in the
  114. inspector. This property controls the threshold below which pixels should be
  115. made transparent. While you've already defined an alpha scissor threshold (when
  116. using **Alpha Scissor** only), this additional threshold is used to smoothly
  117. transition between opaque and transparent pixels. **Alpha Antialiasing Edge**
  118. must *always* be set to a value that is strictly below the alpha scissor
  119. threshold. The default of ``0.3`` is a sensible value with an alpha scissor of
  120. threshold of ``0.5``, but remember to adjust this alpha antialiasing edge when
  121. modifying the alpha scissor threshold.
  122. If you find the antialiasing effect not effective enough, try increasing **Alpha
  123. Antialiasing Edge** while making sure it's below **Alpha Scissor Threshold** (if
  124. the material uses alpha scissor). On the other hand, if you notice the texture's
  125. appearance visibly changing as the camera moves closer to the material, try
  126. decreasing **Alpha Antialiasing Edge**.
  127. .. important::
  128. For best results, MSAA 3D should be set to at least 2× in the Project
  129. Settings when using alpha antialiasing. This is because this feature relies
  130. on alpha to coverage, which is a feature provided by MSAA.
  131. Without MSAA, a fixed dithering pattern is applied on the material's edges,
  132. which isn't very effective at smoothing out edges (although it can still
  133. help a little).
  134. Blend Mode
  135. ~~~~~~~~~~
  136. Controls the blend mode for the material. Keep in mind that any mode
  137. other than *Mix* forces the object to go through the transparent pipeline.
  138. * **Mix:** Default blend mode, alpha controls how much the object is visible.
  139. * **Add:** The final color of the object is added to the color of the screen,
  140. nice for flares or some fire-like effects.
  141. * **Sub:** The final color of the object is subtracted from the color of the
  142. screen.
  143. * **Mul:** The final color of the object is multiplied with the color of the
  144. screen.
  145. * **Premultiplied Alpha:** The color of the object is expected to have already been
  146. multiplied by the alpha. This behaves like **Add** when the alpha is ``0.0``
  147. (fully transparent) and like **Mix** when the alpha is ``1.0`` (opaque).
  148. .. image:: img/spatial_material8.png
  149. Cull Mode
  150. ~~~~~~~~~
  151. Determines which side of the object is not drawn when backfaces are rendered:
  152. * **Back:** The back of the object is culled when not visible (default).
  153. * **Front:** The front of the object is culled when not visible.
  154. * **Disabled:** Used for objects that are double-sided (no culling is performed).
  155. .. note::
  156. By default, Blender has backface culling disabled on materials and will
  157. export materials to match how they render in Blender. This means that
  158. materials in Godot will have their cull mode set to **Disabled**. This can
  159. decrease performance since backfaces will be rendered, even when they are
  160. being culled by other faces. To resolve this, enable **Backface Culling** in
  161. Blender's Materials tab, then export the scene to glTF again.
  162. Depth Draw Mode
  163. ~~~~~~~~~~~~~~~
  164. Specifies when depth rendering must take place.
  165. * **Opaque Only (default):** Depth is only drawn for opaque objects.
  166. * **Always:** Depth draw is drawn for both opaque and transparent objects.
  167. * **Never:** No depth draw takes place
  168. (do not confuse this with the No Depth Test option below).
  169. * **Depth Pre-Pass:** For transparent objects, an opaque pass is made first
  170. with the opaque parts, then transparency is drawn above.
  171. Use this option with transparent grass or tree foliage.
  172. .. image:: img/material_depth_draw.png
  173. No Depth Test
  174. ~~~~~~~~~~~~~
  175. In order for close objects to appear over far away objects, depth testing
  176. is performed. Disabling it has the result of objects appearing over
  177. (or under) everything else.
  178. Disabling this makes the most sense for drawing indicators in world space,
  179. and works very well with the *Render Priority* property of Material
  180. (see the bottom of this page).
  181. .. image:: img/spatial_material3.png
  182. Shading
  183. -------
  184. Shading mode
  185. ~~~~~~~~~~~~
  186. Materials support three shading modes: **Per-Pixel**, **Per-Vertex**, and
  187. **Unshaded**.
  188. .. figure:: img/standard_material_shading_modes.webp
  189. :align: center
  190. :alt: Three spheres showing the Per-Pixel, Per-Vertex, and Unshaded modes.
  191. The **Per-Pixel** shading mode calculates lighting for each pixel, and is a good
  192. fit for most use cases. However, in some cases you may want to increase
  193. performance by using another shading mode.
  194. The **Per-Vertex** shading mode, often called "vertex shading" or "vertex lighting",
  195. instead calculates lighting once for each vertex, and interpolates the result
  196. between each pixel.
  197. On low-end or mobile devices, using per-vertex lighting can considerably increase
  198. rendering performance. When rendering several layers of transparency,
  199. such as when using particle systems, using per-vertex shading can improve
  200. performance, especially when the camera is close to particles.
  201. You can also use per-vertex lighting to achieve a retro look.
  202. .. figure:: img/standard_material_shading_modes_textured.webp
  203. :align: center
  204. :alt: Two cubes with a brick texture, one shaded and one unshaded.
  205. Texture from `AmbientCG <https://ambientcg.com/view?id=Bricks051>`__
  206. The **Unshaded** shading mode does not calculate lighting at all. Instead, the
  207. **Albedo** color is output directly. Lights will not affect the material at all,
  208. and unshaded materials will tend to appear considerably brighter than shaded
  209. materials.
  210. Rendering unshaded is useful for some specific visual effects. If maximum
  211. performance is needed, it can also be used for particles, or low-end or
  212. mobile devices.
  213. Diffuse Mode
  214. ~~~~~~~~~~~~
  215. Specifies the algorithm used by diffuse scattering of light when hitting
  216. the object. The default is **Burley**. Other modes are also available:
  217. * **Burley:** Default mode, the original Disney Principled PBS diffuse algorithm.
  218. * **Lambert:** Is not affected by roughness.
  219. * **Lambert Wrap:** Extends Lambert to cover more than 90 degrees when
  220. roughness increases. Works great for hair and simulating cheap
  221. subsurface scattering. This implementation is energy conserving.
  222. * **Toon:** Provides a hard cut for lighting, with smoothing affected by roughness.
  223. It is recommended you disable sky contribution from your environment's
  224. ambient light settings or disable ambient light in the StandardMaterial3D
  225. to achieve a better effect.
  226. .. image:: img/spatial_material6.webp
  227. Specular Mode
  228. ~~~~~~~~~~~~~
  229. Specifies how the specular blob will be rendered. The specular blob
  230. represents the shape of a light source reflected in the object.
  231. * **SchlickGGX:** The most common blob used by PBR 3D engines nowadays.
  232. * **Toon:** Creates a toon blob, which changes size depending on roughness.
  233. * **Disabled:** Sometimes the blob gets in the way. Begone!
  234. .. image:: img/spatial_material7.webp
  235. Disable Ambient Light
  236. ~~~~~~~~~~~~~~~~~~~~~
  237. Makes the object not receive any kind of ambient lighting that would
  238. otherwise light it.
  239. Disable Fog
  240. ~~~~~~~~~~~
  241. Makes the object unaffected by depth-based or volumetric fog. This is useful for particles or other additively blended materials that would otherwise show the shape of the mesh (even in places where it would be invisible without the fog).
  242. Vertex Color
  243. ------------
  244. This setting allows choosing what is done by default to vertex colors that come
  245. from your 3D modeling application. By default, they are ignored.
  246. .. image:: img/spatial_material4.webp
  247. Use as Albedo
  248. ~~~~~~~~~~~~~
  249. Choosing this option means vertex color is used as albedo color.
  250. Is sRGB
  251. ~~~~~~~
  252. Most 3D modeling software will likely export vertex colors as sRGB, so toggling
  253. this option on will help them look correct.
  254. Albedo
  255. ------
  256. *Albedo* is the base color for the material, on which all the other settings
  257. operate. When set to *Unshaded*, this is the only color that is visible. In
  258. previous versions of Godot, this channel was named *Diffuse*. The change
  259. of name mainly happened because, in PBR (Physically Based Rendering), this color affects many
  260. more calculations than just the diffuse lighting path.
  261. Albedo color and texture can be used together as they are multiplied.
  262. *Alpha channel* in albedo color and texture is also used for the
  263. object transparency. If you use a color or texture with *alpha channel*,
  264. make sure to either enable transparency or *alpha scissoring* for it to work.
  265. Metallic
  266. --------
  267. Godot uses a metallic model over competing models due to its simplicity.
  268. This parameter defines how reflective the material is. The more reflective, the
  269. less diffuse/ambient light affects the material and the more light is reflected.
  270. This model is called "energy-conserving".
  271. The *Specular* parameter is a general amount for the reflectivity (unlike
  272. *Metallic*, this is not energy-conserving, so leave it at ``0.5`` and don't touch
  273. it unless you need to).
  274. The minimum internal reflectivity is ``0.04``, so it's impossible to make a
  275. material completely unreflective, just like in real life.
  276. .. image:: img/spatial_material13.png
  277. Roughness
  278. ---------
  279. *Roughness* affects the way reflection happens. A value of ``0`` makes it a
  280. perfect mirror while a value of ``1`` completely blurs the reflection (simulating
  281. natural microsurfacing). Most common types of materials can be achieved with
  282. the right combination of *Metallic* and *Roughness*.
  283. .. image:: img/spatial_material14.png
  284. Emission
  285. --------
  286. *Emission* specifies how much light is emitted by the material (keep in mind this
  287. does not include light surrounding geometry unless :ref:`VoxelGI <doc_using_voxel_gi>`
  288. or :ref:`SDFGI <doc_using_sdfgi>` are used). This value is added to the resulting
  289. final image and is not affected by other lighting in the scene.
  290. .. image:: img/spatial_material15.png
  291. Normal map
  292. ----------
  293. Normal mapping allows you to set a texture that represents finer shape detail.
  294. This does not modify geometry, only the incident angle for light. In Godot,
  295. only the red and green channels of normal maps are used for better compression
  296. and wider compatibility.
  297. .. image:: img/spatial_material16.png
  298. .. note::
  299. Godot requires the normal map to use the X+, Y+ and Z+ coordinates, this is
  300. known as OpenGL style. If you've imported a material made to be used with
  301. another engine it may be DirectX style, in which case the normal map needs to
  302. be converted so its Y axis is flipped.
  303. More information about normal maps (including a coordinate order table for
  304. popular engines) can be found
  305. `here <http://wiki.polycount.com/wiki/Normal_Map_Technical_Details>`__.
  306. Rim
  307. ---
  308. Some fabrics have small micro-fur that causes light to scatter around it. Godot
  309. emulates this with the *Rim* parameter. Unlike other rim lighting implementations,
  310. which just use the emission channel, this one actually takes light into account
  311. (no light means no rim). This makes the effect considerably more believable.
  312. .. image:: img/spatial_material17.png
  313. Rim size depends on roughness, and there is a special parameter to specify how
  314. it must be colored. If *Tint* is ``0``, the color of the light is used for the
  315. rim. If *Tint* is ``1``, then the albedo of the material is used. Using
  316. intermediate values generally works best.
  317. Clearcoat
  318. ---------
  319. The *Clearcoat* parameter is used to add a secondary pass of transparent coat
  320. to the material. This is common in car paint and toys. In practice, it's a
  321. smaller specular blob added on top of the existing material.
  322. .. image:: img/clearcoat_comparison.png
  323. Anisotropy
  324. ----------
  325. This changes the shape of the specular blob and aligns it to tangent space.
  326. Anisotropy is commonly used with hair, or to make materials such as brushed
  327. aluminum more realistic. It works especially well when combined with flowmaps.
  328. .. image:: img/spatial_material18.png
  329. Ambient Occlusion
  330. -----------------
  331. It is possible to specify a baked ambient occlusion map. This map affects how
  332. much ambient light reaches each surface of the object (it does not affect direct
  333. light by default). While it is possible to use Screen-Space Ambient Occlusion
  334. (SSAO) to generate ambient occlusion, nothing beats the quality of a well-baked
  335. AO map. It is recommended to bake ambient occlusion whenever possible.
  336. .. image:: img/spatial_material19.png
  337. Height
  338. ------
  339. Setting a height map on a material produces a ray-marched search to emulate the
  340. proper displacement of cavities along the view direction. This only creates an
  341. illusion of depth, and does not add real geometry — for a height map shape used
  342. for physics collision (such as terrain), see :ref:`class_HeightMapShape3D`. It
  343. may not work for complex objects, but it produces a realistic depth effect for
  344. textures. For best results, *Height* should be used together with normal
  345. mapping.
  346. .. image:: img/spatial_material20.png
  347. Subsurface Scattering
  348. ---------------------
  349. *This is only available in the Forward+ renderer, not the Mobile or Compatibility
  350. renderers.*
  351. This effect emulates light that penetrates an object's surface, is scattered,
  352. and then comes out. It is useful to create realistic skin, marble, colored
  353. liquids, etc.
  354. .. image:: img/spatial_material21.png
  355. Back Lighting
  356. -------------
  357. This controls how much light from the lit side (visible to light) is transferred
  358. to the dark side (opposite from the light). This works well for thin objects
  359. such as plant leaves, grass, human ears, etc.
  360. Refraction
  361. ----------
  362. When refraction is enabled, Godot attempts to fetch information from behind the
  363. object being rendered. This allows distorting the transparency in a way similar
  364. to refraction in real life.
  365. Remember to use a transparent albedo texture (or reduce the albedo color's alpha
  366. channel) to make refraction visible, as refraction relies on transparency to
  367. have a visible effect.
  368. Refraction also takes the material roughness into account. Higher roughness
  369. values will make the objects behind the refraction look blurrier, which
  370. simulates real life behavior. If you can't see behind the object when refraction
  371. is enabled and albedo transparency is reduced, decrease the material's
  372. **Roughness** value.
  373. A normal map can optionally be specified in the **Refraction Texture** property
  374. to allow distorting the refraction's direction on a per-pixel basis.
  375. .. image:: img/spatial_material23.png
  376. .. note::
  377. Refraction is implemented as a screen-space effect and forces the material
  378. to be transparent. This makes the effect relatively fast, but this results
  379. in some limitations:
  380. - :ref:`Transparency sorting <doc_3d_rendering_limitations_transparency_sorting>`
  381. issues may occur.
  382. - The refractive material cannot refract onto itself, or onto other
  383. transparent materials. A refractive material behind another transparent
  384. material will be invisible.
  385. - Off-screen objects cannot appear in the refraction. This is most
  386. noticeable with high refraction strength values.
  387. - Opaque materials in front of the refractive material will appear to have
  388. "refracted" edges, even though they shouldn't.
  389. Detail
  390. ------
  391. Godot allows using secondary albedo and normal maps to generate a detail
  392. texture, which can be blended in many ways. By combining this with secondary
  393. UV or triplanar modes, many interesting textures can be achieved.
  394. .. image:: img/spatial_material24.png
  395. There are several settings that control how detail is used.
  396. Mask: The detail mask is a black and white image used to control where the
  397. blending takes place on a texture. White is for the detail textures, Black
  398. is for the regular material textures, different shades of gray are for
  399. partial blending of the material textures and detail textures.
  400. Blend Mode: These four modes control how the textures are blended together.
  401. - Mix: Combines pixel values of both textures. At black, only show the material texture,
  402. at white, only show the detail texture. Values of gray create a smooth blend between
  403. the two.
  404. - Add: Adds pixel values of one Texture with the other. Unlike mix mode
  405. both textures are completely mixed at white parts of a mask and not at gray
  406. parts. The original texture is mostly unchanged at black
  407. - Sub: Subtracts pixel values of one texture with the other. The second
  408. texture is completely subtracted at white parts of a mask with only a little
  409. subtraction in black parts, gray parts being different levels of subtraction
  410. based on the exact texture.
  411. - Mul: Multiplies the RGB channel numbers for each pixel from the top texture
  412. with the values for the corresponding pixel from the bottom texture.
  413. Albedo: This is where you put an albedo texture you want to blend. If nothing
  414. is in this slot it will be interpreted as white by default.
  415. Normal: This is where you put a normal texture you want to blend. If nothing is
  416. in this slot it will be interpreted as a flat normal map. This can still be used
  417. even if the material does not have normal map enabled.
  418. UV1 and UV2
  419. -----------
  420. Godot supports two UV channels per material. Secondary UV is often useful for
  421. ambient occlusion or emission (baked light). UVs can be scaled and offset,
  422. which is useful when using repeating textures.
  423. .. _doc_standard_material_3d_triplanar_mapping:
  424. Triplanar Mapping
  425. ~~~~~~~~~~~~~~~~~
  426. Triplanar mapping is supported for both UV1 and UV2. This is an alternative way
  427. to obtain texture coordinates, sometimes called "Autotexture". Textures are
  428. sampled in X, Y and Z and blended by the normal. Triplanar mapping can be
  429. performed in either world space or object space.
  430. In the image below, you can see how all primitives share the same material with
  431. world triplanar, so the brick texture continues smoothly between them.
  432. .. image:: img/spatial_material25.png
  433. World Triplanar
  434. ~~~~~~~~~~~~~~~
  435. When using triplanar mapping, it is computed in object local space. This
  436. option makes it use world space instead.
  437. .. _doc_standard_material_3d_sampling:
  438. Sampling
  439. --------
  440. Filter
  441. ~~~~~~
  442. The filtering method for the textures used by the material. See :ref:`this page<class_BaseMaterial3D_property_texture_filter>`
  443. for a full list of options and their description.
  444. Repeat
  445. ~~~~~~
  446. if the textures used by the material repeat, and how they repeat. See :ref:`this page<class_BaseMaterial3D_property_texture_repeat>`
  447. for a full list of options and their description.
  448. Shadows
  449. -------
  450. Do Not Receive Shadows
  451. ~~~~~~~~~~~~~~~~~~~~~~
  452. Makes the object not receive any kind of shadow that would otherwise
  453. be cast onto it.
  454. Use Shadow to Opacity
  455. ~~~~~~~~~~~~~~~~~~~~~
  456. Lighting modifies the alpha so shadowed areas are opaque and non-shadowed
  457. areas are transparent. Useful for overlaying shadows onto a camera feed in AR.
  458. Billboard
  459. ---------
  460. Billboard Mode
  461. ~~~~~~~~~~~~~~
  462. Enables billboard mode for drawing materials. This controls how the object
  463. faces the camera:
  464. * **Disabled:** Billboard mode is disabled.
  465. * **Enabled:** Billboard mode is enabled. The object's -Z axis will always
  466. face the camera's viewing plane.
  467. * **Y-Billboard:** The object's X axis will always be aligned with the camera's viewing plane.
  468. * **Particle Billboard:** Most suited for particle systems, because it allows
  469. specifying :ref:`flipbook animation <doc_process_material_properties_animation>`.
  470. .. image:: img/spatial_material9.webp
  471. The **Particles Anim** section is only visible when the billboard mode is **Particle Billboard**.
  472. Billboard Keep Scale
  473. ~~~~~~~~~~~~~~~~~~~~
  474. Enables scaling a mesh in billboard mode.
  475. Grow
  476. ----
  477. Grows the object vertices in the direction pointed by their normals:
  478. .. image:: img/spatial_material10.png
  479. This is commonly used to create cheap outlines. Add a second material pass,
  480. make it black and unshaded, reverse culling (Cull Front), and add some grow:
  481. .. image:: img/spatial_material11.png
  482. .. note::
  483. For Grow to work as expected, the mesh must have connected faces with shared
  484. vertices, or "smooth shading". If the mesh has disconnected faces with unique
  485. vertices, or "flat shading", the mesh will appear to have gaps when using Grow.
  486. Transform
  487. ---------
  488. Fixed Size
  489. ~~~~~~~~~~
  490. This causes the object to be rendered at the same size no matter the distance.
  491. This is useful mostly for indicators (no depth test and high render priority)
  492. and some types of billboards.
  493. Use Point Size
  494. ~~~~~~~~~~~~~~
  495. This option is only effective when the geometry rendered is made of points
  496. (generally it's made of triangles when imported from 3D modeling software). If
  497. so, then those points can be resized (see below).
  498. Point Size
  499. ~~~~~~~~~~
  500. When drawing points, specify the point size in pixels.
  501. Transmission
  502. ~~~~~~~~~~~~
  503. This controls how much light from the lit side (visible to light) is transferred
  504. to the dark side (opposite from the light). This works well for thin objects
  505. such as plant leaves, grass, human ears, etc.
  506. .. image:: img/spatial_material22.png
  507. Proximity and Distance Fade
  508. ---------------------------
  509. Godot allows materials to fade by proximity to each other as well as depending
  510. on the distance from the viewer. Proximity fade is useful for effects such as
  511. soft particles or a mass of water with a smooth blending to the shores.
  512. .. image:: img/spatial_material_proxfade.gif
  513. Distance fade is useful for light shafts or indicators that are only present
  514. after a given distance.
  515. Keep in mind enabling proximity fade or distance fade with **Pixel Alpha** mode
  516. enables alpha blending. Alpha blending is more GPU-intensive and can cause
  517. transparency sorting issues. Alpha blending also disables many material
  518. features such as the ability to cast shadows.
  519. .. note::
  520. To hide a character when they get too close to the camera, consider using
  521. **Pixel Dither** or better, **Object Dither** (which is even faster than
  522. **Pixel Dither**).
  523. **Pixel Alpha** mode: The actual transparency of a pixel of the object changes
  524. with distance to the camera. This is the most effect, but forces the material
  525. into the transparency pipeline (which leads, for example, to no shadows).
  526. .. image:: img/standart_material_distance_fade_pixel_alpha_mode.webp
  527. **Pixel Dither** mode: What this does is sort of approximate the transparency
  528. by only having a fraction of the pixels rendered.
  529. .. image:: img/standart_material_distance_fade_pixel_dither_mode.webp
  530. **Object Dither** mode: Like the previous mode, but the calculated transparency
  531. is the same across the entire object's surface.
  532. .. image:: img/standart_material_distance_fade_object_dither_mode.webp
  533. Material Settings
  534. -----------------
  535. Render priority
  536. ---------------
  537. The rendering order of objects can be changed, although this is mostly
  538. useful for transparent objects (or opaque objects that perform depth draw
  539. but no color draw, such as cracks on the floor).
  540. Objects are sorted by an opaque/transparent queue, then :ref:`render_priority<class_Material_property_render_priority>`,
  541. with higher priority being drawn later. Transparent objects are also sorted by depth.
  542. Depth testing overrules priority. Priority alone cannot force opaque objects to be drawn over each other.
  543. Next Pass
  544. ---------
  545. Setting :ref:`next_pass<class_Material_property_next_pass>` on a material
  546. will cause an object to be rendered again with that next material.
  547. Materials are sorted by an opaque/transparent queue, then :ref:`render_priority<class_Material_property_render_priority>`,
  548. with higher priority being drawn later.
  549. .. image:: img/next_pass.webp
  550. Depth will test equal between both materials unless the grow setting or other vertex transformations are used.
  551. Multiple transparent passes should use :ref:`render_priority<class_Material_property_render_priority>` to ensure correct ordering.