How to convert a panaroma to a cubemap in runtime?

Hello,

Complete disclosure : Have paraded thro’ walls of the internet to find none.

ATTEMPTING:

Literally trying to do this thro’ script.

REQUIREMENT:

Let’s say that we have a panorama shot such as this guy. I successfully implemented the panorama image with the above mention medium article to create a powerful VR scene.

Now, I want to implement it thro’ script. Using www class, I prefer to download the texture then wrap the texture to the CubeMap.

TRYOUTS :

  • I do see I could use TextureImporter but it required UnityEngine class for to use it which prevents me from using it in runtime.
  • A lot of people have posted the same question such as this one for no response.
  • Or could I possible split the Texture to six images for to use to a cube map using a shader or something similar?
  • How could I possibly split a panorama shot to six faces for a cube map?

Thank you & help in scripts is also much appreciated.

regards,

karsnen

You can simply extract the unitypackage file from [145605-panoramictocubemapconverter-unitypackage-zipped.zip|145605] zip and extract that into your project, it contains the “PanoramicToCubemapRuntimeConverter” class, that contains the “ConvertPanoramaTextureToCubemap” function that converts a panoramic image to a cubemap using a compute shader.

depending on the resolution it might take a few seconds to convert it (as all the pixels have to be copied by the main cpu thread due to unity and hlsl limitations).

it should be able to convert any texture you give it, including non-panoramic ones.

the “cubemapResolution” parameter should be set to the height of the texture you are converting, but you can give it any value you want (higher resolution = higher quality but longer processing times).

the package also contains the “PanoramicToCubemapTestInterface” MonoBehaviour that you can attach to a gameobject, attach a texture to it, and then press enter (you can change key if you want) to convert the texture given to it (while in play mode) and apply it to a cubemap skybox.

The platform you are targeting however requires compute shader support.

EDIT: link does not work properly and expects an image. Use this instead.

Did you find anything for this? Even I require converting from panaromic to cubemap for dynamically downloaded images, but not able to reach a solution.