Creates a subdivided rectangular grid mesh on XZ plane (useful for terrain, water, cloth simulation).
Takes textureSlots, uvMode, unique, sizeX (width along X-axis, default 10.0), sizeZ (depth along Z-axis, default 10.0), subdivisionsX (quads along X, clamped 1-256, default 10), subdivisionsZ (quads along Z, clamped 1-256, default 10).
Returns mesh entity handle or 0 on failure.
3D Graphics
Parameters & Returns
Parameters
textureSlotsInt
uvModeInt
uniqueInt
sizeXDouble
sizeZDouble
subdivisionsXInt
subdivisionsZInt
Returns
Int
Quick Summary
Creates a subdivided rectangular grid mesh on XZ plane (useful for terrain, water, cloth simulation).
Takes textureSlots, uvMode, unique, sizeX (width along X-axis, default 10.0), sizeZ (depth along Z-axis, default 10.0), subdivisionsX (quads along X, clamped 1-256, default 10), subdivisionsZ (quads along Z, clamped 1-256, default 10).
Returns mesh entity handle or 0 on failure.
Technical Exegesis...
Creates a subdivided rectangular grid mesh on XZ plane (useful for terrain, water, cloth simulation). Takes textureSlots, uvMode, unique, sizeX (width along X-axis, default 10.0), sizeZ (depth along Z-axis, default 10.0), subdivisionsX (quads along X, clamped 1-256, default 10), subdivisionsZ (quads along Z, clamped 1-256, default 10). Returns mesh entity handle or 0 on failure.
Creates a subdivided rectangular grid mesh on XZ plane (useful for terrain, water, cloth simulation). Takes textureSlots, uvMode, unique, sizeX (width along X-axis, default 10.0), sizeZ (depth along Z-axis, default 10.0), subdivisionsX (quads along X, clamped 1-256, default 10), subdivisionsZ (quads along Z, clamped 1-256, default 10). Returns mesh entity handle or 0 on failure. Creates surface-based mesh on XZ plane (Y=0), centered at origin, generates vertices in rows (Z) x columns (X), creates quads (2 triangles each), sets all normals pointing up (0,1,0), unlocks. UV mapping: 0-1 across entire grid. Grid dimensions: -sizeX/2 to +sizeX/2 on X-axis, -sizeZ/2 to +sizeZ/2 on Z-axis, Y=0. Returns mesh entity handle.
This function creates flat subdivided plane for terrains, water surfaces, and cloth. Grid = rectangular array of quads on horizontal XZ plane. subdivisionsX parameter: number of quads along X-axis (width), clamped 1-256. More subdivisions = smoother deformation but more vertices. subdivisionsZ parameter: number of quads along Z-axis (depth), clamped 1-256. sizeX/sizeZ parameters: physical dimensions in world units. Grid centered at origin: spans from (-sizeX/2, 0, -sizeZ/2) to (+sizeX/2, 0, +sizeZ/2). Vertex layout: generated row-by-row (Z increases outer loop, X increases inner loop). Each row has subdivisionsX+1 vertices. Quad construction: each quad subdivided into 2 triangles with CCW winding (visible from above). UV mapping: U wraps 0-1 across X-axis, V wraps 0-1 across Z-axis (full 0-1 range across entire grid). All normals point up (0,1,0) for flat shading. Use cases: (1) Terrain heightmaps (modify vertex Y after creation), (2) Water surfaces (animate vertices for waves), (3) Cloth simulation (physics-driven vertex deformation), (4) Platform/floor geometry, (5) Radar displays (flat circular patterns). Common pattern: grid=b3dCreateGrid(BBR_ONE_SLOT, BBR_TEXTURE_UV, 0, 20.0, 20.0, 32, 32) creates 20x20 unit terrain with 32x32 subdivision for smooth hills. Vertex count: (subdivisionsX+1) x (subdivisionsZ+1). Example: 32x32 subdivisions = 33x33 = 1089 vertices. Triangle count: 2 x subdivisionsX x subdivisionsZ. Example: 32x32 = 2048 triangles. Quality: higher subdivisions allow smoother vertex-level deformation but increase polygon count. Typical values: 16x16 for simple platforms, 64x64 for detailed terrain, 128x128 for high-quality water. Modification pattern: b3dLockMesh -> loop through vertices with b3dVertexCoords to modify Y heights -> b3dUpdateNormals -> b3dUnlockMesh. Alternative: b3dCreatePolarGrid for circular grids, b3dCreateCube flattened for single quad, custom mesh for non-uniform subdivision. Orientation: horizontal by default (XZ plane), rotate 90 degrees for vertical wall grid. Performance: surface-based, fully editable, efficient for real-time deformation.