{"id":177,"date":"2018-04-28T12:49:10","date_gmt":"2018-04-28T09:49:10","guid":{"rendered":"http:\/\/kadircenk.com\/blog\/?p=177"},"modified":"2019-02-07T19:38:48","modified_gmt":"2019-02-07T16:38:48","slug":"trace-the-ray-part-4-textures-perlin-noise-bump-mapping","status":"publish","type":"post","link":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/","title":{"rendered":"Trace the Ray \u2013 Part 4 (Textures, Perlin Noise, Bump Mapping)"},"content":{"rendered":"<p>I am back again; but this time with textures!<\/p>\n<p>In my fourth assignment, my task was to implement:<\/p>\n<ul>\n<li>Texture mapping (Triangle and Sphere)<\/li>\n<li>Perlin noise implementation<\/li>\n<li>Bump mapping<\/li>\n<\/ul>\n<p>In this post, we will examine them together!<\/p>\n<p><!--more--><\/p>\n<p>Apart from those capabilities, I have also added support for\u00a0<strong>backgroundTexture<\/strong>, where a color read from that background texture is used to color the current pixel when a ray cast from that pixel does not hit any object in the scene.<\/p>\n<h4>Texture Mapping<\/h4>\n<p>From now on, we have the\u00a0<strong>Textures<\/strong> tag in our input scene files. A texture has:<\/p>\n<ul>\n<li>ImageName: path to the image. Use perlin noise instead of an image if the value of this tag is &#8220;perlin&#8221;.<\/li>\n<li>Interpolation: nearest and bilinear.\n<ul>\n<li>Nearest: If hit (1.2, 3.4), round to nearest pixel integer coordinate (1, 3) on the texture and use that color.<\/li>\n<li>Bilinear: Do not round, but average four neighbour pixels&#8217; texture color values.<\/li>\n<\/ul>\n<\/li>\n<li>DecalMode: replace_kd, replace_all, blend_kd\n<ul>\n<li>replace_kd: While calculating the diffuse color, replace kd constant with the texture color normalized to [0..1].<\/li>\n<li>replace_all: Replace all color with texture color.<\/li>\n<li>blend_kd: Half weight texture color, half weight diffuse color.<\/li>\n<\/ul>\n<\/li>\n<li>Normalizer: Normalize texture color value by that much.<\/li>\n<li>Appearance and ScalingFactor: Used in perlin. &#8220;patch&#8221; appearance is a smooth-lined perlin, &#8220;vein&#8221; appearance is a hard-lined perlin.<\/li>\n<li>bumpmap=&#8221;true&#8221; if bump map would be used;\u00a0bumpmapMultiplier=&#8221;&lt;float_value&gt;&#8221; to boost the bump effect.<\/li>\n<\/ul>\n<p>In Spheres, we calculate texture\u00a0<strong>u, v<\/strong> coordinates such that the texture could map the whole surface. In Triangles, we use barycentric coordinates to calculate u and v. Here are some outputs:<\/p>\n<p style=\"text-align: left;\"><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png\"><br \/>\n<\/a><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"181\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/sphere_texture_blend_bilinear-2\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"sphere_texture_blend_bilinear\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png\" class=\"aligncenter wp-image-181 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>sphere_texture_blend_bilinear.xml\n(800x800)\n\/w 8 thrd, 1MSAA<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_bilinear.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"182\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/sphere_texture_replace_bilinear\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_bilinear.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"sphere_texture_replace_bilinear\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_bilinear.png\" class=\"aligncenter wp-image-182 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_bilinear.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_bilinear.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_bilinear-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_bilinear-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_bilinear-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_bilinear-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>sphere_texture_replace_bilinear.xml\n(800x800)\n\/w 8 thrd, 1MSAA<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_nearest.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"183\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/sphere_texture_replace_nearest\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_nearest.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"sphere_texture_replace_nearest\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_nearest.png\" class=\"aligncenter wp-image-183 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_nearest.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_nearest.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_nearest-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_nearest-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_nearest-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_replace_nearest-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>sphere_texture_replace_nearest.xml\n(800x800)\n\/w 8 thrd, 1MSAA<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/skybox.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"184\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/skybox\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/skybox.png\" data-orig-size=\"1600,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"skybox\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/skybox-1024x512.png\" class=\"aligncenter wp-image-184 size-large\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/skybox-1024x512.png\" alt=\"\" width=\"525\" height=\"263\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/skybox-1024x512.png 1024w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/skybox-300x150.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/skybox-768x384.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/skybox.png 1600w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/a><\/p>\n<pre>skybox.xml\n(1600x800)\n\/w 8 thrd, 100MSAA\nGround is triangle,\nScene is inside a sphere (sky).<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_diffuse_specular_texture.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"185\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/killeroo_diffuse_specular_texture\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_diffuse_specular_texture.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"killeroo_diffuse_specular_texture\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_diffuse_specular_texture.png\" class=\"aligncenter wp-image-185 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_diffuse_specular_texture.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_diffuse_specular_texture.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_diffuse_specular_texture-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_diffuse_specular_texture-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_diffuse_specular_texture-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_diffuse_specular_texture-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>killeroo_diffuse_specular_texture.xml\n(800x800)\n\/w 8 thrd, 16MSAA\nWalls are grid-textured.<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_static.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"188\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/galactica_static\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_static.png\" data-orig-size=\"1280,720\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"galactica_static\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_static-1024x576.png\" class=\"aligncenter wp-image-188 size-large\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_static-1024x576.png\" alt=\"\" width=\"525\" height=\"295\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_static-1024x576.png 1024w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_static-300x169.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_static-768x432.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_static.png 1280w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/a><\/p>\n<pre>galactica_static.xml\n(1280x720)\n\/w 8 thrd, 36MSAA\nMETU logo on wings,\nMy name, CENK, on the tips of wings.<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_dynamic.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"191\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/galactica_dynamic\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_dynamic.png\" data-orig-size=\"1280,720\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"galactica_dynamic\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_dynamic-1024x576.png\" class=\"aligncenter wp-image-191 size-large\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_dynamic-1024x576.png\" alt=\"\" width=\"525\" height=\"295\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_dynamic-1024x576.png 1024w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_dynamic-300x169.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_dynamic-768x432.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/galactica_dynamic.png 1280w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/a><\/p>\n<pre>galactica_dynamic.xml\n(1280x720)\n\/w 8 thrd, 64MSAA, MB\nMETU logo on wings,\nMy name, CENK, on the tips of wings.\nHad some BBox vs. MB problems,\nwill solve them.<\/pre>\n<h4>Perlin Noise Implementation<\/h4>\n<p><em>Please check <a href=\"http:\/\/mrl.nyu.edu\/~perlin\/\" target=\"_blank\" rel=\"noopener\">Ken Perlin&#8217;s webpage<\/a> for detailed information on Perlin Noise.<\/em><\/p>\n<p>This part is where I spent most of my time for this assignement. I wrote a Perlin class which initially creates the\u00a0<strong>G<\/strong> array, and a shuffled\u00a0<strong>P<\/strong> array. Then for each hit point, I floored the hitpoint coordinates, built up the 3D grid cube, assigned\u00a0<strong>e<\/strong> vectors to the vertices by selecting from <strong>G<\/strong>, using\u00a0<strong>P\u00a0<\/strong>index array to choose an index, and finally weighted those 8 corners of the cube to get a Perlin value between [0..1].<\/p>\n<p>If the appearance is chosen as &#8220;patch&#8221;, then\u00a0<strong>(perlinValue + 1) \/ 2\u00a0<\/strong>is sent to the replace_kd operation as normalized texture color.<\/p>\n<p>If the appearance is chosen as &#8220;vein&#8221;, then <strong>abs(perlinValue)\u00a0<\/strong>is sent to the replace_kd operation as normalized texture color.<\/p>\n<p>Below are my outputs:<\/p>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/ellipsoids_texture.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"186\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/ellipsoids_texture\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/ellipsoids_texture.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"ellipsoids_texture\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/ellipsoids_texture.png\" class=\"aligncenter wp-image-186 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/ellipsoids_texture.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/ellipsoids_texture.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/ellipsoids_texture-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/ellipsoids_texture-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/ellipsoids_texture-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/ellipsoids_texture-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>ellipsoids_texture.xml\n(800x800)\n\/w 8 thrd, 1MSAA\nLeft sphere is replace_all,\nRight sphere is blend_kd (reddish diffuse),\nSecond right sphere is replace_kd,\nSecond left sphere is \"patch\" perlin.<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"187\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/perlin_types\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"perlin_types\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types.png\" class=\"aligncenter wp-image-187 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>perlin_types.xml (800x800)\n\/w 8 thrd, 1MSAA\nGround is blend_kd scalingFactor 0.03 \n\"patch\" perlin triangle,\nCloser left-right are scalingFactor 5\n\"patch\" and \"vein\", respectively,\nMiddle left-right are scalingFactor 1\n\"patch\" and \"vein\", respectively,\nFar left-right are scalingFactor 1\n\"patch\" and \"vein\", respectively.<\/pre>\n<h4>Bump Mapping<\/h4>\n<p>Bump mapping is used to give the effect of bumpings on the surfaces, without actually disturbing the geometry of the surface. It is done by changing the pointing direction of the surface normal by an amount of the difference in texture color between hitpoint u, v and neightbour u, v (as if taking the derivative) when a point on the surface is hit by a ray. The more the difference we have, the more the bump is seen. Below are my outputs of Triangle and Sphere bump mappings. Some of the outputs include the use of Perlin noise and bump mapping together, where we use the difference between the perlin values of neighbour coordinates as the bump amount, and also the color.<br \/>\n<a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_basic.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"189\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/bump_mapping_basic\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_basic.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"bump_mapping_basic\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_basic.png\" class=\"aligncenter wp-image-189 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_basic.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_basic.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_basic-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_basic-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_basic-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_basic-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>bump_mapping_basic.xml\n(800x800)\n\/w 8 thrd, 36MSAA\nGround triangle bumped by grid texture,\nSphere bumped by leather texture.<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_transformed.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"190\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/bump_mapping_transformed\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_transformed.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"bump_mapping_transformed\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_transformed.png\" class=\"aligncenter wp-image-190 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_transformed.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_transformed.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_transformed-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_transformed-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_transformed-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/bump_mapping_transformed-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>bump_mapping_transformed.xml\n(800x800)\n\/w 8 thrd, 36MSAA\nGround triangle bumped by cobblestone\ntexture, Sphere bumped by leather\ntexture.<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_bump_nobump.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"193\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/sphere_bump_nobump\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_bump_nobump.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"sphere_bump_nobump\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_bump_nobump.png\" class=\"aligncenter wp-image-193 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_bump_nobump.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_bump_nobump.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_bump_nobump-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_bump_nobump-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_bump_nobump-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_bump_nobump-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>sphere_bump_nobump.xml\n(800x800)\n\/w 8 thrd, 36MSAA\nLeft nobump,\nRight bump.<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_bump_walls.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"192\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/killeroo_bump_walls\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_bump_walls.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"killeroo_bump_walls\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_bump_walls.png\" class=\"aligncenter wp-image-192 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_bump_walls.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_bump_walls.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_bump_walls-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_bump_walls-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_bump_walls-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/killeroo_bump_walls-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>killeroo_bump_walls.xml\n(800x800)\n\/w 8 thrd, 16MSAA\nWalls are grid bumped,\nNo texture &amp; bump on killeroo.<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/spheres_perlin.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"194\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/spheres_perlin\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/spheres_perlin.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"spheres_perlin\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/spheres_perlin.png\" class=\"aligncenter wp-image-194 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/spheres_perlin.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/spheres_perlin.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/spheres_perlin-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/spheres_perlin-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/spheres_perlin-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/spheres_perlin-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>spheres_perlin.xml\n(800x800)\n\/w 8 thrd, 36MSAA\nLeft \"patch\" perlin,\nRight \"vein\" perlin.<\/pre>\n<p><a href=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types_bump.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"195\" data-permalink=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/perlin_types_bump\/\" data-orig-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types_bump.png\" data-orig-size=\"800,800\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"perlin_types_bump\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types_bump.png\" class=\"aligncenter wp-image-195 size-full\" src=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types_bump.png\" alt=\"\" width=\"800\" height=\"800\" srcset=\"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types_bump.png 800w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types_bump-150x150.png 150w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types_bump-300x300.png 300w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types_bump-768x768.png 768w, https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/perlin_types_bump-100x100.png 100w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<pre>perlin_types_bump.xml\n(800x800)\n\/w 8 thrd, 1MSAA\nSame setup as perlin_types.xml above,\nbut with bump mapping now.<\/pre>\n<p>I would like to end this post by a video of sequential renders of a slightly edited (METU logo on the wings and my name, CENK, on the tips of the wings) version of Galactica spaceship <a href=\"http:\/\/user.ceng.metu.edu.tr\/~akyuz\/\" target=\"_blank\" rel=\"noopener\">Oguz hoca<\/a>\u00a0has shared with us, together with The Imperial March!<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/cQDYVJ3n-rw\" width=\"1113\" height=\"626\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>See you in the next post!<\/p>\n<p>Happy tracing!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am back again; but this time with textures! In my fourth assignment, my task was to implement: Texture mapping (Triangle and Sphere) Perlin noise implementation Bump mapping In this post, we will examine them together!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[4],"tags":[],"class_list":["post-177","post","type-post","status-publish","format-standard","hentry","category-ray-tracing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Trace the Ray \u2013 Part 4 (Textures, Perlin Noise, Bump Mapping) - kadircenk<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Trace the Ray \u2013 Part 4 (Textures, Perlin Noise, Bump Mapping) - kadircenk\" \/>\n<meta property=\"og:description\" content=\"I am back again; but this time with textures! In my fourth assignment, my task was to implement: Texture mapping (Triangle and Sphere) Perlin noise implementation Bump mapping In this post, we will examine them together!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/\" \/>\n<meta property=\"og:site_name\" content=\"kadircenk\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/kadircenk3\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/kadircenk3\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-28T09:49:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-07T16:38:48+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png\" \/>\n<meta name=\"author\" content=\"kadircenk\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/kadircenkalpay\" \/>\n<meta name=\"twitter:site\" content=\"@kadircenkalpay\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kadircenk\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/\"},\"author\":{\"name\":\"kadircenk\",\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d9546d987c40be9d6ff61c6512b3a25\"},\"headline\":\"Trace the Ray \u2013 Part 4 (Textures, Perlin Noise, Bump Mapping)\",\"datePublished\":\"2018-04-28T09:49:10+00:00\",\"dateModified\":\"2019-02-07T16:38:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/\"},\"wordCount\":589,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d9546d987c40be9d6ff61c6512b3a25\"},\"image\":{\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/kadircenk.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/sphere_texture_blend_bilinear-1.png\",\"articleSection\":[\"Ray Tracing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/\",\"url\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/\",\"name\":\"Trace the Ray \u2013 Part 4 (Textures, Perlin Noise, Bump Mapping) - kadircenk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/kadircenk.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/sphere_texture_blend_bilinear-1.png\",\"datePublished\":\"2018-04-28T09:49:10+00:00\",\"dateModified\":\"2019-02-07T16:38:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/#primaryimage\",\"url\":\"http:\\\/\\\/kadircenk.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/sphere_texture_blend_bilinear-1.png\",\"contentUrl\":\"http:\\\/\\\/kadircenk.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/04\\\/sphere_texture_blend_bilinear-1.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Trace the Ray \u2013 Part 4 (Textures, Perlin Noise, Bump Mapping)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/\",\"name\":\"kadircenk.com\",\"description\":\"Blog\",\"publisher\":{\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d9546d987c40be9d6ff61c6512b3a25\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d9546d987c40be9d6ff61c6512b3a25\",\"name\":\"kadircenk\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/ss.png\",\"url\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/ss.png\",\"contentUrl\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/ss.png\",\"width\":696,\"height\":696,\"caption\":\"kadircenk\"},\"logo\":{\"@id\":\"https:\\\/\\\/kadircenk.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/ss.png\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/kadircenk3\",\"https:\\\/\\\/www.instagram.com\\\/kadircenkalpay\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/kadir-cenk-alpay\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/kadircenkalpay\",\"https:\\\/\\\/www.youtube.com\\\/kadircenkalpay\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Trace the Ray \u2013 Part 4 (Textures, Perlin Noise, Bump Mapping) - kadircenk","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/","og_locale":"en_US","og_type":"article","og_title":"Trace the Ray \u2013 Part 4 (Textures, Perlin Noise, Bump Mapping) - kadircenk","og_description":"I am back again; but this time with textures! In my fourth assignment, my task was to implement: Texture mapping (Triangle and Sphere) Perlin noise implementation Bump mapping In this post, we will examine them together!","og_url":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/","og_site_name":"kadircenk","article_publisher":"https:\/\/www.facebook.com\/kadircenk3","article_author":"https:\/\/www.facebook.com\/kadircenk3","article_published_time":"2018-04-28T09:49:10+00:00","article_modified_time":"2019-02-07T16:38:48+00:00","og_image":[{"url":"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png","type":"","width":"","height":""}],"author":"kadircenk","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/kadircenkalpay","twitter_site":"@kadircenkalpay","twitter_misc":{"Written by":"kadircenk","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/#article","isPartOf":{"@id":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/"},"author":{"name":"kadircenk","@id":"https:\/\/kadircenk.com\/blog\/#\/schema\/person\/8d9546d987c40be9d6ff61c6512b3a25"},"headline":"Trace the Ray \u2013 Part 4 (Textures, Perlin Noise, Bump Mapping)","datePublished":"2018-04-28T09:49:10+00:00","dateModified":"2019-02-07T16:38:48+00:00","mainEntityOfPage":{"@id":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/"},"wordCount":589,"commentCount":0,"publisher":{"@id":"https:\/\/kadircenk.com\/blog\/#\/schema\/person\/8d9546d987c40be9d6ff61c6512b3a25"},"image":{"@id":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/#primaryimage"},"thumbnailUrl":"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png","articleSection":["Ray Tracing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/","url":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/","name":"Trace the Ray \u2013 Part 4 (Textures, Perlin Noise, Bump Mapping) - kadircenk","isPartOf":{"@id":"https:\/\/kadircenk.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/#primaryimage"},"image":{"@id":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/#primaryimage"},"thumbnailUrl":"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png","datePublished":"2018-04-28T09:49:10+00:00","dateModified":"2019-02-07T16:38:48+00:00","breadcrumb":{"@id":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/#primaryimage","url":"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png","contentUrl":"http:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2018\/04\/sphere_texture_blend_bilinear-1.png"},{"@type":"BreadcrumbList","@id":"https:\/\/kadircenk.com\/blog\/trace-the-ray-part-4-textures-perlin-noise-bump-mapping\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kadircenk.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Trace the Ray \u2013 Part 4 (Textures, Perlin Noise, Bump Mapping)"}]},{"@type":"WebSite","@id":"https:\/\/kadircenk.com\/blog\/#website","url":"https:\/\/kadircenk.com\/blog\/","name":"kadircenk.com","description":"Blog","publisher":{"@id":"https:\/\/kadircenk.com\/blog\/#\/schema\/person\/8d9546d987c40be9d6ff61c6512b3a25"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kadircenk.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/kadircenk.com\/blog\/#\/schema\/person\/8d9546d987c40be9d6ff61c6512b3a25","name":"kadircenk","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2023\/02\/ss.png","url":"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2023\/02\/ss.png","contentUrl":"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2023\/02\/ss.png","width":696,"height":696,"caption":"kadircenk"},"logo":{"@id":"https:\/\/kadircenk.com\/blog\/wp-content\/uploads\/2023\/02\/ss.png"},"sameAs":["https:\/\/www.facebook.com\/kadircenk3","https:\/\/www.instagram.com\/kadircenkalpay","https:\/\/www.linkedin.com\/in\/kadir-cenk-alpay","https:\/\/x.com\/https:\/\/twitter.com\/kadircenkalpay","https:\/\/www.youtube.com\/kadircenkalpay"]}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9NbhO-2R","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/kadircenk.com\/blog\/wp-json\/wp\/v2\/posts\/177","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kadircenk.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kadircenk.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kadircenk.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kadircenk.com\/blog\/wp-json\/wp\/v2\/comments?post=177"}],"version-history":[{"count":6,"href":"https:\/\/kadircenk.com\/blog\/wp-json\/wp\/v2\/posts\/177\/revisions"}],"predecessor-version":[{"id":453,"href":"https:\/\/kadircenk.com\/blog\/wp-json\/wp\/v2\/posts\/177\/revisions\/453"}],"wp:attachment":[{"href":"https:\/\/kadircenk.com\/blog\/wp-json\/wp\/v2\/media?parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kadircenk.com\/blog\/wp-json\/wp\/v2\/categories?post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kadircenk.com\/blog\/wp-json\/wp\/v2\/tags?post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}