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 luniac · Dec 12, 2014 at 02:24 PM · camerabackgroundculling

make camera background cull everything

I attached a screen shot of my game running at a resolution where theres extra space at the top and bottom. How do i make it so that anywhere the camera background is exposed, it will render above any gameobject? Really not sure how to accomplish this considering my background texture has to be above the background camera, but all the objects i want to cull are above the background texture so how can i make them go behind the camera background...alt text

capture.png (78.5 kB)
Comment
Add comment · Show 4
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 MrSoad · Dec 12, 2014 at 02:31 PM 0
Share

Hi could you not just add some black border objects that are placed above the height of the objects you want to hide?

avatar image luniac · Dec 12, 2014 at 02:38 PM 0
Share

ah yes i forgot to mention that since i'm publishing to iphone and android, there could be different size borders depending on the aspect ratio, both on the vertical and horizontal sides.

I know i can technically cover all the different aspect ratio and create black border objects for each one, and then at the start of the scene deter$$anonymous$$e what aspect ratio the game is running at and enable the proper border objects....

but i wanted to check if theres a simpler solution...

avatar image MrSoad · Dec 12, 2014 at 02:46 PM 0
Share

It does not matter if your border goes off the side of the screen, so just make each border big enough to make sure that everything is covered regardless of the aspect ratio.

avatar image luniac · Dec 12, 2014 at 04:02 PM 0
Share

not sure what you mean, depending on the resolution i may have to cover less or more because of how the background texture fits into the screen.

For example: at 480x854 FWVGA resolution you get the screenshot i posted. at 320x480 HVGA resolution you get no black bars on the top and bottom at all, but ins$$anonymous$$d a little on the sides:

alt text

capture.png (45.6 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by MrSoad · Dec 12, 2014 at 04:35 PM

The Dimension(Aspect Ratio) of your play field(BG Texture) seems to be constant. So download the image below, import it into Unity, in it's import settings set Alpha Is Transparency to true, place this on a Quad with a Transparent Shader. Now stretch the Quad until your play field(BG Texture) fits perfectly in the transparent window of the texture.

Now hopefully this will mask the borders regardless of the display aspect ratio.

alt text


border_mask.png (3.0 kB)
Comment
Add comment · Show 5 · 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 luniac · Dec 12, 2014 at 06:34 PM 0
Share

thanks that did the trick, i just used it as a sprite. now im running into a totally different problem of objects being trigered as "visible" to the camera while they're still in the mask zone :) so they're invisible to the player but the camera still detects them and makes them interactable. Almost perfect though!

avatar image MrSoad · Dec 12, 2014 at 06:41 PM 0
Share

Not sure about how to fix your new problem but will let you know if I think of anything :)

That is odd, you have accepted the question but it is not showing as such on any page other than this... Not seen that happen before...???

avatar image luniac · Dec 12, 2014 at 06:49 PM 0
Share

server issues probably.

Anyway i found another thread with a efficient solution http://answers.unity3d.com/questions/437116/onbecamevisible-question.html

i just have to convert it to 2D form and should be good to go.

avatar image MrSoad · Dec 12, 2014 at 06:53 PM 0
Share

Good, it's always nice when you find a solution easily :)

avatar image luniac · Dec 13, 2014 at 01:39 PM 0
Share

uh oh just realized that since a solution uses a raycast id need a collider attached to the black part which doesn't really work with the image with a transparent middle.

BUT i also realized that you were right before in ur previous suggestion about black border objects!

I just snapped 4 wide black boxes on all 4 sides of the main game view and added box collider to each, and it works just fine :) I got confused before.

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

26 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Dynamically instantiated game objects not showing in main camera (with background camera) 3 Answers

Camera Culling mask/ background color issue. 0 Answers

Why can't I see my objects in the scene view when adding a background image and a background camera? 1 Answer

I'm having trouble with Color.Lerp() 0 Answers

Two Levels of Directional Lighting For Different Cameras 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