Page 1 of 1

main menu with a 3d model

Posted: Sun Nov 14, 2021 12:01 pm
by hrohibil
Hello

Sorry if this is probraly a basic unity question.

I am using the Menu frame work extras and i try to add a 3D model to be part of the menu, but what ever i do it is not visible in the camera / game view?


Re: main menu with a 3d model

Posted: Sun Nov 14, 2021 12:43 pm
by Tony Li
Hi,

Screen Space - Overlay canvases always draw on top of everything else. Here are 3 different suggestions:

1. Add a second camera that looks only at the 3D model. Configure it to render to a render texture asset. Then add a UI Raw Image to our canvas, and assign the render texture asset.

2. Or use 2 canvases:
  • Use the first canvas for the title menu. Leave it set to Screen Space - Overlay.
  • Move the background image(s) to a new, second canvas. Set it to Screen Space - Camera. Then you can set its Plane Distance, which is the distance from the camera.
  • Add your 3D model at a closer distance to the camera.
3. Or change the entire menu system canvas to Screen Space - Camera. This will require some adjustment to make everything look the way you want.

Re: main menu with a 3d model

Posted: Sun Nov 14, 2021 1:04 pm
by hrohibil
I want to go with option 1 but it seems i am missing something.

this is my steps:

1: I create a new camera
2:I set culling mask to ONLY my model.
3:I create a Render texture
4: Add the render texture to my new camera
5: Add a Raw Image to the canvas.
6:Add the Render texture to the raw image.

Issue now is that the whole screen fills with this new render texture??

see image

Re: main menu with a 3d model

Posted: Sun Nov 14, 2021 1:20 pm
by Tony Li
Make sure to set the size of your Raw Image UI element.

You may also want to set the render texture camera's Clear Flags to Depth Only.

Re: main menu with a 3d model

Posted: Sun Nov 14, 2021 11:48 pm
by hrohibil
Did the depth part.
How do I change the size of raw image? Scale does not work?

No change.

Re: main menu with a 3d model

Posted: Mon Nov 15, 2021 8:19 am
by Tony Li
Change its Rect Transform like any other UI element. It works the same as a UI Image except it shows a texture instead of a sprite.

Re: main menu with a 3d model

Posted: Mon Nov 15, 2021 4:21 pm
by hrohibil
YES YES it worked.

Is the raw image, can it handle 3d movement? Cause when i play my player object has animation, but for every movement he generates large trails?

IS it only meant for static iamge?

Re: main menu with a 3d model

Posted: Mon Nov 15, 2021 4:50 pm
by Tony Li
Did you set Clear Flags to Depth Only?

Re: main menu with a 3d model

Posted: Mon Nov 15, 2021 5:08 pm
by hrohibil
Yes i did

Re: main menu with a 3d model

Posted: Mon Nov 15, 2021 8:17 pm
by Tony Li
Hmm, you may need to put a background behind the character and set the Clear Flags to Solid Color.