Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
0
Question by Vigil1 · Jun 07, 2016 at 10:56 PM · camerashadercullinginvisiblehide

Is there any way to hide only part of an object from the camera? (unity free)

I have a Virtual Reality scene in which you can see your own characters body. However, the character's face can sometimes be seen through the main camera (mainly when looking downward). This character is a whole model, so limbs, head, etc. aren't separate. Therefore I can't use layers to hide the character's head from the camera. And moving the camera outside the model distorts the view of your character model in an immersion-breaking way. Is there any way I can hide the character's head from the main camera?

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by IgorAherne · Jun 07, 2016 at 11:36 PM

Hacky way, but unless you want to start fiddling with mesh vertex colors in blender/3ds max (to use them to discard fragments in your shader), do the following:

just use transparent cutout shader and make sure the head's part of the texture is transparent. This will mean you'll have problems when looking in the mirror though.

Comment
Add comment · 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
0

Answer by izukingz · Mar 30, 2019 at 01:06 AM

@Vigil1
I know this is 3 yrs now but I ran into this issue and this is the only place i've seen it discussed. This is how I just solved it. First of all I made the camera rotation to rotate the neck of the character only in the x and y direction.

//Camera script
neck.transform.rotate = Quanterion.Euler(transform.eulerAngles.x, transform.eulerAngles.y, neck.eulerAngles.z);

This makes when you look up/down and left/right in the VR, the character neck/head will follow your movement.
The above does not fully solve my issue as you may have noticed. When you look down, the camera rotates in place while the head moves downwards, thereby blocking the camera view. I thought about solutions like clipping the near distance of the camera which is not ideal.
Then i came up with a solution to create an empty object as child of the head and place it just in front of the eyes of the character.
I then map the position of the camera to be the position of this object. Since when the head starts rotating downwards, the object position will change. This will cause the camera position to follow it in turn.

transform.position = object.position;

Hope this helps any other person

Comment
Add comment · 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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

occlusion culling conflict with shader,Occlusion culling conflict with shader 0 Answers

UI masking in a jet fighter HUD 0 Answers

Exclude layer from culling 1 Answer

Invisible effect? 3 Answers

Hiding parts of a mesh 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