{"id":27149,"date":"2025-01-07T19:16:45","date_gmt":"2025-01-08T00:16:45","guid":{"rendered":"http:\/\/blog.kenperlin.com\/?p=27149"},"modified":"2025-01-07T19:16:45","modified_gmt":"2025-01-08T00:16:45","slug":"noise-revisited-part-5","status":"publish","type":"post","link":"http:\/\/blog.kenperlin.com\/?p=27149","title":{"rendered":"Noise revisited, part 5"},"content":{"rendered":"<p>One thing that makes me happy about modern GPUs is just how darned fast they are. I find that I can create procedural textures with multiple calls to my noise function at every pixel, and the GPU keeps up just fine.<\/p>\n<p>For example, click on the image below to see a live simulation of roiling clouds. When you follow the link, you can also see the complete vertex and fragment shader code that generated the simulation.<\/p>\n<p><a href=\"http:\/\/cs.nyu.edu\/perlin\/cloudy\"><img decoding=\"async\" src=\"http:\/\/blog.kenperlin.com\/wp-content\/uploads\/2025\/01\/cloudy.jpg\"><\/a><\/p>\n<p>This cloudy skies simulation was created by calling 3D noise multiple times at different scales. I find that I can call noise up to 8 times per pixel and still maintain a steady frame rate of 60 frames per second on my phone.<\/p>\n<p>Let&#8217;s work out some numbers. The simulation itself is 1000&#215;1000, so that&#8217;s one million pixels.<\/p>\n<p>My noise implementation calls the cosine function 4 times to compute a repeatable random number. So to evaluate noise once, that&#8217;s 4 cosine functions for each of the x,y,z axes at the 8 corners of a cube.<\/p>\n<p>That&#8217;s 4x3x8 = 96 cosine computations. Multiply that by 8 calls to the noise function per pixel, then again by one million pixels, and then again by 60 frames per second.<\/p>\n<p>The result? More than 46 billion calls to the cosine function every second &#8212; not counting all the other computations involved. And it all runs just fine on the low power GPU of a smartphone.<\/p>\n<p>Pretty cool, yes?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One thing that makes me happy about modern GPUs is just how darned fast they are. I find that I can create procedural textures with multiple calls to my noise function at every pixel, and the GPU keeps up just fine. For example, click on the image below to see a live simulation of roiling &hellip; <a href=\"http:\/\/blog.kenperlin.com\/?p=27149\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Noise revisited, part 5&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/27149"}],"collection":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27149"}],"version-history":[{"count":2,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/27149\/revisions"}],"predecessor-version":[{"id":27153,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/27149\/revisions\/27153"}],"wp:attachment":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27149"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}