donw.io icon indicating copy to clipboard operation
donw.io copied to clipboard

Comments: Fast, Constant Time Sphere Indexing, Part 1

Open dwilliamson opened this issue 5 years ago • 7 comments

http://donw.io/post/sphere-indexing/

dwilliamson avatar Nov 20 '18 17:11 dwilliamson

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)))
screen shot

redblobgames avatar Nov 23 '18 00:11 redblobgames

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 😄

dwilliamson avatar Nov 23 '18 12:11 dwilliamson

Interesting problem. After playing around a bit I came up with this pleasantly simple method: https://www.shadertoy.com/view/MlVfzG

matthewarcus avatar Nov 24 '18 00:11 matthewarcus

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)

dwilliamson avatar Nov 24 '18 20:11 dwilliamson

Yup, that looks like the business. I've always wondered why people didn't use octahedral environment mappings more.

matthewarcus avatar Nov 25 '18 00:11 matthewarcus

very nice!!! good job)

HeorhiiPotapov avatar Sep 27 '19 12:09 HeorhiiPotapov

cool

Feelcame avatar May 28 '21 21:05 Feelcame