Fantastic; change material properties in realtime using video textures.


Note; Code based on an example here

For a long time I figured that there was little you can do to edit such fine aspects of a material in the BGE such as specularity, simply because the functions that did those did not work in GLSL, it almost seemed like you would need to go to another engine to have games with neat looking material changes.

However, people who figured that it was the case is wrong (thanks to what is possibly a little known fact about the possibilities of video texture).

In the .blend, once unzipped, use the left and right arrow keys and watch the specularity get rougher, the specularity get dimmer, and the color more blue in realtime and in GLSL (with no vertex color tricks, replace mesh tricks, or any other hacks or workarounds). I have found that any material property that can be manipulated by a normal texture can be manipulated by a video texture as well.

Have fun. :slight_smile:

Fantastic indeed. Would other objects need to have the same logic as the cube or is this more like a manager for controlling multiple objects?

Can you use a video, to control how a video is blended?

Uploaded a new version that’s a little easier to use.

The only limitation I know of is that the effect is global for all objects containing the same material. To get different effects on different objects, use the ‘make single user’ option for both the material and the texture that is overridden (and what really helps, you don’t need duplicates of the source images).