update: updated material 3 texture

This commit is contained in:
2025-07-22 16:48:11 +05:30
parent 786e6cb6d9
commit e1546cc0b7
4 changed files with 34 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 6.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 KiB

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

View File

@@ -49,7 +49,7 @@ function FloorInstance({ floor }: { floor: Floor }) {
roughnessMap?: string; roughnessMap?: string;
metalnessMap?: string; metalnessMap?: string;
normalMap?: string; normalMap?: string;
textureTileScale?: number; textureTileScale?: [number, number];
} }
> = { > = {
"Default Material": { "Default Material": {
@@ -63,13 +63,14 @@ function FloorInstance({ floor }: { floor: Floor }) {
roughnessMap: material2MetalicRoughnessMap, roughnessMap: material2MetalicRoughnessMap,
metalnessMap: material2MetalicRoughnessMap, metalnessMap: material2MetalicRoughnessMap,
normalMap: material2NormalMap, normalMap: material2NormalMap,
textureTileScale: 0.1, textureTileScale: [0.1, 0.1],
}, },
"Material 3": { "Material 3": {
map: material3Map, map: material3Map,
roughnessMap: material3MetalicRoughnessMap, roughnessMap: material3MetalicRoughnessMap,
metalnessMap: material3MetalicRoughnessMap, metalnessMap: material3MetalicRoughnessMap,
normalMap: material3NormalMap, normalMap: material3NormalMap,
textureTileScale: [0.35, 0.5],
}, },
"Material 4": { "Material 4": {
map: material4Map, map: material4Map,
@@ -118,38 +119,59 @@ function FloorInstance({ floor }: { floor: Floor }) {
const sideTexturesList = getMaterialMaps(sideMaterial, defaultMaterialMap); const sideTexturesList = getMaterialMaps(sideMaterial, defaultMaterialMap);
// Use loader to load top and side textures // Use loader to load top and side textures
const [ const [topTexture, topNormalTexture, topRoughnessTexture, topMetalicTexture] =
topTexture, topNormalTexture, topRoughnessTexture, topMetalicTexture, useLoader(TextureLoader, topTexturesList);
] = useLoader(TextureLoader, topTexturesList);
const [ const [
sideTexture, sideNormalTexture, sideRoughnessTexture, sideMetalicTexture, sideTexture,
sideNormalTexture,
sideRoughnessTexture,
sideMetalicTexture,
] = useLoader(TextureLoader, sideTexturesList); ] = useLoader(TextureLoader, sideTexturesList);
// Early exit if materials are missing // Early exit if materials are missing
if (!materials[floor.topMaterial] || !materials[floor.sideMaterial]) return null; if (!materials[floor.topMaterial] || !materials[floor.sideMaterial])
return null;
// Combine and pair textures with their corresponding material // Combine and pair textures with their corresponding material
const textureMaterialMap = [ const textureMaterialMap = [
{ textures: [topTexture, topNormalTexture, topRoughnessTexture, topMetalicTexture], materialKey: floor.topMaterial }, {
{ textures: [sideTexture, sideNormalTexture, sideRoughnessTexture, sideMetalicTexture], materialKey: floor.sideMaterial }, textures: [
topTexture,
topNormalTexture,
topRoughnessTexture,
topMetalicTexture,
],
materialKey: floor.topMaterial,
},
{
textures: [
sideTexture,
sideNormalTexture,
sideRoughnessTexture,
sideMetalicTexture,
],
materialKey: floor.sideMaterial,
},
]; ];
// Apply texture settings // Apply texture settings
textureMaterialMap.forEach(({ textures, materialKey }) => { textureMaterialMap.forEach(({ textures, materialKey }) => {
const tileScale = materials[materialKey]?.textureTileScale ?? textureScale; const tileScale = materials[materialKey]?.textureTileScale ?? [
textureScale,
textureScale,
];
textures.forEach((tex, idx) => { textures.forEach((tex, idx) => {
if (!tex) return; if (!tex) return;
tex.wrapS = tex.wrapT = RepeatWrapping; tex.wrapS = tex.wrapT = RepeatWrapping;
tex.repeat.set(tileScale, tileScale); tex.repeat.set(tileScale[0], tileScale[1]);
tex.anisotropy = 16; tex.anisotropy = 16;
// First texture is always the color map (use SRGB), others should be linear // First texture is always the color map (use SRGB), others should be linear
tex.colorSpace = idx < 1 ? SRGBColorSpace : NoColorSpace; tex.colorSpace = idx < 1 ? SRGBColorSpace : NoColorSpace;
}); });
}); });
if (!shape) return null; if (!shape) return null;
return ( return (