mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-12 20:26:10 +01:00
feat: baked ao
This commit is contained in:
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;
|
||||
}
|
||||
Reference in new issue
Block a user