2
\$\begingroup\$

Can't explain better than with video: https://youtu.be/4nIMIL6w-0M

The effect I'm trying to achive is a simple fog of war.

See, I have a point light casting shadows on a plane. The plane has a shader which takes light attenuation and either draws a black pixel if there is no light, or discards a pixel to draw background if the light touches that pixel.

After hours spent on this, I came up with a thought that I cannot do anything more.

A problem as I see it:

Light successefully casts a shadow of shadow casters on a plane, however, with camera at a distance from the shadow, the shadow it self gets splitted and sliced, like it would've been, if some of the shadow casters' faces are suddenly removed from their meshes.

What I have tried:

  1. Changing Z coordinate of a light.
  2. Changing Z height of obstacles (shadow casters).
  3. Changing vertices on the obstacles so that every face would have its own vertices so no faces could share a vertex.
  4. Changing shadow quality in the settings.
  5. Changing camera rendering mode, all four of them.
  6. Changing point light to a spot light with wide cone radius.
  7. Using nice and simple standart unity's shader for a shadow receiver (a plane) - Standart Diffuse.
  8. Switching between hard and soft shadow types.
  9. Changing light's shadow's resolution, shadow strength and biases
  10. Trying out the compiled EXE on another machine.
  11. Changing light's baking type, rage and intensity.
  12. You name it.

None of those had any improvementes on an issue.

I would like to hear authoritive replies (best option would be from the developers) as well as any information you guys think I can try out (so I can do that).

\$\endgroup\$
  • \$\begingroup\$ Using a separate camera to render Fog of War should solve the slicing problem. \$\endgroup\$ – Justin Markwell Jun 2 '15 at 22:34
  • 1
    \$\begingroup\$ That's what I use in the layer there is only plane, light and shadow casters. \$\endgroup\$ – AgentFire Jun 2 '15 at 22:47
  • 1
    \$\begingroup\$ the only other thing I can think of that you probably already checked would be the clipping planes of both. \$\endgroup\$ – Justin Markwell Jun 2 '15 at 23:02
  • \$\begingroup\$ @JustinMarkwell could you clarify please? \$\endgroup\$ – AgentFire Jun 2 '15 at 23:45
  • \$\begingroup\$ The near and far clipping settings on the camera settings in the inspector. \$\endgroup\$ – Justin Markwell Jun 3 '15 at 0:00
0
\$\begingroup\$

In case someone stumbles on the same rare and weird issue, I would like to recommend a solution:

Decrease your total overall world size.

I have figuratively multiplied my whole unity world by 1 / 100 and the issue vanished.

\$\endgroup\$
-1
\$\begingroup\$

I just solved it.. Go to Edit -> ProjectSettings -> Quality and then ShadowCascades set to No Cascades

\$\endgroup\$
  • 2
    \$\begingroup\$ Hi and welcome to Gamedev.SE! While your answer might be correct, there is already an accepted answer for this question, so instead of giving a one-liner answer, can you elaborate, why setting that option that way helps? \$\endgroup\$ – Katu Sep 7 '18 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.