Objects in scene continue to be dark after lighting is set up - unity3d

Here is how my scene is currently looking:
I'm not sure what I'm doing wrong. I had previously set up this scene to be dark although I don't exactly remember how I did that. Now I'm trying to set the scene as a daytime one. Despite putting a directional light with a strong intensity, the objects I made for the scene continue to be dark. So I'm at a standstill here. I've only been using Unity since February.
Edit: Added Lighting Settings for the scene.

In your Light Settings tab, either select the Auto Generate checkbox or click the Generate Lighting button to properly bake your light.

Two Possible problems and their solution:
If you don't want bake, then go in lighting tab and clear baked data.
Ensure that Lighting is on at editor, see below:

In my case, it was because the "Sun Source" variable in the Lighting window was set to "None". Grabbing my Directional Light from the scene in there solved the problem.
I hope this can help someone in the future.

Related

Custom 2D Lighting System in Unity

Ok so I've been trying to make a custom 2D lighting system in Unity, and I'm at that annoying stage where I know what I want to do but I'm not sure how to do it.
Here's the plan:
There will be dedicated light objects with their own meshes. These meshes determine the shape of the light.
Before the camera renders the whole scene, it does an extra render of just the light meshes with a black background to create a lightmap.
Then the camera renders the scene as normal (does NOT render the light meshes this time). Every object has a shader that will access the lightmap and shade itself appropriately depending on the color of the lightmap at that point.
That's the idea anyway. I sorta threw together a botched form of this. I used a separate camera to render the lightmap into a render texture with a culling mask so that it only rendered the light meshes, which are on their own layer. I then manually passed that texture to the shaders which use their screen uvs to sample from it.
This works sorta ok, but the scene view is completely messed up since it tries to light things as if you were looking at it from the perspective of the lighting camera. I feel like this would make the system hard to use, so I want to try to make some that feels a bit more cohesive.
Here's some screenshots to explain:
The tan-ish box is my "light," which gets rendered to the light cam, visible in scene. This next shot is what renders to the lightmap:
The black background is not from the big black box, the clear flag is just set to Black.
Now according to this lightmap, the middle of the screen should be lit up. and that's exactly what happens:
Notice that in the game view, since the light camera is set up with the same position/rotation/perspective settings as the game camera, it looks fine:
The main problem is figuring out that extra render. Is there anyway to create an extra pass for the main camera before the scene render that only renders the light meshes? I could probably figure out the rest from there. It would also be nice if I could make the lightmap a global shader variable, that way I don't have to pass it to each individual material, but one thing at a time, right?
Thanks so much to anyone who can shed some light on this subject. I'm still pretty new to shaders and rendering, so any help is much appreciated.
If I understand correctly, your problem is the appearance of your lights in Scene View, right ?
For that, you can create a custom Gizmos for them and hide the original objects. There's a tutorial:
https://learn.unity.com/tutorial/creating-custom-gizmos-for-development-2019-2#5fa30655edbc2a002192105c

Lights not doing anything

I'm working on a project and no matter what light I put in everything stays the same. It won't even show itself unlit. Also yes the scene lighting is on. I have tried altering Pixel Light Count nothing works -100 - 100. I turned off my scriptable render pipeline too and even that didn't work.
No lights in scene Light in scene scene lighting on btw I've used this specific scriptable render pipeline before and it works but I disabled it anyway.
My render pipeline was set in one place but not the other small problem easy fix.
Essentially go into setting and if your using HDRP make sure it says HDRP under render pipeline and then check under the lighting assets to see if HDRP is enabled.

White in unity isnt white but beige

I've finally decided to start Unity. I have little to none experience with these kinds of stuff, and I'm currently facing a problem. When I import a 3d shape on unity, the default color is beige, even though it is set to white. When I try making a white texture and apply it to the object, it still turns out as beige.
This is due to lighting. Check the light source in your scene, it probably has a yellow-ish color, try to turn that back to white.
Depending on your render pipeline (Universal RP, HDRP...) you might even have something like global illumination with a slight color tint enabled. Try to check your lighting settings.
You can also always click on the material the object in question uses and in the little preview window you see it lit by a neutral light source, without your scene lighting settings.
also, you did not provide an image, which is why I can only help you so far given your message :)

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.

How to get my lighting like this video?

I am following this video to start learning about Unity.
https://www.youtube.com/watch?v=VV3sSM0gjQ8
In this video, his scene is pretty dark aside from the lights that he put in, while my scene is like this:
https://i.gyazo.com/5c038a72e47e37234ab56cecba29bee0.png
No matter what I do with the light toggle, I can never get it like his. How do I do this?
You are not seeing light in your scene. Click the light icon in your toolbar (its next to the shaded and 2D button) to see how the light looks in your scene.
For even better results use lightmapping. This means you put light in the scene and let the program calculate it for you. What you are using now is realtime lighting in your scene. Lightmapping will also enable you to use softshadows. Read the basics about it here: http://docs.unity3d.com/410/Documentation/Manual/Lightmapping.html