Files
synthetic-defect-factory/reports/defects_engine.md
T

3.8 KiB
Raw Blame History

Procedural Defect Engine Specification: src/defects.py

Implementation Script: src/defects.py
Render Verification Script: blender/render_sample.py
Validation Suite: pxr.UsdValidation (30 validator suites)
Render Backend: Blender 5.2.2 LTS (Cycles GPU / OptiX)


1. Defect Class Definitions & Geometric Implementations

The defect generator models all 4 industrial defect classes procedurally on the USDA stage, plus good (pristine) parts:

Class ID Class Name Target Prim 3D Physical & Geometric Implementation Manifest Coordinates
0 scratch /World/Product/Body Hairline directional groove with perturbed vertex normals on the bracket top quad grid (z \in [0.0055, 0.006]) combined with a high-contrast abrasive ribbon mesh (/World/Product/Scratch_Ribbon) bound to /World/Materials/ScratchAbrasion. Center [x_c, y_c, 0.006] (m), radius L/2 (m)
1 dent /World/Product/Body Smooth C^1 radial indentation on the top face grid with depth D \in [0.8\text{ mm}, 1.6\text{ mm}] and radius R \in [4.5\text{ mm}, 7.5\text{ mm}] using \Delta z = -D(1 - r^2/R^2)^2. Vertices deformed and vertex normals recomputed for raytraced concave shadows and rim highlights. Center [x_c, y_c, 0.006] (m), radius R (m)
2 missing_part /World/Product/Screw_1 or Screw_2 Complete omission / deactivation of either Screw_1 (Hole 1) or Screw_2 (Hole 4), leaving the dark cylindrical through-hole clearance bore exposed down to the black conveyor rubber. Hole center [-0.025, -0.010, 0.006] or [0.025, 0.010, 0.006], radius 0.004 (m)
3 misplaced_part /World/Product/Screw_* Variation A: Fastener inserted into the wrong hole (Hole 2 or 3).
Variation B: Fastener cross-threaded / high (backed out by 2.2–3.2 mm and tilted by $14^\circ$–20^\circ).
Variation C: Stray loose fastener dropped horizontally on the bracket top surface.
Position [x, y, z] (m), radius $0.0045$–0.006 (m)
None good — Pristine bracket with Hole 1 having Screw_1 seated flush, Hole 4 having Screw_2 seated flush, 0 dents, 0 scratches. defects: []

2. USD Compliance Validation Results

All 5 representative sample USDA scenes were validated against all 30 standard validator suites in pxr.UsdValidation:

Scene Name USDA Path JSON Manifest Path USD Errors USD Warnings Compliance Status
sample_good usd/scenes/sample_good.usda usd/manifests/sample_good.json 0 0 100% COMPLIANT
sample_scratch usd/scenes/sample_scratch.usda usd/manifests/sample_scratch.json 0 0 100% COMPLIANT
sample_dent usd/scenes/sample_dent.usda usd/manifests/sample_dent.json 0 0 100% COMPLIANT
sample_missing_part usd/scenes/sample_missing_part.usda usd/manifests/sample_missing_part.json 0 0 100% COMPLIANT
sample_misplaced_part usd/scenes/sample_misplaced_part.usda usd/manifests/sample_misplaced_part.json 0 0 100% COMPLIANT

3. Render Verification Outputs

Rendered at 640 \times 640 in headless Blender 5.2.2 LTS (Cycles OptiX GPU on NVIDIA RTX 3050):

  • renders/samples/preview_good.png: Pristine bracket with two seated screws and two empty holes.
  • renders/samples/preview_scratch.png: Clear directional abrasive scratch streak with recomputed normals.
  • renders/samples/preview_dent.png: Physically raytraced concave dent with smooth shadow and crescent rim reflection.
  • renders/samples/preview_missing_part.png: Screw 1 absent, exposing the dark through-bore hole.
  • renders/samples/preview_misplaced_part.png: Stray loose fastener lying horizontally on the bracket top face.