Tangent and Bitangent in Custom Shader

Do was have access to these readily in the CustomShader, or will I have to construct them myself?

I was about to jack this:

vec3 random = texture2D(randomSampler, vUV * randTextureTiles).rgb;
vec3 vNormal = normal;
vec3 rvec = random * 2.0 - 1.0;
rvec.z = 0.0;
float dotProduct = dot(rvec, normal);
rvec = 1.0 - abs(dotProduct) > 1e-2 ? rvec : vec3(-rvec.y, 0.0, rvec.x);
vec3 vTangent = normalize(rvec - normal * dot(rvec, normal));
vec3 vBitangent = cross(normal, tangent);
mat3 vTMN = mat3(tangent, bitangent, normal);

but I am not sure about this line:
vec3 random = texture2D(randomSampler, vUV * randTextureTiles).rgb;

Can I just replace with any random function?

So I was not able to make that work.

I tried including the attribute
attributes: [“position”, “normal”, “uv”, “tangent”]
and then passing it as a vTangent to the fx and vx but to no avail as well… it seems the attribute does not get passed with the compilation of the custom shader?

Are you sure the initial mesh data contains tangent values?

Ahhh I thought that the attribute was generated when requested by the shader, so I will need to add it to the models buffer manually?

Yes sir