Commit Graph

3182 Commits

Author SHA1 Message Date
Syoyo Fujita
3340210631 Remove ANSI color codes from failure summary output
Changed the failure summary to use plain text instead of ANSI color
codes. This ensures the output is readable when redirected to a file
or piped through other commands.

Output format:
  [X] Failed Files (N):
    - /path/to/file.usda
  [!] Warning/Error Files (N):
    - /path/to/file.usda

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
b3fa37f436 Add failure and warning summary to comparison script
Added a new feature to report failed and warning files at the end of
the batch comparison run. This makes it easy to see which files need
attention without scrolling through the full output.

Features:
- Lists all files with differences (✗) at the end
- Lists all files with warnings/errors (⚠) at the end
- Shows count of failed and warning files
- On by default, can be disabled with --no-failure-summary flag
- Environment variable SHOW_FAILURE_SUMMARY=false also works

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
ffb385197a Fix triple-@ asset path closing delimiter detection in JS parser
The parser was incorrectly treating @@@ followed by alphanumeric content
as the closing delimiter. For example, in the path:
  @@@0/teapot_\\@@@n.png@@@
The middle @@@n was being parsed as closing @@@ + leftover "n.png@@@",
causing an EOF error when the parser tried to find the next closing @@@.

The fix checks if @@@ is followed by whitespace, delimiter, or EOF before
treating it as the closing delimiter. If followed by alphanumeric content,
the @@@ is included as part of the path content.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
5bc0e6422f Add support for connection syntax parsing in USDA lexer
- Add readConnection() method to tokenize USDA connection targets (<...>)
- Connection targets are now properly recognized as STRING tokens
- This allows files with connection attributes (.connect) to tokenize correctly
- Example: </path/to/prim.attribute> is now recognized as a valid token

All 304 test files continue to process successfully.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
144739584e Fix asset path escape sequence handling for triple-@ delimited paths
Properly implement USDA escape rules for @@@...@@@ delimited asset paths:
- \\@@@ = one escaped backslash + closing delimiter
- \@@@ = escaped triple-@ sequence = three literal @ characters in content

This allows correct parsing of asset paths like @@@0/teapot_\@@@n.png@@@
where the \@@@ sequence includes literal @@@n in the resulting path.

All 304 test files pass comparison successfully.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
e18c0e55a1 Improve asset path tokenization for escape sequences in triple-@@ delimited paths
- Add special handling for \@@@ escape sequence in triple-@ delimited asset paths
- This allows proper parsing of @@@...\@@...@@@n...@@@ patterns
- Note: triple-quoted-assetpath-001.usda still has ambiguous escaping but parser handles gracefully
- All 304 test files now process successfully in comparison script

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
9fa64fe884 Add --print-commands option and improve parser error reporting
New features:
- Added --print-commands option to show executed commands before running each file
- Improved error messages to show context when parsing fails
- Enhanced error reporting with line-level information in verbose mode
- Shows token context (3 tokens before/after error position) for parsing errors

This helps identify which file is failing and provides better error context
for debugging parsing issues like "Expected RBRACE but got EOF()".

Usage:
  node compare-usda.js --print-commands --tusdcat ... --usdcat ... *.usda
  node compare-usda.js --verbose --tusdcat ... --usdcat ... file.usda

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
e7c05d515b Fix double-quoting of layer metadata in pprinter
Previously, string metadata values were being double-quoted because
to_string() for strings already calls quote(). This caused values like
"Blender v2.93.0" to be output as ""Blender v2.93.0"".

Removed unnecessary quote() calls for registered metadata (doc, comment)
since to_string() already handles the quoting.

Fixes issue where curves.usda output had `doc = ""Blender v2.93.0""`.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
c822c0c656 Fix unquoted string metadata in prim metadata output
Unregistered prim metadata (stored in unregisteredMetas) were being output
without quotes, even for string values. This caused string metadata like
`doc = "value"` to be output as `doc = value`, which is invalid USDA syntax.

Updated the pprinter to detect and quote string values in unregisteredMetas,
while preserving the format of non-string values.

Fixes issue where bora-001.usda's `doc = "bora-001"` was output as
`doc = bora-001` without quotes.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
b008aab3f0 Fix OpenPBR parameter types: subsurface_radius and subsurface_radius_scale
OpenPBR Specification correction:
- subsurface_radius: should be float type (not color3f)
- subsurface_radius_scale: should be color3f type

Changes made:
1. Updated documentation in doc/openpbr-parameters-reference.md
2. Updated doc/C++_MATERIALX_IMPORT.md with correct parameter types
3. Fixed TinyUSDZ Core schema definitions in src/usdShade.hh
4. Updated MaterialX types in src/usdMtlx.hh and src/usdMtlx.cc
5. Fixed Tydra render data types in src/tydra/render-data.hh/.cc
6. Fixed Three.js exporter in src/tydra/threejs-exporter.cc
7. Updated test comparison script

This allows openpbr-subsurface-sphere.usda and similar files to parse
without "Property type mismatch" validation errors.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
fce033b8de Fix subsetFamily attributes not being output in pprinter
The PARSE_UNIFORM_ENUM_PROPERTY macro contains a `continue` statement
that was preventing the code that adds subsetFamily values to
mesh->subsetFamilyTypeMap from executing.

Instead of using the macro, we now manually parse the enum value and add
it to the subsetFamilyTypeMap, allowing the attributes to be properly
output by the pprinter.

Fixes issue where `uniform token subsetFamily:*:familyType = "partition"`
attributes were being parsed but not output by tusdcat.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
88f3f4e804 Implement attribute ordering independence and numeric normalization
Improvements:
1. Attribute ordering independence
   - Comparison now truly order-independent using Set of normalized attribute names
   - Empty attribute names are filtered out (parser edge cases)
   - Attributes compared by normalized name only, not position

2. Numeric representation normalization
   - Integers like 1.0 now normalize to 1 to match integer representations
   - Treats 1, 1.0, 1e0 as semantically equivalent
   - Arrays and tuples now recursively normalize numeric elements
   - Improved extractAttributeName() robustness

3. Better attribute name extraction
   - Added empty string check
   - More explicit type detection regex
   - Better handling of namespaced attributes (inputs:, outputs:, primvars:)

Results after improvements:
- Equivalent files: 29 (up from 27)
- Different files: 67 (down from 69)
- Error files: 2 (unchanged)

Impact: The numeric normalization fixed 2 additional files that had differences
only in float representation (1 vs 1.0).

Remaining issues are primarily due to parser edge cases with complex attributes
that have metadata or special characters, and MaterialX-related output differences.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
4ed820b932 Improve USDA comparison script parser robustness
Added comprehensive defensive checks throughout the USDA parser to prevent crashes
when encountering edge cases or malformed tokens. Key improvements:

1. Enhanced token access safety in peek() and advance() methods - always return
   valid token objects with required properties (type, value, line, col)

2. Improved error messages with token context - shows exact position and
   surrounding tokens for debugging parser failures

3. Defensive checks in all parsing methods (parseAttributeName, parseDictionaryKey,
   parseValue, parseRelationshipName, parsePath, parsePrim) to safely handle
   undefined tokens

4. Error recovery in parse() method - wraps prim parsing in try-catch and skips
   to next prim if one fails, returning partial results instead of crashing

5. Fixed readAssetPath() tokenizer to properly handle triple-@ delimited paths
   and escaped characters

Benefits:
- Prevents "Cannot read properties of undefined" errors
- Makes parser more resilient to edge cases
- Provides better debugging information when parsing fails
- Maintains backward compatibility with valid USDA files

The improved parser is now resilient enough to handle malformed input gracefully
and continue processing remaining content.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
029794a28d Fix asset path truncation and improve comparison test robustness
This commit fixes multiple issues discovered during USDA comparison testing:

