feat: baked ao

This commit is contained in:
TrèsAbhi committed 2025-09-06 00:48:39 -05:00
1 parent 335cd4d699
commit 66cf1fd223
11 files changed
+75 -93

No files matched your search

@@ -11,7 +11,7 @@ const LIGHTS_COUNT = 5;
const LIGHT_DISTANCE = 13;
const LIGHT_HEIGHT_0 = 4;
const LIGHT_HEIGHT_1 = 2;
const INTENSITY = 30;
const INTENSITY = 35;
const N = 128;
const TARGET_FRAME_RATE = 30;
@@ -64,7 +64,7 @@ export function Lighting() {
position={position}
intensity={INTENSITY}
penumbra={1}
// castShadow={cast}
castShadow={cast}
decay={1}
color={color}
/>
@@ -1,8 +1,8 @@
import { invalidate, useFrame } from '@react-three/fiber';
import { clamp } from 'lodash-es';
import { Quicklime, type QuicklimeEvent } from 'quicklime';
import { useEffect, useRef } from 'react';
import { Mesh, MeshStandardMaterial } from 'three';
import { invalidate, useFrame } from "@react-three/fiber";
import { clamp } from "lodash-es";
import { Quicklime, type QuicklimeEvent } from "quicklime";
import { useEffect, useRef } from "react";
import { Mesh, MeshStandardMaterial } from "three";
const SIZE = 2 ** 5;
@@ -28,13 +28,6 @@ export function TankModel() {
const { gltf } = useModel(protagonist.tank.id);
const nodes = Object.values(gltf.nodes);
nodes.forEach((n) => {
if (n instanceof Mesh && n.material instanceof MeshStandardMaterial) {
n.material.aoMapIntensity = 10;
console.log(n.geometry.attributes);
}
});
useTankTransform(track, turret, turretContainer, gunContainer);
return (
+2 -2
View File
@@ -1,3 +1,4 @@
import { asset } from "@blitzkit/core";
import { type ObjectMap, useLoader } from "@react-three/fiber";
import { Mesh, MeshStandardMaterial } from "three";
import { type GLTF, GLTFLoader } from "three-stdlib";
@@ -11,8 +12,7 @@ const cache: Record<
> = {};
export function useModel(id: number) {
// const gltf = useLoader(GLTFLoader, asset(`3d/tanks/models/${id}.glb`));
const gltf = useLoader(GLTFLoader, `/test.glb`);
const gltf = useLoader(GLTFLoader, asset(`3d/tanks/models/${id}.glb`));
if (!cache[id]) {
cache[id] = {