Unity 2019.3.0f1 one sided meshes with baked lightmap dark - unity3d

I am using unity 2019.3.0f1, with HDRP. I have made a simple room mesh, that has only one sided walls, facing inwards. Turning the room static, having it generate lightmap uv, and setting the light static makes it completely black, when scene lightning is used. I've attached some images. I tried turning backface tolerance to 0, but it did not help.
Without lights (scene lightning not used)
With lights (scene lightning used).
Any help is appreciated :).

So my original answer was untrue, unfortunately. Turns out, when I created the mask, I've set green to 0, setting ambient occlusion to 0. Because of this, it handled everything occluded (from ambience). Setting ambient occlusion to 1 manually (and adding full green on every mask afterwards) fixes the issue.

Related

Baking point light URP

I use URP for my Unity 3d project. I have many point lights in my scene, they all set to mixed and important light. However some point lights does not produce any light on the scene after the baking.
Before baking:
After baking:
If I mark them as baked light instead of mixed than they just go completely black.
Any suggestions?
In URP there is a limit for realtime point lights. You can´t set more than 8 point lights. This is the reason, that in "mixed mode" some of your point lights are producing lights and the others don´t. Nevertheless baked lighting should produce a result for every point light. Probably the light setup is not correct. Try to follow some basic URP lighting tutorials i.e. on youtube

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.

Scene in complete darkness in Unity

I want to create a scene in complete Darkeness, which will be iluminated just by the lightnings of a storm. But I am already failing in the first step, I am not able to make the scene completely in darkness, even if I remove all lights in the scene and set background of the camera as black, I still get this:
And Hier my Hierarchy where you can see there are no lights:
What am I missing?
You can try to set the ambient light to black, so it will be all in darkness. You can do this programatically with this line:
RenderSettings.ambientLight = Color.black;
And also, to switch off any light you may have in your scene (just in case)
Light[] ligths = FindObjectsOfType(typeof(Light)) as Light[];
foreach (Light ligth in ligths) {
ligth.enabled = false;
}
Take care also of the follwing three things, which may be adding some light into the scene.
Turn off or delete any light maps.
Ensure shaders are not using self-illuminating or particle shaders.
Ensure that "use scene lighting" is turned on in the scene view.
However I think in your case with the ambient light set to Black will be enough. Your scene seems quite simple.
To light your scene entirely from lights placed, you need to drop your Ambient Light settings. Ambient light is the light that is added to every object so that things do not appear entirely black - but there are many cases where you want them to.
Answer
Ambient Light settings can be found by going Window > Lighting > Settings.
Make sure that theEnvironment Lightingsource is set toColor`. Here you can also tweak the color using the RGB picker to have greater control over how the ambient light looks.
You may want to use a color that is slightly above black so that things can still be very faintly seen, without your lighting effects.
One thing to note, some materials may be set up to emit or use their own light settings - but these can usually be tweaked by modifying the material.
Another note, you can preview the lighting in the editor (or conversely - see what you are doing) with the lighting switch in the editor. This will toggle lighting effects on or off (including ambient light settings) for the Scene view.
In most cases the answers already given are correct.
But also attention to the Light Probes! ;)
Try disabling it on the object's Mesh Renderer.
Making things pitch black at night without artificial light involved several steps for me. I wanted a Sun that rose and set, so first I made a script to simply change my Directional Light's (gameobject Sun) x rotation over time.
Then I made a script to adjust my Sun's intensity, with the intensity starting at 0 when the sun rose and quickly rising to 1 at about 15 degrees, and contrariwise at about 165 degrees it goes from 1 back down to 0. So far so good....
Sun.intensity = intensity;
Next I made the script set the ambient light and reflection intensity to the same.
RenderSettings.ambientIntensity = intensity; // RenderSettings controls found in Lighting tab
RenderSettings.reflectionIntensity = intensity;
And just for good measure I made sure to set these:
RenderSettings.ambientEquatorColor = Color.white;
RenderSettings.ambientGroundColor = Color.white;
RenderSettings.ambientSkyColor = Color.white;
I noticed that when they were black, for example, even with intensities at 1.0 the ambient light was very, very low.
Finally, I had to use a custom shader to blend between a daytime skybox and a nighttime skybox. This because if you have the Skybox as the source for environment lighting (in your Lighting tab) then the ambient light will be affected by the color of your skybox. I.e., you want a bright daytime skybox and a dark nighttime skybox.
There you go. Now when the sun had set the terrain was completely black, only lit by scene lights like torches. I'm also using Ceto's water system, so I had to control the Ocean_TransparentQueue gameobject's UnderWater script to adjust the Absorption/Inscatter intensities as well, the same as above.

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