Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411500 Posts in 69373 Topics- by 58428 Members - Latest Member: shelton786

April 25, 2024, 10:13:29 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Shadow issues, a.k.a. Unity Sucks
Pages: [1]
Print
Author Topic: Shadow issues, a.k.a. Unity Sucks  (Read 2966 times)
darkhog
Level 7
**


Dragon Agent


View Profile
« on: November 07, 2018, 09:51:59 AM »

So, despite my tries to adjust stuff like bias, cascades, etc. I either get BS like this when using stable fit, along with ton of shadow acne:


or I get terrible flickering (think z-fighting) with close fit on the walls. I need shadows over huge distances. I can't bake shadows etc. as I'm using a custom level editor instead of unity's scenes so my only option are directional lights. What to do?
Logged


Be a computer virus!


I cannot C well, so I stick with simpler languages.

There are no impossible things, there is only lack of skill.
nova++
Level 4
****


Real life space alien (not fake)


View Profile
« Reply #1 on: November 07, 2018, 10:42:19 AM »

Have you looked into alternate shadow packages that might be available? Unity's included shadows definitely aren't very versatile.

What sort of huge distances are we talking about?

Have you tried adjusting the camera's clipping planes?

What specific settings on the light have you tried?
Logged

darkhog
Level 7
**


Dragon Agent


View Profile
« Reply #2 on: November 07, 2018, 11:03:22 AM »

Have you looked into alternate shadow packages that might be available? Unity's included shadows definitely aren't very versatile.

What sort of huge distances are we talking about?

Have you tried adjusting the camera's clipping planes?

What specific settings on the light have you tried?

What alternatives do you recommend? As of the rest, we're talking about shadow distances 500+, tried adjusting clipping planes, but it makes it look even worse as the main character gets clipped and tried basically every combination of settings for the single directional light I use.
Logged


Be a computer virus!


I cannot C well, so I stick with simpler languages.

There are no impossible things, there is only lack of skill.
Ordnas
Level 10
*****



View Profile WWW
« Reply #3 on: November 08, 2018, 04:58:16 AM »

About the flickering, did you try to switch from Forward to Deferred rendering (on the main camera component)? It seems a material receiving two or more lights at the same time.
Logged

Games:

darkhog
Level 7
**


Dragon Agent


View Profile
« Reply #4 on: November 08, 2018, 11:13:34 AM »

There's only single directional light in the scene and it's already deferred.
Logged


Be a computer virus!


I cannot C well, so I stick with simpler languages.

There are no impossible things, there is only lack of skill.
yakandco
Level 0
*

Yak & Co


View Profile WWW
« Reply #5 on: November 13, 2018, 06:33:40 PM »

Hey there, what platform are you planning to publish to because Deferred may not be an option on mobile. I think Unity have recently added deferred to mobile platforms, but for the longest time it's not been an option. Many people have been mistaken thinking that deferred is used but if you actually check the rendering pipeline at runtime (even with deferred selected) you'll find it's using forward on mobile. The new Lightweight rendering pipeline though is supposedly going to give mobile the ability to use more than one pixel light but still is not a deferred renderer.

As for shadow quality, you're going to get better shadow quality results if the shadow distance is as small as possible. I know this might not work out for scene that you're lighting but try and set the shadow distance to something low like 10-20 and see how it appears. With shadow distance think of it like the shadows are texture map of set resolution, the higher the shadow distance value the further this texture map is getting stretched and therefore the pixels of the shadow map increase in size (decreasing the quality and appearance).
Logged

Creators of award winning puzzle adventure game Agent A: A puzzle in disguise.
darkhog
Level 7
**


Dragon Agent


View Profile
« Reply #6 on: November 14, 2018, 01:17:56 PM »

PC only as of right now, maybe consoles in future. Definitely not mobile, it wouldn't handle my game unless it's like $3k phone. And again, the only light I have is a single directional light (skylight). There are no other lights in the scene so I have no idea why is it flickering with shadow mode set to close fit.

