## Archive for December, 2011

### drawing monster

Saturday, December 31st, 2011

### single in rochester, detail, adjusted

Friday, December 30th, 2011

### single in rochester, detail

Friday, December 30th, 2011

### single in rochester

Friday, December 30th, 2011

### i also spend a few hours each day working, #3

Friday, December 30th, 2011

### i also spend a few hours each day working, #1

Friday, December 30th, 2011

### Bounded Biharmonic Weights on back cover of SIGGRAPH Proceedings

Wednesday, December 28th, 2011

An image (the 3D hand) from our paper “Bounded biharmonic weights for real-time deformation” was chosen to appear on the back cover of the SIGGRAPH 2011 Proceedings, ACM Transactions on Graphics.

### Indexing array of uniforms by variable in GLSL on ATI/AMD graphics card

Thursday, December 22nd, 2011

After a month or two of frustration I’ve finally understood why my GLSL vertex shader has been running so slowly on my iMac’s AMD Radeon HD 6970M 2048 MB graphics card. I thought the problem was that when I index an array of uniforms using a variable (attribute), the shader switches the renderer into “software mode” (Apple Software Renderer). To get around this I had a super-hack in my shader that was very slow. I wanted to achieve:

...
attribute vec4 indices;
uniform mat4 T[LARGE_NUMBER];
void main()
{
...
mat4 t =  T[int(indices[0])];
...
}

But since I thought I couldn’t index by a variable I just made a function to index by a variable using if statements:

mat4 T_at_i(int i)
{
if(i==0) return T[0];
else if(i==1) return T[1];
else if(i==2) return T[2];
else if(i==3) return T[3];
else if(i==4) return T[4];
...
}

These if statements, of course, destroyed the efficiency of my shader.

But it turns out that indexing by variable is not really the problem. It was more of a symptom. I had too many uniform components. I shirk some of the blame because ATI returns the wrong number when you ask for the number of components via GL_MAX_VERTEX_UNIFORM_COMPONENTS Rather than the correct number (for my machine 1024) it returns 4 times that number (for my machine 4096). Thus I thought I had no problem with maxing out my allotted uniform memory. This is documented in very confusing language on the
OpenGL wiki and with slightly less confusing language on the answer to my question on stackoverflow.

The point is that when you ask for too many uniforms and you index them by a variable your shader still compiles and you get no complaints, but secretly the graphics card is giving up and making the software renderer activate (super slow). If you don’t index by variable you can use how ever many uniforms you want and the graphics card will still run the shader, but you have to use slow hacks like the one above to act like your indexing by a variable. Finally the “solution” is to use the right number of uniforms (after filtering the number you get when you ask ATI for it by a possible factor of 4) and then you’re free to index them by variables and have the shader run on the card and not in software mode.

### Sha la la or Mama tried to teach me how to tie my shoes but I learned on my own

Tuesday, December 20th, 2011

### Stretchable, Twistable Bones Skinning SIGGRAPH Asia Fast Forward

Tuesday, December 20th, 2011

I presented the above at SIGGRAPH ASIA in Hong Kong last week during the Technical Papers Fast Forward. Each paper gets 40 seconds to present or at least tease their work. Here’s our 40 sec video for our paper “Stretchable and Twistable Bones for Skeletal Shape Deformation” by me and my advisor Olga Sorkine.