1. Fix asset path truncation bug (src/value-pprint.cc)
   - Bug: Characters at end of asset paths were dropped when path contains '@'
   - Cause: Off-by-one error in boundary check logic
   - Impact: Asset paths like '0/teapot_@n.png' were truncated to '0/teapot_@n.p'
   - Fix: Moved boundary check into the '@@@' pattern detection condition
   - Result: Asset paths now print correctly, outputs match Pixar's usdcat

2. Improve comparison test suite (tests/compare-usda.js)
   - Increase parser depth limit from 100 to 10,000 for complex USD files
   - Increase iteration limit from 10,000 to 100,000
   - Add filter to remove empty strings from glob expansion results
   - These changes allow skeleton and skeletal animation test files to parse

3. Add comprehensive analysis documentation
   - ERROR-ANALYSIS.md: Details of 7 error cases found
   - ASSET-PATH-BUG-ANALYSIS.md: Initial investigation of asset path issue
   - ASSET-PATH-FIX-SUMMARY.md: Root cause analysis and fix explanation

Test suite improvements:
- Before: 174 equivalent (91%), 10 different, 7 errors
- After: 173 equivalent (91%), 13 different, 4 errors
- Fixed: Asset path truncation completely, skeleton file parsing
- Remaining: 4 errors due to comparison script limitations and reference tool

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 12:45:42 +09:00
Syoyo Fujita
869700908d Normalize type annotations in attribute comparison
Added extractAttributeName() function to strip type annotations from
attribute keys when comparing. This allows attributes with different
type annotations (e.g., texCoord2f vs float2) to be properly matched
during comparison, since the type difference is often due to role type
printing differences rather than actual data differences.

Example:
- Before: 'texCoord2f inputs:st' and 'float2 inputs:st' are different
- After: Both map to 'inputs:st' for comparison

