pouët.net

Go to bottom

Height field normals using Noise derivatives

category: code [glöplog]
Erm. My suggestion might not have been entirely serious. With real coder I meant more like a madman than someone with discipline.

(But if you go that route after all, try some postprocessing filters that exaggerate detail)
added on the 2012-05-21 22:43:46 by 216 216
Unless you're animating the height map, why not just store the normals in the texture?
added on the 2012-05-22 00:16:43 by psonice psonice
Dave is not quite used to Pouet and needs to tweak his troll filter :)
added on the 2012-05-22 00:37:47 by trc_wm trc_wm
No real suggestions then, I think I'm doing OK. My code runs really fast, check it out on the the YouTube link, there's an executable. I'll be on my way then, no point hanging around here any further... .. .
added on the 2012-05-22 05:48:25 by Dave Dave
great, now we've done it :( we teach nothing useful, then we drop an internal joke, newcomers learns nothing and of course runs away from our modals. heh, for good or for bad, there is no way we'll ever change, lol. now, let's go open yet one more of those "how do we get more (young) programmers interested in the demoscene" thread full of outreach ideas :D
added on the 2012-05-22 11:18:33 by iq iq
(that been said, i love the demoscener evolutionary way of behaving - only the strongests survive in it)
added on the 2012-05-22 11:20:01 by iq iq
@Dave Hit me if I'm Captain Obvious. You can compute the gradient of your height-field *numerically*, that is estimating it with a thing called "finite difference", which is what those 4 evaluations (4 in 2d, 6 in 3d) around the sample are about.

But *IF* your heightfield admit analytical derivatives, bingo, no need to use finite difference and pay the cost of 4 evaluations. As it turns out, for common functions, computing analytical derivatives is really cheap. Even better, good old Perlin noise (thus FBM) admits analytical derivatives, which dirty cheap. If you use the "old classic Perlin noise", IQ have a nice page on it on his website. If you use Simplex noise (also from Perlin, tends to be a tad cheaper & better), you might give a look here
http://webstaff.itn.liu.se/~stegu/aqsis/DSOs/DSOnoises.html
as said, there is no any useful height field that you want to use to make a cool demo that has analytical derivatives, so for all practical uses, the idea can be just discarded and this thread nuked.
added on the 2012-05-22 19:22:19 by iq iq
Dont get into derivatives; no good will come of it.
added on the 2012-05-22 21:03:03 by trc_wm trc_wm
iq is picking it up again ... Analytical Normals (loop to Daves post on Shadertoy)
added on the 2014-07-22 23:06:41 by movAX13h movAX13h
With todays hardware keeping in mind you have to sample 4 extra-calls is no stress (for the GPU). Just do that for everything you need normals! End of story!
Except for when you need the derivatives inside the fbm/terrain construction itself, during iteration. Cause in that case those "4 extra-calls" mean you'd be multiplying the cost of your raymarcher by x5.... unless.... you had analytical derivatives!
added on the 2014-07-23 00:29:54 by iq iq

login

Go to top