• 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 DigitalMagic · Dec 11, 2013 at 06:08 AM · shadershadowsshadow

How to measure the area of shadow on a GameObject?

Good day everyone.

I have a simple scene: a plane with several cube GameObjects (of varying sizes, with textures on each facet) and a directional light shining at an angle (with hard shadows). The result is that each facet of most of the cubes has a differently-sized shadows cast on it.

Is it possible to read how much shadow is cast (in percentages maybe?) on each facet of a cube?

I was thinking maybe by reading how the color of the texture on each facet of a cube changes by the shadow cast on it, but I do not know how to do it.

Does the color of the texture actually changes?

Do I need to read some light map on a GameObject to determine this?

Could someone provide a sample code on how this could be done?

Thank you!

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 fafase · Dec 11, 2013 at 06:10 AM 0
Share

I do not quite get it, if you have the cubes on scene, the shadow is not on them but on any object behind them.

Then you can read on: http://web.cs.wpi.edu/~matt/courses/cs563/talks/shadow/shadow.html

avatar image tanoshimi · Dec 11, 2013 at 06:48 AM 0
Share

Also, section 9.4 of the Cg tutorial has a good explanation of the basic technique: http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter09.html

avatar image DigitalMagic · Dec 11, 2013 at 07:33 AM 0
Share

Of course not all the cubes have shadows. I am asking, how do I access that information in Unity?

I want to know, for each cube that has a shadow cast on it, to be able to calculate how much shadow is cast, without having to implement an outside algorithm to do it.

I mean, the information is right there - the shadow is displayed correctly after all. I am only asking - how do I access that data and read from it?

avatar image tanoshimi · Dec 11, 2013 at 07:42 AM 0
Share

You can't. Follow Aras' advice to render it manually from the light's POV using the information already provided.

0 Replies

· Add your reply
  • Sort: 

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

17 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

Related Questions

Shadows being received by non-shadow collectors that are depth culled by a shadow collector. 1 Answer

Shadows with Alpha, fade out shadow. 2 Answers

Strange shadow I didn't expect 1 Answer

Is it possible to change the shadow that is cast? 1 Answer

I need swaying, self-shadowing, ultra-realistic grass 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