• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code [Shader] vertex_format_add_custom

Hello community!

I'm having trouble using vertex_format_add_custom(). I know there have been trouble using it before but now I can't even use my workaround from GMS 1.x.

Using the following code will throw an error in the console "Draw failed due to invalid input layout"
vertex_format_add_custom(vertex_type_ubyte4, vertex_usage_blendindices)
vertex_format_add_custom(vertex_type_float4, vertex_usage_blendweight)
Changing it to the following make will at least draw the model but the vec4 seem to be set to 0,0,0,0.
I've confirmed this by hardcoding the values directly in the shader to see that the other part of the shader is working correctly.
vertex_format_add_custom(vertex_type_ubyte4, vertex_usage_texcoord)
vertex_format_add_custom(vertex_type_float4, vertex_usage_texcoord)
I've also tried with vertex_usage_color without any luck.

Does anyone know if there is a way to get this to work (would love to actually use vertex_usage_blendindices becouse it looks so nice :)) or a workaround to at least get this working.

Thank you!
(A reply from a legend, my lucky day! :D)
Thank you for your reply!
I actually filed a bug report today, I will keep an eye on it and post back here.

I however just figured out a workaround, it's quite ugly and will lose precision on the weights but i think it will work for now.

Vertex format
vertex_format_add_color() //index
vertex_format_add_color() //weight
Vertex buffer
vertex_color(vbuffer, make_color_rgb(
vertex_color(_o.m_buff, make_color_rgb(
bone_weight[0] * 256,
bone_weight[1] * 256,
bone_weight[2] * 256),
attribute vec4 in_Color1;
attribute vec4 in_Color2;
in_Index = floor(in_Color1 * 256.0 + 0.5);
in_Weight = in_Color2;