• 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 sean · May 06, 2010 at 08:46 PM · renderingscalingcubemap

accelerated narrowing-with-distance of objects cubemap?

I'm playing with a hack of the Island Demo that has me more or less looking at the world through a real-time cubemap. I just noticed that objects like the palm trees seem to rapidly narrow themselves into invisibility past a certain distance. For instance, I can back away from the beach up a mountain path and at some point each tree-cluster individually will start rapidly shrinking on x and/or z while retaining its proper-for-distance height, before popping out entirely. The cubemap camera is set to the same clipping depth as my main camera (2000), and yet the main camera renders fine from the same position.

I could see this being a Unity optimization to discreetly reduce the amount of content rendered to cubemaps. I could also see it being a bug in the cubemap render transforms that hasn't been caught because most folks aren't pathological enough to be using a real-time cubemap as their primary view of a world. Anyone have any idea what's up?

Comment
Add comment · 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 sean · May 06, 2010 at 08:54 PM 0
Share

To reproduce: In the Island Demo, try putting the Reflective Bumped Unlit shader on a flat plane in front of the camera and adding the real-time cubemap script from the manual (disable the water layer from the script's rendering set, and up the cubemap resolution to at least 512 if you can). This will give you a rear-view-mirror. Cross the bridge and continue down the path to the heron beach and hang a right up the mountain. $$anonymous$$eep an eye on the trees behind you as you walk up- past a certain point they will very clearly flatten themselves along a horizontal axis...

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by sean · May 11, 2010 at 06:35 PM

Hm. Suspicions confirmed- the objects are flattening themselves to bilboard against the heading of the rendering camera. Popping a cam.transform.rotation tweak into the UpdateCubemap function:

function UpdateCubemap (faceMask : int) { if (!cam) { var go = new GameObject ("CubemapCamera", Camera); go.hideFlags = HideFlags.HideAndDontSave; go.transform.position = transform.position; go.transform.rotation = Quaternion.identity; cam = go.camera; cam.farClipPlane = farClippingPlane; // don't render very far into cubemap cam.enabled = false;

 //cam.cullingMask = ~(1<<4) & m_ReflectLayers.value; // never render water layer
 //cam.cullingMask = ~(1<<8) & m_ReflectLayers.value; // never render self
 cam.cullingMask = m_ReflectLayers.value;
 //cam.depth = 2;

}

if (!rtex) { rtex = new RenderTexture (cubemapSize, cubemapSize, 16); rtex.isPowerOfTwo = true; rtex.isCubemap = true; rtex.hideFlags = HideFlags.HideAndDontSave; renderer.sharedMaterial.SetTexture ("_Cube", rtex); }

cam.transform.position = transform.position; cam.transform.rotation = transform.rotation; cam.RenderToCubemap (rtex, faceMask); }

seems to eliminate the visible symptom (yeah, there are some extra commented-out lines in there that I was playing with to solve ~other~ issues).

I'm still curious as to why the engine does this to begin with, and whether it happens on all renders or just cubemap renders...

Comment
Add comment · 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 sean · May 11, 2010 at 06:40 PM 0
Share

Er... this solves it for ~my~ purposes, anyway. It won't help if your environment map needs to be correct from any angle when seen from any angle.

avatar image Eric5h5 · May 11, 2010 at 07:42 PM 0
Share

The terrain engine flattens trees to billboards at a certain distance because otherwise you'd have 50 gazillon polygons being drawn, which would not really be acceptable.

avatar image sean · May 12, 2010 at 02:21 PM 0
Share

Figured it was that or depth buffer disambiguation. Still, the fact that it billbaords against camera object heading even for the non-front sides of cubemaps seems like a glitch. This may not be the 'right' answer, but what would happen if they billboarded against the cameraPos->objectPos vector?

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

No one has followed this question yet.

Related Questions

Having static objects in scene disables skybox reflections. 0 Answers

How to use CubeBlur shader 0 Answers

Problem with rendering after using localScale 0 Answers

Cubemaps disappearing from objects with identical material? 1 Answer

Does the scaling of 3D objects in unity have an impact on its realism? 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