URP Lit Shader on 2D sprite delayed reaction to directional light - Unity 2021.3.11f1 - unity3d

So I have a HD2D Setup in Unity, meaning a 3D world containing 2D sprites (billboards). I am using URP and created a Lit Shader with the following configuration:
This Shader is attached to a material and this material is attached to my sprite. My problem is, when I rotate the global directional light, the sprite with this shader attached has sort of a delay in adjusting its darkness to the global light (in the video, the environment is bright (morning) but the sprite is still very dark in color (see next picture) and vice versa). This behavior can be seen in the video I uplaoded here:
https://www.youtube.com/watch?v=uAm71ftfy2Y
Desired outcome:
The sprite gets darker as the sun fades (similar to the white Quad that can be seen in the video scene).
Does anyone have an idea which setting I need to tweak here? Thanks for any advice.

I figured it out. For some reason, URP Pipeline was not set under Edit-->ProjectSettings-->Graphics. Once set, I was able to set [X] Will be affected by shadows in shader graph. This solved the problem

Related

Unity 2d - How can I make particles inherit rotation from parent

I have a particle system attached to a bullet and the particles being emitted are just rectangles. The problem is that when rotating the bullet, the particles don't rotate to face the same direction as the bullet.
What could I do to fix this?
Okay, I've looked around at some tutorials and I found that my problem fixes itself when I give the particle a texture. I had assumed I could do it without one given that I only wanted a yellow rectangle. To fix it, I went to the particle system and checked "Texture Sheet Animation" and switched Mode to sprites and assigned a texture. Then I went to "Renderer" and set Render Mode to Billboard and set Render Alignment to Local. Shoutout to Martin for linking that thread!

Why SpotLight passes through 3D sprite using this shader?

I'm using Unity2021.3, and this is a URP project.
There is a 3D sprite in the scene that receives and casts shadow, the material for its spriteRender uses a shader that is a simple modification of Unity URP Simple Lit, and there is a spotLight in front of the 3D sprite with shadow enabled, and there is also a directional light in the scene. The 3D sprite casts shadow on the ground due to the directional light and the spotLight, everything is correct.
But if I switch to a new shader, it seems the SpotLight passes through the 3D sprite, rendering the shadow incorrectly, if I move the SpotLight to make it far away from the 3D sprite, then it seems the shadow is correct.
Please see the attached screenshot, the top three screens are custom shader, below two are the URP Simple Lit variant.
I'm wondering what the problem is with the new shader?
Thank you so much.

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!

How to achieve Terraria/Starbound 2d lighting?

I am making a 2d game in the perspective of Terraria/Starbound. I want the lighting to look similar to this:
Ive tried to get lighting like this by adding a material on all the sprites in my game and then giving them a sprite diffuse shader. Then I made a point light wherever I needed light. There where two problems with this though: 1) Where the light was most intense, it was draining the color of a sprite and made it lighter. 2) I noticed a big FPS drop (And I only had 1 point light!).
Is there any way of achieving lighting like this without having to write my own lighting engine? Ive search the asset store and Ive searched to see if unity has any way of handing 2D lighting from this angle but I have found nothing.
If I do have to write my own lighting engine, would that be to complex for someone who is relatively new to unity and has only had ~ 8 months experience?
Assume you are using tile map.
You need to have a field of view map, which can be achieved by reading this: http://www.redblobgames.com/articles/visibility/
Using such map, you know exactly the color tinting for each tile. Now, just blend the color to the SpriteRenderer of every tile on the map.
Somebody already created a line of sight plugin:
http://forum.unity3d.com/threads/light-of-sight-2d-dynamic-lighting-open-source.295968/
Here's my hacky solution on GitHub
There's 2 cameras.
Empty tiles on the tilemap are filled in with white blocks (only one camera renders this)
A gaussian blur is applied to the camera rendering the white blocks
Then, blend the two cameras, darkening everything not covered by the white blur.
You can adjust the "light" penetration by changing the white tile's sprite's Pixels Per Unit.

Unity2D tile mesh render is darker than source texture

I am making a 2D tile-based game in Unity.
I have a tile mesh implemented roughly along the lines of this wiki entry. Full source code is available at PasteBin. When I look at my graphic (image file) it is precisely the same color as I see in the scene view; however, when I start the game, the mesh is darkened. I notice that when I change the Ambient Light color, it does resolve the issue (sort of): it changes the brightness, but if I set it to pure white, then the colors are too bright (see here). Furthermore, when I have regular GameObjects (such as the brick you see in the second image) they are not affected by this Light setting. I don't understand why the mesh is. Is there a prescribed way to make it totally WYSIWYG? The tileset I am using is here.
Try changing the shader on the material of the renderer to Unlit/Texture or Transparent/Unlit - if you need transparency.