diff --git a/frontend/misc/settings.ts b/frontend/misc/settings.ts index 0a37825..e657ab2 100644 --- a/frontend/misc/settings.ts +++ b/frontend/misc/settings.ts @@ -29,7 +29,11 @@ export async function settings() { panSensitivity: 1, exposure: 1, shadowIntensity: 0, - background: '', + // Nice low-res outdoor/high-contrast HDRI image (CC0 licensed) for lighting + background: "https://dl.polyhaven.org/file/ph-assets/HDRIs/hdr/1k/qwantani_afternoon_1k.hdr", + // Uniform (1x1 pixel) medium gray background for visibility + skybox: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNsaFjwHwAFyQKh26fFAAAAAABJRU5ErkJggg==", + }; // Auto-override any settings from the URL diff --git a/frontend/viewer/ModelViewerWrapper.vue b/frontend/viewer/ModelViewerWrapper.vue index e35bd4f..b94ac42 100644 --- a/frontend/viewer/ModelViewerWrapper.vue +++ b/frontend/viewer/ModelViewerWrapper.vue @@ -215,7 +215,7 @@ watch(disableTap, (newDisableTap) => { @@ -302,4 +302,4 @@ watch(disableTap, (newDisableTap) => { float: left; transition: width 0.3s; } - \ No newline at end of file + diff --git a/yacv_server/gltf.py b/yacv_server/gltf.py index 6c4a2df..df61a2d 100644 --- a/yacv_server/gltf.py +++ b/yacv_server/gltf.py @@ -4,9 +4,10 @@ import numpy as np from build123d import Location, Plane, Vector from pygltflib import * -_checkerboard_image_bytes = base64.decodebytes( - b'iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAAF0lEQVQI12N49OjR////Gf' - b'/////48WMATwULS8tcyj8AAAAASUVORK5CYII=') +# PNG file containing 1x1 while pixel +_default_tex = (b'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=') + +_default_color = (1.0, 0.75, 0.0, 1.0) def get_version() -> str: try: @@ -36,7 +37,7 @@ class GLTFMgr: vertex_positions: List[float] # x, y, z vertex_colors: List[float] # r, g, b, a - def __init__(self, image: Optional[Tuple[bytes, str]] = (_checkerboard_image_bytes, 'image/png')): + def __init__(self, image: Optional[Tuple[bytes, str]] = (_default_tex, 'image/png')): self.gltf = GLTF2( asset=Asset(generator=f"yacv_server@{get_version()}"), scene=0, @@ -79,7 +80,7 @@ class GLTFMgr: def add_face(self, vertices_raw: List[Vector], indices_raw: List[Tuple[int, int, int]], tex_coord_raw: List[Tuple[float, float]], color: Optional[Tuple[float, float, float, float]] = None): """Add a face to the GLTF mesh""" - if color is None: color = (1.0, 0.75, 0.0, 1.0) + if color is None: color = _default_color # assert len(vertices_raw) == len(tex_coord_raw), f"Vertices and texture coordinates have different lengths" # assert min([i for t in indices_raw for i in t]) == 0, f"Face indices start at {min(indices_raw)}" # assert max([e for t in indices_raw for e in t]) < len(vertices_raw), f"Indices have non-existing vertices"