Skip to content

Conversation

@chrismichaelps
Copy link
Owner

1

I spent way too much time debugging this, but here's what was happening:

  • The textures weren't showing at all - Turns out we were missing a tiny but crucial line in our material shaders (outputs:surface declaration).
  • When textures did show, they looked weird - The UV coordinates were all messed up, going way outside the normal 0-1 range.
  • The texture mapping was flipped - USDZ uses a different coordinate system than regular GLTF files.
  • The model hierarchy was wrong - Materials weren't properly connected to the geometry.

Fixed the Model Hierarchy

  • Materials are now properly connected to the geometry nodes.
  • Embedded geometry approach - Instead of separate files, everything is in one place.
  • Proper material binding - Materials actually stick to the right parts of the model.
  • Cleaner structure - Materials are organized under /Root/Materials for better compatibility.

Made Everything More Robust

  • Auto-detect if textures are JPEG or PNG (instead of assuming PNG).
  • Generate better texture IDs based on actual content.
  • Embed geometry data directly instead of separate files (simpler = better).

- Add support for emissive, occlusion, and metallic/roughness textures
- Expand TextureReference interface to include all texture types
- Add individual channel outputs (r, g, b) for packed textures
- Process all 5 texture types from GLB materials dynamically
- Convert KHR_materials_pbrSpecularGlossiness to metallic-roughness
- Add fallback handling for missing textures and resources
- Ensure dynamic compatibility with any GLB/GLTF model
- Improve package.json with updated description and visibility settings.
- Added new scripts for building and linting, including watch mode.
- Updated rollup.config.js to support UMD format and improved external dependencies handling.
- Modified tsconfig.json for better type checking and source mapping.
- Refined error handling in src/errors.ts and improved type definitions across various files.
- Adjusted function parameters for clarity in src/converters and src/core.
- Improved logger context interface in src/utils/logger.ts for better type safety.

ref: #1
- UsdzZipWriter class for creating ZIP files with 64-byte alignment.
- Added validation schemas for ZIP writer options and file information using Zod.
- Defined constants and error messages related to ZIP file handling.
- Improve error handling for ZIP operations, including file size and extension checks.
- Updated package.json to replace jszip with crc-32 for ZIP functionality.

ref: #1
@chrismichaelps chrismichaelps merged commit 1cc70f4 into dev Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant