Download

Painting textures in real time?

I am curious how one would go about making a surface that can be drawn on in real time. I’m thinking of something like the whiteboard in Duke Nukem Forever where you could use the marker to draw stuff on it.

Are you talking about painting textures or something like being able to draw in-game?

An example would be to pull up a map in game and draw on top of it. Leaving notes and such that will always be saved. I assume that would be painting a texture in real time which would overlay ontop of the map.

I could be wrong though

Well, I am not sure how you would do it in the Engine, but have some questions that might help others know what you are looking for.

Do you need more than one color? If not, couldn’t you just use an editable mask? Could you simply define where the user is likely to draw, and use a texture ahead of time?

A typing interface may be better if you expect notes to be longer than very short words. Or, you could give premade phrases they can stamp down on, in which case you could use texture coordinates to match a mask you have for that purpose.

Is it important that it is handwritten by the user? And, will it be done on any 3D object, which requires different strategies than a flat 2D object?

Well he was refering to the whiteboard in, so actual drawing. This is what you’re able to achieve with some (well, much) artistic skill on the Duke Nukem Whiteboard:

I would also like to know how this is done. RUST and now ARK have a form of drawing boards in the games as well as Duke Nukem Forever.

For me personally, I’m not so much concerned about painting pictures, but being able to “paint” an alpha mask at a hit location from a line trace in real time to reveal a layer of a material, which I believe would actually use the same principles as painting on an object/material in real time. If I am off topic, I am happy to create a new thread, but seems like this is all relevant to the topic anyway.

I think that ultimately, it will be a matter of getting hit location from a line trace (or click location), getting material from the hit actor, converting the hit location to UV coordinates on the material, and somehow altering the pixels on a mask on that material, or in the case of painting colours, adding colour to a blank texture which would blend with the diffuse, specular, normal etc (depending on complexity of paint material).
It’s the “how” part that has me a bit stumped, and I believe it must be done with some coding, not via blueprints like I’m trying to do.

I stumbled across these links which may be of some use:
https://answers.unrealengine.com/questions/25594/accessing-pixel-values-of-texture2d.html#answer-73443

A while ago I also stumbled across this cool video of real-time per-pixel painting in UDK/UE3 for interest :slight_smile:
https://www.youtube.com/watch?v=R1B3VCMhE4I