Page 1 of 1

Set Custom Attributes in GLSL Mat for Render Pick?

PostPosted: Thu Jan 10, 2019 6:10 pm
by lucasm
I am attempting to set Custom render pick attributes via a GLSL Mat, but seem unable to do so.

Image

I've read through https://docs.derivative.ca/Write_a_GLSL_Material and noticed that this struct:

Code: Select all
TDPickVertex {
   vec3 sopSpacePosition;
   vec3 worldSpacePosition;
   vec3 camSpacePosition;
   vec3 sopSpaceNormal;
   vec3 worldSpaceNormal;
   vec3 camSpaceNormal;
   vec3 uv[1];
   flat int instanceId;
   vec4 color;
} vTDPickVert;


can be modified after calling TDWritePickingValues(); like this:

Code: Select all
TDWritePickingValues();
vTDPickVert.sopSpacePosition = newPosition;
vTDPickVert.worldSpacePosition = uTDMats[TDCameraIndex()].world * vec4(newPosition, 1.0);
vTDPickVert.camSpacePosition = uTDMats[TDCameraIndex()].worldCam * vec4(newPosition, 1.0);


However I can't find a syntax or convention for addressing those custom attributes..

Is it possible to address them at all as in, they are simply not documented? or is this not possible through GLSL materials?

I should note, I am able to still pass custom attributes through the glslMAT via the point SOP pre shader.. that works just fine, so the data is getting through, I just can't set it manually.

Re: Set Custom Attributes in GLSL Mat for Render Pick?

PostPosted: Mon Jan 14, 2019 7:27 pm
by malcolm
Sorry, those end up in
Code: Select all
vTDCustomPickVert
instead of
Code: Select all
vTDPickVert
. I'll update the help

Re: Set Custom Attributes in GLSL Mat for Render Pick?

PostPosted: Mon Jan 14, 2019 7:34 pm
by lucasm
Awesome thanks for the tip!