Viewer: surroundings to reflect (sky, horizon, ground) and a ground shadow #252

Manually merged
github merged 2 commits from gh-pr/252/head into gh-pr/252/base 2026-11-26 20:21:41 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 06:24 UTC · original
holdmysocks:claude/viewer-environment → master · +218 −17 · 3 files · 2 commits · merged 2026-11-25 06:44 UTC

What

Models in the viewer had almost nothing to reflect and no shadow under them. SIX-201.

  • Surroundings to reflect. Reflections came from a two-colour gradient. They now come from a sky gradient with a sun glow, a sharp horizon and an asphalt-grey ground lit by sun and sky. Horizon, gradient and glow widen with the surface's roughness. The sun's disc shows in the background only; in a reflection the direct specular term already is the sun.
  • Ground shadow. A soft blob shadow from the model's bounds: a dark one under the model and a wider, lighter one pushed away from the sun. Not a shadow map. Shaded mode only, for models up to 40 m wide, when the camera is above the ground.
  • Grid under the tyres. The grid sat at the body's lowest point and cut through a vehicle's wheels. Grid and shadow now sit at the lowest tyre point.
  • Ambient. Unchanged for surfaces facing up or sideways. Faces looking down take up to 80% of the light the ground sends back, so undersides are a little darker.

Viewer only (shader.wgsl, render3d.rs, model_view.rs). No change to the frame uniforms or any shared struct. The Metal 4 renderer is not touched. The paint shading itself is not touched.

Checked

  • Before and after pictures, same angles, master build against this one: two cars from two angles, chrome finish, dusk, night, a ped head, a prop. Chrome now splits along a horizon line (sky above, ground below); the tyres stand on the grid; there is a shadow under and beside the car; the car's own exposure is close to master; skin shading on the head looks the same.
  • No shader errors in the viewer log.
  • Workspace tests pass (run before the merge of master into this branch).

Not decoded / not done

  • Glossy non-metal paint looks almost the same as before: at 4% reflectance the diffuse colour hides the surroundings. That needs the clear coat (SIX-202), not this change.
  • The shadow is a soft rectangle from static bounds. It does not follow the silhouette, open doors or poses, and an aircraft gets a rectangle. Fog does not fade it.
  • Thumbnails and the 3D map were not rendered. By the code, thumbnails get the new background below the horizon and no shadow; map glass and water reflect the new surroundings; map cells change only on downward faces.
  • No full ped or creature was looked at, only a head. The moon's disc at night was not looked at.
  • Not built or run on macOS; CI compiles it. The Metal 4 renderer keeps the old look.
**@⁠holdmysocks** on GitHub · 2026-11-25 06:24 UTC · [original](https://github.com/holdmysocks/SixNG/pull/252) `holdmysocks:claude/viewer-environment` → `master` · +218 −17 · 3 files · 2 commits · merged 2026-11-25 06:44 UTC ## What Models in the viewer had almost nothing to reflect and no shadow under them. SIX-201. - **Surroundings to reflect.** Reflections came from a two-colour gradient. They now come from a sky gradient with a sun glow, a sharp horizon and an asphalt-grey ground lit by sun and sky. Horizon, gradient and glow widen with the surface's roughness. The sun's disc shows in the background only; in a reflection the direct specular term already is the sun. - **Ground shadow.** A soft blob shadow from the model's bounds: a dark one under the model and a wider, lighter one pushed away from the sun. Not a shadow map. Shaded mode only, for models up to 40 m wide, when the camera is above the ground. - **Grid under the tyres.** The grid sat at the body's lowest point and cut through a vehicle's wheels. Grid and shadow now sit at the lowest tyre point. - **Ambient.** Unchanged for surfaces facing up or sideways. Faces looking down take up to 80% of the light the ground sends back, so undersides are a little darker. Viewer only (`shader.wgsl`, `render3d.rs`, `model_view.rs`). No change to the frame uniforms or any shared struct. The Metal 4 renderer is not touched. The paint shading itself is not touched. ## Checked - Before and after pictures, same angles, master build against this one: two cars from two angles, chrome finish, dusk, night, a ped head, a prop. Chrome now splits along a horizon line (sky above, ground below); the tyres stand on the grid; there is a shadow under and beside the car; the car's own exposure is close to master; skin shading on the head looks the same. - No shader errors in the viewer log. - Workspace tests pass (run before the merge of master into this branch). ## Not decoded / not done - Glossy non-metal paint looks almost the same as before: at 4% reflectance the diffuse colour hides the surroundings. That needs the clear coat (SIX-202), not this change. - The shadow is a soft rectangle from static bounds. It does not follow the silhouette, open doors or poses, and an aircraft gets a rectangle. Fog does not fade it. - Thumbnails and the 3D map were not rendered. By the code, thumbnails get the new background below the horizon and no shadow; map glass and water reflect the new surroundings; map cells change only on downward faces. - No full ped or creature was looked at, only a head. The moon's disc at night was not looked at. - Not built or run on macOS; CI compiles it. The Metal 4 renderer keeps the old look.
Glossy surfaces had only a two-colour sky gradient to reflect, and models
floated over the grid.

- shader: `environment(d, blur)` replaces the gradient for reflections: sky
  from horizon to zenith, a glow around the sun, a sharp horizon and a
  ground of asphalt lit by the sun and the sky (never brighter than the
  horizon sky). The horizon, the gradient and the glow widen with the
  roughness of the reflecting surface. `sky(d)`, the background, adds the
  sun's disc; reflections leave it to the direct specular term.
- shader: `ambient(n)`: as before for surfaces that face up or sideways;
  surfaces that face down take the light the ground sends back.
- renderer: `Renderer3D::ground`, a soft shadow on the ground under the
  model: two blurred rounded boxes from the model's bounds (one under it,
  a wider one pushed away from the sun). Not a shadow map. Shaded mode
  only, drawn after the opaque surfaces.
- model view: sets the shadow for models up to 40 m, and puts the ground
  (grid and shadow) under the tyres of a vehicle on its wheels; the grid
  used to sit at the body's lowest point and cut through the wheels.

No change to the frame uniforms or the paint and specular code.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:21:41 +00:00
github manually merged commit 63d974e113 into gh-pr/252/base 2026-11-26 20:21:41 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.