mirror of
https://github.com/lighttransport/tinyusdz.git
synced 2026-01-18 01:11:17 +01:00
This commit adds comprehensive OpenPBR documentation and a powerful synthetic environment map generation tool for testing and visualization workflows. ## OpenPBR Parameters Reference (doc/openpbr-parameters-reference.md) - Complete mapping of all 38 OpenPBR parameters - Blender v4.5+ MaterialX export parameter names - Three.js MeshPhysicalMaterial support status with detailed notes - Parameter categories: base, specular, transmission, subsurface, sheen, coat, emission, and geometry - Support summary: 15 fully supported (39%), 7 partial (18%), 16 not supported (42%) - Critical limitations clearly marked (subsurface, transmission effects, advanced coat) - Conversion recommendations for Three.js WebGL target - Blender MaterialX and USD format examples - 8KB comprehensive reference with all technical details ## HDRGen Tool (tools/hdrgen/) Pure Node.js synthetic HDR/EXR/LDR environment map generator with zero dependencies. ### Version 1.0.0 Features: - Three presets: white-furnace (testing), sun-sky (outdoor), studio (3-point lighting) - Dual projections: lat-long and cubemap (6 faces) - HDR output: Radiance RGBE format with proper encoding - Procedural generation: Hosek-Wilkie sky approximation, studio lighting model - Comprehensive CLI with preset-specific options - Full test suite: 8 unit tests, all passing - Documentation: 15KB README, quick start guide, examples ### Version 1.1.0 Features (added in this commit): - Image rotation: rotate environment maps around Y axis with bilinear filtering - Intensity scaling: global brightness multiplier for testing and adjustment - LDR output formats: PNG (8-bit RGB), BMP (24-bit), JPEG placeholder - Tone mapping: three operators (simple, Reinhard, ACES filmic) - Exposure control: EV-based exposure adjustment - Gamma correction: configurable gamma for different displays ### Code Statistics: - Total: ~1,500 lines of pure JavaScript - Core library: 913 lines (hdrgen.js) - CLI: 254 lines (cli.js) - Tests: 194 lines - Zero external dependencies ### Technical Implementation: - HDR: Proper RGBE encoding with 8-bit mantissa + shared exponent - PNG: Uncompressed RGB with CRC32 validation - BMP: 24-bit RGB with proper padding - Tone mapping: Reinhard, ACES filmic, simple clamp operators - Image transforms: Bilinear filtering for rotation - Math utilities: Vec3, coordinate conversions, color space operations ### Output Examples Included: - test_furnace.hdr (white furnace for energy conservation testing) - test_sunsky.hdr (procedural sky with sun disk) - test_studio.hdr (3-point studio lighting) - test_cube_*.hdr (cubemap faces, 6 files) - studio_test.png (LDR preview with tone mapping) - sky_test.bmp (BMP format example) ### Use Cases: - Material energy conservation validation (white furnace) - IBL testing and debugging - Web-friendly environment map previews (LDR output) - Lighting direction adjustment (rotation) - Brightness testing (intensity scaling) - DCC integration (Blender, Houdini, Maya, Unreal, Unity) ## Documentation Updates (doc/materialx.md) - Added "Related Documentation" section linking to OpenPBR parameters reference - Cross-reference for developers working with OpenPBR materials - Better discoverability of comprehensive parameter mappings ## Testing All functionality tested and verified: - HDR output: Valid Radiance RGBE format - PNG output: Valid PNG with correct CRC32 - BMP output: Valid 24-bit bitmap - Rotation: Smooth 90° rotation with bilinear filtering - Intensity scaling: Correct 0.5x and 2.0x multipliers - Tone mapping: All three methods produce correct output 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3.7 KiB
3.7 KiB
HDRGen Changelog
Version 1.1.0 (2025-11-06)
✨ New Features
Image Transformations
-
Rotation Support - Rotate environment maps around Y axis
- Use
--rotation <degrees>(positive = counterclockwise) - Bilinear filtering for smooth results
- Useful for adjusting lighting direction
- Use
-
Intensity Scaling - Global intensity multiplier
- Use
--intensity-scale <factor>or--scale <factor> - Quickly adjust overall brightness
- Apply after preset generation
- Use
LDR Output Formats
-
PNG Output - 8-bit RGB PNG format
- Automatic tone mapping from HDR
- Simplified implementation (no compression)
- Use
--format pngor-f png
-
BMP Output - 24-bit RGB BMP format
- Uncompressed bitmap format
- Widely compatible
- Use
--format bmpor-f bmp
-
JPEG Placeholder - JPEG support noted
- Currently converts to BMP
- Requires jpeg-js library for true JPEG encoding
- Use
--format jpgor--format jpeg
Tone Mapping
-
Multiple Tone Mapping Methods
simple- Exposure + clampreinhard- Reinhard operator (default)aces- ACES filmic tone curve- Use
--tonemap-method <method>
-
Exposure Control
--exposure <ev>- Exposure adjustment in EV stops- Default: 0.0
- Positive values brighten, negative darken
-
Gamma Correction
--gamma <value>- Gamma correction for display- Default: 2.2 (standard for sRGB displays)
- Adjustable for different display profiles
🔧 API Changes
HDRGenerator.generate() new options:
{
rotation: 0, // Rotation in degrees
intensityScale: 1.0, // Intensity multiplier
format: 'hdr', // Now supports: hdr, exr, png, bmp, jpg
tonemapOptions: { // For LDR output
exposure: 0.0,
gamma: 2.2,
method: 'reinhard'
}
}
New Classes Exported:
ImageTransform- Image rotation and scaling utilitiesToneMapper- HDR to LDR tone mappingLDRWriter- LDR format writers (PNG, BMP, JPEG)
📝 Examples
Generate LDR preview:
hdrgen -p sun-sky -f png --exposure 1.0 -o output/sky_preview.png
Rotate environment 90 degrees:
hdrgen -p studio --rotation 90 -o output/studio_rotated.hdr
Scale intensity 2x and output as BMP:
hdrgen -p studio --intensity-scale 2.0 -f bmp -o output/studio_bright.bmp
ACES tone mapping:
hdrgen -p sun-sky -f png --tonemap-method aces --exposure -0.5 -o output/sky_aces.png
🐛 Bug Fixes
- Fixed CRC32 calculation in PNG writer (was producing negative values)
- Added unsigned 32-bit coercion for correct CRC generation
📊 Code Statistics
- New Code: ~400 lines
- Total Code: ~1,500 lines
- New Classes: 3 (ImageTransform, ToneMapper, LDRWriter)
- New Formats: 3 (PNG, BMP, JPEG placeholder)
Version 1.0.0 (2025-11-06)
Initial Release
- HDR/EXR environment map generation
- Three presets: white-furnace, sun-sky, studio
- Lat-long and cubemap projections
- Pure Node.js implementation (zero dependencies)
- Comprehensive documentation
Features
-
Presets:
- White Furnace - Energy conservation testing
- Sun & Sky - Procedural outdoor environment
- Studio Lighting - 3-point lighting setup
-
Formats:
- HDR (Radiance RGBE) - Fully implemented
- EXR (OpenEXR) - Stub implementation
-
Projections:
- Lat-long (equirectangular)
- Cubemap (6 faces)
-
CLI:
- Comprehensive command-line interface
- Preset-specific options
- Resolution control
-
Documentation:
- Complete README (15KB)
- Quick start guide
- API documentation
- DCC integration guides
Code Statistics
- Total Code: ~1,100 lines
- Test Coverage: 8 unit tests
- Examples: 7+ preset variations