Dynamic Image Shader Inputs

I have a texture that is in effect a heightmap (plus other info in various colour channels).

I use this texture as a shader input for my terrain, the grass layer, the tree layer and a clutter layer.
(These shaders are attached to various models in the scene)

What is the most efficient way in panda3d for me to change a given pixel colour in the heightmap texture and have this change propagate to the various shaders/models?

I intend to use this to dynamically alter various aspects of the terrain/clutter in realtime.

Any help much appreciated, thanks.


you can set textures directly as a shader input, something like this (in c++) but I am sure this works in python as well.

//Init and shader setup
PT(Texture) myTex;
myNodePath.set_shader_input("ProceduralTex", myTex );

//generate texture i.e. from an offscreen buffer/parasite buffer

//in an update loop update your texture

also you dont need to resend/reset the texture every frame on you shader, just once on Initialization.
The shader input will have the updated texture “myTex” always as an input every frame.

Don’t know if that makes sense to you what I wrote here :slight_smile:

in regards to write into your texture I think panda has some handy interfaces for this

I hope that helped a bit.

Your link did the trick…thanks