Custom attributes in MAT shader confusion

In testing and getting familiar with all POP operators, I came to realize that I never really used custom attributes in a MAT shader for instancing, since I’ve always passed my data manually via textures or arrays. I’m now trying to figure out how to do so and have a silly question.

I thought that if I create a custom point attribute, then I could use it in my shader simply by declaring it as an input, such as:

in float myAttribute;

However I’m not able to properly read it. What am I doing wrong here? :sweat_smile: Find attached an example.
AttributesInShaderConfusion.tox (10.9 KB)

Hello @Darien.Brito
In your example, the attribute in not part of the Sphere POP in the geometry.
To use a custom attribute as a instance attribute, you can configure the 3rd instance page on the Geometry. In your shader, you can reference those custom instance attributes with the TDInstanceCustomAttrib method (See the attached sample)

InstanceAttributesInShader.tox (10.9 KB)

Finally, when you want to access POP attributes in a GLSL MAT, they must be declared on the Attributes page and can be accessed with TDAttrib_AttribName(), for example with an attribute called Test: TDAttrib_Test().

Fantastic! Thank you for the explanation. In all these years I never knew of TDInstanceCustomAttrib. Good to finally know what the Instance3 page is for.

Ah, of course! That makes sense :slight_smile: Just tested accessing the POP attribute in the MAT, passed via the Attributes page. All clear!