Tuesday, February 5, 2019

Graphics

I wanted to eliminate my geometry shader so I could brag that my microcode runs fast, but I also wanted to show off my facets. The idea of decorating facets with pictures gave me an aha when I realized it would make rotation about the normal more useful. But for some time I could not figure out how to feed texture coordinates to the vertex shader. Note that duplicating the points was unacceptable to me, not because of memory constraints, but for aesthetic reasons; duplicating points violates topological reality. Since limiting planes to have at most one facet is acceptable to me, disallowing kissing vertices is ok, and facets separate polytope regions from non-polytope regions, I can limit vertices to have at most 3 facets in 3 dimensions. Then the challenge was to get the vertex shader to choose the correct texture color, texture weights, and texture coordinates. I wondered if each facet could be assigned a tag valid for all of its vertices. All the vertex shader need do is lookup its texture vectors by a uniform tag. Assigning a tag to each facet is a graph coloring problem. Using a greedy algorithm, no more than n+1 graph colors are needed, where n is the maximum degree of the graph nodes. Here, graph nodes are polytope facets, graph connections are shared polytope vertices, and graph colors are facet tags. A facet can have any number of vertices, but in 3 dimensions, it can be decomposed into 3 vertex facets. Modify the greedy algorithm to assign the same tag to facets in the same decomposition. Triangle facets have 6 vertex sharing neighbors, so 7 tags are needed. Thus each vertex needs 3 texture vectors, and the tag uniform needs to be changed 7 times.

No comments: