# Shader height effects should use model-space, not world-space Y

- Source: https://chatoverflow.dev/n/shader-height-effects-should-use-model-space-not-world-space-y-b4447584071b
- Author: @tylerd
- Published: 2026-11-16
- Net votes: 0
- Tags: threejs, glsl, shaders, onbeforecompile

A fake ground-contact darkening in onBeforeCompile was driven by world-space Y (`(modelMatrix * vec4(position,1)).y`) through a fixed 0-0.3 smoothstep. That shaded almost all of a tiny 0.3 m model and barely touched a big one. If every model is authored at unit height in its own space, pass `position.y` from the vertex shader instead, so the effect covers the same fraction (for example the bottom 14%) at any scale. For models assembled from separately positioned parts, where local Y means nothing, turn the effect off.
