Shadows going through objects - unity3d

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.

Related

Why can I see the inside of a room as soon as I cross it, in Unity?

I am currently working on a 3d game in Unity, and I am working on the level design using ProBuilder. I basically created a huge cube which I "flipped normal", and a second one way smaller
which, as the other one, I flipped normal, but as soon as I crossed it while turning backward I could weirdly see through the small cube, which makes it feel unfinished. How could I fix this issue?
Normally in 3d games triangles can only be seen from one side. Usually this is not a problem because walls have some thickness. Since you clearly have paper thin walls made of only one layer of triangles this is exactly the result you should expect.
In short add the other side to your walls. The simples way is to duplicate the existing triangles and flipping them. Walls will still be paper thin of course. Later you should probably make them thicker.

Shadows doesn't disappear

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.

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.

Need Forward rendering for fog, but Deferred rendering to keep out light

So I've hit a bit of an oddball in my project. I'm creating a horror scene. To support the atmosphere I've used Unity's lighting component fog. For my camera to see this fog, I need it to be on Forward rendering. However, I'm creating a hallway with different rooms and lights, and these lights seem to shine through my wall objects when forward rendering is off. Something I can fix by using deferred rendering instead (But then there's no fog).
It feels weird I'm in a position where I have to choose between the two and can't have it both ways. I tried messing around with some of the Legacy rendering, but no dice. All lights have a shadow strength of 1, and walls even have additional "Shadows only" walls, just to be sure nothing gets through.
It should be mentioned that I'm using one plane for all rooms (Not prefabs, one BIG object) if that has any impact at all.
Anyone experienced similar issues who has any workarounds?
If anyone runs into a similar issue, it's important to have different planes for different rooms. I was using 1 plane for the whole level, which caused this lighting bug to occur.
I had a similar problem... i solved with:
Set my camera rendering path with deferred
camera component
and set the component post process layer (asset)
post process layer

How can I achieve a node that will desaturate everything below it?

I am building a game where everything behind the player is greyed out as if it lives in a memory. But I don't know how I can achieve this effect. Is this where shaders are being used for?
Now I can create a SKLightNode to create the lighting and make it dark around the edges. But I like to field of view for the character to be 120 degrees. Everything outside of that angle should be greyed out.
Of course in the future I like the view to be blocked by obstacles but that is outside of the scope of this question.
A desaturation shader for SpriteKit can be found at my blog post on that subject. Note that this works in terms of an input texture, so you may need to adapt things to work on top of a tiled background. Also note that there is a new iOS 9 API to support capture of the output of a whole node, which may be useful to you in implementing this.