Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How do I render a mesh object on Canvas?

Discussion in 'UGUI & TextMesh Pro' started by HardRoosterLabs, Jun 3, 2020.

  1. HardRoosterLabs

    HardRoosterLabs

    Joined:
    Jun 20, 2019
    Posts:
    14
    I've added a mesh renderer, a material a canvas renderer, placed the object on the UI Layer, still I can't get it to render in game view.

    I'm trying to create a little Procedural character/face/avatar generator, but if I can't render it on the Canvas, it'll be all for naught. It's just a plane of vertices, rigged to bones with various morphs set up to get different head shapes (so far), I spend most of the day getting it functional, now I just need to get it to appear on the Canvas.

    upload_2020-6-2_21-24-55.png
     
  2. ookk47oo

    ookk47oo

    Joined:
    Mar 17, 2017
    Posts:
    80
    Solution1: Set canvas's render mode to ScreenSpace, assign the UI Camera to the canvas and adjust the object's zoffset.

    Solution2 : Use another Camera to render the object on a target texutre and assign the texture to RawImage
     
  3. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    Also check placement order in hierarchy in canvas and hierarchy order overall. I know this is a simple solution but many get caught in this. It is easier to move things around before digging too deep into code or asset problems.
     
  4. HardRoosterLabs

    HardRoosterLabs

    Joined:
    Jun 20, 2019
    Posts:
    14
  5. HardRoosterLabs

    HardRoosterLabs

    Joined:
    Jun 20, 2019
    Posts:
    14
    OK, so I think I figured out how to do the texture rendering bit. I set up a separate camera, and rendered it onto a render texture and that's working fine, the problem I have now is, how do I assign that render texture, or a material with that render texture on it, to a UI element? I can't seem to do anything about the UI Material.
     
  6. HardRoosterLabs

    HardRoosterLabs

    Joined:
    Jun 20, 2019
    Posts:
    14
    Nevermind the last, I mostly figured it out, I didn't see that you could assign a material to a UI Image, so I did that.

    However how, the image is quite dark, even though I have unlit materials on everything.

    Here's the colors I expected.
    upload_2020-6-3_13-29-48.png

    Compared to the color I'm getting:
    upload_2020-6-3_13-30-19.png

    For Material, I chose UI/Unlit/Detail, since any other shader was just rendering a black box.

    Both the skintone and backdrop materials are Universal Render Pipeline/Unlit shaders.

    Edit: Nevermine all that too :p Guess I just needed to type it out. I figured out that the Main Color of the Material I had created was set to gray by default, and it was causing a dark tint sort of effect. I set it to white, and the material now looks correct.
     
    Last edited: Jun 3, 2020
  7. ookk47oo

    ookk47oo

    Joined:
    Mar 17, 2017
    Posts:
    80