• 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
Question by Cereal_Killa · Jan 31, 2015 at 05:31 AM · lighting bugshadow bugdeferred renderingclipping plane

Why does my lighting create square boxes at sharp angles?

See image below. Not using anything fancy; just a basic terrain with a directional and point light.

I've spent weeks on this problem and can't find any information on the internet or anyone else with the same problem, but it happens to every light that I use close to a flat surface.

I just want a normal light and shadow effect.

alt text

I've experimented with camera clipping planes and moving the camera. Also note the Camera Preview is different to the game window.

Here are 3 images with the same settings, I've just moved the camera closer for each one:

(this is probably related to shadow distance, with shadows not drawn far away from the camera; thus this problem seems to relate to shadows rather than to the light itself)

alt text

square-lighting-in-unity.png (85.8 kB)
movecamera.jpg (515.3 kB)
Comment

People who like this

0 Show 2
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 dethtoll · Jan 31, 2015 at 06:36 AM 0
Share

Took me a bit to understand what I'm looking at here. So this is a terrain mesh (viewed from above) with random thin mountains and red light in the middle, right?

Can you provide some sense of scale? What are the dimensions here? 100m? 10km? How close is the light to the ground plane?

Also, what are the coordinates of the center? Is this object near the world origin (0,0,0)?

avatar image Cereal_Killa · Jan 31, 2015 at 07:00 AM 0
Share

This only happens with deferred lighting. Changing the camera's near and far clipping planes makes the problem worse, but doesn't eliminate it.

0,0 is the top left corner of the terrain.

Yes it is looking down at the terrain from the sky, but I get the same effect with a vertical plane and a camera looking sideways.

Scale of everything is the default: 1,1,1, except for the cube which I made into a small wall.

Moving the point light further from the terrain reduces the problem, but also means that I need to make everything taller to give off shadows.

The problem only happens at sharp angles so of course moving the light away from the plane would increase the range of non-sharp angles surrounding the light.

I don't know if it's related to z-fighting or not, but it seems like such a simple thing that I shouldn't need to waste time on.

I've tried changing the shadow bias and it has no effect.

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by Cereal_Killa · Jan 31, 2015 at 08:08 AM

As a temporary fix/hack I have created a plane 0.2 in front of the flat area of the terrain and turned off shadow casting for this plane.

Now the flat surface receives smooth light and smooth shadows from the terrain.

Unfortunately this creates a hard line where the plane meets the hills, but I guess this is unavoidable.

Comment

People who like this

0 Show 0 · 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

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

20 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

Related Questions

Very Strange Realtime Shadows 0 Answers

Graphics Quality Settings on Android 2 Answers

Shadow/lighting glitch problem when placing walls adjacent each other,Shadow problem when placing two wall adjacent eachother 1 Answer

My lightning got broken after I changes the shadow strength. 0 Answers

Real time shadows are suddenly low resolution with lots of errors. 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