mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Fix ground clutter height sampling and terrain shader GPU crash
- Fix HeightMap::getHeight() to use interleaved 17-wide row layout matching MCVT storage (was using wrong 9-wide contiguous indexing) - Guard terrain bump mapping normalize against zero-length vectors to prevent NaN propagation and GPU faults
This commit is contained in:
parent
1e08d6ff22
commit
3e6de8485b
3 changed files with 10 additions and 20 deletions
|
|
@ -96,7 +96,9 @@ void main() {
|
|||
// Bump strength controls how much texture detail affects lighting
|
||||
const float bumpStrength = 9.0;
|
||||
vec3 perturbation = (dLdx * cross(norm, dpdy) + dLdy * cross(dpdx, norm)) * bumpStrength;
|
||||
norm = normalize(norm - perturbation);
|
||||
vec3 candidate = norm - perturbation;
|
||||
float len2 = dot(candidate, candidate);
|
||||
norm = (len2 > 1e-8) ? candidate * inversesqrt(len2) : norm;
|
||||
}
|
||||
|
||||
vec3 lightDir2 = normalize(-lightDir.xyz);
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue