realtime texture painting

Hi all!

here is an example of realtime texture painting in BGE.

following these commits
i was interested in setting up a paint engine in the BGE using Buffers and VideoTexture. As documentation is sparse I contacted Benoit Bolsee and he was kind to share this resource.

It uses VideoTexture.Texture and the textures source is set to a VideoTexture.ImageBuff. A brush (a simple bytearray in this case) is then plotted into the ImageBuff at a specified UV location (which is taken from the mouse sensors hitUV in this case).

I will elaborate this more in the comming week (kinda got eraser and layers working now). Plotting images instead of bytearrays for dynamic damage also comes to my mind.

Hope this is useful and the starting point of some more documentation on this powerful feature. And thax again Benoit!


testTexPaint_25.blend (99.4 KB)

Cool, thanks for share!

I was thinking about implementing this using the bge.texture / VideoTexture module. Nice job.

Huh, lovely!
Great job, thank you!

Interesting. I tried a few colors and brush sizes. Got a little bit of scintillation at the edge of the strokes.

very cool! i have been looking for this for a very long time. however, if you duplicate the object, you’ll paint on both at the same time. this is rather unusefull if you have many generic object. is there a possible work around for this?

do you now a tutorial for make brush ??

Haha, you could make an RPG Character Setup and paint the Tattoos by yourself onto the Characters Face and Body! : D

Here are some other ideas:

Water "splashes, a color texture on top of the normal map.
a bouncing ball, darken and fade areas that come into contact with floor (just for fun)
Blood on a sword?
Blood on walls? (get a ray from a FPS gun, then expand the hit UV list by a factor in a radius

I want drawing footstep on the normal map

how to draw a texture?

Hi 2D23D,
that’s really nice work. Thanks for sharing. :yes:

Is it possible to save the painted texture as an image during runtime? How would one implement that?
Many greetings.

This is exactly what is needed to light in real time :slight_smile:
Dynamic paint mapped to emission :slight_smile:

someone huuuuuurrrry up and code this :slight_smile:

“I’m helping, I love you, peanuts will kill me” -Bizarro Quinn sealab 2021


I’m having a problem :c
when I draw on one part/section of the torus it draws the it on different sections and not on the place where I clicked

help, please? :frowning:

You should recognise that problem!
The image coordinates need setting to UV in the texture window

that was the first thing that came to me when I saw the problem. However, it doesn’t seem to be the problem

also, I did not change anything from the file 2d23d included, I simply pressed P and started drawing, but it doesn’t seem to be a problem to other users except for me

That’s not it. Go to the Properties panel -> Textures -> set mapping to UV not global.

Stupid me XD
thanks a lot c: it works now!

how would this be used to have a better bullet hole effect?