Objects disappear at certain angles - unity3d

So I made a water shader and for some reason in-game, the object disappears at certain camera angles. the material is also flipping the plane 90 degrees when i place it on an object
ShaderGraph
ShaderGraph
FlippedPlaneProBuilder
VideoOfError
I tried changing the alpha but that had no effect

I'd wager that your plane is moving into the near-clip plane of the camera. Anything that is not within the camera's viewable frustum is clipped away (not rendered).
read more here

Related

Why don't camera mesh appear in Unity?

I have two cameras and for each I've associated a Mesh Filter and Mesh Renderer (which are just red and green cubes. I notice that in the Scene view I can see one cameras position from the other camera. But when I actually play the scene the camera I'm looking through cannot see the cube of the other camera?
EDIT: Adding some clarity I hope.
When I click the play symbol.
When I switch to the green camera it cannot see the red camera.
When I switch to the red camera it cannot see the green camera.
Even though both cameras has a mesh attached to them which appears both in the Scene and Game previews (screenshot above).
The camera at the position of the green cube cannot see the green cube because it is inside the cube and the standard material uses backface culling, which means that only the fronts of the faces of the mesh are drawn and not their backs. And the standard Unity cube has all its faces facing outwards.
Also, I assume the cube would have been clipped regardless, since it's too close, under the near clipping distance of the camera. So anything outside the camera frustum will not be drawn.

World to Cube projection Unity

That's the setting:
I have 2 cameras in the game scene. The game must be played in a room with screens on frontal wall and on the floor. To be able to test it I just recreated the 2 screens in Unity. The goal is to make the game immersive, creating the correct illusion as the image on the left.
What I've tried so far (and it kinda worked as you can see from the screenshot) is:
Camera0: goes directly in the frontal display.
Camera1: I created a post processing effect that deforms the output texture to create the correct perspective illusion.
The problem:
The fact that I'm basically working over a texture creates some blurry effect on the borders, because the pixel density is not the same in start and deformed image.
I think the best approach would be to make the deforming transformation happen on the projection matrix of Camera1 instead. But I just failed. Have you any idea on how to approach this problem correctly?
You can let your perspective cameras do the work for you.
Set the fov of the floor camera so that it shows only as much as will fit on the screen.
Then, have the cameras at the same position.
Finally, have the floor camera rotated on the +x axis by half of the sum the fov of both cameras. For example, if the wall camera is fov 80º and the floor fov is 40º, set the floor camera to be rotated by 60º along the x axis.
This will guarantee that the view of the cameras do not overlap, and they will have the correct projection along their surfaces to create the desired illusion.

How to move forward with rotationg head

I am trying to move forward like this
float speed = 40;
this.transform.Translate(0,0,speed/50);
It works well when character's face is looking horizontally(y=0)
However when character's face is looking down,
Somehow, It goes down through the terrain.
Is there any good way to move horizontally even character's face is looking down??
If the GameObject the script is attached to is passing through the terrain (to find out look in the scene view with the object selected and see if its position is inside the terrain):
transform.Translate moves the position of a GameObject in the direction specified even if there is an object with a collider in the way such as terrain.
If you want to move an object with collision detection you should think about using a Rigidbody or CharacterController.
If the camera is seeing through the terrain even though the camera is not inside the terrain (to find out look in the scene view with the camera selected and see if its position is inside the terrain):
It is possible that the value of the camera's near clipping plane is too large. The camera's clipping planes tell Unity at what distances to start and stop rendering geometry. The far clipping plane tells Unity at what distance away from the camera to stop rendering geometry and the near clipping plane tells Unity at what distance from the camera to start rendering geometry. Any geometry within the two values is rendered and any geometry outside the two values is not. To stop the camera seeing through the terrain you could try lowering the value of the near clipping plane, to have geometry closer to the camera rendered or move the camera further away from the terrain.

Offsetting the rendered result of a camera in Unity

I am trying to make everything that is rendered by my perspective "Camera A" appear 100 points higher. This is due to the fact that my App has an interface with an open space on the upper part.
My app uses face detection to simulate the face movement into an in game avatar. To do this I compute the "Model-View-Matrix" to set it into the camera's "worldToCameraMatrix".
So far this works well, but everything is rendered with the center as the origin, now i want to move this center origin a certain distance "up" so that it matches my interface.
Is there a way to tell Unity to offset the rendered camera result?
An alternative I thought about is to render into a texture, then I can just move the texture itself, but I thought there must be an easier way.
By the way, my main camera is orthographic, and i use this one to render the camera texture. In this case simply moving the rendering game object quad up does the trick.
I found a property called "pixelRect", the description says:
Where on the screen is the camera rendered in pixel coordinates.
However moving the center up seems to scale down my objects.
You can set the viewport rect/orthosize so that its offset or you can render to a render texture and render that as a overlay with a offset or diffirence in scale.
Cheers

unity slide sphere on a slope without rotating

I have a ramp and I move a sphere with arrows. I have unity's gravity and I want the rigid body of sphere to slide when it is stoped at the top of the ramp but without rotating it's body. The problem is if I Freeze rotation on x axis, it won't slide.
Try to use physics materials like ice and freeze rotations.
See info about materials here. "Like ice" means than you need set frictions to zero.
You should create a new Physical Material and set both dynamic and static friction to 0. Then drag it to the sphere and maybe also to the ramp.
Test with both rotation constrained and not.