This commit is contained in:
ExPikaPaka
2026-07-21 10:12:09 +02:00
parent ab023f3f6d
commit 61d2d4355a
19 changed files with 251 additions and 533 deletions

View File

@@ -62,7 +62,7 @@ uniform bool use_vertex_uv; // true: sample at vertex_uv with a derived ta
// A 2x3 affine (columns packed as lin = (m00, m01, m10, m11), tr = (m02, m12)) applied to the uv of
// the island currently being dragged in the UV editor (active > 0.5). Identity when nothing is
// dragged, so this whole path is a no-op then. Lets a UV island drag move the bump on the model with
// only a uniform update -- no mesh rebuild -- exactly the way Adjust placement moves the whole texture.
// only a uniform update
uniform vec4 island_delta_lin;
uniform vec2 island_delta_tr;
@@ -76,7 +76,7 @@ in vec2 vertex_uv;
out vec4 out_color;
// The two model-space axes the triplanar planar coordinate is read off, per dominant normal
// component -- same choice libslic3r's project_planar() makes, so planar.x runs along t, planar.y
// component - same choice libslic3r's project_planar() makes, so planar.x runs along t, planar.y
// along b.
void projection_axes(vec3 n, out vec3 t, out vec3 b)
{
@@ -113,10 +113,10 @@ void main()
triangle_normal = -triangle_normal;
if (use_vertex_uv) {
// Precomputed-uv (LSCM) path -- Mikkelsen's surface-gradient bump ("Bump Mapping
// Precomputed-uv (LSCM) path - Mikkelsen's surface-gradient bump ("Bump Mapping
// Unparametrized Surfaces on the GPU"). The perturbed normal is derived straight from the
// screen-space derivatives of the *sampled height* and the position, so it is scale-exact
// with no uv->mm assumption at all -- which is the whole point here: an LSCM map is conformal,
// with no uv->mm assumption at all - which is the whole point here: an LSCM map is conformal,
// not isometric, so the local mm-per-uv varies across the chart and the earlier "one global
// 1/tiling factor" got the depth visibly wrong. dFdx(h) captures the true on-screen rate of
// change however the chart is stretched or however fine the tiling is.

View File

@@ -2,11 +2,11 @@
// UV-check overlay for the texture-displacement gizmo, drawn over the painted patch so the LSCM
// unwrap can be sanity-checked on the real 3D surface (mode set by the `mode` uniform):
// mode 0 -- Checker: a procedural checkerboard sampled at the layer's uv. Even squares that stay
// mode 0 - Checker: a procedural checkerboard sampled at the layer's uv. Even squares that stay
// square everywhere on the model mean the unwrap is low-distortion; squares that smear or
// shear reveal exactly where it stretches. Same uv the bake samples, so what you see is
// where the texture actually lands.
// mode 1 -- Distortion heatmap: the per-vertex area-distortion carried in `distortion`, blue
// mode 1 - Distortion heatmap: the per-vertex area-distortion carried in `distortion`, blue
// (compressed) -> green (ideal) -> red (stretched).
// Both are lit with the same cheap two-light diffuse the bump preview uses, so the surface still
// reads as 3D.

View File

@@ -2,9 +2,9 @@
// Vertex stage for the UV-check overlay (checker / distortion heatmap) drawn over the painted patch
// by GLGizmoTextureDisplacement. Reuses GLModel's P3N3T2 layout so it needs no bespoke buffer:
// v_normal.x -- per-vertex UV distortion (uv-area / surface-area ratio, remapped so 0.5 = ideal);
// v_normal.x - per-vertex UV distortion (uv-area / surface-area ratio, remapped so 0.5 = ideal);
// only the distortion mode reads it.
// v_tex_coord -- precomputed texture uv, valid only when use_vertex_uv is set (LSCM); the checker
// v_tex_coord - precomputed texture uv, valid only when use_vertex_uv is set (LSCM); the checker
// mode reconstructs uv in the fragment shader otherwise.
uniform mat4 view_model_matrix;