Unity realtime GI - baking causes odd shadows - unity3d

I am using realtime lighting with baked GI.
I have tried resolutions between 1-20 for these rocks, I've tried chaning UV distance, angle and lightmap scale. Nothing seems to fix these weird shadows. Does anyone know what is causing it? It only occus on about 1% of objects.

It is the result of ambient occlusion - deactivate PostProcessing to see if your baked shadows look fine.

Related

Unlit shader issue with fog in Unity's Univeral Render Pipeline

Edit
I figured out a tempoary fix for my initial question "how to disable this weird fog": Disable the fog in the lighting pannel (genius, right ?)
However, since I might need fog later, and it does not behave as I would expect, I still need to fix this issue.
Note: This only happens with exponential fog modes, not with linear.
I'm having issues with unity's universal render pipeline: A light grey fog, whose strength depends on the camera heading (see video)
(see how the plane geometry affects the fog)
The steps to reproduce are very simple (or just download the project here):
Create a universal render pipeline project
Delete the "example assets" from the scene
Create a floor with a quad (create quad, rotate, scale)
Create a new material
Shader: URP / unlit
Base map: black
That's it.
Rotate around, see how the "unlit" plane is actually affected by a fog whose strength depends on the heading of the camera
Rotating the quad has the same effect as rotating the camera.
Rotating the directionnal light has no effect (except on the skybox)
Removing the Directionnal light has no effect (except on the skybox)
Removing the Post processing volume makes the "fog" stronger in all directions so the camera heading effect is less noticeable but still there
This happens in game mode as well as in the editor
Getting close to the ground makes the fog lighter
the camera position has an impact as well (this is more visible when testing with a plane rather than a quad)
system info:
tested on unity versions: 2019.4.18f1, 2019.4.20f1 (LTS), 2020.2.1f1
Windows 10 Home 19042.804
Is it possible this is a bug in the URP/unlit shader ?
Thanks for any help!

Unity 3D - Baked light is too dark

