scad-gltf 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -8
- package/bin/scad-godot.js +1 -1
- package/bin/scad-web.js +1 -1
- package/editor/dist/assets/{OutputPass-Bvl6NigM.js → OutputPass-B6MrFnGE.js} +1 -1
- package/editor/dist/assets/{index-Cy6q5gqL.js → index-CgVih1C4.js} +1 -1
- package/editor/dist/assets/{preview-C1zc24MJ.js → preview-CA_S_fWF.js} +1 -1
- package/editor/dist/assets/{prompt-ui-mDTjxcQO.js → prompt-ui-B9QCNLfJ.js} +1 -1
- package/editor/dist/content.js +1 -1
- package/editor/dist/index.html +5 -5
- package/editor/dist/manifest.webmanifest +1 -1
- package/editor/dist/preview.html +2 -2
- package/editor/dist/sw.js +1 -1
- package/godot/README.md +5 -2
- package/godot/addons/scad_importer/scad_importer.gd +1 -1
- package/godot/examples/README.md +5 -0
- package/godot/examples/fruit_fusion_3d.js +229 -29
- package/godot/examples/horde_survivor_3d.js +65 -6
- package/godot/examples/naval_battle_3d.js +1 -1
- package/godot/export_presets.cfg +25 -0
- package/package.json +6 -2
- package/src/prompt.js +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A powerful WebAssembly (WASM) build of a custom OpenSCAD fork that enables direct compilation of OpenSCAD (`.scad`) scripts to **glTF/GLB** formats natively in JavaScript (Node.js and Browser).
|
|
4
4
|
|
|
5
|
-
Unlike standard OpenSCAD, this custom engine supports **Physically Based Rendering (PBR)** materials, **Hierarchical
|
|
5
|
+
Unlike standard OpenSCAD, this custom engine supports **Physically Based Rendering (PBR)** materials, **Hierarchical Node Animations**, and **Texture Baking**, making it a perfect bridge between procedural CAD generation and modern 3D web rendering engines (like Three.js or Babylon.js).
|
|
6
6
|
|
|
7
7
|
The C++ source code for this custom OpenSCAD version is included directly in this repository within the `openscad/` subfolder.
|
|
8
8
|
|
|
@@ -14,8 +14,7 @@ The C++ source code for this custom OpenSCAD version is included directly in thi
|
|
|
14
14
|
|
|
15
15
|
- **Direct SCAD to GLB conversion:** Compile geometry directly to web-ready binary glTF.
|
|
16
16
|
- **Extended PBR Material Support:** Native extensions to the OpenSCAD `color()` module supporting `metalness`, `roughness`, `transmission` (glass), `thickness`, `ior`, `attenuationColor`, `attenuationDistance`, `clearcoat`, `sheen`, `emissive`, `specular`, and `iridescence`, plus a `$asa` special variable for auto smooth shading.
|
|
17
|
-
- **
|
|
18
|
-
- **True Skeletal Skinning:** Exports absolute world transforms and properly bound animation tracks.
|
|
17
|
+
- **Hierarchical Node Animation:** Define articulated, rigid-body hierarchies and keyframe animations using `armature()` and `bone()` modules. Exports proper glTF node transform tracks (rigid parenting rather than vertex-weighted skinning—ideal for robots, mechanical parts, vehicles, and articulated components).
|
|
19
18
|
- **Texture Baking:** Automatically generate UVs and bake high-poly details (colors, normals, ORM) onto low-poly meshes using the new `bake()` module.
|
|
20
19
|
- **Web Editor & Real-time Viewer (Scadify):** In-browser IDE with live WebAssembly compilation, GPU path tracing, animation timeline scrubbing, video/image export, URL sharing, and `.scad` / `.hdr` drag-and-drop.
|
|
21
20
|
- **LLM Friendly:** Includes a built-in modular prompt generator (`prompt.js` and Web UI) to help AI models (like Gemini, Claude, or ChatGPT) write compatible OpenSCAD scripts utilizing the new features.
|
|
@@ -23,6 +22,7 @@ The C++ source code for this custom OpenSCAD version is included directly in thi
|
|
|
23
22
|
- **CLI Converter:** Bundled `scad-convert` CLI utility for single file and batch compiling `.scad` files with smart dependency hashing.
|
|
24
23
|
- **MCP Server for AI Agents:** Bundled `scad-mcp` server enables MCP clients to iteratively design, compile, and **visually inspect** 3D models via multi-angle headless rendering and animation frame evaluation.
|
|
25
24
|
- **AI Studio Extension:** Chrome extension to natively preview, prompt, take chat snapshots, open in Scadify, and locally save AI-generated 3D models directly inside Google AI Studio.
|
|
25
|
+
- **Godot 4 Integration & Web Demos:** Native Godot 4 importer addon for procedural `.scad` assets and prebuilt AI-generated [web game examples](https://iliagrigorevdev.github.io/scad-godot/).
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
|
@@ -32,7 +32,7 @@ The built-in web editor (**Scadify**) provides a full-featured development envir
|
|
|
32
32
|
|
|
33
33
|
- **Real-Time 3D Viewport:** Instant WebAssembly compilation with auto-rendering, camera auto-framing, wireframe view, grid/axes toggles, ACES Filmic tone mapping, and full-screen mode.
|
|
34
34
|
- **Photorealistic GPU Path Tracing:** Built-in hardware-accelerated path tracer with HDR environment lighting for realistic reflections, shadows, and glass refraction. Supports custom `.hdr` environment maps via drag-and-drop.
|
|
35
|
-
- **Interactive Animation Controls:** Multi-animation selector, playback controls (play/pause), and smooth timeline scrubbing for
|
|
35
|
+
- **Interactive Animation Controls:** Multi-animation selector, playback controls (play/pause), and smooth timeline scrubbing for animated hierarchies.
|
|
36
36
|
- **Modular AI Prompt Generator:** Built-in UI with fine-grained feature toggles (Basic PBR, Auto Smooth, Animations, Extended PBR, Texture Baking) and persistent local settings to generate optimized prompts for LLMs.
|
|
37
37
|
- **Image & Video Capture:**
|
|
38
38
|
- **📷 PNG Snapshots:** Export high-resolution renders with a single click.
|
|
@@ -284,7 +284,11 @@ This repository includes an official **Godot 4.x Importer Addon** located in the
|
|
|
284
284
|
|
|
285
285
|
The addon allows you to drag-and-drop `.scad` files directly into your Godot project. It uses this WASM compiler under the hood to transform scripts into 3D scenes automatically.
|
|
286
286
|
|
|
287
|
-
|
|
287
|
+
**🕹️ Play Web Demos (No Installation Required):**
|
|
288
|
+
Try prebuilt AI-generated Godot games directly in your browser: [https://iliagrigorevdev.github.io/scad-godot/](https://iliagrigorevdev.github.io/scad-godot/)
|
|
289
|
+
|
|
290
|
+
- **Features:** Supports PBR Materials and Hierarchical Node Animations inside the Godot Editor.
|
|
291
|
+
- **Examples:** Check out AI-generated game templates in the [`godot/examples`](./godot/examples) directory.
|
|
288
292
|
- **License:** The Godot Addon is licensed under **MIT**.
|
|
289
293
|
- **Setup:** Simply copy the `addons/scad_importer` folder to your project and enable it in Project Settings.
|
|
290
294
|
|
|
@@ -329,9 +333,9 @@ color(
|
|
|
329
333
|
}
|
|
330
334
|
```
|
|
331
335
|
|
|
332
|
-
### 2.
|
|
336
|
+
### 2. Hierarchical Node Animations (Rigid Parenting)
|
|
333
337
|
|
|
334
|
-
Define hierarchical armatures, resting positions, and keyframe animations:
|
|
338
|
+
Define hierarchical armatures, resting positions, and keyframe animations for rigid parts:
|
|
335
339
|
|
|
336
340
|
```openscad
|
|
337
341
|
anim_data = [
|
|
@@ -422,7 +426,7 @@ console.log(promptContext);
|
|
|
422
426
|
|
|
423
427
|
Once connected, an AI assistant can use the server to execute the following loop:
|
|
424
428
|
|
|
425
|
-
1. **Retrieve Syntax Rules:** The assistant calls the `get_scad_prompt` tool to get the extended syntax rules for PBR materials,
|
|
429
|
+
1. **Retrieve Syntax Rules:** The assistant calls the `get_scad_prompt` tool to get the extended syntax rules for PBR materials, hierarchical node animations, and texture baking.
|
|
426
430
|
2. **Generate Code:** The assistant writes the `.scad` script based on your design request.
|
|
427
431
|
3. **Compile & Visually Inspect:** The assistant calls the `render_scad_model` tool to inspect rendered multi-angle frames and keyframes, fixing any errors before final export.
|
|
428
432
|
|
|
@@ -486,3 +490,7 @@ This repository includes a custom fork of OpenSCAD in the `openscad/` subfolder
|
|
|
486
490
|
- **Path Tracing:** The web editor utilizes [three-gpu-pathtracer](https://github.com/gkjohnson/three-gpu-pathtracer) for high-quality rendering.
|
|
487
491
|
- **Environment Map (HDR)**: [Aristea Wreck Puresky](https://polyhaven.com/a/aristea_wreck_puresky) by **Jarod Guest** via [Poly Haven](https://polyhaven.com/). Licensed under [CC0](https://polyhaven.com/license).
|
|
488
492
|
- **License:** See the `LICENSE` file (GPL-2.0 or later, inheriting from standard OpenSCAD).
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
```
|
package/bin/scad-godot.js
CHANGED
|
@@ -158,7 +158,7 @@ What to generate:
|
|
|
158
158
|
* OpenSCAD -Y (Back) -> Godot +Z (Back)
|
|
159
159
|
* OpenSCAD +Z (Up) -> Godot +Y (Up)
|
|
160
160
|
DO NOT manually apply root rotations (e.g., \`rotate([90, 0, 0])\`) to compensate for Godot.
|
|
161
|
-
- CRITICAL: You must use the custom OpenSCAD glTF extensions for PBR materials (e.g., \`roughness\`, \`metalness\`, \`emissive\`) and
|
|
161
|
+
- CRITICAL: You must use the custom OpenSCAD glTF extensions for PBR materials (e.g., \`roughness\`, \`metalness\`, \`emissive\`) and Hierarchical Node Animations (\`armature()\`, \`bone()\`). The rules and syntax for these features are provided below:
|
|
162
162
|
|
|
163
163
|
=== OPENSCAD SYNTAX RULES ===
|
|
164
164
|
${promptRules}
|
package/bin/scad-web.js
CHANGED
|
@@ -137,7 +137,7 @@ What to generate:
|
|
|
137
137
|
1. 3D Web Assets (.scad):
|
|
138
138
|
- Generate procedural 3D models for the web app using OpenSCAD.
|
|
139
139
|
- CRITICAL: The SCAD to glTF converter automatically converts OpenSCAD's Z-up coordinate system to the standard glTF Y-up coordinate system. Design your models naturally in OpenSCAD.
|
|
140
|
-
- CRITICAL: You must use the custom OpenSCAD glTF extensions for PBR materials (e.g., \`roughness\`, \`metalness\`, \`emissive\`) and
|
|
140
|
+
- CRITICAL: You must use the custom OpenSCAD glTF extensions for PBR materials (e.g., \`roughness\`, \`metalness\`, \`emissive\`) and Hierarchical Node Animations (\`armature()\`, \`bone()\`). The rules and syntax for these features are provided below:
|
|
141
141
|
|
|
142
142
|
=== OPENSCAD SYNTAX RULES ===
|
|
143
143
|
${promptRules}
|