Here’s how the problem is currently set-up:
I have a NodePath called m_image.
m_image has a custom shader attached to it.
I utilize m_image.set_tex_scale() to change the uv texture scaling.
However, due to the custom shader, the texture scaling isn’t applied.
I’d like to know what cg variable could be added? to vshader or fshader so that the shader may utilize the 4x4 texture scaling transform matrix.
I’ve researched other possible values, and the best one so far is maybe k_scale?
The goal is to avoid using this:
shaderAttrib->set_shader_input()
Which is an incredibly slow operation.
The texture UV will be scaled and translated in realtime, on a per frame basis, so I think the most optimal way will be to somehow automatically provide the tex_scale_mat to the shader.
Just multiply the uv in the shader by 4 ( usualy named something like vtx_texcoord0 in the vshader or l_texcoord0 in the fshader). If it’s always 4x4 then you can skipp the shader input and hardcode it like that into the shader.
Buried deep within shaderGenerator.cxx, I found where the generated shader gets the tex scale matrix.
It uses “texmat_x” where x is the index of the texture.