Documentation
¶
Overview ¶
[graphics.gd/classdb/Decal]s are used to project a texture onto a graphics.gd/classdb/Mesh in the scene. Use Decals to add detail to a scene without affecting the underlying graphics.gd/classdb/Mesh. They are often used to add weathering to building, add dirt or mud to the ground, or add variety to props. Decals can be moved at any time, making them suitable for things like blob shadows or laser sight dots.
They are made of an [AABB.PositionSize] and a group of [graphics.gd/classdb/Texture2D]s specifying [Color.RGBA], normal, ORM (ambient occlusion, roughness, metallic), and emission. Decals are projected within their [AABB.PositionSize] so altering the orientation of the Decal affects the direction in which they are projected. By default, Decals are projected down (i.e. from positive Y to negative Y).
The [graphics.gd/classdb/Texture2D]s associated with the Decal are automatically stored in a texture atlas which is used for drawing the decals so all decals can be drawn at once. Godot uses clustered decals, meaning they are stored in cluster data and drawn when the mesh is drawn, they are not drawn as a post-processing effect after.
Note: Decals cannot affect an underlying material's transparency, regardless of its transparency mode (alpha blend, alpha scissor, alpha hash, opaque pre-pass). This means translucent or transparent areas of a material will remain translucent or transparent even if an opaque decal is applied on them.
Note: Decals are only supported in the Forward+ and Mobile rendering methods, not Compatibility. When using the Mobile rendering method, only 8 decals can be displayed on each mesh resource. Attempting to display more than 8 decals on a single mesh resource will result in decals flickering in and out as the camera moves.
Note: When using the Mobile rendering method, decals will only correctly affect meshes whose visibility AABB intersects with the decal's AABB. If using a shader to deform the mesh in a way that makes it go outside its AABB, graphics.gd/classdb/GeometryInstance3D.Instance.ExtraCullMargin must be increased on the mesh. Otherwise, the decal may not be visible on the mesh.
Index ¶
- type Advanced
- type Any
- type DecalTexture
- type Extension
- type ID
- type Instance
- func (self Instance) AlbedoMix() Float.X
- func (self Instance) AsDecal() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
- func (self Instance) CullMask() int
- func (self Instance) DistanceFadeBegin() Float.X
- func (self Instance) DistanceFadeEnabled() bool
- func (self Instance) DistanceFadeLength() Float.X
- func (self Instance) EmissionEnergy() Float.X
- func (self Instance) ID() ID
- func (self Instance) LowerFade() Float.X
- func (self Instance) Modulate() Color.RGBA
- func (self Instance) NormalFade() Float.X
- func (self Instance) SetAlbedoMix(value Float.X)
- func (self Instance) SetCullMask(value int)
- func (self Instance) SetDistanceFadeBegin(value Float.X)
- func (self Instance) SetDistanceFadeEnabled(value bool)
- func (self Instance) SetDistanceFadeLength(value Float.X)
- func (self Instance) SetEmissionEnergy(value Float.X)
- func (self Instance) SetLowerFade(value Float.X)
- func (self Instance) SetModulate(value Color.RGBA)
- func (self Instance) SetNormalFade(value Float.X)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetSize(value Vector3.XYZ)
- func (self Instance) SetTextureAlbedo(value Texture2D.Instance)
- func (self Instance) SetTextureEmission(value Texture2D.Instance)
- func (self Instance) SetTextureNormal(value Texture2D.Instance)
- func (self Instance) SetTextureOrm(value Texture2D.Instance)
- func (self Instance) SetUpperFade(value Float.X)
- func (self Instance) Size() Vector3.XYZ
- func (self Instance) TextureAlbedo() Texture2D.Instance
- func (self Instance) TextureEmission() Texture2D.Instance
- func (self Instance) TextureNormal() Texture2D.Instance
- func (self Instance) TextureOrm() Texture2D.Instance
- func (self Instance) UpperFade() Float.X
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type DecalTexture ¶
type DecalTexture int //gd:Decal.DecalTexture
const ( // [graphics.gd/classdb/Texture2D] corresponding to [Instance.TextureAlbedo]. TextureAlbedo DecalTexture = 0 // [graphics.gd/classdb/Texture2D] corresponding to [Instance.TextureNormal]. TextureNormal DecalTexture = 1 // [graphics.gd/classdb/Texture2D] corresponding to [Instance.TextureOrm]. TextureOrm DecalTexture = 2 // [graphics.gd/classdb/Texture2D] corresponding to [Instance.TextureEmission]. TextureEmission DecalTexture = 3 // Max size of [DecalTexture] enum. TextureMax DecalTexture = 4 )
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsVisualInstance3D ¶
func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsVisualInstance3D ¶
func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance