Lights not doing anything - unity3d

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.

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

Spot light doesnt work for virtual reality in unity Urp

My point lights renders in unity but it wont render in the oculus headset. What could be the cause. I Could not find a solution online.
I am using URP
Add more details if possible, are you using baked lighting, mixed, realtime? It might be your light per pixel setting.
Try to disable any other light in the scene and leave only the spotlight, increase the spotlight range and check if the spotlight works.
If it does, then it's your light per pixel/vertex count, you can edit it from your Settings folder, opening up the URP profile you're currently using, it's called Per Object Limit:
Do not go beyond 1 on the Quest and bake lights if they don't have to be dynamic.

Unity light breaking in build version

So in unity you can bake lights and you have to make the gameobjects static so they get a lightmap
So I did made my objects static and bake the scene light.
The result in the editor and in editor play
this is what I want
But when I build the game I get this
there is no light at all or its just spread all around the floor
The floor gameobjects are just primitives with a texture
I tried to reacreate the bug by placing some gameobjects and lights in a new scene
in both editor and build there was no problem
I used the default camera to make sure its not a issue with the camera on the play but no matter what I do it has the same effect on the previous scene.
I tried making the direct samples bigger inderect samples bigger and enviroment samples bigger
also the lightmap size bigger but nothing works.
LightMap Settings
Quality Settings
Okay so they way to fix this is go to
Edit > Project settings > Player
go to other settings and disable lightmap streaming
You need to disable it because huge maps like mine generate a lot of lightmaps and streaming all of them in runtime is really slow and so the lightmaps is really low res

Light Baking Issue

Before I have real-time lighting because of the performance issue, I decided to do light baking for my 3d game.
So I have mark 3d environment as static because it remains on screen always without movement.
Also changed direction light mode to Mixed because I have few moving game objects too.
But after the baking process gets completed, I got this kind of output:
In above, you can see in the above image what happened with my environment after baking and I have also included light settings if you need it.
You have to enable lightmap UVs in your 3d imported model file.
I got this reply from one Unity forum member so exact wording, I am posting here:

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

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.