Panoramas
What if the image was really wide, such as a panoramic photo that you can take with your phone? Let's try this and map it onto a cylinder.
I was in Los Angeles last year. I hiked to the top of the Hollywood sign, where I took two 180-degree panoramic images with my phone, and later I quickly stitched them together in Gimp. The Hollywood.png
image is included with this book, or you can use your own panorama:
Putting it together, using the following steps:
Move
Sphere 2
out of the way and set its Position to (-3, 1.5, 0
).Create a new cylinder by navigating to GameObject | 3D Object | Cylinder, set its Position to (
0, 1.5, 0
), and name itCylinder 3
.Set the Scale to (
2, 0.5, 2
).Disable its Capsule Collider component by unchecking the checkbox.
Drag the
Hollywood
texture onto the cylinder.Ensure that the
Cylinder 3
object is selected. On itsHollywood
material component in Inspector, navigate to Shader | Custom | InwardShader.
A default cylinder in Unity is 2 units tall and 1 unit wide...