This significantly reduces false-positive differences, particularly in
shader-related files. For example, shader.usdc went from 39 differences
to 13, with most remaining differences being attribute ordering and
structural differences that should be ignored.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-14 12:45:34 +09:00
Syoyo Fujita
4fd185ccd1 Cherry-pick timeSamples and comparison fixes from anim-mtlx-phase3-fix
- Fix timeSamples printing for scalar POD types
- Fix subdivisionScheme typo and None/blocked sample handling
- Fix token attribute double-quoting in metadata printing
- Add epsilon-based comparison for floating-point values
- Fix double/float precision in timeSamples printing
- Use dtoa_milo for precision
- Fix array timeSamples printing
- Fix token timeSamples reading from USDC files
2026-01-14 12:45:07 +09:00
Syoyo Fujita
a83494135d Add comprehensive USDA comparison tools with detailed diff reporting
- Add tests/compare-usda.js: Node.js CLI tool for comparing USDA (USD ASCII) outputs
  from tusdcat and usdcat, with detailed diff reporting including line numbers and context

  Features:
  * Lexer tracks line/column numbers for all tokens
  * Parser stores location info in prims and attributes
  * Order-independent comparison at prim and attribute levels
  * Glob pattern support for batch testing (*.usda, **/*.usdc, etc.)
  * TimeSamples parsing with proper time-code handling
  * Support for dictionaries, asset paths, relationships, and metadata
  * Configurable timeouts and error handling
  * JSON output format option
  * --detailed-diff flag for rich diff output with context lines

- Add tests/run-usdcat-compare.sh: Bash batch runner script
  * Automatically tests both tests/usda and tests/usdc directories
  * Configurable tool paths and timeouts
  * Results logged to timestamped files in tests/comparison-results/
  * Colored terminal output with progress indicators
  * Support for detailed or summary-only output modes
  * Flexible configuration via CLI options or environment variables

Test Results:
  * Successfully processes 304+ USDA test files
  * 73% equivalent, 23% different, 4% errors
  * Detailed diffs show exact line numbers and surrounding context
  * Full integration with existing tusdcat/usdcat tools

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-10 06:46:23 +09:00
Syoyo Fujita
160aab95fb Update ARM64 CI to Ubuntu 24.04 and fix bootstrap script defaults
- Update ARM64 runners from ubuntu-22.04-arm to ubuntu-24.04-arm
- Update LLVM apt repository from jammy to noble for Ubuntu 24.04
- Remove clang default from bootstrap-cmake-linux.sh; now uses
  system default compiler unless CC/CXX are explicitly set

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 11:11:24 +09:00
Syoyo Fujita
39a9a656a3 Fix bootstrap-cmake-linux.sh to respect CC/CXX environment variables
The script was hardcoding CXX=clang++ CC=clang, ignoring any
user-provided environment variables. Now uses shell parameter
expansion to default to clang only if CC/CXX are not already set.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 10:04:16 +09:00
Syoyo Fujita
9422931843 Add GCC build and update Clang to v21 for ARM64 Linux CI
- Split build-arm64 into build-arm64-gcc and build-arm64-clang
- build-arm64-gcc: Uses system GCC on Ubuntu 22.04 ARM
- build-arm64-clang: Installs Clang 21 from LLVM apt repository
  (previously used system Clang 14 which is outdated)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 08:57:30 +09:00
Syoyo Fujita
352c9fa708 suppress compiler warnings. 2026-01-08 07:03:22 +09:00
Syoyo Fujita
8834878173 Fix timeSamples pprint for array types and add bounds checking
- Fix move constructor/assignment operator to transfer value array storage
  fields (_value_array_storage, _value_array_refs, _use_value_array)
- Fix copy constructor/assignment operator for value array storage fields
- Add bounds checking for blocked[] and offsets[] array access in pprint
- Strip TYPE_ID_1D_ARRAY_BIT before type lookup in print_pod_value_dispatch
  and get_pod_type_size to handle array element types correctly
- Add handler for value array storage path in get_samples()
- Set _use_pod=false when using value array storage

This fixes the "Unknown type_id: 1048618" error when printing array-typed
timeSamples (e.g., color3f[]) and prevents heap-buffer-overflow when
printing timeSamples with None values.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 07:02:27 +09:00
Syoyo Fujita
c6ace402dc Add granular coroutine yield phases for Tydra conversion
- Remove debug console.log statements from coroutine helpers
- Split Tydra conversion into multiple phases with yields:
  - detecting: Format detection
  - parsing: USD parsing
  - setup: Converter environment setup
  - assets: Asset resolution setup
  - meshes: Tydra mesh conversion
  - complete: Done

- Each phase yields to event loop, allowing browser repaints
- Update progress-demo.js phase mapping with descriptive messages
- The Tydra ConvertToRenderScene call is still blocking, but yields
  occur before and after it

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:13:51 +09:00
Syoyo Fujita
f6c9ad1d44 Use coroutine async loading in progress-demo.js with debug logging
- Add console.log debug prints at yield points in binding.cc:
  - Log when yielding to event loop
  - Log when resuming from yield (rAF or setTimeout)
  - Log phase name and progress percentage

- Add hasAsyncSupport() method to TinyUSDZLoader.js:
  - Checks if loadFromBinaryAsync is available
  - Returns true if WASM was built with TINYUSDZ_WASM_COROUTINE=ON

- Update progress-demo.js to use coroutine async when available:
  - Check hasAsyncSupport() before loading
  - Use parseAsync() for file and URL loading when available
  - Fall back to standard Promise-based loading if not
  - Map coroutine phases to progress UI stages
  - Manual fetch with progress for URL loading in async mode

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 03:40:00 +09:00
Syoyo Fujita
c66a71428e Add TINYUSDZ_WASM_COROUTINE cmake option for C++20 coroutine async loading
- Add CMake option TINYUSDZ_WASM_COROUTINE (default OFF) to enable/disable
  C++20 coroutine-based async loading
- Add TINYUSDZ_USE_COROUTINE compile definition for conditional compilation
- Wrap coroutine helper functions (yieldToEventLoop, reportAsyncPhaseStart)
  with #if defined(TINYUSDZ_USE_COROUTINE)
- Wrap loadFromBinaryAsync method with #if defined(TINYUSDZ_USE_COROUTINE)
- Wrap EMSCRIPTEN_BINDINGS registration with same guard

To enable coroutine support:
  cmake .. -DTINYUSDZ_WASM_COROUTINE=ON

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 00:40:52 +09:00
Syoyo Fujita
9d58ccc7ed Add C++20 coroutine-based async USD loading with browser yield support
- Add yieldToEventLoop() helper using EM_JS that returns a Promise for requestAnimationFrame
- Implement loadFromBinaryAsync() coroutine that yields between processing phases:
  - detecting: format detection
  - parsing: USD parsing
  - converting: Tydra conversion
  - complete: done
- Add reportAsyncPhaseStart() EM_JS callback for JS progress tracking
- Add parseAsync() and loadAsync() methods to TinyUSDZLoader.js
- Parameters passed by value (not reference) to survive co_await suspension points
- No ASYNCIFY required - uses native LLVM coroutine transform

This allows the browser to repaint between processing phases, improving
perceived loading performance for large USD files.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 00:22:07 +09:00
Syoyo Fujita
3b4bf5a687 update html file.
revert to use fancy-teapot for materialx.js demo.
2026-01-06 08:08:30 +09:00
Syoyo Fujita
abd5d28771 Add delayed texture loading with progress bar for faster initial scene render
- Add TextureLoadingManager class for queuing and progressive texture loading
- Add texture progress bar UI (bottom overlay with green theme)
- Modify buildSceneWithProgress to use delayed texture mode
- Scene renders immediately without textures, then textures load in background
- Support textureLoadingManager option in material conversion functions
- Update TinyUSDZMaterialX.js to support delayed loading for OpenPBR materials
- Textures load with concurrency control (2 at a time) and browser yields

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 07:46:03 +09:00
Syoyo Fujita
4366fdd2f1 Fix HDRI light visibility in envmap mode and improve light transform controls
- Fix lights disappearing from HDRI on refresh in envmap mode by using
  lightData.enabled (user's intention) instead of threeLights.visible
  (rendering state) for HDRI projection filtering
- Update toggleLight() to respect envmap mode - keep lights hidden for
  rendering while still allowing on/off toggling for HDRI purposes
- Fix setLightingMode() to restore lights based on user's enabled state
  when switching back to lights mode
- Fix SpotLight rotation gizmo position by resetting light.position to
  (0,0,0) after creation (Three.js r146+ defaults to (0,1,0))
- Add getAttachTargetForLight() for proper transform control attachment
  based on mode (translate/rotate/scale -> group, target -> target object)
- Add minHdriRadius (0.3) for HDRI projection to ensure lights are visible
- Improve light picking to skip disabled/invisible helpers
- Add drag state management to prevent picking different object after drag

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 06:58:19 +09:00
Syoyo Fujita
dc6dc91c85 Update Env Intensity GUI from DomeLight settings
- Add envIntensityController to guiState for GUI updates
- Update Env Intensity display when loading DomeLight from USD
- Update Env Intensity display when switching to usd_dome environment

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 04:13:33 +09:00
Syoyo Fujita
7ba445a9cb Add normal map support for UsdPreviewSurface and enhance Show Normals feature
- Export normalTextureId, occlusionTextureId, displacementTextureId in
  material-serializer.cc for UsdPreviewSurface materials
- Fix TinyUSDZLoaderUtils.js to properly extract surfaceShader from
  nested JSON structure
- Add Normal Mode selector (geometry/mapped) to Show Normals feature
- Add createViewNormalMaterial() shader for view-space normals with
  normal map support
- Add extractNormalMapFromMaterial() to extract normal maps from both
  OpenPBR/MaterialX and UsdPreviewSurface materials
- Make Env Color and Env Colorspace controls disabled when Environment
  is not constant_color

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 04:03:01 +09:00
Syoyo Fujita
73d7a8aa69 Add CLI test for EM_JS progress callbacks
- Add test-progress-cli.js with synthetic USD generation and file tests
- Tests verify EM_JS onTydraProgress callbacks work in Node.js
- Generates USDA on-the-fly (3 meshes, 10 meshes, mixed geometry)
- Loads real USD files (usda, usdc, usdz) with progress tracking
- Add npm script: npm run test:progress

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 23:59:46 +09:00
Syoyo Fujita
d04efdf8d3 Add EM_JS synchronous progress callbacks for Tydra conversion
- Add EM_JS functions in binding.cc for direct C++ to JS progress reporting
  - reportTydraProgress: mesh conversion progress (current/total, stage, name)
  - reportTydraStage: conversion stage changes
  - reportTydraComplete: conversion completion with counts
- Update TinyUSDZLoader.js with callback options:
  - onTydraProgress, onTydraStage, onTydraComplete
  - setTydraProgressCallback/setTydraStageCallback/setTydraCompleteCallback methods
- Integrate callbacks in progress-demo.js for real-time UI updates
- Add design document for JS/WASM synchronous event update patterns

This enables real-time progress updates during Tydra scene conversion
without requiring ASYNCIFY, using Emscripten's EM_JS for synchronous
JavaScript calls from C++.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 22:41:47 +09:00
Syoyo Fujita
bb39395f3f filename fix. 2026-01-04 07:28:12 +09:00
Syoyo Fujita
fbeb15e62f uncomment debug logging. 2026-01-04 07:27:36 +09:00
Syoyo Fujita
c1913a6a69 Add detailed mesh progress logging and memory cleanup for progress demo
- Add DetailedProgressInfo struct with mesh/material counts and stage tracking
- Add printf progress logging during Tydra mesh conversion (visible in console)
- Count GeomMesh, GeomCube, and GeomSphere for accurate total mesh count
- Add cleanupScene() function to free Three.js and WASM memory before loading
- Add Fit to Scene button for camera adjustment
- Add multi-mesh test model for progress testing

Console output shows real-time progress:
[Tydra] Found N meshes (X mesh, Y cube, Z sphere), M materials
[Tydra] Mesh 1/N: /path/to/mesh
[Tydra] Conversion complete: N meshes, M materials, T textures

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 07:26:45 +09:00
Syoyo Fujita
4eb8912457 Add texture loading patterns and OpenPBRMaterial support
- Add sync/Loaded variants for material conversion functions:
  - convertOpenPBRToMeshPhysicalMaterial (immediate return)
  - convertOpenPBRToMeshPhysicalMaterialLoaded (waits for textures)
  - convertToOpenPBRMaterial (immediate return)
  - convertToOpenPBRMaterialLoaded (waits for textures)

- Add full texture support for OpenPBRMaterial custom shader:
  - map, roughnessMap, metalnessMap, emissiveMap, normalMap, aoMap

- Add HDR/EXR texture format detection and decoding:
  - Magic byte detection in getMimeType()
  - TinyUSDZ HDR decoder (faster) with Three.js fallback
  - Three.js EXR decoder with TinyUSDZ fallback

- Update MaterialX documentation:
  - Three.js/WebGL integration section
  - Supported parameters and texture maps tables
  - MaterialX NodeGraph and node shader documentation
  - Complete USDA examples

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 02:08:24 +09:00
Syoyo Fujita
e4400c53d6 clean-up documents 2026-01-03 06:08:10 +09:00
Syoyo Fujita
054578ed8e Add EXRDecoder with Three.js primary + TinyUSDZ fallback
EXRDecoder.js:
- Uses Three.js EXRLoader by default (faster, more compression support)
- Falls back to TinyUSDZ for unsupported formats (deep EXR, tiled, etc.)
- Exports: decodeEXR(), decodeEXRAsync(), checkEXRSupport()
- Supports float16/float32 output formats
- Verbose mode for debugging decoder selection

Three.js EXRLoader supports:
- NO_COMPRESSION, RLE, ZIPS, ZIP, PIZ, PXR24, B44, B44A, DWAA, DWAB

TinyUSDZ fallback supports:
- NO_COMPRESSION, RLE, ZIPS, ZIP, PIZ

Usage:
  import { decodeEXR } from 'tinyusdz/EXRDecoder.js';
  const result = decodeEXR(buffer, tinyusdz, { outputFormat: 'float16' });

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 05:56:52 +09:00
Syoyo Fujita
6a810eacf2 Add synthetic EXR generator for benchmark testing
- generate-test-exr.js: Creates uncompressed EXR files with various patterns
  (gradient, checker, noise, solid, hdr)
- Supports half (fp16) and float (fp32) pixel types
- Generates 256x256, 512x512, and 1024x512 test files by default
- Add npm script: npm run generate:exr

EXR benchmark results (uncompressed):
- 256x256: TinyUSDZ 1.4x faster than Three.js
- 512x512+: Both decoders perform similarly

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 05:51:16 +09:00
Syoyo Fujita
141501ec22 Add HDR (Radiance RGBE) image loading support and benchmark
Core image-loader:
- Add DecodeImageHDR using stbi_loadf_from_memory for float32 RGBA output
- Add IsHDRFromMemory and GetImageInfoHDR functions
- HDR detection runs before STB fallback to ensure float output

WASM binding:
- Update decodeHDR to use stbi_loadf_from_memory instead of image-loader
- Default output format changed to float16 (Uint16Array) for memory savings
- Add TINYUSDZ_WITH_EXR compile definition to binding target

Benchmark (web/js/benchmark-exr.js):
- Compare TinyUSDZ vs Three.js HDRLoader/EXRLoader performance
- Support float32 and float16 output formats
- JSON output mode for automation
- TinyUSDZ is 2.7-3x faster than Three.js for HDR decoding

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 05:43:45 +09:00
Syoyo Fujita
e64c409a97 Add FP16 support and SIMD for WASM image decoding
- Add IEEE 754 half-precision float conversion utilities (float32ToFloat16, float16ToFloat32)
- Update decodeEXR/decodeHDR/decodeImage to accept outputFormat parameter ("float32", "float16", "auto")
- Add convertFloat32ToFloat16Array and convertFloat16ToFloat32Array utility functions
- Enable WebAssembly SIMD (-msimd128) by default for better performance
- Add optional Relaxed SIMD support via TINYUSDZ_WASM_RELAXED_SIMD flag
- FP16 output returns Uint16Array for direct WebGL HALF_FLOAT texture upload
- 50% memory savings when using FP16 format for HDR/EXR textures

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 12:58:26 +09:00
Syoyo Fujita
7ac01267d4 Add TinyEXR v3 API with backward compatible v1 fallback
- Copy TinyEXR v3 source files from upstream tinyexr repository
- Add new CMake option TINYUSDZ_USE_TINYEXR_V3 (default ON)
- V3 provides modern C17/C++17 API with Vulkan-style interface
- V1 API functions remain available for backward compatibility
- Backup original v1 header as tinyexr_v1.h

New files:
- tinyexr_c.h, tinyexr_c_impl.c: Pure C API
- tinyexr_v3.hh: C++17 RAII wrapper
- tinyexr_v2.hh, tinyexr_v2_impl.hh: V2 implementation
- tinyexr_huffman.hh, tinyexr_piz.hh: Compression codecs
- tinyexr_simd*.{hh,h,cc}: SIMD optimizations
- exr_reader.hh, streamreader.hh, streamwriter.hh: Utilities

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 08:38:01 +09:00
Syoyo Fujita
51b3eeb2c5 Remove test-results-usdlux.json from repository
Test result files should not be tracked in version control
as they are generated output.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 08:12:53 +09:00
Syoyo Fujita
60352623de Move batch runner to separate directory web/batch-runner
Reorganize to avoid vite dev server interference with batch testing:

New structure:
- web/batch-runner/          # Batch testing tool (isolated)
  - batch-runner.js          # Visual regression runner
  - test.js                  # WebGPU/headless Chrome test
  - headless-chrome-setup.md # Setup documentation
  - package.json             # Own dependencies
  - .gitignore               # Ignore batch-results/

Changes to web/js/:
- materialx.js: Add URL params for batch rendering (usd, autoRender, renderTimeout)
- package.json: Remove batch:* scripts and glob dependency
- vite.config.ts: Ignore node_modules in watch

The batch-runner now references web/js/ for vite server:
  const webJsDir = path.join(__dirname, '..', 'js');

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 07:50:27 +09:00
Syoyo Fujita
f048b9cd29 Add WebGL2 setup section to headless Chrome documentation
- Update title to include WebGL2
- Add comprehensive Quick Start table comparing WebGPU vs WebGL2
- Add WebGL2 with Hardware GPU example (NVIDIA/Vulkan)
- Add WebGL2 with SwiftShader example (software, no GPU)
- Add WebGL2 vs WebGPU comparison table
- Add WebGL2 renderer detection utility function
- Add --use-angle=swiftshader flag to reference table

Key findings:
- WebGL2 works on any origin (no HTTPS requirement unlike WebGPU)
- WebGL2 still requires xvfb (true headless mode doesn't work)
- SwiftShader WebGL2 uses Vulkan 1.3.0 backend

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 07:27:55 +09:00
Syoyo Fujita
853d0a4f12 Add WebGPU headless Chrome setup documentation and test script
- Add headless-chrome-setup.md with comprehensive guide for:
  - Hardware GPU acceleration with NVIDIA/Vulkan
  - Software rendering with SwiftShader (no GPU required)
  - Docker/CI environment setup examples
  - Troubleshooting common issues

- Add test.js for WebGPU verification with Puppeteer
  - Requires xvfb-run for X11 display
  - NVIDIA env vars to select real GPU over llvmpipe
  - HTTPS origin required for secure context

Key findings:
- ANGLE Vulkan requires X11 (xcb_connect), solved with xvfb
- True --headless=new mode doesn't work for WebGPU
- SwiftShader works but still needs xvfb

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 07:19:53 +09:00
Syoyo Fujita
acb5be7777 Add mesh dump CLI option and MaterialX enhancements
JS changes:
- dump-materialx-cli.js: Add --mesh option for dumping vertex data with
  winding order analysis (faceVertexIndices, computed face normals)
- materialx.js: Various MaterialX demo improvements
- OpenPBRMaterial.js: OpenPBR material refinements
- TinyUSDZMaterialX.js: MaterialX parsing enhancements

C++ changes:
- render-data.cc/hh: Add MaterialX config and UV handling improvements
- material-serializer.cc: Material serialization updates
- render-scene-dump.cc: Scene dump enhancements

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 09:01:58 +09:00
Syoyo Fujita
9720b0bc07 Fix quad winding order in MaterialX normal map test files
- mtlx-normalmap-plane.usda: Changed faceVertexIndices from [0,1,2,3] to [0,3,2,1]
- mtlx-normalmap-multi.usda: Fixed plane meshes winding order (cubes were already correct)

The CCW winding [0,3,2,1] produces face normals pointing UP (+Y) matching
the declared vertex normals, ensuring correct front-face rendering.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 09:00:05 +09:00
Syoyo Fujita
c922926ca8 Refactor usdlux.js: add DEBUG flag and clean up logging
- Add DEBUG flag (default false) and debugLog() wrapper function
- Convert ~50+ console.log debug statements to use debugLog()
- Keep console.warn/error for important messages
- Remove unused RectAreaLightHelper import

Set DEBUG = true to re-enable debug output.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 00:39:58 +09:00