And yes, you're right, 10-20 shadow distance wouldn't work for my game at all as it consists of open spaces and I want to keep it that way.

Again, what alternatives to unity's shadow do you propose that would work for the game I'm developing (link in my signature)?

//edit: Issue in action:


« Last Edit: November 14, 2018, 01:48:08 PM by darkhog » Logged


Be a computer virus!


I cannot C well, so I stick with simpler languages.

There are no impossible things, there is only lack of skill.
Ordnas
Level 10
*****



View Profile WWW
« Reply #7 on: November 15, 2018, 07:47:08 AM »

Never saw something like that. Strange that only the 2 walls have the shadow flickering, and not the other 2 (they have shadows casted by the light). What happens of you rotate the lights? Are the same walls still flickering? I would investigate these 2 walls, maybe the materials. Are you sure they are just boxes and they hadn't some child hidden?
Logged

Games:

nova++
Level 4
****


Real life space alien (not fake)


View Profile
« Reply #8 on: November 16, 2018, 04:42:16 PM »

I have personally run into issues with very large triangles on meshes casting/receiving shadows. Something about it can cause the shadow system to barf, or something. Maybe you can subdivide some of the meshes and see if it gets any better?
Logged

Ordnas
Level 10
*****



View Profile WWW
« Reply #9 on: November 19, 2018, 08:48:49 AM »

I have personally run into issues with very large triangles on meshes casting/receiving shadows. Something about it can cause the shadow system to barf, or something. Maybe you can subdivide some of the meshes and see if it gets any better?

I think you found the solution, now that you mention it I remember something similar with a very large rectangular sprite, and it could receive lights only to 1 of the two triangles.
Logged

Games:

darkhog
Level 7
**


Dragon Agent


View Profile
« Reply #10 on: November 19, 2018, 02:06:39 PM »

Derp... No idea why it does that, but subdividing it would require me to rebuild the menu. Also the other two walls have same if not bigger triangles and they don't seem to cause issues. Anyway, sorta fixed it by rotating light a bit (was almost straight down), but now the menu doesn't have the lighting I want.
Logged


Be a computer virus!


I cannot C well, so I stick with simpler languages.

There are no impossible things, there is only lack of skill.
yakandco
Level 0
*

Yak & Co


View Profile WWW
« Reply #11 on: November 19, 2018, 04:49:20 PM »

//edit: Issue in action:




This kind of problem does seem familiar. I have seen this kind of thing before. One thing I'd be suspect on is the wall mesh casting shadows onto itself. With the extruded wall segments that jut out from the wall, are those separate meshes or are they part of the same wall mesh? what I'm wondering is if the shadow calculations are getting confused about how to cast shadows on itself. If they are try separating those out on their own. You could also think about disabling receive shadows on just those walls, it obviously depends on how you want them to appear but there's a chance they don't even need shadows and the look you're after can be faked (just for the flat walls, not the parts that jut out).
Logged

Creators of award winning puzzle adventure game Agent A: A puzzle in disguise.
Ordnas
Level 10
*****



View Profile WWW
« Reply #12 on: November 20, 2018, 01:17:25 AM »

Derp... No idea why it does that, but subdividing it would require me to rebuild the menu. Also the other two walls have same if not bigger triangles and they don't seem to cause issues. Anyway, sorta fixed it by rotating light a bit (was almost straight down), but now the menu doesn't have the lighting I want.

Or instead of subdividing you could make the wall small and duplicate it, and copy-paste them.
Logged

Games:

darkhog
Level 7
**


Dragon Agent


View Profile
« Reply #13 on: November 20, 2018, 02:59:12 AM »

They're separate meshes, yakandco.
Logged


Be a computer virus!


I cannot C well, so I stick with simpler languages.

There are no impossible things, there is only lack of skill.
bateleur
Level 10
*****



View Profile
« Reply #14 on: November 21, 2018, 12:22:50 AM »

It's never a good idea to have a directional light that's exactly parallel to any surface. You don't usually have to rotate by much to remove the problem, though. Half a degree should be fine.
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic