Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Pingar5 · Feb 29, 2016 at 10:14 AM · 2dlighting

How do I make a wall block light in 2D?

I have a 2D Puzzle Platformer that I am working on that has ambient lighting (One of the mechanics revolves around lighting). I am currently having a problem where light will go through walls, like so: A picture documenting the problem. Is there any way, short of creating a new shader, to prevent this from happening?

EDIT: Just as clarification I am using Sprite Renderers on everything you see and the Sprites/Diffuse Shader.

141e835fd5c64190ca7e919de74717fd.png (49.7 kB)
Comment
Add comment · Show 14
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 Cherno · Feb 29, 2016 at 11:17 AM 1
Share

It's not possible. The only thing you can do is to put a 3d wall between the light and the sprites.

avatar image Pingar5 Cherno · Feb 29, 2016 at 04:57 PM 0
Share

Is that a viable solution? I wouldn't be opposed to it if it doesn't create other problems.

avatar image Graphics_Dev Pingar5 · Feb 29, 2016 at 05:08 PM 0
Share

It is fine if you don't have colliders on it.

Show more comments
avatar image Magius96 · Feb 29, 2016 at 08:50 PM 0
Share

Its not directly available, however, if you check out something like Sprite Lamp you can do it.

http://spritelamp.com/

Sprite Lamp uses a bump map and a normal map to help give the illusion of depth on a 2D surface. I'm not saying you have to use the software, but if you check it out i'm sure you'll get the general gist of how it works and can manually reproduce the bump maps and normal maps yourself. I haven't played with it myself, but i know that method works with Unity.

Personally I have played around with AutoTileGen, which does the same thing as Sprite Lamp and I have tested it and confirmed that it does in fact work in Unity. From your image above, I actually think it may be more along the lines of what you need.

https://www.indiegogo.com/projects/autotilegen#/

avatar image Magius96 Magius96 · Feb 29, 2016 at 08:50 PM 0
Share

I should note that the version of AutoTileGen on S$$anonymous$$m is better than the one that I linked to above.

avatar image Cherno Magius96 · Feb 29, 2016 at 08:54 PM 0
Share

Do these two assets/solutions adress the actual problem at hand, which is having sprites not blocking light?

Show more comments
avatar image Naphier · Mar 06, 2016 at 09:16 PM 0
Share

What about just having a culling mask on the light?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by qiqette · Mar 06, 2016 at 08:16 PM

Search for dynamic lighting and shadows 2d in the asset store, there a few assets for free

Comment
Add comment · Show 1 · 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 tanoshimi · Mar 06, 2016 at 08:48 PM 1
Share

Not that work with Unity's lights, AFAI$$anonymous$$. They work by simple raycasts to deter$$anonymous$$e areas that are occluded from a given point.

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Torchlight effect in 2D 3 Answers

Directional light 2D 0 Answers

Prevent light combining with other lights 0 Answers

Flickering circle of light around character 0 Answers

Why do 2D Lights render past shadowcasters. 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