3 ms·
I get the concept because I used to be a 3d artist... But when it comes to program this... A static model I just copy it's vertex position to a buffer, right?
by atum47 6y ago
I get the concept because I used to be a 3d artist... But when it comes to program this...
A static model I just copy it's vertex position to a buffer, right? So when there's a bone animation I just update the vertex in my models and the copy it again to the buffer, for every frame?
- 936936 6y agoYour vertex buffer should hold indices for which bones influence the position of each vertex and by what fraction. Each vertex could, for example, have 4 indices and 4 floats to indicate these values, and these only need to be uploaded to the gpu once. The transformation matrices are interpolated for each rendered frame using the hierarchial animation data and the computed matrices are uploaded to the gpu in a buffer. The matrices are accessed in the vertex shader by indexing into the matrix buffer to calculate the vertex position.
- brundolf 6y agoAh, I misunderstood. Yeah I've never actually implemented it myself :)
- corysama 6y agoThat can work. But, it's slow. The way this has been done is to not modify the buffers and instead do the work in the vertex shader. The vertex shader sends the skinned verts straight to the triangle rasterizer and then then are never needed again. So, no need to read-modify-write the buffer just to have the rasterizer read it back again.
- atum47 6y agoyeah, I figured that should be a better solution. I was using ThinMatrix [1] videos as guidelines when I was creating my engine. I'll take a look in how he implemented animations. Thank you. 1 - https://www.youtube.com/user/ThinMatrix https://www.youtube.com/user/ThinMatrix
- BearOso 6y agoNo, you'll generally pass the relevant bone information and desired transforms to a vertex shader, and that computes the new positions.