Search Unity

VR drawing

Discussion in 'VR' started by ToastBubbles, Jul 23, 2019.

  1. ToastBubbles

    ToastBubbles

    Joined:
    Aug 18, 2018
    Posts:
    2
    So I am planning on adding a VR drawing feature to my project, but there are a few aspects that I am not sure how to tackle.

    So I would like to do a Rec Room style marker that you hold and when the tip touches a surface, it leaves a mark behind, and there is also going to be an easel that the user can draw on, and when saved/applied, it can be used as a texture for other objects.

    I understand most of the functions of setting it up, and saving the texture, but the two parts I have no idea about are:
    What is the best method to use to physically draw lines on things when the marker contacts them
    and
    How to save the PNG texture with a transparent background (the parts that are not drawn on remain invisible)

    My current idea would be to just instantiate thousands of small colored planes that would then be captured by an ortho camera as a texture, but that would be messy and again, I'm not sure how to get an Alpha background out of that.

    If I get it all figured out, I'll be happy to make a quick video tutorial for any future devs!
    Cheers!
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    :eek:

    I'd suggest you use PixelSurface (see my sig), or if you want to do it all yourself, make a Texture2D and use GetPixels and SetPixels to write to it.

    Best,
    - Joe