This commit is contained in:
syuilo 2026-05-21 10:46:15 +09:00
commit 199c0f533b
15 changed files with 15 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -9,6 +9,7 @@
// TODO: glbを事前に最適化(なるべくメッシュをマージするなど)するツールもしくはMisskeyビルド時処理。ついでにカタログ用スクショも自動生成したい
// TODO: テクスチャ置き換え時、元のテクスチャをちゃんとdispose
// TODO: Safariでテクスチャの読み込みに失敗かつ無ハンドリングだとsrが有効にできなくなる現象をbabylonに報告
// TODO: 一升瓶を選択するとエラーが出る現象をbabylonに報告
import * as BABYLON from '@babylonjs/core';
import { registerBuiltInLoaders } from '@babylonjs/loaders/dynamic';

View file

@ -28,25 +28,24 @@ export const issyoubin = defineObject({
const liquidMesh = model.findMesh('__X_LIQUID__');
const liquidMaterial = model.findMaterial('__X_LIQUID__');
const bottleMaterial = model.findMaterial('__X_BOTTLE__');
const labelMaterial = model.findMaterial('__X_LABEL__');
// 以下を行うとレンダリングのグリッチが直るが、残念ながらWebGPUかつNCMでは動作しない
// https://doc.babylonjs.com/setup/support/webGPU/webGPUOptimization/webGPUNonCompatibilityMode/#dodont-in-non-compatibility-mode-ncm
//for (const m of model.root.getChildMeshes()) {
// if (m.material != null) {
// (m.material as BABYLON.PBRMaterial).separateCullingPass = true;
// }
//}
labelMaterial.transparencyMode = BABYLON.PBRMaterial.PBRMATERIAL_ALPHATEST;
labelMaterial.alphaCutOff = 0.5;
// しょうがないので不透明にする
bottleMaterial.transparencyMode = BABYLON.PBRMaterial.PBRMATERIAL_ALPHATEST;
bottleMaterial.transparencyMode = BABYLON.PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND;
const applyVariation = () => {
if (options.variation === 'misuki') {
const tex = new BABYLON.Texture('/client-assets/room/objects/issyoubin/textures/misuki.png', scene, false, false);
bottleMaterial.albedoTexture = tex;
labelMaterial.albedoTexture = tex;
bottleMaterial.albedoColor = new BABYLON.Color3(0.5, 0.2, 0);
bottleMaterial.alpha = 0.8;
} else if (options.variation === 'ai') {
const tex = new BABYLON.Texture('/client-assets/room/objects/issyoubin/textures/ai.png', scene, false, false);
bottleMaterial.albedoTexture = tex;
labelMaterial.albedoTexture = tex;
bottleMaterial.albedoColor = new BABYLON.Color3(0.0, 0.5, 0.14);
bottleMaterial.alpha = 0.8;
}
};

View file

@ -31,6 +31,10 @@ export const petBottle = defineObject({
createInstance: ({ model, options }) => {
const capMesh = model.findMesh('__X_CAP__');
const liquidMesh = model.findMesh('__X_LIQUID__');
const labelMaterial = model.findMaterial('__X_LABEL__');
labelMaterial.transparencyMode = BABYLON.PBRMaterial.PBRMATERIAL_ALPHATEST;
labelMaterial.alphaCutOff = 0.5;
const applyWithCap = () => {
capMesh.isVisible = options.withCap;