Shadows doesn't disappear - unity3d

I made an endless runner game where the horse runs in a canyon. So i noticed that in the walls makes shadows on theirselves so i wanted to remove it beacuse it's ugly. So my problem comes here, how can i remove that shadow even if i disabled the shadow casting from the mesh renderer of that walls? I also tried to place a light point near the walls but it still don't work. How can i resolve this. I attach a photo so you can understand what i am talking about.
Picture

Those are most likely just objects interacting with a directional light in the scene. Instead of shadows, those are just sides of objects that as less illuminated.
I can throw in two potential solutions:
Solution1:
Go to Window->Rendering->Lighting, select Environment, change the Environment Lighting Source value and modify the color values to your liking.
Solution2:
Add a material which changes how the objects interact with lighting. One option could be to just add a standard material with some emission.

Related

Unity URP Material scripting

I just started using URP in Unity for a game in progress. I'm doing a sort of sprites-in-3d thing, so I'm rendering some sprite sheets on quads. To do this, I create a Material with the sprite sheet and use tiling/offset to render the proper frame of animation by making a call like:
CombatMaterial?.SetTextureOffset("_BaseMap", new Vector2( (AnimationDefinitions[animationDefinition] % 16) * .0625f, CombatMaterial.mainTextureOffset.y));
I'm currently trying to add some feedback into my game for when characters use abilities or get hit by flickering the material. Because the base color starts at white and goes to black, that won't really work; the only other thing I seem to have available to me is emission, which looks great. Using a 0xAAAish color achieves the effect I'm looking for. I've been using the Feel Unity asset to do this, but I've also attempted using something like this:
CombatMaterial?.SetColor("_EmissionColor", Color.white);
The problem is, once I've set the _EmissionColor, the main texture offset no longer updates in game, thereby ruining all animations. If I change the texture offset manually through the inspector at runtime, animations don't work AND the _EmissionColor flickering stop working. If I mess around with the color of the _BaseMap in the inspector, _EmissionColor flickering starts working again.
Before I start diving into some unsightly color adjustments in an attempt to make this work again, I would love to know if I'm doing something that is simply unsupported by URP/Materials/whatever, or if there is some alternative to what I'm doing that's a little more straightforward.
Thank you!
After trying a bunch of random stuff, I don't have a "real" solution, but the game IS working how I want it to.
What worked for me was setting the _EmissionColor on the Material to (1,1,1). For some reason, when the _EmissionColor is set to (0,0,0) it's a black (ha) hole and won't accept future changes to the _EmissionColor. I assume this is some shader nonsense (with the base Lit Shader that URP uses) that I am clearly unfamiliar with.
Hopefully this helps anyone doing something as pointlessly against the grain as I am!

Unity - Why particle system gets transparent?

I just created an particle system where you see a blinking add-icon. The problem is that if something gets behind the particle system, it gets transparent and I dont know why. I read that changing the shader could fix it, but it didnt work. I tried every shader in "Particles/..."
Here you how it looks like:
I seems that your object doesn't get transparent, but rather that it is being covered by the other object even though it should be in front of it.
Sorting is a common problem with objects that use some sort of blending:
In this case this is probably due to the other object being in a ui element. You could try to enforce the draw order by modifying the render queue in the material, or force it to use depth testing by using an alpha cutout shader instead (but its edges will not look as nicely anti-aliased without an extra MSAA or FXAA)

How can I use baked lighting on sprites? / How to light up a large area in 2D?

I'm having trouble figuring out how to light up large area(s) of sprites in Unity 2D. My previous knowledge on Unity's lighting is zero.
I first tried using a large amount of point lights and using the "Sprites/Diffuse" material, but about only five would actually render at a time, so I guess there's a limit on that.
Then I tried putting in an area light. That didn't do anything, so that's when I started doing research about baked lighting on sprites (and baked lighting in general). I found stuff like this but I couldn't get it to work either because it's outdated or because I don't know what I'm doing. Other answers I've come across seem to assume that the reader knows anything about lighting in Unity in the first place which, to be honest, I don't. Unity's documentation website had some information on it, but no tutorials that go into how to set up baked lighting.
I've tried a bunch of different combinations of materials (like using the "Standard" shader for the sprites instead of "Sprites/Diffuse", emission, ect.) and I enabled "Baked Global Illumination" in Lighting>Settings.
If baked lighting isn't possible on sprites (or isn't worth the trouble), what are the alternatives?
Edit: I made sure not to have the lights pointing the wrong direction, and I do realise that Unity2D is just like painting onto a piece of paper in Unity3D. I was able to get point lights to work, but only a few at a time. I don't need to do the entire screen at once, I need to do a large specific area at once.
some tips...
working with sprites your in 2d... when you add a light, switch to 3d mode, and rotate to make sure your light is pointed at your objects, and oriented so as not to be on the same plane, or level with them, as this will cast all the light behind them.
if your trying to light up everything on the screen(in camera) attach an area light to the camera at the cameras position, point it where the camera points, and then in the inspector on the right, you can change its variables. intensity, range, width, height etc.
Emissive Texture:
https://www.youtube.com/watch?v=oa6kW5HhRd4
For some reason, I never even thought about going into the asset store. I found this for free, and it looks like it will work: Light2D.

Texture doesn't look the same

I am new to Unity and having problems with the textures. Whenever I import a texture and apply it to the terrain it doesn't look the same, sometimes it's for example way too dark and sometimes it's way too shiny. Here is an example:
I have been googling for a while without finding much about it, does someone know what is causing this and how I can fix it?
The reason for this, I expect, is because you are just dropping a texture image onto an object without changing anything. By default, this will create a new material asset, which is what is actually added to the object.
Look up Materials if you don't already understand how they work. The default settings are the Metallic slider at 0 and the Shininess slider at 0.5. Obviously these settings need to be changed depending on the texture, as not every texture is going be a non-metallic, kind of shiny substance.
It is also in these settings that you can add things like Normal Maps, Bump Maps, etc, to make them look more realistic.
Reasons for it being too dark might simply be that the your lighting isn't reaching that particular surface. In order to have a global light source, add a Directional Light to your scene.

Shadows going through objects

I'm new to Lighting in 3D. Just started working with Unity3D. I was creating a sample for myself to test shadows and there is a problem.
As you can see that i have created two simple walls with two cubes. Also I have setup a directional light. Let's go the backside of the walls to view the problem
Technically the front wall should be blocking the shadow of the back wall. But it is not. I have painted a read line to show that where the shadow of front wall is overlapping the shadow of the other, meaning going all the was through the wall. Why is that happening. Help please...
set your shader to DIFFUSE. i have the same problem and solved this. my spotlight is passing thor
that is interesting indeed, i have used unity3d for 5 plus years and never seen or noticed this. however, this might seem like a weird request, could you set the ground and the two cubes to bumped diffuse and make sure the cubes are touching the ground.
Since the shader that is used might allow shadows to pass, secondly, could you go to player settings and check if you are using forward of differed rendering, since their lighting techniques are very different they might have different results.
but all in all, best guess is that the shader you are using allows shadows to pass.