Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Add a slight fog to the background to help the floor blend into the background

Scott Petrovicece33e087c2b
diff --git a/src/lib/Generators.ts b/src/lib/Generators.ts
index aa38bca..8cfa155 100644
--- a/src/lib/Generators.ts
+++ b/src/lib/Generators.ts
@@ -22,7 +22,9 @@ export class Generators {
static create_grid_helper (grid_color: number = 0x111155, floor_color: number = 0x4e4e7a): any[] {
// create floor mesh and add to scene to help with shadows
- const floor_geometry = new PlaneGeometry(30, 30, 30, 30)
+ const grid_size: number = 180
+ const divisions: number = 100
+ const floor_geometry = new PlaneGeometry(grid_size, grid_size, divisions, divisions)
const floor_material = new MeshPhongMaterial({ color: floor_color, wireframe: false, transparent: false, shininess: 0.0, specular: 0.0 })
floor_material.side = DoubleSide // helps us see that we are below the character
@@ -38,9 +40,7 @@ export class Generators {
axes_helper.position.copy(new Vector3(0, 0.008, 0)) // offset a bit to avoid z-fighting
// grid display on floor
- const size: number = 30
- const divisions: number = 30
- const grid_helper: GridHelper = new GridHelper(size, divisions, grid_color, grid_color)
+ const grid_helper: GridHelper = new GridHelper(grid_size, divisions, grid_color, grid_color)
return [grid_helper, floor_mesh, axes_helper]
}
diff --git a/src/script.ts b/src/script.ts
index 286e278..2a45abb 100644
--- a/src/script.ts
+++ b/src/script.ts
@@ -138,6 +138,8 @@ export class Bootstrap {
light_strength = 12
}
+ this.scene.fog = new THREE.Fog(floor_color, 20, 80)
+
this.environment_container = new Group()
this.environment_container.name = 'Setup objects'
this.environment_container.add(...Generators.create_default_lights(light_strength))