Unfortunately it's not possible to do this just with a projection matrix since it only can do linear projection. What you want requires z². It is possible to do this with a custom shader, but your geometry need to have "enough" vertices along the "bend". See this example in Minecraft. I think you can't do the bending in the fragment shader since it requires you to offset the geometry depending on the distance to the camera. AFAIK this can only be done in the vertex shader.
This example scene has 3 objects in a row (two planes and one cube). The camera is sliding linearly on the z-axis over the objects. The first plane has my curved shader, the second plane has a normal diffuse shader and the cube also has my curved shader.
I've packed the sample together in a package.
Here's the important part of the vertex shader:
_Dist wouldn't be necessary. It just scales the whole vector, but it helps to find nice values ;)
As you can see the first plane bends quite nicely because the default Unity plane consists of 10x10 quads, so there are many vertices along the bending edge.
The cube doesn't have subdivs. The vertices bend correctly, but the edges will stay linear.
The second plane keep the original position since it doesn't have a bending shader.
Keep in mind that the actual objects will be on a straight line. This is very useful for physics and collisions. Only the view is bent.
I try to connect this shader property with the default shader Mobile/Particles/Additive. But i can't get the exact solution.
Please help me
answered Mar 06 at 07:42 AM