Creating a 3d gui

Is there a way to display 3d objects on the gui? I was thinking about a second camera with a higher depth and adding in some kind of green screen shader possibly? Not sure if it’s at all possible to accomplish. Has anyone else done this before?

5 Answers

5

You can have a secondary camera in your scene and set its Clear Flags to “Depth Only”. Place the objects that you want in front of that camera and simply have it enabled while playing, along with your normal camera. The achieved effect looks like this.

[9115-ss+(2013-03-20+at+03.15.51).png|9115]

[9116-ss+(2013-03-20+at+03.17.16).jpg|9116]

Amazing!!!! Works like a charm, just what I needed. Thank you so much!

NGUI supports 3D UI elements.

Not looking to buy anything.

Yes, you can make a 3d GUI by going into GameObject = Create Other = 3DText. Hope that helps.
Cheers.

3d text is not what I'm looking for. I'm using 3d models as the gui elements.

If you are using 3D models for you GUI you would just make some script attached to them that makes them follow the Camera (maybe also turn based on Mouse X position). Then when you click on them OnClick() would be called and you do whatever you want it to do, or you could do Physics.Raycast() in a specific GUI Layer to make sure that it does not hit any or your in game objects

The issue is if the 3d elements are infront of the main camera then they can clip through terrain and objects. Seeing why I need then displayed on another camera.

Oh I see.. Im working with NGUI myself, so this is my best answer to that. Either way you would need to look into how you would render information from an extra camera into the main camera

I need some kind of green screen effect pretty much

yeah... well maybe use http://docs.unity3d.com/Documentation/ScriptReference/Camera.Render.html and have it adding onto the current camera's image. don't know if possible though

Ya I'm a little confused by that :/ I know render to texture would work but that's a pro feature

gameObject-Create other- GUI texture, and put an image of what you want

That has nothing to do with displaying a 3d model on the screen as apart of the gui. I need to be able to display 3d elements on a second camera and create some kind of green screen effect to display ontop of the first camera.