Re:Hallucinations re: the rendering of Cyberpunk 2077
by corysama on Thursday December 17, 2020 @05:34PM
(#25461410)
That 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.
Re:Hallucinations re: the rendering of Cyberpunk 2077
by atum47 on Thursday December 17, 2020 @06:03PM
(#25461674)
yeah, 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.
Re:Hallucinations re: the rendering of Cyberpunk 2077
by 936936 on Thursday December 17, 2020 @05:42PM
(#25461483)
Your 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.
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?