Skip to content

Commit

Permalink
disables fog and improves scene floor and lights (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCodeTherapy authored Dec 1, 2023
1 parent 1e36730 commit 9391ccb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
4 changes: 0 additions & 4 deletions tools/gltf-avatar-exporter/src/scene/QuadrantScene.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
Box3,
BufferGeometry,
Fog,
Group,
PCFSoftShadowMap,
PerspectiveCamera,
Expand Down Expand Up @@ -32,8 +31,6 @@ export class QuadrantScene {
this.renderer.shadowMap.enabled = true;
this.renderer.setSize(this.width, this.height);

this.scene.fog = new Fog(0x000000, 0.01, 50);

this.camera.position.set(0, 1, 2);
this.camera.lookAt(this.scene.position);
this.camera.updateProjectionMatrix();
Expand Down Expand Up @@ -76,7 +73,6 @@ export class QuadrantScene {
const fitHeightDistance = maxSize / (2 * Math.atan((Math.PI * this.camera.fov) / 360));
const fitWidthDistance = fitHeightDistance / this.camera.aspect;
const distance = Math.max(fitHeightDistance, fitWidthDistance);
this.scene.fog = new Fog(0x000000, 0.01, distance * 5);

const offset = new Vector3(0, distance * 0.1, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class CheckerTexture extends DataTexture {
const data = new Uint8Array(size);

for (let i = 0; i <= 12; i += 4) {
const c = i === 4 || i === 8 ? 127 : 255;
const c = i === 4 || i === 8 ? 70 : 200;
CheckerTexture.fillData(data, i, c, c, c, 255);
}

Expand Down
2 changes: 1 addition & 1 deletion tools/gltf-avatar-exporter/src/scene/elements/Lights.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AmbientLight, DirectionalLight, OrthographicCamera, Vector3 } from "three";

export class Lights {
public ambientLight: AmbientLight = new AmbientLight(0xffffff, 0.05);
public ambientLight: AmbientLight = new AmbientLight(0xffffff, 0.5);
public mainLight: DirectionalLight;

private shadowResolution: number = 8192;
Expand Down
8 changes: 4 additions & 4 deletions tools/gltf-avatar-exporter/src/scene/elements/Room.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { FrontSide, Group, Mesh, MeshStandardMaterial, PlaneGeometry } from "three";
import { CircleGeometry, FrontSide, Group, Mesh, MeshStandardMaterial } from "three";

import { CheckerTexture } from "./CheckerTexture";

export class Room extends Group {
private readonly floorSize = 200;
private readonly floorGeometry = new PlaneGeometry(this.floorSize, this.floorSize, 1, 1);
private readonly floorSize = 30;
private readonly floorGeometry = new CircleGeometry(this.floorSize, 36);
private readonly floorMaterial: MeshStandardMaterial;
private readonly floorMesh: Mesh | null = null;
private readonly checkerTexture: CheckerTexture;

constructor() {
super();
this.checkerTexture = new CheckerTexture(this.floorSize / 2, this.floorSize / 2);
this.checkerTexture = new CheckerTexture(this.floorSize / 1, this.floorSize / 1);

this.floorMaterial = new MeshStandardMaterial({
color: 0xbcbcbc,
Expand Down

0 comments on commit 9391ccb

Please sign in to comment.