Simple example of painting straight onto a mesh with a shader.
PaintMe.csto any mesh with a
- When the user clicks, a raycast will try and find any object with
- When this is called we grab the UV's where we hit (note: some untextured objects will only have
0,0for a uv!) and start painting
- The first time, a
RenderTextureis setup, copies the texture from the material on us (or clears a colour if no texture) and assigns itself to the material
- then (and on subsequent hits) it will set a point to draw a circle at on a shader, then do a blit onto the existing texture
Not the MOST effecient way, but a thousand times better than using SetPixel. And now you can do shapes, masks, gradients, wobbly effects.