8 Commits

Author SHA1 Message Date
Syoyo Fujita
2aeac6eb28 Fix reverse face orientation in Tydra earcut triangulation for 5+ gons
The mapbox earcut library returns triangles in clockwise winding order,
but USD expects counter-clockwise order. This was causing reversed face
orientation for polygons with 5 or more vertices when using the earcut
triangulation method.

Changes:
- src/tydra/render-data.cc: Reverse triangle winding order by swapping
  indices 1 and 2 when processing earcut results to convert from CW to CCW
- examples/tydra_to_renderscene/to-renderscene-main.cc: Add --trifan
  option to enable triangle fan triangulation method for testing

The triangle fan method was already producing correct CCW triangles and
did not require changes.

Tested with models/ngon.usdc containing pentagon, hexagon, and octagon.
Both triangulation methods now correctly produce CCW triangles.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 11:14:43 +09:00
Syoyo Fujita
1987c70df4 add envmaps(CC0) from Blender datadir. 2025-11-06 10:01:04 +09:00
Syoyo Fujita
231441761a Add reproduction script for environment map presets
- New generate_envmaps.sh script to regenerate all 7 environment maps
- Includes exact parameters for each preset (sun/sky/studio variations)
- Automated Node.js version checking and HDRGen tool validation
- Optional PNG preview generation with tone mapping
- Updated ENVMAPS_README.md with reproduction instructions

Usage: bash models/textures/generate_envmaps.sh

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 02:40:36 +09:00
Syoyo Fujita
ae38a6cfad Add synthetic HDR environment map presets for MaterialX testing
This commit adds 7 ready-to-use HDR environment maps in lat-long format
for testing and visualizing MaterialX materials in various lighting conditions.

## Environment Maps Added (models/textures/)

All maps are 512x256 resolution, Radiance RGBE format, ~513KB each.

### Testing Environment
- **env_white_furnace.hdr** - Uniform white (intensity: 1.0)
  - Energy conservation validation
  - BRDF integration testing
  - Perfect diffuse should integrate to 1.0

### Outdoor Environments (Sun & Sky)
- **env_sunsky_afternoon.hdr**
  - Sun: 45° elevation, 135° azimuth (southeast)
  - Balanced natural lighting
  - Good for general outdoor scenes

- **env_sunsky_sunset.hdr**
  - Sun: 5° elevation, 270° azimuth (west)
  - Dramatic warm lighting, long shadows
  - High intensity: 150

- **env_sunsky_noon.hdr**
  - Sun: 85° elevation, 0° azimuth (north)
  - Harsh overhead lighting
  - Very high intensity: 200

### Studio Environments (3-Point Lighting)
- **env_studio_default.hdr**
  - Balanced professional lighting
  - Key: 50, Fill: 10, Rim: 20
  - Good for product renders

- **env_studio_highkey.hdr**
  - Bright, soft, low contrast
  - Key: 80, Fill: 30, Rim: 10, Ambient: 1.0
  - Beauty/product photography style

- **env_studio_lowkey.hdr**
  - Dramatic, high contrast
  - Key: 30, Fill: 5, Rim: 40, Ambient: 0.1
  - Cinematic/moody renders

## Documentation (models/textures/ENVMAPS_README.md)

Comprehensive documentation including:
- Detailed specifications for each environment
- Technical properties (intensity ranges, color space)
- Usage examples for USD, Three.js, Blender
- Generation instructions for custom variants
- Energy conservation testing guide
- DCC compatibility matrix

## Use Cases

**MaterialX Testing:**
- Validate OpenPBR materials in different lighting
- Test transmission, subsurface, coat effects
- Compare with DCC renders

**Web Demos:**
- Ready-to-use for Three.js MaterialX demos
- Fast loading (512x256 optimized for web)
- Cover all common lighting scenarios

**Development:**
- Quick IBL testing without large HDR files
- Consistent lighting across tests
- Energy conservation validation

**Integration:**
```usda
def DomeLight "EnvLight" {
    asset inputs:texture:file = @./textures/env_sunsky_afternoon.hdr@
    float inputs:intensity = 1.0
}
```

## Technical Specifications

- Format: Radiance RGBE (.hdr)
- Resolution: 512 x 256 (2:1 lat-long)
- Color Space: Linear RGB (no gamma)
- Dynamic Range: HDR (values > 1.0)
- File Size: ~513 KB per file
- Total: ~3.6 MB for all 7 files

## Generation

Generated using HDRGen tool (tools/hdrgen/):
- Procedural sky model (Hosek-Wilkie approximation)
- Professional 3-point studio lighting
- Uniform white furnace for testing
- All parameters documented in ENVMAPS_README.md

These can be regenerated at higher resolutions:
```bash
cd tools/hdrgen
node src/cli.js -p sun-sky -w 2048 --height 1024 -o env_2k.hdr
```

## Testing

All environment maps validated:
- ✓ Valid Radiance RGBE format
- ✓ Proper lat-long aspect ratio (2:1)
- ✓ HDR values preserved (> 1.0)
- ✓ Linear color space (no gamma)
- ✓ Loadable in Blender, Three.js

Tested with:
- file command (format verification)
- Blender World environment texture
- RGBELoader in Three.js

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 02:23:42 +09:00
Syoyo Fujita
567ee25f1d Add synthetic OpenPBR MaterialX test scenes with texturing
Created comprehensive test suite for OpenPBR materials demonstrating various
material properties and texture mapping workflows. All scenes use proper USD
shader node IDs (OpenPBRSurface, UsdUVTexture, UsdPrimvarReader_float2) rather
than MaterialX node definition IDs.

New test files:
- openpbr-brick-sphere.usda: Diffuse material with brick texture
- openpbr-metallic-cube.usda: Metallic material with checkerboard
- openpbr-emissive-plane.usda: Emissive with cat texture (Mesh - MaterialX exportable)
- openpbr-glass-sphere.usda: Glass/transmission material
- openpbr-subsurface-sphere.usda: Subsurface scattering with texture
- openpbr-coated-cube.usda: Clear coat over brick texture
- openpbr-multi-object.usda: Multi-material scene (4 objects, 4 materials)

Texture asset:
- textures/brick.bmp: 64x64 red brick pattern with gray mortar
- create_brick_texture.py: Python script to generate brick texture

Documentation:
- OPENPBR_TESTS_README.md: Comprehensive guide covering material structure,
  shader node IDs, Tydra conversion limitations, and testing procedures

Material features demonstrated:
- Base layer (color, metalness, roughness)
- Specular (weight, roughness, IOR)
- Transmission (weight, color, thin_walled)
- Emission (color, luminance)
- Subsurface scattering (color, weight, radius, radius_scale)
- Coat (weight, roughness, IOR, color)
- Texture mapping with UV coordinates
- Multiple texture formats (BMP, PNG, JPG)

Note: Materials bound to parametric primitives (Sphere, Cube) are not
currently converted by Tydra RenderScene. Use explicit Mesh primitives
for MaterialX export compatibility.

Tested: All files parse correctly, emissive-plane exports to MaterialX XML/JSON

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 01:50:24 +09:00
Syoyo Fujita
32877a67e8 Add textured-cat-plane test scene(modeled by Blender 3.5 alpha + USD) 2022-12-25 05:46:06 +09:00
Syoyo Fujita
7b8e5a451c Add texturedcube USDC model.
Refactor some Shader classes.
2022-04-20 03:10:51 +09:00
Syoyo Fujita
65ccbdb3f9 Add some test models. 2022-04-18 02:39:16 +09:00