- Home /
Mapping hi-resolution image to an object
Hello,
I'm developing for Android, but I'm total newbie in Unity and graphics. My final goal is to make a viewer for hi-res panoramic pictures in Unity. I was able to make it partly. I added a sphere with corresponding mesh, applied a material with my image and placed a camera in the center. It works, but it seems that Unity has a 4096-pixels limit on image size. I need to bypass it somehow.
Now my idea is to split an image to multiple smaller images and to map them separately on this spherical object. I dint't find the answer, but maybe I wasn't searching properly.
Can it be done? Or maybe there are another solutions? Could you help me and give an advice at least what direction should I look?
Thank you.
Edit: now I received the panorama image that I should map on the object. It's in two formats: cubic (split into 6 faces, and each of them then split into 16 fragments) and equirectangular (split into multiple fragments). Maybe it will be easier to map it on cube, and then map this cube on the sphere?
Try looking for UV mapping in a modeling tool. This is what allows you to specific the position of the vertex in the image that you wish to map it too. This will also let you map each sub mesh to its own image.
I don't know if this will have limits like the 4096px one.
O$$anonymous$$ thanks, now I think I understand what I need to do. I need to create my own mesh with submeshes for each panorama segment in some modeling tool and apply some UV mapping to it. But if I get it right, the UV-mapping algorithms should be different for each segment because of different shapes. Does the tool do it automatically or I need to program it by myself?
Answer by SimonTS · Dec 06, 2014 at 04:53 PM
You'll probably want to use a skybox. By using a skybox you can use six textures, one for each side (up, down, left, right, forward, back), instead of only 1 on your custom object.
wow, thanks, it works well for cubic format. But is there a way to split each side of skybox to multiple images. For example if I want to implement zoom in the future and set different resolution to different zoom levels?
No, you can't split a skybox as far as i know.. You'll have to use a custom object in this case. You could use a cube and split each of its six sides into smaller squares (2x2, 3x3, etc.). Then you would apply a material/texture to each little square.
Ok thank you, and the last question I have: how to make custom cube object behave like skybox (I mean look like the sphere from the center)?
Ok, I think I found enough, thanks all again. But I think the cubic option is suitabl for me )
There are several possibilities, but applying a texture to a sphere or a smoothed cube can be difficult and will most likely look distorted.
You should research transfor$$anonymous$$g your panoramic image into cubemap format. $$anonymous$$ost programs that allow assembling panoramic images support multiple formats, and cubemap should be one of them. This results in either six individual images or one big image containing all six sides arranged in a cross.
Then just load the images into photoshop (or similar) and split them into smaller images, which are then used as textures on the split cube I mentioned above.
edit: Just saw your update to your question. You already seem to have the image in cubemap format with each side split into 16 fragments (4x4). All that is left to do is to create a cube with each of its sides split into 4x4 and then applying the individual fragments to their corresponding face of the cube in Unity. Then place the camera in the center of the cube.
Answer by robertbu · Dec 05, 2014 at 09:54 PM
You have a couple of choices. You can split your sphere into sections and map a separate image into each section. I've done this. I split the sphere into two half spheres and use 4K x 4K images for each half sphere. I had some artifacts at the boundaries of each half sphere I never worked out but I was just playing and otherwise the approach worked fine.
The second choice is to use the WWW interface to load your images. You are not restricted to 4K x 4K for the images brought in by the WWW interface. They can be loaded either locally or from the web using this interface. I don't know if there is an upper limit, but I successfully brought in images of 4k by 8k and 6k x 12 k (panorama images are 1 : 2 ratio height/width).
Thank you. But now I see in what format is this panorama image (updated my question) and it seems that I should work with the first approach. All these manipulations with object splitting etc. can be done in Unity or I should use modeling tools first?
Your answer
Follow this Question
Related Questions
Applying UV to plane mesh is pixel imperfect. 0 Answers
Mesh building changes in Unity 3.5.6 0 Answers
Make Mesh from Image (Alpha) 0 Answers
Plane pivot point creating 0 Answers
Script rendering Mesh to Image with transparent background 1 Answer