@@ -23,7 +23,9 @@ This class handles options for both the built-in shader and any custom override
2323
2424It is a savable resource, so you can save it to disk and use the same material settings in multiple scenes that use Terrain3D. The amount of data is small, assuming you have saved your shader parameter textures to disk, so it can be saved as a git-friendly, text based .tres file or left within the scene file.
2525
26- While it does mimic some of the functionality of ShaderMaterial, it does not derive from any of the Godot Material classes. It will not pass any ``is Material `` checks. It is a ``Resource ``.
26+ While it does mimic some of the functionality of ShaderMaterial, it does not derive from any of the Godot Material classes. It will fail any ``is Material `` checks. It is a ``Resource ``.
27+
28+ Inspector settings above `Custom Shader ` and :ref: `shader_override<class_Terrain3DMaterial_property_shader_override> ` are used to determine what code is used in the current shader. Inspector settings in `Shader Uniforms ` are the public uniforms (not prefaced with `\_ `) available in the current shader.
2729
2830.. rst-class :: classref-reftable-group
2931
@@ -48,6 +50,18 @@ Properties
4850 +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+-----------+
4951 | ``bool `` | :ref: `dual_scaling_enabled<class_Terrain3DMaterial_property_dual_scaling_enabled> ` | ``false `` |
5052 +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+-----------+
53+ | ``bool `` | :ref: `macro_variation_enabled<class_Terrain3DMaterial_property_macro_variation_enabled> ` | ``false `` |
54+ +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+-----------+
55+ | ``bool `` | :ref: `output_albedo<class_Terrain3DMaterial_property_output_albedo> ` | ``true `` |
56+ +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+-----------+
57+ | ``bool `` | :ref: `output_ambient_occlusion<class_Terrain3DMaterial_property_output_ambient_occlusion> ` | ``true `` |
58+ +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+-----------+
59+ | ``bool `` | :ref: `output_normal_map<class_Terrain3DMaterial_property_output_normal_map> ` | ``true `` |
60+ +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+-----------+
61+ | ``bool `` | :ref: `output_roughness<class_Terrain3DMaterial_property_output_roughness> ` | ``true `` |
62+ +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+-----------+
63+ | ``bool `` | :ref: `projection_enabled<class_Terrain3DMaterial_property_projection_enabled> ` | ``false `` |
64+ +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+-----------+
5165 | ``Shader `` | :ref: `shader_override<class_Terrain3DMaterial_property_shader_override> ` | |
5266 +------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+-----------+
5367 | ``bool `` | :ref: `shader_override_enabled<class_Terrain3DMaterial_property_shader_override_enabled> ` | ``false `` |
@@ -124,7 +138,7 @@ Methods
124138 +-------------+----------------------------------------------------------------------------------------------------------------------------+
125139 | |void | | :ref: `set_shader_param<class_Terrain3DMaterial_method_set_shader_param> `\ (\ name\: ``StringName ``, value\: ``Variant ``\ ) |
126140 +-------------+----------------------------------------------------------------------------------------------------------------------------+
127- | |void | | :ref: `update<class_Terrain3DMaterial_method_update> `\ (\ full \: ``bool `` = false \ ) |
141+ | |void | | :ref: `update<class_Terrain3DMaterial_method_update> `\ (\ flags \: ``int `` = 0 \ ) |
128142 +-------------+----------------------------------------------------------------------------------------------------------------------------+
129143
130144.. rst-class :: classref-section-separator
@@ -192,6 +206,56 @@ Textures are filtered using a blend of 4 adjacent pixels. Use this for most case
192206
193207Textures are filtered using a the nearest pixel only. It is faster than LINEAR, but the texture will look pixelated. Use this for a low-poly look, with a very low uv_scale.
194208
209+ .. rst-class :: classref-item-separator
210+
211+ ----
212+
213+ .. _enum_Terrain3DMaterial_UpdateFlags :
214+
215+ .. rst-class :: classref-enumeration
216+
217+ enum **UpdateFlags **: :ref: `🔗<enum_Terrain3DMaterial_UpdateFlags> `
218+
219+ .. _class_Terrain3DMaterial_constant_UNIFORMS_ONLY :
220+
221+ .. rst-class :: classref-enumeration-constant
222+
223+ :ref: `UpdateFlags<enum_Terrain3DMaterial_UpdateFlags> ` **UNIFORMS_ONLY ** = ``0 ``
224+
225+ Non-texture array values are assigned to the shader. This is the default and is always done.
226+
227+ .. _class_Terrain3DMaterial_constant_TEXTURE_ARRAYS :
228+
229+ .. rst-class :: classref-enumeration-constant
230+
231+ :ref: `UpdateFlags<enum_Terrain3DMaterial_UpdateFlags> ` **TEXTURE_ARRAYS ** = ``1 ``
232+
233+ The ground texture arrays are assigned to the shader, along with the values in `UNIFORMS_ONLY `.
234+
235+ .. _class_Terrain3DMaterial_constant_REGION_ARRAYS :
236+
237+ .. rst-class :: classref-enumeration-constant
238+
239+ :ref: `UpdateFlags<enum_Terrain3DMaterial_UpdateFlags> ` **REGION_ARRAYS ** = ``2 ``
240+
241+ The region data texture arrays are assigned to the shader, along with the values in `UNIFORMS_ONLY `.
242+
243+ .. _class_Terrain3DMaterial_constant_UPDATE_ARRAYS :
244+
245+ .. rst-class :: classref-enumeration-constant
246+
247+ :ref: `UpdateFlags<enum_Terrain3DMaterial_UpdateFlags> ` **UPDATE_ARRAYS ** = ``3 ``
248+
249+ Values in `TEXTURE_ARRAYS ` and `REGION_ARRAYS ` are assigned to the shader.
250+
251+ .. _class_Terrain3DMaterial_constant_FULL_REBUILD :
252+
253+ .. rst-class :: classref-enumeration-constant
254+
255+ :ref: `UpdateFlags<enum_Terrain3DMaterial_UpdateFlags> ` **FULL_REBUILD ** = ``7 ``
256+
257+ The shader is rebuilt, then all values in `UPDATE_ARRAYS ` are assigned to the shader.
258+
195259.. rst-class :: classref-section-separator
196260
197261----
@@ -221,8 +285,8 @@ This private dictionary stores all of the shader parameters in the resource. It
221285
222286.. rst-class :: classref-property-setget
223287
224- - |void | **set_auto_shader **\ (\ value\: ``bool ``\ )
225- - ``bool `` **get_auto_shader **\ (\ )
288+ - |void | **set_auto_shader_enabled **\ (\ value\: ``bool ``\ )
289+ - ``bool `` **get_auto_shader_enabled **\ (\ )
226290
227291Enables selecting two texture IDs that will automatically be applied to the terrain based upon slope.
228292
@@ -306,15 +370,117 @@ Adjusts the transition between textures. When set at `1.0`, the blending of disp
306370
307371.. rst-class :: classref-property-setget
308372
309- - |void | **set_dual_scaling **\ (\ value\: ``bool ``\ )
310- - ``bool `` **get_dual_scaling **\ (\ )
373+ - |void | **set_dual_scaling_enabled **\ (\ value\: ``bool ``\ )
374+ - ``bool `` **get_dual_scaling_enabled **\ (\ )
311375
312376Enables selecting one texture ID that will have multiple scales applied based upon camera distance. Use it for something like a rock texture so up close it will be nicely detailed, and far away mountains can be covered in the same rock texture without looking tiled. The two blend together at a specified distance.
313377
314378.. rst-class :: classref-item-separator
315379
316380----
317381
382+ .. _class_Terrain3DMaterial_property_macro_variation_enabled :
383+
384+ .. rst-class :: classref-property
385+
386+ ``bool `` **macro_variation_enabled ** = ``false `` :ref: `🔗<class_Terrain3DMaterial_property_macro_variation_enabled> `
387+
388+ .. rst-class :: classref-property-setget
389+
390+ - |void | **set_macro_variation_enabled **\ (\ value\: ``bool ``\ )
391+ - ``bool `` **get_macro_variation_enabled **\ (\ )
392+
393+ Allows you to add a couple of noise patterns at different scales and colors to add variation to your terrain to avoid tiled textures.
394+
395+ .. rst-class :: classref-item-separator
396+
397+ ----
398+
399+ .. _class_Terrain3DMaterial_property_output_albedo :
400+
401+ .. rst-class :: classref-property
402+
403+ ``bool `` **output_albedo ** = ``true `` :ref: `🔗<class_Terrain3DMaterial_property_output_albedo> `
404+
405+ .. rst-class :: classref-property-setget
406+
407+ - |void | **set_output_albedo_enabled **\ (\ value\: ``bool ``\ )
408+ - ``bool `` **get_output_albedo_enabled **\ (\ )
409+
410+ Enables the Albedo, aka Base Color or Diffuse, output channel in the shader.
411+
412+ .. rst-class :: classref-item-separator
413+
414+ ----
415+
416+ .. _class_Terrain3DMaterial_property_output_ambient_occlusion :
417+
418+ .. rst-class :: classref-property
419+
420+ ``bool `` **output_ambient_occlusion ** = ``true `` :ref: `🔗<class_Terrain3DMaterial_property_output_ambient_occlusion> `
421+
422+ .. rst-class :: classref-property-setget
423+
424+ - |void | **set_output_ambient_occlusion_enabled **\ (\ value\: ``bool ``\ )
425+ - ``bool `` **get_output_ambient_occlusion_enabled **\ (\ )
426+
427+ Enables the Ambient Occlusion output channel in the shader.
428+
429+ .. rst-class :: classref-item-separator
430+
431+ ----
432+
433+ .. _class_Terrain3DMaterial_property_output_normal_map :
434+
435+ .. rst-class :: classref-property
436+
437+ ``bool `` **output_normal_map ** = ``true `` :ref: `🔗<class_Terrain3DMaterial_property_output_normal_map> `
438+
439+ .. rst-class :: classref-property-setget
440+
441+ - |void | **set_output_normal_map_enabled **\ (\ value\: ``bool ``\ )
442+ - ``bool `` **get_output_normal_map_enabled **\ (\ )
443+
444+ Enables the Normal Map output channel in the shader.
445+
446+ .. rst-class :: classref-item-separator
447+
448+ ----
449+
450+ .. _class_Terrain3DMaterial_property_output_roughness :
451+
452+ .. rst-class :: classref-property
453+
454+ ``bool `` **output_roughness ** = ``true `` :ref: `🔗<class_Terrain3DMaterial_property_output_roughness> `
455+
456+ .. rst-class :: classref-property-setget
457+
458+ - |void | **set_output_roughness_enabled **\ (\ value\: ``bool ``\ )
459+ - ``bool `` **get_output_roughness_enabled **\ (\ )
460+
461+ Enables the Roughness output channel in the shader.
462+
463+ .. rst-class :: classref-item-separator
464+
465+ ----
466+
467+ .. _class_Terrain3DMaterial_property_projection_enabled :
468+
469+ .. rst-class :: classref-property
470+
471+ ``bool `` **projection_enabled ** = ``false `` :ref: `🔗<class_Terrain3DMaterial_property_projection_enabled> `
472+
473+ .. rst-class :: classref-property-setget
474+
475+ - |void | **set_projection_enabled **\ (\ value\: ``bool ``\ )
476+ - ``bool `` **get_projection_enabled **\ (\ )
477+
478+ Enables textures to be projected vertically when placed on slopes above 45 degrees. This is useful for mapping textures on cliff faces without stretching, even though the polygons are stretched.
479+
480+ .. rst-class :: classref-item-separator
481+
482+ ----
483+
318484.. _class_Terrain3DMaterial_property_shader_override :
319485
320486.. rst-class :: classref-property
@@ -343,7 +509,9 @@ If shader_override_enabled is true and this Shader is valid, the material will u
343509- |void | **set_shader_override_enabled **\ (\ value\: ``bool ``\ )
344510- ``bool `` **is_shader_override_enabled **\ (\ )
345511
346- Enables use of the :ref: `shader_override<class_Terrain3DMaterial_property_shader_override> ` shader code. Generates default code if shader_override is blank.
512+ Enables using the :ref: `shader_override<class_Terrain3DMaterial_property_shader_override> ` shader. An editable shader is generated from the current one if shader_override is blank.
513+
514+ The inspector settings above this group determine the code that is used in the current shader. The settings below are uniforms for the current shader.
347515
348516.. rst-class :: classref-item-separator
349517
@@ -854,11 +1022,9 @@ Set a parameter in the active shader (built-in or override shader).
8541022
8551023.. rst-class :: classref-method
8561024
857- |void | **update **\ (\ full\: ``bool `` = false\ ) :ref: `🔗<class_Terrain3DMaterial_method_update> `
858-
859- Sends all uniform values to the shader again.
1025+ |void | **update **\ (\ flags\: ``int `` = 0\ ) :ref: `🔗<class_Terrain3DMaterial_method_update> `
8601026
861- full - recompiles the shader first .
1027+ Sends uniform values to the shader. See :ref: ` UpdateFlags<enum_Terrain3DMaterial_UpdateFlags> ` for options .
8621028
8631029.. |virtual | replace :: :abbr: `virtual ( This method should typically be overridden by the user to have any effect. ) `
8641030.. |const | replace :: :abbr: `const ( This method has no side effects. It doesn't modify any of the instance's member variables. ) `
0 commit comments