• 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 kirypto · Dec 27, 2016 at 04:20 AM · c#cameraclipping plane

How do you set up a 3D object so that when you slice it with the camera's clipping planes, it is solid?

I am attempting to create a toggle-able mode on my camera so that it shows a 2D slice of the 3D objects in the world. I found a question similar to t$$anonymous$$s. In fact, I t$$anonymous$$nk it is my exact question, except I do not understand the answer.

My scene is fairly simple: The camera, and a sphere at (0,0,0). If I set the camera's clipping plane to only show one unit along the z axis at 0. I would like a set up so that a circle is drawn. How would I ac$$anonymous$$eve t$$anonymous$$s?

Comment
AlwaysSunny

People who like this

1 Show 2
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 UnityCoach · Dec 27, 2016 at 12:50 PM 0
Share

Camera clipping won't do this.

Shaders is the way to go I believe.

avatar image tanoshimi · Jan 02, 2017 at 08:08 AM 0
Share

The words noone has yet mentioned that might help you to search for are "cutaway" or "cross-section" shaders. There's several examples on the forums as well as elsewhere on the net.

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Adam_Myhill · Dec 28, 2016 at 05:05 AM

I'm not sure the camera clip plane is the best method to ac$$anonymous$$eve the look you're going for.

The fact is, that sphere isn't solid. Cutting it with the camera's near clip will just expose the backfaces of that hollow geometry. You could draw it again with a second render pass (like the link you shared) or give them a shader w$$anonymous$$ch is a constant value so it appears solid but it won't have any shape to it.

If you want it to look like it's actually holding light / has any illumination falloff, you'll need geometry to 'hold' that light, so maybe look at animating the model instead.

Comment
kirypto

People who like this

1 Show 3 · 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 kirypto · Dec 28, 2016 at 06:35 PM 0
Share

So I have a couple additional questions for you:
1) You mentioned "give them a shader which is a constant value so it appears solid...". Would you be able to explain this a little further? I am still new enough to unity to not know what it means.
2) You also said that cutting it "will just expose the backfaces...". For some reason, when I near clip mine, it does not show the inside. (The far clip is set to a very large number) Any idea why this is?
3) I don't think I need to care about lighting. I'm doing a fairly constant/even lighting across everything anyway

If it helps, I found an animation of the type of thing I am wanting to do, which is taking a 2D slice of a 3D object. Unfortunately, I can only find a video, and not a gif. I have made the link go straight to an example though. It is slicing 2D cross-sections from a 3D balloon. In my case, imagine the balloon (or sphere) was crossing the z=0 plane, so my camera would render a similar animation as the video. Here is the link.

Finally: For any of the above explanations, if you would rather send a tutorial link, I am more than okay with that! :) I tried a quick Google search, but don't know what to look for. Secondly, if you have a recommendation on a completely different approach to solve this, I would be happy to hear it. I went with this as it was my only lead.

avatar image Adam_Myhill kirypto · Dec 30, 2016 at 10:38 PM 1
Share

Hi, answers to your questions:

1) A solid / emissive shader will just appear a particular set colour - it won't show the light fallof of the inside of the object, so you can maybe get away with that because the constant colour won't reveal that you're just looking at the inside of the object. The outside and inside are the same - it's all one colour.

2) by default, Unity doesn't render the back sides of polygons. You could put this script on your objects which will make Unity draw the backfaces. It will look like you're seeing the inside of the object though which may be weird and that's why I mentioned the constant shader of answer #1

3) that's cool then, you might get away with it.

Try that link, mess around with 'Emissive' shaders on the object and see if that works out. Good luck.

avatar image kirypto Adam_Myhill · Jan 02, 2017 at 03:46 AM 0
Share

Awesome. Thanks for the clarifications and explanations. I'll take a look at that script and the shaders. Whether or not I can make it work, I thank you for the help you've given me in understanding.
Cheers!

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

9 People are following this question.

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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Rotation seems to pass through condition checks 1 Answer

How do you position an object relative to the camera? 0 Answers

I need help with TPS controls! 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