Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Vectrosity drawing overlaying the Canvas in Overlay render mode

Discussion in 'UGUI & TextMesh Pro' started by MarcoMeter, Sep 3, 2014.

  1. MarcoMeter

    MarcoMeter

    Joined:
    Jun 14, 2013
    Posts:
    69
    Hi folks,

    I'm working on some kind of feedback for a mouse driven gesture input. I would like to draw a line which represents the mouse movement. The drawing of the line works just fine. But I couldn't get the drawing in front of the UI which is hold by the canvas in Overlay render mode. Screen space mode kind of solves this, but my former dynamic behavior of positioning is getting distorted.

    Is there a reasonable approach to overlay the drawing on the canvas which is in Overlay render mode?


    I'm thankful for any reply!
     
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Overlay always renders on top of everything. If you want to render 3D objects on top of UI elements you'll need to use Screen Space - Camera.
     
  3. MarcoMeter

    MarcoMeter

    Joined:
    Jun 14, 2013
    Posts:
    69
    The VectorLine object of Vectrosity is rendered on a specific camera. Could this provide a point to start out from?

    Is there a uGUI Element where a renderTexture can be applied to?


    edit: got it working now.
     
    Last edited: Sep 3, 2014
  4. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,221
    The RawImage component can accept any texture type. Also, why not write a custom Vectrocity UI component to put the verts right onto the canvas?
     
  5. MarcoMeter

    MarcoMeter

    Joined:
    Jun 14, 2013
    Posts:
    69
    It would be nice to develope such an addition to Vectrosity. But I can't think of a good start for accomplishing this component. I definetly need some inspiration on how to start out.

    edit: But still the Screen Space - Camera mod messed up my current UI Layout behavior. It doesn't react as aspected when I change the screen size.
     
    Last edited: Sep 3, 2014
  6. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Can you provide more details? Preferrably a screencast showing how the behavior is different when using Screen Space - Camera compared to Screen Space - Overlay. They're supposed to work the same layout-wise (except for the effects of perspective if you're not using an orthographic camera).
     
  7. MarcoMeter

    MarcoMeter

    Joined:
    Jun 14, 2013
    Posts:
    69
    The first image shows the drawing behind the overlay. The second one uses the render mode camera.
    I have to reposition the drawing according to the camera's position and I have to change the layer of the VectorLine's camera to make it visible.

    The problem with the camera render mode is that the sword icon in the middle of that squared pattern won't hold its relative location if the screen size gets adjusted. The icon is locked to the lower right edge of the squared pattern. After resizing the screen its far off.

    Furthermore I need to adjust the position of the drawing manually (pretty much fixed, not dynamic).
    Everything works like a charm with the overlay render mode, except the drawing which I want to get on top.

    edit. The sword symbol is moved by mouse input.
     

    Attached Files:

    Last edited: Sep 3, 2014
  8. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    I can't see anything from these pictures of why that would happen. I suggested a screencast where you show the behavior because that is often much more informative than just pictures. You can use Jing or similar. Make sure to show the Inspector and Hierarchy too in the screencast, and show the anchoring settings of the various objects; especially the problematic ones.
     
  9. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    You might ask @Eric5h5 if he has done and/or plans to do this.
     
  10. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,042
    +1

    It would be nice.

    Tim C or runevision. Are you considering to have an API to draw basic stuff like it does Vectrosity? Lines, Circles, etc...
     
  11. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It has UIVertex and SetVertices. So yes that's something I've been thinking about for Vectrosity.

    --Eric
     
    mactyr, Tim-C and runevision like this.
  12. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    This post might also be of interest.

    --Eric