How to increase shadow strength overtime/distance in Unity - unity3d

I'm trying to increase shadow strength when the object is becoming near to the ground.
Using light source (Directional Light) which is perpendicular on my cube game object (Rotation 90,0,0).
This is how I want it to appear:
#Workaround which isn't good:
Manipulating the directional light will work when there is only one falling object, but when there are more than one falling cube it won't work properly at all. As if there are 5 falling objects each one at a different distance from the ground.. no way :/ I don't know how to work this out.
Any suggestions? I would be so grateful, thanks in advance.

Related

Make only near faces of a cube invisible in unity

I'm trying to make an isometric style room where only the further back 3 sides of a cube are visible, based on the location of the camera but also maintain the shadows casted from these faces.
I have tried to do such using raycasts and updating the shadow casting mode of the GameObjects hit but haven't had any success.
Any ideas on how to do this would be much appreciated.
Thank you!

How to get lighting information on a 2D Sprite's front-side?

I'm using 2D Sprites for NPCs in a 3D game. My problem is when a sprite NPC turns away from the light source (eg. Directional Light) it becomes completely dark. So for almost 180 degrees when not facing the light source the sprite is all black. I need to prevent this from happening and find a way to set a minimum light/color for my NPCs so the player can see them. What would be a good way to find out how much light is affecting the forward facing side of a gameobject?
Any help is appreciated. Thank you.
Not a complete answer, but I did spend a fair amount of time looking into this for a recent project.
One suggestion that might work is to map the graphics to quads instead of using the sprite renderer, since they will use the 3D-lighting.

How to roll a cube on it's edges on Unity 3D

I want to move a cube by making it roll on it's edges. The cube will be standing on a x-z grid and each movement it takes will make it stand on a different square of the grid.
The player will controll the movement and will only be able to make the cube roll on one direction at a time (left, right, forward or back), but the cube must always stand exactly on top of one of the grid's squares.
I don't think applying a force to the cube will help cause it could move it a little bit too much or too little. I want to achieve something like this: https://www.youtube.com/watch?v=yaAIUYuNi84 but only on the x-z plane. Notice how on each corner the cube can stop and change direction with ease, because it never moves too much or too little.
Any ideas on how to approach this?
If you are new to the Unity it will be useless to trowing you a bunch of codes so i am telling you the way of doing it so you can implement your own codes.
You can create 4 empty game object which will always follow the cube on the floor and when you want to roll the cube you will rotate the cube around the empty objects.
You can find the codes for following the cube and rotating the cube on youtube, and for the starters searching is allways good.
So i hope you can manage it out, if you cant please write me again where did you stuck and i will be happy to answer you :)

Unity3D: I want my moving 3D objects to have a consistent shading

I have 2 directional lights in the scene, light 1 is parallel to the Y axis (I want it to make a shadow underneath the sphere), light 2 is parallel to the x axis.
I have some barriers(3d cube objects) that are moving to the left side of the screen( velocity = (-20,0,0) ).
I want the barriers to have a consistent color/shade while moving through the scene. When the object is on the right side of the screen it is darker and as it moves to the left, right before it moves off the screen, it gets brighter. I can't figure out why!
What I've done:
I found if I remove all lights from the scene the effect doesn't happen.
I've removed all other objects from the scene.
In the lighting options I've turned off RealtimeGI and Baked GI.
I've removed the Skybox and turned Ambient Intensity, Reflection Intensity to 0.
Here is the effect to help understand it more:
Barrier
Barrier moved
Thanks if you can help me out!
It looks like it had more to do with the orthogonal camera. I noticed that if I move the camera source point further away, the effect disappeared. My guess is the angle of my camera and how close it was to my main scene intensified the color so it showed it as brighter.
That is my guess anyways, If someone has a better answer please let me know!

Tracking 3D cube position OpenGL?

SHORT INTRO:
I'm having trouble with a 3D cube on a plane. The plane is a grid of squares. The ID number of the square that the cube currently occupies on is stored in a storage-variable. This is so that I can tell whether or not adjacent squares are free for the cube to move onto. When I move the cube, the storage-variable is updated to reflect the ID number of the new square.
PROBLEM:
The problem is that sometimes when I am moving the cube, the cube is moved too far or in the wrong direction and the square in the storage-variable does not match the actual square the cube is drawn on...This causes problems like the cube not detecting collisions and even going through objects it is not supposed to....
Cube is drawn in a drawView method in an iPhone OpenGL ES EAGLView at a rate of 24 times per second...Could the fast drawing be the cause of this???? How can I fix this? My job depends on it...
Somebody please help.
Well, not a lot to go on... But I doubt that the display refresh rate has any bearing on where the cube is going. Sounds like you have a good old fashioned logic error. But again, that's only going off what you've given.
Have you tried checking to make sure each storage-variable maps correctly onto each square in your plane? Try debugging, drawing a square at a time to make sure it's drawing each one where you think it's supposed to be.