Documentation / Node reference / mat nodes

mat/MeshGrid

Draws a ruled grid with coloured axes, procedurally.

Mesh

Put this on a plane to get a ground grid. The lines are computed per pixel from the surface position rather than sampled from a texture, so they stay the same thickness however close you get and never turn into a moire pattern in the distance. The two axis lines through the origin get their own colours, which is what tells you where you are and which way you are facing. Everything between the lines is the background colour, and its alpha is how you make the grid float over the scene rather than sit on an opaque sheet.

Parameters

Name Type What it does
cellSize Float The spacing between grid lines, in the object's own units. One cell is one square of the grid.
lineColor Color The colour of the ordinary grid lines, the ones that are not an axis.
lineWidth Float How thick the grid lines are, as a fraction of a cell. 0.04 is a thin ruled line; push it up and the lines start to close over the background between them.
bgColor Color4 The colour between the lines. Its alpha is the useful part: below 1 the grid reads as floating over whatever is behind it, and at 0 only the lines are drawn.
xAxisColor Color The colour of the line along X through the origin, drawn on top of the ordinary lines so the axis stands out.
zAxisColor Color The colour of the line along Z through the origin, the companion to xAxisColor.
axisWidth Float How thick the two axis lines are, as a fraction of a cell, separately from lineWidth. Set it above lineWidth to make the axes read as the main lines, or to 0 to drop them entirely and leave a plain grid.
transparencyMode UInt8 AUTO · OPAQUE · MASK · BLEND Whether this material is drawn in the opaque pass or through order-independent transparency. AUTO decides from the material itself, which for most materials means its colour alpha below 1. OPAQUE always draws in the opaque pass and ignores alpha entirely, which is what you want for a material whose alpha is incidental. MASK draws in the opaque pass but throws away fragments below alphaCutoff, which is what hard-edged cutouts want: they still write depth, so they occlude each other correctly. BLEND always goes through transparency, which is the only way to get soft texture alpha to show, since nothing on the CPU side can inspect the texels.
sides UInt8 FRONT · BACK · BOTH Which side of each triangle is drawn. FRONT draws the outward-facing side only, which is what a closed mesh wants: its inner surface is hidden anyway, so drawing it is wasted work. BACK draws the inward-facing side, for a surface seen from the inside such as a skydome or a box the camera sits in. BOTH draws either side, which is what an open single surface needs: a cutout leaf, a sheet of cloth, or a plane the camera can walk around, all of which disappear from one side under FRONT. The shadow pass follows BOTH so an open surface still casts a shadow whichever way it faces the light, and draws FRONT otherwise.

This page is generated from the engine, so it describes the release you can download. The same text is in the editor's Help panel next to the node itself.