Add custom attribute to CustomMaterial

Hello,

i am trying to add custom vertex attributes to my CustomMaterial, but only existing attributes are being sent to the vertex shader.
Here is my PG. I’m just copying uv coordinates to uv6 and try to use them in the shader, however they are not sent.

material.getEffect().getAttributesNames() = ["position", "normal", "uv"].

Is there any way how to add them? Or should i use ShaderMaterial and copy StandardMaterials vertex and fragment shaders and modify them?

Thanks
L

1 Like

Pinging @nasimiasl who is the author of the CustomMaterial

You can’t currently do it, but this PR should help:

3 Likes

Looks exactly like what i was looking for :wink:

I have updated my PG.
Works nicely, thanks.

1 Like

Hi, all! I was looking into adding an attribute as well, and I noticed that ludevik’s excellent example works for Babylon 4.2 but not for 5.0.

I’m attempting to troubleshoot my way through the materials and shaders to see why this might be the case, but I haven’t hit gold quite yet.

Any insight into what might be preventing the PG example from working with 5.0?

Thanks all,
Dacoda

1 Like

Check this post by @Evgeni_Popov:

Just remove the declaration of uv6, i’ve updated the PG for you.

3 Likes

Brilliant! Thank you for your quick response :heart:

1 Like