|
16 | 16 | <meta property="og:image" content="https://tmhsdigital.github.io/Blender-Developer-Tools/gallery/assets/gn-instance-grid-hero.webp" /> |
17 | 17 | <meta property="og:image:width" content="1280" /> |
18 | 18 | <meta property="og:image:height" content="720" /> |
19 | | - <meta property="og:image:alt" content="A three-by-three grid of green instanced cubes on a dark floor." /> |
| 19 | + <meta property="og:image:alt" content="A three-by-three grid of green instanced cubes, each sitting on a node of a faint source-grid lattice on a dark floor." /> |
20 | 20 | <meta property="og:site_name" content="Blender Developer Tools" /> |
21 | 21 | <meta name="twitter:card" content="summary_large_image" /> |
22 | 22 | <meta name="twitter:title" content="gn-instance-grid — Examples — Blender Developer Tools" /> |
23 | 23 | <meta name="twitter:description" content="A generative Geometry Nodes tree — Mesh Grid → Instance on Points → Realize Instances → Set Shade Smooth — attached as a NODES modifier with no Group Input geometry." /> |
24 | 24 | <meta name="twitter:image" content="https://tmhsdigital.github.io/Blender-Developer-Tools/gallery/assets/gn-instance-grid-hero.webp" /> |
25 | | - <meta name="twitter:image:alt" content="A three-by-three grid of green instanced cubes on a dark floor." /> |
| 25 | + <meta name="twitter:image:alt" content="A three-by-three grid of green instanced cubes, each sitting on a node of a faint source-grid lattice on a dark floor." /> |
26 | 26 | <style> |
27 | 27 | /* fonts are deployed by the landing build (docs/fonts/) */ |
28 | 28 | @font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; |
@@ -268,8 +268,8 @@ <h1>gn-instance-grid</h1> |
268 | 268 | <p>A generative Geometry Nodes tree — Mesh Grid → Instance on Points → Realize Instances → Set Shade Smooth — attached as a NODES modifier with no Group Input geometry.</p> |
269 | 269 | </header> |
270 | 270 | <main id="main"> |
271 | | - <button class="detail-hero" id="heroZoom" type="button" aria-label="View full size: A three-by-three grid of green instanced cubes on a dark floor."> |
272 | | - <img src="../assets/gn-instance-grid-hero.webp" alt="A three-by-three grid of green instanced cubes on a dark floor." width="1280" height="720" /> |
| 271 | + <button class="detail-hero" id="heroZoom" type="button" aria-label="View full size: A three-by-three grid of green instanced cubes, each sitting on a node of a faint source-grid lattice on a dark floor."> |
| 272 | + <img src="../assets/gn-instance-grid-hero.webp" alt="A three-by-three grid of green instanced cubes, each sitting on a node of a faint source-grid lattice on a dark floor." width="1280" height="720" /> |
273 | 273 | </button> |
274 | 274 | <p class="zoom-hint">Rendered headless by the example itself — click to zoom.</p> |
275 | 275 | <div class="callout"><span class="tag">witnesses</span> Realized instances produce closed-form topology (72 verts, 54 faces), Set Material carries Lime, and the corner instance center sits at its closed-form grid coordinate.</div> |
@@ -490,8 +490,33 @@ <h2>Source</h2> |
490 | 490 | <span class="c"># tip the grid so depth reads; cubes already rest on the floor via the tree</span> |
491 | 491 | obj.rotation_euler = (<span class="n">0.0</span>, <span class="n">0.0</span>, math.radians(<span class="n">24</span>)) |
492 | 492 |
|
| 493 | + <span class="c"># The source Mesh Grid drawn as a faint lattice on the floor, turned with</span> |
| 494 | + <span class="c"># the instances, so the still shows grid points in and one cube per</span> |
| 495 | + <span class="c"># point out. Render-only: the same GRID_SIZE / GRID_X / GRID_Y the tree</span> |
| 496 | + <span class="c"># uses, as a wireframe 1 mm above the floor.</span> |
| 497 | + lat_me = bpy.data.meshes.new(<span class="s">"Lattice"</span>) |
| 498 | + lbm = bmesh.new() |
| 499 | + <span class="k">try</span>: |
| 500 | + bmesh.ops.create_grid(lbm, x_segments=GRID_X - <span class="n">1</span>, y_segments=GRID_Y - <span class="n">1</span>, |
| 501 | + size=GRID_HALF) |
| 502 | + lbm.to_mesh(lat_me) |
| 503 | + <span class="k">finally</span>: |
| 504 | + lbm.free() |
| 505 | + lat_mat = bpy.data.materials.new(<span class="s">"Lattice"</span>) |
| 506 | + lat_mat.use_nodes = <span class="k">True</span> |
| 507 | + lb = lat_mat.node_tree.nodes[<span class="s">"Principled BSDF"</span>] |
| 508 | + lb.inputs[<span class="s">"Base Color"</span>].default_value = (<span class="n">0.30</span>, <span class="n">0.42</span>, <span class="n">0.26</span>, <span class="n">1.0</span>) |
| 509 | + lb.inputs[<span class="s">"Roughness"</span>].default_value = <span class="n">0.6</span> |
| 510 | + lat_me.materials.append(lat_mat) |
| 511 | + lattice = bpy.data.objects.new(<span class="s">"Lattice"</span>, lat_me) |
| 512 | + lattice.location = (<span class="n">0.0</span>, <span class="n">0.0</span>, <span class="n">0.001</span>) |
| 513 | + lattice.rotation_euler = obj.rotation_euler |
| 514 | + wire = lattice.modifiers.new(<span class="s">"lattice"</span>, <span class="s">"WIREFRAME"</span>) |
| 515 | + wire.thickness = <span class="n">0.018</span> |
| 516 | + scene.collection.objects.link(lattice) |
| 517 | + |
493 | 518 | aim = bpy.data.objects.new(<span class="s">"Aim"</span>, <span class="k">None</span>) |
494 | | - aim.location = (<span class="n">0.0</span>, <span class="n">0.0</span>, CUBE_SIZE / <span class="n">2</span>) |
| 519 | + aim.location = (-<span class="n">0.12</span>, <span class="n">0.0</span>, <span class="n">0.0</span>) |
495 | 520 | scene.collection.objects.link(aim) |
496 | 521 |
|
497 | 522 | <span class="k">def</span> light(name, loc, energy, size, col): |
@@ -523,7 +548,9 @@ <h2>Source</h2> |
523 | 548 | cam_data = bpy.data.cameras.new(<span class="s">"Cam"</span>) |
524 | 549 | cam_data.lens = <span class="n">50.0</span> |
525 | 550 | cam = bpy.data.objects.new(<span class="s">"Cam"</span>, cam_data) |
526 | | - cam.location = (<span class="n">3.7</span>, -<span class="n">4.3</span>, <span class="n">2.7</span>) |
| 551 | + <span class="c"># Higher, so the 3 x 3 layout reads as a grid: from 2.7 m the perspective</span> |
| 552 | + <span class="c"># scrambled the rows and the right column crowded the frame edge.</span> |
| 553 | + cam.location = (<span class="n">3.4</span>, -<span class="n">4.6</span>, <span class="n">4.3</span>) |
527 | 554 | scene.collection.objects.link(cam) |
528 | 555 | scene.camera = cam |
529 | 556 | track = cam.constraints.new(<span class="s">'TRACK_TO'</span>) |
@@ -584,7 +611,7 @@ <h2>Source</h2> |
584 | 611 | </main> |
585 | 612 | <dialog class="lightbox" id="lightbox" aria-label="Full-size render"> |
586 | 613 | <button class="lightbox-close" type="button" autofocus>Close</button> |
587 | | - <img src="../assets/gn-instance-grid-hero.webp" alt="A three-by-three grid of green instanced cubes on a dark floor." /> |
| 614 | + <img src="../assets/gn-instance-grid-hero.webp" alt="A three-by-three grid of green instanced cubes, each sitting on a node of a faint source-grid lattice on a dark floor." /> |
588 | 615 | </dialog> |
589 | 616 | <footer> |
590 | 617 | <div class="statusbar"> |
|
0 commit comments