Search Unity

Is it possible to generate a Spheremap from a Texture2D in Unity at run-time?

Discussion in 'Scripting' started by Ben-BearFish, May 28, 2015.

  1. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    I was trying to create a dynamic spheremap from a Texture2D for a skybox at run-time (Standalone build). Does anyone know if this is possible and how to do that?

    Separately, is it possible to generate a cylindrical cubemap at run-time if spheremaps are too difficult to achieve?
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    you can modify UVs at run time... not sure if that's what you are after?
     
  3. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Not exactly, but that might help part of the problem. I already know how to access and modify uv's on a Texture2D at run-time, but I don't know how to do that for a spheremap in Unity.
     
  4. rakkarage

    rakkarage

    Joined:
    Feb 3, 2014
    Posts:
    683
  5. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @rakkarage While that seems okay for a mesh sphere, unfortunately that won't work with a spheremap. I'll keep looking.
     
  6. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @Aras I know you're a busy guy, but any insights into this?

    I'm aware of RenderToCubeMap, but I'm not sure that would do what I need specifically. Is it possible to take a Texture2D and convert it to a Cubemap with spheremap mapping at run-time? I'm trying to create a spheremap skybox that updates its Texture2D at run-time.
     
  7. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    I seems RenderToCubeMap is only really useful for simulating reflections. It won't help with converting a Texture2D to a Cubemap/Spheremap at run-time.
     
  8. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Anybody else have any idea how to generate a spheremap at run-tiime from a texture?
     
  9. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    for my own edification... what do you mean by spheremap? (I keep envisaging the example textures in modelling tools when you say that o_O )
     
  10. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    @LeftyRighty By spheremap, I mean in the Unity editor when you create a cubemap by importing a texture, you can set it's cubemap mapping settings to spheremap as shown here:

    Spheremap.png

    I'd like to be able to take a texture or Texture2D at run-time, load it, then create a cubemap with spheremap settings. Thus, I could create a dynamic spheremap from a Texture2D for a skybox at run-time.
     
    Last edited: Jun 2, 2015
  11. razielanarki

    razielanarki

    Joined:
    Jun 1, 2014
    Posts:
    58
    any news?
    i'm trying to do something similar, only i'm trying to source a cylindrical cubemap from a texture2d at runtime.