Shader Noise
After some gnashing of teeth -- mostly involving "stupid" stuff like creating a proper 2-channel 3D texture and computing lighting vectors -- I have working shader noise functions in the noise library. The raw noise functions do 3D Perlin, fbm, and turbulent noise. To demo them I created a script that bump-maps three rotating spheres with some simple real-time procedural textures. The first is just a bumpy texture using straight Perlin noise, the second is a crinkly texture using 4 octaves of fbm noise. The third (bottom) is an embossed turbulent noise texture.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdvcFqsJALVVlgrUOX2ZOLRzfTjfu0yMNFs3atl212v9c_S_TWpBZUsTmef3n3bVM-zd_zzf8G_hlY3xrHWjsntW6ycp72uxFTj0H7MMo4inAtUE-85BOxD56qnSMzUaXN6Flwag/s400/bumpy.png)
Note that all three spheres use exactly the same vertex geometry, the apparent differences in the shapes are entirely due to the shaders. The effect is even better with a moving image, as is usual with these types of things.
Get the code
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdvcFqsJALVVlgrUOX2ZOLRzfTjfu0yMNFs3atl212v9c_S_TWpBZUsTmef3n3bVM-zd_zzf8G_hlY3xrHWjsntW6ycp72uxFTj0H7MMo4inAtUE-85BOxD56qnSMzUaXN6Flwag/s400/bumpy.png)
Note that all three spheres use exactly the same vertex geometry, the apparent differences in the shapes are entirely due to the shaders. The effect is even better with a moving image, as is usual with these types of things.
Get the code
0 Comments:
Post a Comment
<< Home