Attention: Here be dragons (unstable version)
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Redot.
Checking the stable version of the documentation...
WorldScape3DMeshAsset
Inherits: WorldScape3DAssetResource < Resource < RefCounted < Object
Description
This class manages meshes used for instancing. There are two broad types of meshes it can host.
Generated Texture Card - this class will generate a QuadMesh. The typical use for this is to create a material in the override material, place a 2D grass texture in the albedo texture slot, and enable alpha scissor. This will generate low poly grass.
Scene File - you can provide your own mesh in a scene file, which is specifically a PackedScene (.tscn, .scn, .glb, .fbx, etc). You can override the material if desired. MultiMeshes only support one mesh object, so complex objects like tree trunks and leaves, or a door frame and door either need to be combined into one object with multiple materials, or placed by another method. The system will look for MeshInstance3D nodes in the file to use as Levels of Detail (LODs). Ideally they have suffixes like LOD0, LOD1. We support up to 10 LODs, but recommend no more than 4.
Read More: MultiMesh, MultiMeshInstance3D
Properties
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods
void |
clear() |
get_lod_range(lod: int) const |
|
get_thumbnail() const |
|
void |
set_lod_range(lod: int, distance: float) |
Signals
file_changed() 🔗
Emitted when scene_file is changed, or if the generated mesh is toggled.
id_changed(type: int, old_id: int, new_id: int) 🔗
Emitted when id is changed.
instancer_setting_changed() 🔗
Emitted when instancer specific settings are changed on this mesh asset, such as cast_shadows, and triggers an instancer rebuild.
setting_changed() 🔗
Emitted when settings are changed, other than those tracked by other signals.
Enumerations
enum GenType: 🔗
GenType TYPE_NONE = 0
No generated mesh is in use, likely because a scene file is used.
GenType TYPE_TEXTURE_CARD = 1
Generates a QuadMesh to be used as a texture card.
GenType TYPE_MAX = 2
Maximum value for this enum.
Property Descriptions
ShadowCastingSetting cast_shadows = 1 🔗
void set_cast_shadows(value: ShadowCastingSetting)
ShadowCastingSetting get_cast_shadows()
Tells the renderer how to cast shadows from this mesh asset onto the terrain and other objects. This sets GeometryInstance3D.cast_shadow on all MultiMeshInstances used by this mesh.
Density is used to set the approximate default spacing between instances based on the size of the mesh. When painting meshes on the terrain, mesh density is multiplied by brush strength.
This value is not tied to any real world unit. It is calculated as 10.f / mesh->get_aabb().get_volume(), then clamped to a sane range. If the calculated amount is inappropriate, increase or decrease it here.
If enabled, MultiMeshInstance3Ds will be generated for this mesh asset.
If > 0, sets GeometryInstance3D.fade_mode = self, sets this margin in GeometryInstance3D.visibility_range_begin_margin and GeometryInstance3D.visibility_range_end_margin and adjusts the ranges to allow fading between lods.
Limited to the smaller of half the distance between LOD0 and LOD1, or 64m.
Currently broken and hidden in the inspector until Redot issue #102799 is fixed.
Select if you want the generated texture card to have a single QuadMesh, 2 meshes rotated 90° in a cross, or 3 rotated at 60°.
Vector2 generated_size = Vector2(1, 1) 🔗
Sets the base size of the QuadMesh texture card. Increasing this size will expand from bottom, not the middle.
If enabled, this mesh asset will be set to a generated QuadMesh to be used as a texture card.
Vertically offsets the origin point of the mesh asset. For example, if you have a 2 meter diameter rock with the mesh origin point in the center, but you want all rocks to be sitting on the ground, you could enter 1 or 0.9 here and it will be placed near its edge. You can also adjust this when painting using the tool settings bar; both options are cumulative.
The user settable ID of the mesh. You can change this to reorder meshes in the list.
Sets the farthest Level of Detail (LOD) that will be rendered. Farther LODs (greater than this number) will be ignored.
Sets the farthest Level of Detail (LOD) that will cast shadows. Farther LODs (greater than this number) won't cast shadows. If shadow_impostor is greater than this number, the shadow impostor will still cast shadows.
Sets GeometryInstance3D.visibility_range_end on all MultiMeshInstances used by this mesh at the closest Level of Detail (LOD), the most detailed.
Allows the renderer to cull MMIs beyond this distance. The next LOD level will use this value for its GeometryInstance3D.visibility_range_begin.
Set to 0 to disable culling and see this LOD at any distance.
Sets the end visible range for LOD1. See lod0_range.
Sets the end visible range for LOD2. See lod0_range.
Sets the end visible range for LOD3. See lod0_range.
Sets the end visible range for LOD4. See lod0_range.
Sets the end visible range for LOD5. See lod0_range.
Sets the end visible range for LOD6. See lod0_range.
Sets the end visible range for LOD7. See lod0_range.
Sets the end visible range for LOD8. See lod0_range.
Sets the end visible range for LOD9. See lod0_range.
int get_lod_count()
Provides the detected number of Levels of Detail (LODs) found in the provided scene file or generated mesh. Read only.
This sets GeometryInstance3D.material_overlay, which applies an overriding material using next_pass that overlays the base material.
This sets GeometryInstance3D.material_override, which replaces the rendered mesh material with this one.
The user specified name for this asset.
PackedScene scene_file 🔗
void set_scene_file(value: PackedScene)
PackedScene get_scene_file()
Specifies the PackedScene (.tscn, .scn, .glb, .fbx, etc) to load the mesh from. See the top description.
Uses this lower quality Level of Detail (LOD) to calculate shadows (as an impostor) instead of the visible mesh.
e.g. Normally each LOD casts its own shadows. Given LOD0-3, if shadow_impostor = 2 then when LOD0-1 are visible, they are set to no shadows and LOD2 is set to cast shadows only. When LOD2-3 are visible, each casts their own shadow as normal.
Increase to improve performance by lowering shadow quality.
Shadow impostors are disabled if this is set to 0 or if cast_shadows is set to shadows only.
Method Descriptions
void clear() 🔗
Resets this resource to default settings.
float get_lod_range(lod: int) const 🔗
Returns the far visible distance for the specified Level of Detail (LOD). The near visible distance is the LOD range for the next closest LOD.
Mesh get_mesh(lod: int = 0) const 🔗
Returns the Mesh resource for the specified Level of Detail (LOD).
Texture2D get_thumbnail() const 🔗
Returns the thumbnail generated by WorldScape3DAssets.
void set_lod_range(lod: int, distance: float) 🔗
Sets the far visible distance for the specified Level of Detail (LOD).