Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by GeorgeIng · May 31, 2015 at 11:27 PM · shadershadowunlitrealtime-shadows

Unlit shader that receives shadows?

I currently have a procedurally generated scene of a number of objects, all with baked textures. Their shaders are thus set to "unlit" given that the lighting plays no part in the scene. I would however love to have realtime shadows - they can't be baked because the scene is generated at runtime.

Does anyone know of an unlit - or alternative - shader that would allow me to do this?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by SmilingCatEntertainment · Mar 13, 2016 at 01:49 PM

I wound up solving this issue without using a special shader.

Since I was already billboarding my quads with baked textures to the camera, I just adjusted my billboarding code a bit to billboard the normals to the directional light's angle instead of the camera position. This ensures that the lighting is never affected by the angle of the directional light. Then I just used the Standard Shader in Cutout mode.

mikelo actually got me thinking about the solution with his comment "maybe you can... ignore normals", and I suddenly thought, "What if instead of ignoring the normal, the normal always faced the directional light, to the same effect?"

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 mikelortega · Jun 01, 2015 at 11:15 AM

I would only use unlit for light emitting materials. Use Standard (in Unity 5) or diffuse (in previous versions). If your scene is too dark, try with a higher ambient color and intensity with these materials, this way you won't have problems with shadows.

Comment
Add comment · Show 4 · 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 GeorgeIng · Jun 01, 2015 at 12:23 PM 0
Share

The problem is that I have baked lighting, if I light using a directional light then I do not get the kind of scene lighting that I require and if I were to turn up Ambient Lighting to 1 to compensate (leaving the directional light to only cast shadows) then I wouldn't get any shadows.

Thanks for the answer though!

avatar image mikelortega · Jun 01, 2015 at 12:32 PM 0
Share

With ambient light set to 1 you get shadows, give it a try :)

I would try setting a low intensity directional light with a high strength shadow. Set your directional light to "Realtime" so it doesn't affect your baked lighting.

avatar image GeorgeIng · Jun 01, 2015 at 12:41 PM 0
Share

Yeah that's just it - the only way to get shadows with ambient light is to turn the directional light's intensity up which is something that's not really practical given that the scene parts have already been lit and balanced in another application. Even if I set the lights intensity to 0.2 (which adversely effects the baked textures to a decent degree) the shadows are still pretty faint despite their strength being set to 1.

I think a vertex shader is the only practical option for solving the problem unfortunately :)

avatar image mikelortega · Jun 01, 2015 at 01:27 PM 0
Share

$$anonymous$$aybe you can tweak the Standard shader to ignore normals... but I cannot help you with that :)

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

22 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

Related Questions

Is there a way to Separate the light contribution from the shadow? 0 Answers

Receive Shadows with Custom Vertex Shader & Shadow Passes Functioning Incorrectly 1 Answer

bake (?) the moving object 1 Answer

Having problems with unlit shaders casting shadows 0 Answers

Fading shadows in / out along with material. 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