Import a 3D Model and automatically assign and export animations
TypeScript
Switch to more vertical format with previews and up quality. change tone mapping so 3d model is softer
Scott Petrovicd330735fe45c
diff --git a/src/lib/AnimationSearch.ts b/src/lib/AnimationSearch.tsindex a07a9d8..2e5156f 100644--- a/src/lib/AnimationSearch.ts+++ b/src/lib/AnimationSearch.ts@@ -181,8 +181,8 @@ export class AnimationSearch {video.className = 'anim-preview'const src = placeholder.getAttribute('data-src') ?? ''video.src = src- video.width = 140- video.height = 80+ video.width = 100+ video.height = 120video.loop = truevideo.muted = truevideo.playsInline = true // tells mobile browsers to play inline instead of going fullscreendiff --git a/src/lib/Generators.ts b/src/lib/Generators.tsindex ed6966d..d37779a 100644--- a/src/lib/Generators.ts+++ b/src/lib/Generators.ts@@ -153,7 +153,7 @@ export class Generators {light_1.shadow.mapSize = new Vector2(shadow_map_size, shadow_map_size) // decreases moire effect on meshlight_1.position.set(-2, 2, 2)- const light_2 = new AmbientLight(0xffffff, 0.9)+ const light_2 = new AmbientLight(0xffffff, 1.2)// backfill lightconst backfill_light = new DirectionalLight(0x777777, light_strength * 0.5)diff --git a/src/preview-generator/preview-generator.ts b/src/preview-generator/preview-generator.tsindex 650b33e..393147f 100644--- a/src/preview-generator/preview-generator.ts+++ b/src/preview-generator/preview-generator.ts@@ -31,7 +31,13 @@ class PreviewGenerator {// Setup renderer, scene, camerathis.renderer_ = new THREE.WebGLRenderer({ antialias: true, alpha: true })this.renderer_.setSize(window.innerWidth, window.innerHeight)- this.renderer_.shadowMap.enabled = true // Enable shadow mapping+ this.renderer_.shadowMap.enabled = true // Enable shadows++ // Set Filmic tone mapping for less saturated, more cinematic look+ this.renderer_.toneMapping = THREE.ACESFilmicToneMapping // a bit softer of a look+ this.renderer_.toneMappingExposure = 2.0 // tweak this value for brightness++document.body.appendChild(this.renderer_.domElement)this.theme_manager = new ThemeManager()@@ -48,7 +54,7 @@ class PreviewGenerator {// Add orbit controlsthis.controls_ = new OrbitControls(this.camera_, this.renderer_.domElement)- this.controls_.target.set(0, 0.9, 0)+ this.controls_.target.set(0, 0.4, 0)this.controls_.minDistance = 5this.controls_.maxDistance = 30this.controls_.update()@@ -174,7 +180,7 @@ class PreviewGenerator {this.current_animation_index_processing += 1// for testing a few, change to something small like 5- const temp_limit = this.animation_clips.length+ const temp_limit = 16 //this.animation_clips.lengthif (this.current_animation_index_processing < temp_limit) {await this.process_animation_clip()diff --git a/src/preview-generator/webm-recorder.ts b/src/preview-generator/webm-recorder.tsindex 107f0c0..863b50b 100644--- a/src/preview-generator/webm-recorder.ts+++ b/src/preview-generator/webm-recorder.ts@@ -1,10 +1,10 @@import * as THREE from 'three'export class WebMRecorder {- public width: number = 140- public height: number = 80+ public width: number = 100+ public height: number = 120public fps: number = 24- public kbps: number = 1200+ public kbps: number = 2600public readonly recorded_files: File[] = []private readonly renderer_ref: THREE.WebGLRendererdiff --git a/src/script.ts b/src/script.tsindex cf69595..41d0336 100644--- a/src/script.ts+++ b/src/script.ts@@ -101,6 +101,10 @@ export class Bootstrap {this.renderer.setSize(window.innerWidth, window.innerHeight)this.renderer.shadowMap.enabled = true+ // Set Filmic tone mapping for less saturated, more cinematic look+ this.renderer.toneMapping = THREE.ACESFilmicToneMapping // a bit softer of a look+ this.renderer.toneMappingExposure = 2.0 // tweak this value for brightness+// Set default camera position for front view// this will help because we first want the user to rotate the model to face the frontthis.camera.position.set(0, 1.7, 15) // X:0 (centered), Y:1.7 (eye-level), Z:5 (front view)