Upload 3D scenes and dynamic objects to the Cognitive3D platform with ease. Cross-platform tools supporting both Bash (macOS/Linux) and PowerShell (Windows) with streamlined environment variable workflows.
- Complete Upload Workflow: Scene files, dynamic objects, and manifests
- Cross-Platform: Bash scripts for macOS/Linux, enterprise-grade PowerShell module for Windows
- Environment Variables: Streamlined workflows with
.envfile support - Enhanced Security: Safe API key handling, comprehensive input validation, and secure HTTP requests
- Developer-Friendly: Progress tracking, detailed help, dry-run mode, and comprehensive error guidance
- Production-Ready: Enterprise-grade PowerShell module with type safety and comprehensive validation
- Go to Cognitive3D Dashboard
- Settings (gear icon) → "Manage developer key"
- Copy your Developer API key
# Copy and edit the configuration file
cp .env.example .env
# Edit .env and add your API key: C3D_DEVELOPER_API_KEY=your_api_key_heremacOS: brew install jq curl
Ubuntu/Debian: sudo apt install jq curl
Fedora/RHEL: dnf install jq curl
Windows: Use PowerShell module (no dependencies required)
# Bash (macOS/Linux)
./upload-scene.sh --scene_dir scene-test --env prod
# PowerShell (Windows)
Import-Module ./C3DUploadTools
Upload-C3DScene -SceneDirectory scene-test -Environment prodSave the returned Scene ID for object uploads, or add it to your .env file:
echo "C3D_SCENE_ID=your-scene-id-here" >> .env# Bash - with scene ID in .env file
./upload-object.sh --object_filename cube --object_dir object-test --env prod
./upload-object-manifest.sh --env prod
# PowerShell - with scene ID in environment
Upload-C3DObject -ObjectFilename cube -ObjectDirectory object-test -Environment prod
Upload-C3DObjectManifest -Environment prod| Platform | Implementation | Dependencies | Status |
|---|---|---|---|
| macOS/Linux | Bash scripts | jq, curl |
✅ Fully tested |
| Windows | PowerShell module | None (uses .NET) | ✅ Native support |
| WSL | Bash scripts | jq, curl |
✅ Compatible |
Set these in your .env file or shell environment:
Required:
C3D_DEVELOPER_API_KEY- Your Cognitive3D Developer API key
Optional (for streamlined workflows):
C3D_SCENE_ID- Default scene ID to avoid passing --scene_id to every commandC3D_DEFAULT_ENVIRONMENT- Default environment (prodordev)
Option 1: .env File (Recommended)
cp .env.example .env
# Edit .env with your valuesOption 2: Shell Environment
export C3D_DEVELOPER_API_KEY="your_api_key"
export C3D_SCENE_ID="your_scene_id" # optionalOption 3: PowerShell
Import-Module ./C3DUploadTools # Auto-loads .env file
# Or set manually:
$env:C3D_DEVELOPER_API_KEY = "your_api_key"Security:
.envfiles are git-ignored automatically. Never commit API keys to version control.
Upload 3D scene files (GLTF, textures, settings) to create or update a scene.
Bash:
./upload-scene.sh --scene_dir <directory> [--env prod|dev] [--scene_id <uuid>] [--verbose] [--dry_run]PowerShell:
Upload-C3DScene -SceneDirectory <directory> [-Environment prod|dev] [-SceneId <uuid>] [-Verbose] [-DryRun]Required Files in Scene Directory:
scene.bin,scene.gltf,screenshot.png,settings.json
Examples:
# Create new scene
./upload-scene.sh --scene_dir scene-test --env prod
# Update existing scene
./upload-scene.sh --scene_dir scene-test --scene_id "12345678-1234-1234-1234-123456789012" --env prod
# Preview changes (safe testing)
./upload-scene.sh --scene_dir scene-test --dry_run --verboseUpload dynamic 3D objects to an existing scene.
Bash:
./upload-object.sh --object_filename <name> --object_dir <directory> [--scene_id <uuid>] [--env prod|dev] [--verbose] [--dry_run]PowerShell:
Upload-C3DObject -ObjectFilename <name> -ObjectDirectory <directory> [-SceneId <uuid>] [-Environment prod|dev] [-Verbose] [-DryRun]Required Files in Object Directory:
<filename>.gltf,<filename>.bincvr_object_thumbnail.png(optional, recommended)
Examples:
# Upload object (scene ID from environment)
./upload-object.sh --object_filename cube --object_dir object-test --env prod
# Upload with explicit scene ID
./upload-object.sh --object_filename cube --object_dir object-test --scene_id "your-scene-id" --env prodUpload object manifest to display objects in the dashboard.
Bash:
./upload-object-manifest.sh [--scene_id <uuid>] [--env prod|dev] [--verbose] [--dry_run]PowerShell:
Upload-C3DObjectManifest [-SceneId <uuid>] [-Environment prod|dev] [-Verbose] [-DryRun]List all objects associated with a scene.
Bash:
./list-objects.sh [--scene_id <uuid>] --env <prod|dev> [--verbose]PowerShell:
Get-C3DObjects [-SceneId <uuid>] [-Environment <prod|dev>] [-OutputFile <path>] [-FormatAsManifest] [-Verbose]Advanced PowerShell Features:
-OutputFile: Save raw JSON response to file-FormatAsManifest: Generate object manifest file- Comprehensive parameter validation with detailed error messages
- Progress tracking for large operations
- Type-safe responses with helper methods
| Option | Description |
|---|---|
--env / -Environment |
Target environment: prod (production) or dev (development) |
--scene_id / -SceneId |
Scene UUID (optional if set in environment variables) |
--verbose / -Verbose |
Enable detailed logging and debug information |
--dry_run / -DryRun |
Preview operations without executing (safe testing mode) |
Security Features:
- Automatic input validation (UUID format, file sizes, SDK versions)
- Safe file operations with backup/rollback
- API key validation with helpful error messages
- 100MB file size limit with clear warnings
The PowerShell module includes comprehensive test suite in C3DUploadTools/Tests/:
# Navigate to test directory
cd C3DUploadTools/Tests
# Run all tests
./test-module-structure.ps1 # Module architecture validation
./test-utilities-internal.ps1 # Internal function testing
./test-scene-upload.ps1 # Scene workflow testing
./test-object-upload.ps1 # Object workflow testing
./Test-EnvWorkflow.ps1 # Complete end-to-end testingTest the entire upload workflow with sample assets.
Bash:
./test-env-workflow.sh --env prod [--verbose] [--dry_run]PowerShell:
# Run from C3DUploadTools/Tests/ directory
./Test-EnvWorkflow.ps1 -Environment prod [-Verbose] [-DryRun]
# Additional PowerShell tests
./test-module-structure.ps1 # Validate module organization
./test-utilities-internal.ps1 # Test internal functions
./test-scene-upload.ps1 # Scene upload workflow
./test-object-upload.ps1 # Object upload workflowAutomated Test Steps:
- Set up temporary environment configuration
- Upload test scene and capture scene ID
- Upload test objects (cube, lantern)
- Upload object manifests
- Verify objects are listed correctly
- Clean up temporary files
Test scene upload:
./upload-scene.sh --scene_dir scene-test --env dev --dry_run --verboseTest object upload:
./upload-object.sh --object_filename cube --object_dir object-test --env dev --dry_runFor existing workflows:
./test-all.sh [scene_id] [env] # Use after manual scene uploadFor New Projects:
# 1. Set up configuration
cp .env.example .env
# Edit .env with your API key
# 2. Upload scene
./upload-scene.sh --scene_dir your-scene --env prod
# Save the returned Scene ID
# 3. Add Scene ID to environment (optional but recommended)
echo "C3D_SCENE_ID=your-scene-id-here" >> .env
# 4. Upload objects (as needed)
./upload-object.sh --object_filename object1 --object_dir your-objects --env prod
./upload-object.sh --object_filename object2 --object_dir your-objects --env prod
# 5. Upload manifest to display in dashboard
./upload-object-manifest.sh --env prod
# 6. Verify objects
./list-objects.sh --env prodFor Existing Projects:
# Update existing scene
./upload-scene.sh --scene_dir updated-scene --scene_id "existing-uuid" --env prod
# Add new objects to existing scene
./upload-object.sh --object_filename new-object --object_dir objects --env prod
./upload-object-manifest.sh --env prodThe PowerShell module provides production-ready features:
- Type Safety: PowerShell classes for structured data handling
- Comprehensive Validation: Advanced parameter validation with detailed error messages
- Progress Tracking: Visual feedback for large file uploads
- Rich Help System: Detailed documentation with real-world examples
- Error Handling: Proper PowerShell error records with recommended actions
- Cross-Platform: Works on Windows PowerShell 5.1+ and PowerShell Core 7.x
- No Dependencies: Pure PowerShell implementation without external tools
# Get detailed help
Get-Help Upload-C3DScene -Detailed
Get-Help Upload-C3DObject -Examples
# Environment-based workflow
$env:C3D_SCENE_ID = "12345678-1234-1234-1234-123456789012"
Upload-C3DObject -ObjectFilename "chair" -ObjectDirectory "./furniture"
Upload-C3DObject -ObjectFilename "table" -ObjectDirectory "./furniture"
Upload-C3DObjectManifest # Displays both objects in dashboard
# Advanced error handling
try {
$result = Upload-C3DScene -SceneDirectory "./scene" -Environment dev
Write-Host "Scene uploaded: $($result.SceneId)"
} catch {
Write-Error "Upload failed: $($_.Exception.Message)"
}
# Batch operations with validation
$objects = @("chair", "table", "lamp")
foreach ($obj in $objects) {
if (Test-Path "./furniture/$obj.gltf") {
Upload-C3DObject -ObjectFilename $obj -ObjectDirectory "./furniture" -AutoUploadManifest:$false
}
}
Upload-C3DObjectManifest # Upload manifest once for all objects| Issue | Solution |
|---|---|
| "jq: command not found" | Install dependencies: brew install jq curl (macOS) or sudo apt install jq curl (Ubuntu) |
| "API key not set" | Set C3D_DEVELOPER_API_KEY in .env file or environment |
| "Invalid scene_id format" | Scene IDs must be valid UUIDs: 12345678-1234-1234-1234-123456789012 |
| PowerShell execution policy | Run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser |
| Issue | Solution |
|---|---|
| "Scene not found" (objects) | Upload a scene first; objects require an existing scene |
| "Manifest file not found" | Object manifests auto-generate after successful object upload |
| File size errors | Individual files cannot exceed 100MB; check with --verbose |
| HTTP 401 "Key expired" | Generate new API key from Dashboard → Settings → "Manage developer key" |
| HTTP 403 "Forbidden" | Verify API key permissions and scene ownership |
Use dry-run mode for safe testing:
./upload-scene.sh --scene_dir scene-test --dry_run --verboseEnable verbose logging:
./upload-object.sh --object_filename cube --object_dir object-test --verboseCheck file contents and structure:
# Verify scene directory structure
ls -la scene-test/
# Should contain: scene.bin, scene.gltf, screenshot.png, settings.json
# Verify object directory structure
ls -la object-test/
# Should contain: <filename>.gltf, <filename>.bin, optional texturesPowerShell module not loading:
# Ensure you're in the correct directory
Import-Module ./C3DUploadTools -Force.env file not recognized:
# PowerShell automatically loads .env files when importing the module
# Alternatively, set variables manually:
$env:C3D_DEVELOPER_API_KEY = "your_api_key"Built-in Help:
./upload-scene.sh --help- Show usage information--verboseflag - Enable detailed logging--dry_runflag - Preview operations safely
Support Channels:
- GitHub Issues - Bug reports and feature requests
- Discord Community - Community support and discussion
- Cognitive3D Support - Official technical support
c3d-upload-tools/
├── upload-scene.sh # Scene upload (Bash)
├── upload-object.sh # Object upload (Bash)
├── upload-object-manifest.sh # Manifest upload (Bash)
├── list-objects.sh # List objects (Bash)
├── test-*.sh # Test scripts (Bash)
├── C3DUploadTools/ # PowerShell module
│ ├── C3DUploadTools.psd1 # Module manifest
│ ├── Public/ # User-facing functions
│ └── Private/ # Internal utilities
├── scene-test/ # Sample scene assets
├── object-test/ # Sample object assets
├── .env.example # Configuration template
└── sdk-version.txt # Current SDK version
Sample Assets Included:
scene-test/- Complete scene for testing uploadsobject-test/- Dynamic object (cube) for testinglantern-test/- Additional object example
This project is licensed under the MIT License. See the LICENSE file for details.