Class GridMaterial
Hierarchy (View Summary)
- WebXRSpatialLayerType
- GridMaterial
Constructors
constructor
-
constructor
Parameters
- name: string
The name given to the material in order to identify it afterwards.
Optionalscene: anyThe scene the material is used in.
- forceGLSL: boolean = false
Use the GLSL code generation for the shader (even on WebGPU). Default is false
Returns GridMaterial
- name: string
Properties
antialias
Whether to antialias the grid
grid Octaves
Number of logarithmic octaves rendered (1–8). Default 4.
grid Offset
Allows setting an offset for the grid lines.
grid Ratio
The scale of the grid compared to unit.
grid Thickness Modifier
Scales grid line width. Values > 1 produce thicker lines. Default 1.0.
line Color
Color of the grid lines.
main Color
Main color of the grid (e.g. between lines)
major Unit Frequency
The frequency of thicker lines.
min Grid Spacing
World-unit spacing of the finest octave. Default 0.001.
minor Unit Visibility
The visibility of minor units in the grid.
opacity
Overall mesh opacity. In linesOnly mode this also scales the maximum line alpha.
pre Multiply Alpha
Determine RBG output is premultiplied by alpha value.
use Horizon Fade
Enable camera-distance-aware horizon (grazing-angle) fade.
use Max Line
Determines if the max line value will be used instead of the sum wherever grid lines intersect.
use Multi Scale
Enable multi-scale logarithmic grid LOD. Number of octaves is controlled by gridOctaves.
use Origin Marker
Render an ultra-fine crosshair at the world origin.
Accessors
below Line Color
-
get belowLineColor(): Nullable<Color3>
Color of grid lines when the camera is below the surface. When set, lineColor acts as the above-surface color.
Returns Nullable<Color3>
-
set belowLineColor(value: Nullable<Color3>): void
Parameters
- value: Nullable<Color3>
Returns void
lines Only
-
get linesOnly(): boolean
When true, only grid lines are visible — non-grid pixels are discarded. Puts the material in the alpha-blend queue and enables a depth pre-pass so grid lines correctly occlude translucent objects (e.g. Gaussian splats). Set mesh.alphaIndex to a value lower than other transparent objects so the depth pre-pass fires first.
Returns boolean
-
set linesOnly(value: boolean): void
Parameters
- value: boolean
Returns void
opacity Texture
Texture to define opacity of the grid
Methods
bind For Sub Mesh
-
Parameters
- world: Matrix
- mesh: Mesh
- subMesh: SubMesh
Returns void
clone
-
Parameters
- name: string
Returns GridMaterial
dispose
-
Dispose the material and its associated resources.
Parameters
OptionalforceDisposeEffect: booleanwill also dispose the used effect when true
Returns void
get Class Name
-
Returns string
is Ready For Sub Mesh
-
Parameters
- mesh: AbstractMesh
- subMesh: SubMesh
OptionaluseInstances: boolean
Returns boolean
need Alpha Blending
-
Returns boolean
whether or not the grid requires alpha blending.
need Alpha Blending For Mesh
-
Parameters
- mesh: AbstractMesh
Returns boolean
serialize
-
Returns any
StaticParse
-
Parse a JSON input to create back a grid material.
Parameters
- source: any
the JSON data to parse
- scene: Scene
defines the hosting scene
- rootUrl: string
defines the root URL to use to load textures and relative dependencies
Returns GridMaterial
a new grid material
- source: any
The grid materials allows you to wrap any shape with a grid. Colors are customizable.