HW #4
Hello everybody.
In this phase, I have added texture mapping support to my ray tracer. Also, azimuth can now use bump mapping and perlin noise.
I started with sphere_texture_<DecalMode>_<Interpolation> scenes. Texture blending and nearest neighbour filtering were pretty straightforward but bilinear filtering was a little bit trickier than those. Basically, multiplying UV coordinates with vec2((TexWidth-1), (TexHeight-1)) and using 4 nearest pixels around that point does not give you the correct result.
Then, I tried to implement bump mapping but could not make it work properly. After spending a considerable amount of time, I gave up and moved to perlin noise. At first, I implemented it with 16 gradient vectors which are all known at compile time but results did not look so nice to me. There were some regions where the pattern look repetitive. In order to fix that, I increased the number of gradient vectors to 256 and generated them randomly at runtime. After that, I implemented bump mapping for surfaces with perlin noise. Unlike the previous experience, it worked on the first try.
Finally, I fixed my bump mapping part after the discussion we had in class. Now, it works a lot better. There are still some issues but results look promising. The problem is probably something trivial.
Here are the results:
0.561377s
sphere_texture_replace_nearest (800x800, 1spp)
Thanks for reading.
In this phase, I have added texture mapping support to my ray tracer. Also, azimuth can now use bump mapping and perlin noise.
I started with sphere_texture_<DecalMode>_<Interpolation> scenes. Texture blending and nearest neighbour filtering were pretty straightforward but bilinear filtering was a little bit trickier than those. Basically, multiplying UV coordinates with vec2((TexWidth-1), (TexHeight-1)) and using 4 nearest pixels around that point does not give you the correct result.
Then, I tried to implement bump mapping but could not make it work properly. After spending a considerable amount of time, I gave up and moved to perlin noise. At first, I implemented it with 16 gradient vectors which are all known at compile time but results did not look so nice to me. There were some regions where the pattern look repetitive. In order to fix that, I increased the number of gradient vectors to 256 and generated them randomly at runtime. After that, I implemented bump mapping for surfaces with perlin noise. Unlike the previous experience, it worked on the first try.
Finally, I fixed my bump mapping part after the discussion we had in class. Now, it works a lot better. There are still some issues but results look promising. The problem is probably something trivial.
Here are the results:
bump_mapping_basic (800x800, 36spp)
24.521975s
bump_mapping_transformed (800x800, 36spp)
25.790098s
ellipsoids_texture (800x800, 1spp)
0.553214s
galactica_static (1280x720, 36spp)
273.390717s
killeroo_bump_walls (800x800, 16spp)
38.775715s
killeroo_diffuse_specular_texture (800x800, 16spp)
41.796097s
perlin_types (800x800, 1spp)
1.642415s
perlin_types_bump (800x800, 1spp)
2.330434s
skybox (1600x800, 100spp)
113.496185s
sphere_bump_nobump (800x800, 36spp)
18.231981s
0.561377s
sphere_texture_replace_bilinear (800x800, 1spp)
0.535448s
sphere_texture_replace_nearest (800x800, 1spp)
0.531086s
spheres_perlin (800x800, 36spp)
22.403355s
galactica_dynamic (1280x720, 1600spp)
11652.299805s = 194.205m = 3.237h (It is probably because of an unbalanced workload between threads (i.e. poor threading architecture))
galactica_animated (1280x720, 1spp)
galactica_dynamic (1280x720, 1600spp)
11652.299805s = 194.205m = 3.237h (It is probably because of an unbalanced workload between threads (i.e. poor threading architecture))
galactica_animated (1280x720, 1spp)
Thanks for reading.















Excellent!
ReplyDelete