• 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
1
Question by d112570 · Aug 16, 2013 at 11:44 AM · shadows

How do you do a cone shaped shadow?

I am making a solar system, I like to use shadows, so you can see the shadow from the satellites reflect on the planets. For example earth and moon shadows. I tried Directional light, but the shadows don't disappear. The shadow from Mercury was on Venus, and Venus and Mercury was on Earth on so on. Everything is in life scale, just reduced to fit. I need a shadow that acts like a cone, the beginning is a large circular shape down to a grain of sand at the ending. The Point light would of been perfect but with one planet the whole universe is in a shadow, here the cone is exactly the opposite, the shadow gets bigger and bigger. I need the shadow to become smaller and smaller till its gone, so I can see the other planets.

I like to use one light source light a star, to light up the planets, asteroids, satellites and each object to cast a shadow until the shadow fades cause the object is getting smaller and smaller while moving away from the celestial object.

The problem I see with the point light, is its like a spec of sand pointing on a larger celestial body, that is why the shadow gets bigger and bigger, so how do you make the light bigger so the shadow gets smaller. Small Light on a larger body = the shadow gets larger. Large light on a smaller body then the shadows gets smaller (Fades).

Any help appreciated, David.

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 sdgd · Aug 16, 2013 at 01:05 PM 0
Share

you could try with 9 lightning bulbs

you see sun is not just 1 little dot from where the light is com$$anonymous$$g from.

but there are millions+ of atoms that produce light source.

so making 9 sun light dots would make your shadow pretty much dissapear. if you make more than 9 light bulbs it'll get more and more disapeared because not all light sources will make shadow on the same spot so you get cone shaped shadow

hope it helped

if it did tell me and I'll change the comment to answer

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by CHPedersen · Aug 16, 2013 at 12:37 PM

I'm sorry to say I don't think this is possible with any of the default light types in Unity. The Directional light is for local ground level scenes where the sun is so far away that it makes sense to model its distance as infinite - i.e. so far away that its rays are approximately parallel. Obviously, that won't work when your scope is the entire solar system.

The shadows you describe require you to model a light source which, as you correctly guessed, has a non-zero area. Point light sources are exactly that - a single point. From any other given point in your scene, there is either a totally unobstructed line from the point to the light source, or an object in the way that totally obstructs the light source. Nothing in between - the light source is never partially visible. For that reason, shadows also don't automatically have a physically correct penumbra. Without an attempt to fake one, the shadow changes from total darkness ("umbra") to area which is totally lit.

None of the light sources in Unity use a spherical area, as you would need for the sun. The one Area Light Source Unity does have is a rectangular plane (like the surface of a flourescent ceiling lamp), and does not functon in real time, but only in lightmap baking.

So, in conclusion: You're out of luck - it isn't supported out of the box in Unity. If you want this, you're going to have to make it yourself from scratch, which will be hard, and undoubtedly very educational. But on the upside, it sounds so useful that if you do implement it, you can probably package and sell it in the Asset store. ;)

Edit:

As an approximation you can try which won't require you to develop area light sources from scratch, you can try to fake it by making your sun a cluster of point lights instead of a single point light in the middle. Place a bunch of individually weaker point lights in evenly spaced positions on the surface of the sphere you use for the sun. This might get you closer to the desired result with no coding at all.

If you choose this approximation, then beware that shaders obey an upper limit on pixel lights which is set in the Quality settings under Edit->Project Settings->Quality. It is 4 by default. Balance this number with the amount of light sources you need to affect each planet, versus the performance hit.

Comment
Add comment · 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
0

Answer by d112570 · Aug 16, 2013 at 04:40 PM

Ok Thanks for the idea, this will try it, 8 directional lights are enough. Each light I have tilted to 1 Rotation pointing towards the center of the Star. I have it setup as a clock, one light at 0h, 1:30h, 3h, 4:30h, 6h, 7:30, 9, and then at 10:30h. The light intensity I divided by 8, which gave me of 0.125 light Intensity, which is the same as having only one light source which has 1 Intensity. The light number nice which would be in the center is useless, it actually does nothing. Having only 4 light sources, does not look good, you would see 1 dark satellite shadow and 4 light shadows. Set the Star to self illumine and receive and cast shadow to false.

I love how the satellites orbit their planet and observe how the planet receives their shadows and the satellites receives the planets shadows once they go behind the planet.

Performance should not be too big of an issue since its only like 8 Planets, 1 Star, and 168 Satellites orbiting their Parent planets. So far I only have Moon, Phobos, and Deimos, still need to add the other satellites then I can see how the performance is. And then theres the asteroids, hmmmmm, for later.

Thanks for the great idea.

Comment
Add comment · Show 2 · 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 d112570 · Aug 29, 2013 at 03:08 PM 0
Share

I found a better work around. $$anonymous$$ake 2 Spheres, 1 sphere to receive shadows and the inside sphere to cast shadows. The closer the sphere gets to the planet, make the inner sphere larger, the further away the outer sphere gets the inside sphere will shrink, $$anonymous$$imum scale of 0 and maximum of 0.99. This will mimik the shadow distance. The code you write should do this automatically, when moving the sphere closer to the Parent object and farther away.

avatar image fatma88 · May 05, 2015 at 11:35 AM 0
Share

Hi, I'm facing the same problem of shadow on my solar system, Any help please? Thanks!

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

18 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

Related Questions

Any way to access the Cascaded Shadow Map texture? 1 Answer

Toon Shader with Shadows AND Alpha? (Unity 2.6) 1 Answer

Implementing Dynamic Shadows on iOS in openGL Es 2.0 0 Answers

Weird shadows 1 Answer

Is this lightmapping error really a bug? 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