Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 crushy · Aug 18, 2012 at 02:12 PM · cameraclipnear

Near plane clipping by object

Hi, I was wondering if there was a way to make the unity camera's near clip plane clip by object and not by "faces".

Our reasoning for this is that we want to create a 2.5D platformer where the player can look at the level in the distance and it seems normal to him. However, upon reaching the actual area, he is only able to see objects between the far plane and the near plane of the camera, so his view of the character isn't obstructed. Due to the way near clipping works however, some of those "hidden" object's geometry can very easily show up. Ideally we want unity to simply not draw objects that have any vertices between the near clip plane and the camera.

Hopefully this image should help someone understand this better: the selected corridor is not meant to be shown as the player moves through this corridor, only after he leaves it. However, if we tilt the camera in a certain way, bits of it's geometry can pop up unwantedly during gameplay.

alt text

theproblem.png (52.4 kB)
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
2
Best Answer

Answer by ScroodgeM · Aug 18, 2012 at 08:26 PM

solution 1 - trigger

make s trigger in front of camera. trigger should be attached to camera GameObject to move with it. size and position of trigger should be from camera to player zone to be covered. disable renderers of all objects that comes to trigger, enable again on exit. playing with different trigger forms and sizes can solve your issue

solution 2 - calculations

like solution 1, but use simple calculations. for example, checking distance from camera to object and comparing it with conditions to disable or enable.

solution 3 - shader clip

shader can clip drawing too. in shader you can make a clip plane effect, but the clip plane can be any, not only perpendicular to camera's view

http://docs.unity3d.com/Documentation/Components/SL-SurfaceShaderExamples.html (search for slices word)

solution 4 - spherecast

spherecast will return you all objects that are placed in some space, for example in space between camera and player. get it and disable

Comment
Add comment · Show 1 · 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 Bunny83 · Aug 18, 2012 at 08:59 PM 0
Share

I recommend solution 4 ;)

+1

avatar image
1

Answer by Dragonlance · Aug 18, 2012 at 08:44 PM

Maybe you should try to not let that happen by having more camera control, or you will end up with performance leeching "having everything in colision boxes" or custom shaders for everything.

I am sure you can find an exiting looking camera drive for this situation.

Comment
Add comment · Show 1 · 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 crushy · Aug 18, 2012 at 10:09 PM 0
Share

That's something we're worried about right now as we're currently using "building blocks", each with their own mesh collision, to create levels as we still haven't found a better method. We're currently trying to limit this by using layers.

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

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

largest reasonable camera view distance? 1 Answer

How to make camera position relative to a specific target. 1 Answer

Near/Far camera problem 0 Answers

Grow up the farclip in C# 1 Answer

How to use 2 tk2dCameras, the 2nd one with "viewport clipping"? 0 Answers


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