donw.io
donw.io copied to clipboard
Comments: Fast, Constant Time Sphere Indexing, Part 1
http://donw.io/post/sphere-indexing/
Cool article! Minor suggestion for less distracting colors:
if (tri_index == 0) debug_colour = vec3(0.7, 0.5, 0.2);
if (tri_index == 1) debug_colour = vec3(0.6, 0.7, 0.2);
if (tri_index == 2) debug_colour = vec3(0.2, 0.7, 0.2);
if (tri_index == 3) debug_colour = vec3(0.2, 0.7, 0.6);
if (tri_index == 4) debug_colour = vec3(0.2, 0.5, 0.7);
if (tri_index == 5) debug_colour = vec3(0.3, 0.2, 0.7);
if (tri_index == 6) debug_colour = vec3(0.7, 0.2, 0.7);
if (tri_index == 7) debug_colour = vec3(0.7, 0.2, 0.3);
It makes the outlines around the cyan and green triangles easier to see. (I generated the values with python code and then tweaking)
import colorsys
for a in range(8):
print("if (tri_index == %d) debug_colour = vec3(%.1f, %.1f, %.1f)" % ((a, ) + colorsys.hsv_to_rgb((30 + a*360/8)/360.0, 0.8, 0.8)))
Ahh, thanks for trying this out but I think I prefer the original colours.
<scrolls up> My eyes! 🙈
I think I'll add your colours 😄
Interesting problem. After playing around a bit I came up with this pleasantly simple method: https://www.shadertoy.com/view/MlVfzG
Good job! You hit on the exact method I'll be covering in part 2 :smiley: It's very similar to Octahedron Normal Encoding, which was how I stumbled on it myself.
(code here: https://gist.github.com/dwilliamson/efe4c2e09ad0c223be8e)
Yup, that looks like the business. I've always wondered why people didn't use octahedral environment mappings more.
very nice!!! good job)
cool