• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by Eux86 · Feb 22, 2011 at 11:45 AM · gui3dmodelover

2D Gui Texture under 3D object

Is it possible to render a 3D model in front a Gui Texture?

In the following images you can see the enemy status overlays the player spaceship. What I want is exactly the opposite situation, with the spaceship that stays in front of the enemy status gui.

alt text

alt text

Comment
zinnfandel

People who like this

1 Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Joshua · Feb 22, 2011 at 01:13 PM 0
Share

I was struggling with the same thing a short while ago. Don't have a solution though - but I'll add a point for the correct answer. :D

4 Replies

· Add your reply
  • Sort: 
avatar image

Answer by efge · Feb 22, 2011 at 01:37 PM

You could try to use 2 cameras (untested):

First:
- with GUILayer
- clear to skybox or solid color
- lower draw order (depth)

Second:
- no GUILayer
- clear to "depth only" - higher draw order

Comment
Ashkan_gc

People who like this

1 Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Eux86 · Feb 22, 2011 at 03:04 PM 0
Share

But how to use 2 cameras at the same time?

avatar image efge · Feb 22, 2011 at 09:16 PM 0
Share

Yes! Look at the "Depth only" - section of the reference: http://unity3d.com/support/documentation/Components/class-Camera.html

avatar image Ashkan_gc · Mar 15, 2011 at 01:27 PM 0
Share

voted you up man but try to answer clean and complete. answering 1 question well is better than 5 answers that look like F# code. :)

avatar image raptorkwok · Mar 05, 2014 at 10:36 AM 0
Share

unclear answer. what is "higher draw order" ?

avatar image

Answer by Ashkan_gc · Mar 15, 2011 at 01:32 PM

there are two ways to do this. first of all you can use renderTextures. put the objects that you want to render in GUI in a seporate layer and tell the main camera to don't render that layer if you don't want them to be visible in the main scene. create another camera and tell it to render only that layer "we call it 3dGUILayer". then tell the new camera to render it's output to a rendertexture and draw the texture using a GUI.Label or GUITexture in your scene or even draw it on a GUI.Button or GUI.Label. the second way is to let the second camera (that renders 3dGUILayer) to render it's outtup to the screen but set it's clearing flag to depth only and set it's depth to a lower value to apear on top of the main camera. depth only tells the camera to render a transparent pixel in positions of the screen that it has nothing to render. then set it's position related to what you want to render to get the result that you want. renderTextures are a unity pro feature.

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by Sandidro · Sep 17, 2012 at 05:35 PM

set it's depth to a lower value to apear on top of the main camera. - "Cameras with lower depth are rendered before cameras with higher depth."

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by IzzySoft · Jan 17, 2014 at 12:51 AM

This approach sounds like it will be a headache later on if you decide you want to add allot of different GUI elements, front and back.

Why not invest some energy into finding a 3D Plane approach? See if you could always face the flat plane with a texture towards the camera, then you can re-position that flat plane in front or in the back of the ship?!

Trust me, this will be less of a head ache later on, even if the flat plane texture doesnt look pixel perfect. ;)

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Dispalay a 3d model on GUI 0 Answers

3D Object in GUI 1 Answer

GUI Label follow an object? 4 Answers

3D Object Position on GUI Screen 1 Answer

Animation window but but not in game 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges