I have a constant table (256 float values) stored a noise function for the shader to generate some random effects. What are the available ways to pass this table to the shader effectively ?
It seems array passing is not supported in setShaderInput. If I pass it through a texture, how the shader code address it precisely ?
Just have a thought, to generate the table in Cg format and combine with the original shader to make the final shader.
Any other advice ?
In addition to the first question, I would like to create a normal map texture on the python side, which will be affected by some user actions, and this normal map will be sent to a shader in each frame. What functions can I use to manipulate the texture at pixel level and send it to a shader effectively ?
Usually, this is done by passing a noise texture to the shader.
If the noise function is not static, how can I do it effectively in Panda ? I would like to modify the noise texture on the fly and send it regularly to the shader. What are the functions available to do these ?
Well, it’s possible to send an animated texture. However, I rather recommend passing a salt to the shader that offsets the pixel that’s being read from the static noise texture.
I have made the situation confusing. May be I should re-state what I want to do.
I would like to create a normal map on the panda side. This normal map will be changed dynamically according to some user input (e.g. some dragging a mouse). The shader side will need this updated normal map to render the scene.
How can I modify a texture dynamically (after it is loaded to panda) ? Is there any efficient api I can use ? I can modify a png through other api dynamically but reload to panda regularly may not be efficient enough.
How can I send this updated normal map to a shader efficiently, (this normal map may be changed every frame) ?