So I am baking Subtractive light in my VR build.
I have the models set to static, generated UV's for all of them and played a lot with the lighting settings.
The problem is that the sigle baked directional light looks too dark and "burnt" after baking.
How can I keep the brightness of the pre-baked scene after baking?
Posting images of before/after baking and settings below:
To increase the brightness of shadow you can change "Intensity" parameter in your directional light settings.
This "burnt" effect looks kinda pixelated so to fix this you could in your lightmapping settings increace lightmap resolution or lightmap size. If it didn't help, you could increase "scale in lightmap" in mesh renderer.
Another option is to create a copy of your directional light so that you have two directional lights in your scene. Then assign one light mode to 'Realtime' and adjust the intensity to get the scene brightness looking the way you want and assign the other light mode to 'Baked' and change the intensity to get the baked shadows looking better.
Baked light should always be the same (or better) brightness under direct lighting conditions.
There can be a multitude of issues in your scene, and why it's giving you this effect.
Please check the following in this order:
Does your models have proper UV maps
Does your models have enough scale in lightmap (small lightmaps can create faulty shadow effects)
Does your scene has enough reflection probes for indirect lighting (not enough light from the shadowed side can "shadow" the lit side.
Do you have ambient occlusion enabled? Maybe you need to fiddle with the values there.
From experience "Baked Indirect" gives better results than "Subtractive"
Are your settings in URP or HRDP or LRP are correct?
Is your "Sun" the right brightness?
What you should expect with "good settings"
Example lighting settings that the result above were achieved:
Change Direct Samples to 32, Indirect samples to 512, Environment size to 256, and change lightmap size from 512 to 1040. Make sure also that any emission materials are changed from Realtime to Baked along with of course having such objects set to static. That should take care of some of the lighting and illumination issues. Also double check that these materials are all checked for GPU instancing.
Since you are using Directional Light, Try adding a Bakery Skylight into your scene. That fixed the burnt shadows problem for me after baking. Shadows are more lighter now.

Unity baked lighting blotchy and cubic

I've set every object in my scene to 'static' and the bake runs automatically, but the result is unusable: blotchy, blurred cubic lighting...
Here are my lighting settings:
What am I doing wrong? I've tried changing the atlas size, the 'scale in lightmap' of the house object and various other settings, but can't seem to make the bake behave.
Any ideas much appreciated.
You might want to check the see how far from 0 the mesh is. I Had mine about -6000(y) and it had extremely blotchy/spotty lightmap results. I moved it much closer to 0(like -10y), re-baked and everything was fixed.
It looks like UV overlap. For issues like this where some sections are bright white, red, or green (where they really shouldn't be), try
increasing the lightmap padding
toggling stitch seems on the render (mesh renderer or whatever it is for the object with white patches)
Play around with the other lighting settings
rebuild the UVs (A lot of forums will end with this, it can be quite manual. Luckily 1- 3 has always worked for me so far)

Unity3D: Why is particle lighting making directional shadows disappear?

UPDATE: As #BenHayward suspected, this is a bug. <link>
I have a very simple setup of cubes on a plane comprising a grid of quads. A directional light is shining down at the scene at an angle, producing a set of shadows from the cubes onto the quads.
Now I'm trying to produce an explosion effect with Unity's particle system, but when I add a point light to the particle system it causes all the directional-lighting shadows to disappear, whether they're in line of sight of the particle or not.
The shadows reappear when the particle is destroyed. Replicating the particle effect with pure C# doesn't cause any problems.
(Oh, and obviously I'm using the deferred rendering path.)
Any ideas? This is driving me off the wall.
[EDIT: I should have mentioned that the point light added to the particle system is set to cast shadows. The Unity standard particle pack has shadow-casting disabled by default. They too cause the problem when I turn the shadow-casting on.]
Based on the project that you linked to, it seems as though the particle system is causing the shadow cast from the directional light to flicker on and off quickly. I suspect this is a bug, since if it were intended behaviour, I wouldn't expect it to flicker in this manner.
In cases where this is not a bug, the problem can be caused by a couple of issues:
You can only have a certain number of dynamic (shadow casting) lights in your scene which are seen by the camera frustum. By default, this number is quite low (I think it's 4). You can increase this number by going to Edit > Project Settings > Quality. Set the Pixel Light count higher from its default value. You will need to increase this value to be greater than the total number of lights in your effect. Higher values will allow more lights to be rendered on the screen, but this reduces performance.
It depends on the shaders which you are using to receive the shadows. Some shaders will only render shadows for one directional light. The light which is used isn't necessarily too easy to determine. If you are using the standard Unity shader this shouldn't be a problem. But if you are using a mobile compatible surface shader or something you've written yourself then this could be the cause of the problem.
Also, for an explosion, I'd recommend using just one single point light (not lights attached to each particle), as this is all that is required. Any more lights would result in considerable performance impact on the GPU especially if there are more than one explosion in the scene at any one time.
I recreated the scene as you described, i can't recreate your issue.
i mostly followed this tutorial, and added a few cubes in a plane:
https://unity3d.com/learn/tutorials/topics/graphics/adding-lighting-particles
I will need a screenshot of your lights componnents, both the directional and the point light, the particles, and the cubes (mostly the material); I cannot comment because i dont have enough reputation yet, so i'll delete this once you add the screenshots;

Unity3D - Light deactivated when facing opposite direction

I placed a light in my scene.
It is lighting the ground when i'm facing that light but when I turn the opposite direction, the light on the ground vanishes.
I think this might be some Unity's default behaviour.
Is there a way I can solve this issue?
Unity uses frustum culling to save performance, so it only draws items that are within the camera's viewing area. As a result of this, the particles behind you are not drawn, and any lights attached to them aren't either.
Scene-crucial lights aren't normally attached to particles, so it's normally not a concern if they're hidden along with their particles.
For conventional lights (not attached to particles), Unity should render the light as long as it affects objects within the camera frustum. If you use a conventional light, you should see better results.
Looks like you may have to disable occlusion culling. Unity3D Manual