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

@@ -1,4 +1,3 @@
import { writeFile } from "fs/promises";
import sharp from "sharp";
import { readTexture } from "./readTexture";
@@ -11,8 +10,8 @@ export async function readRoughnessMetallic(path: string) {
const combined = Buffer.alloc(raw.width * raw.height * 3);
for (let i = 0; i < raw.width * raw.height; i++) {
combined[i * 3 + 1] = roughness?.[i] ?? 0;
combined[i * 3 + 2] = metallicness?.[i] ?? 0;
combined[i * 3 + 1] = roughness[i];
combined[i * 3 + 2] = metallicness[i];
}
const image = await sharp(combined, {
@@ -21,7 +20,5 @@ export async function readRoughnessMetallic(path: string) {
.jpeg()
.toBuffer();
writeFile("test.rm.jpg", image);
return image;
}