Adjusting texture colour

Hello,

I have a texture that occur several times in my game, with the only change being its brightness (or colour tint in general). Ideally, I would like to repurpose the texture file and just adjust its pixel values.

What would be the best way to change values within textures? I cannot seem to find a simple solution. Would I need to create a shader or load the texture as an array? Or would the simplest solution be to just have a slightly darker texture being loaded?

Thanks a lot :slight_smile:

One solution might be to set the “colour-scale” of the NodePath to which the texture is applied. Something like this:

# Tint the object green
myNodePath.setColorScale(0, 1, 0, 1)

(The parameters to “setColorScale” are, in order: red-scale, green-scale, blue-scale, and alpha-scale. There is also a variant of the method that takes a single “Vec4” in place of those four separate parameters.)

1 Like

Thanks a lot :smiley:
Exactly what I was looking for. Works like a charm!

1 Like