MeshInstancer_v4 Op

MeshInstancer

Draw the same mesh multiple times on the GPU


<p>A performant way to render a 3d object many times.</p> <p>The 3d object or mesh to be rendered needs to be connected as a geometry. Most meshes in cables output a geometry object that you can connect. Imported 3d meshes can also output geometries, e.g. see GltfGeometry operator.</p> <p>The object can be scaled differently each time, or have a different color, etc.</p> <p>The Billboarding option will render the object always perpendicular to the screen. Spherical billboarding means the object will be oriented flat to the screen, this is handy for 2d overlays. Cylindrical billboarding can be used for instancing flat objects in a 3d environment, often used in games for rendering trees, grass or bushes as 2d planes.</p>


Full Name
  • Ops.Gl.MeshInstancer_v4
Visibility
  • Core Op - Official cables op
License
  • MIT
AuthorgithubPatchlistTest Patches


Example Patch mesh instancer

This patch demonstrates how we can generate 3 arrays of random numbers between 0-1. Using the arrayMultiply op allows us to smoothly change the range of each array going into the position, scale and rotation arrays.

Open In Editor

Youtube Video Tutorial

INPUT PORTS


exe (Trigger)

<p>Trigger In</p>

geom (Object:geometry)

<p>The shape that will be instanced</p>

Scale (Number)

<p>Global scale for all instances, disabled if scale array is used</p>

Limit Number of Instances

Limit Instances (Number:

<i>boolean</i>

)

<p>Enable to set a limit on how many instances are created</p>

Limit (Number:

<i>integer</i>

)

Parameters

positions (Array)

<p>Needs an XYZ array to determine the positions of each instance</p>

Scale Array (Array)

<p>Needs an XYZ array to determine the scale of each instance</p>

Rotations (Array)

<p>Needs an XYZ array to determine the XYZ rotation of each instance. 0 - 360 degrees.</p>

Rotation Type index (Number:

<i>integer</i>

)

Billboarding index (Number:

<i>integer</i>

)

Material blend mode index (Number:

<i>integer</i>

)

<p>Pick a material blend mode with an integer</p>

Colors (Array)

<p>Needs an RGBA array to determine the color of each instance.</p>

TexCoords (Array)

<p>Needs an array4 in standard UV range (0-1). First two numbers are for UV coordinates. Second two are for UV scale. [ U, V, U scale, V scale ]</p>

OUTPUT PORTS


Trigger Out (Trigger)

<p>Trigger Out</p>

Num (Number)

<p>Total number of instances/shapes</p>


Patches using MeshInstancer_v4

  • Mesh Instancer (3)
  • Public
  • My Patches

Changelog


created opuser avatarcables - 2019-11-14 17:46
Ops.User.cables.MeshInstancer_v3 renamed to Ops.Gl.MeshInstancer_v3user avatarcables - 2019-11-14 19:03
Ops.Gl.MeshInstancer_v3 renamed to Ops.Gl.MeshInstancer_v4user avatarpandur - 2020-07-23 11:24
added core lib: cgl_shadermodifieruser avatarpandur - 2020-07-23 15:13
featureadded option to set rotation from normals array user avatarpandur - 2024-01-23 19:05
featureAdded options for billboardinguser avatarpandur - 2024-02-15 10:22