3 ms·
The easiest way is to compute the directional derivative with some direction pointing upwards. For example u_x + u_y, or convolving the height map with a 3x3 k
by enriquto 5y ago
The easiest way is to compute the directional derivative with some direction pointing upwards. For example u_x + u_y, or convolving the height map with a 3x3 kernel with the following coefficients:
0 -1 0
-1 0 1
0 1 0
You may want to smooth the result if you see too much noise.
- wlesieutre 5y agoOr for the fancy version, you can raytrace the terrain shadows! https://news.ycombinator.com/item?id=17065264 https://news.ycombinator.com/item?id=17065264 The linked post has some good comparisons with derivative-based shading, it does sorta work but you can see it comes up short in conveying actual 3D shape compared to the raytraced version.