/ Forums
New To The Forum? Click Here To Read The How To Guide. -- Developers Click Here.

How to apply the Rift specific skybox?

adamadam Posts: 20
edited November 2015 in Unity

I've made the unity car-tutorial rift-ready (see here).

I want to switch to using the special Rift skybox but don't know how to go about it.

Could someone provide the steps to take the skybox from the rift-unity integration packages and apply them to another scene/project?

Thanks, Adam


  • sorensilksorensilk Posts: 21
    All I did was copy the one from the Tuscany demo. It lost some of the connections so I had to figure out the order of the tiles. I'll try to create a Prefab tonight so anyone can drop it into a project.
  • cyberealitycybereality Posts: 20,980 Oculus Staff
    Thanks, sorensilk. That would be awesome if you could create a prefab.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 32GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i
    PowerColor RX 480 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
  • adamadam Posts: 20
    I figured out how to create a package, so here is the OVRSkyBox, ready to drop into any scene.


    Cheers, Adam.
  • cyberealitycybereality Posts: 20,980 Oculus Staff
    Seems to work to me. Thanks for putting this together.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 32GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i
    PowerColor RX 480 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
  • CosbyTronCosbyTron Posts: 63
    Lawnmower Man (or Woman)
    Awesome, thanks for doing this! Very handy to have in its own package.
  • NoraNora Posts: 16
    Virtual Boy (or Girl)
    I have prepared a script that can be used to generate a mesh of Skybox.
  • NoraNora Posts: 16
    Virtual Boy (or Girl)
    I provice new SkyboxMesh.cs .
    A little bit changed.
    - Support follow target.
    - Selectable shape Cube or Sphere.
  • cyberealitycybereality Posts: 20,980 Oculus Staff
    Awesome, Nora!
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 32GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i
    PowerColor RX 480 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
  • drashdrash Posts: 2,804
    Fantastic script, I'm sure this will be a big help to many. I've been stretching a single spherically-mapped texture along the inside of a big sphere, but even a 4K texture won't show very good detail doing that, so this script is excellent!
  • MarbasMarbas Posts: 112
    Great script Nora. Thanks!

    The cubed skybox works fine when running the app inside the Editor, but for some odd reason the skybox isn't visible when run as a build (x86). Any ideas how to fix this?

    I tracked down the problem having something to do with the shader generated by the script.
    On my end using the script's default "Unlit/Texture" doesn't work in build. (Works in editor)
    Changing "Unlit/Texture" to "Self-Illumin/Diffuse" gives approximately the same visual effect and works in both editor and build.
  • VergeVerge Posts: 58
    Lawnmower Man (or Woman)
    I think I have a better solution for the missing skybox after deployment. The skybox isn't visible, because it isn't assigned to a material when building. Unity strips out all unused assets to keep the build size down.

    If you create a "Resources" folder and put the used shader in there you can force it to be included in the build. :)
  • MarbasMarbas Posts: 112
    I agree that using the script's original "Unlit/Texture" shader would be better.

    But why then would unity include the "Self-Illumin/Diffuse" and not the "Unlit/Texture" shader?
    Note that I've only changed the string-name in Nora's script for the type of shader to generate.
    There really shouldn't be any difference.
  • VergeVerge Posts: 58
    Lawnmower Man (or Woman)
    Well, I'm also using the Unlit/Vertex Color Multiply Background from the topic below, so I have a shader file.


    But I had the same problem with the skybox not showing. "Unlit/Texture" isn't used somewhere else in the scene would be my guess, so at build it isn't compiled. "Self-Illumin/Diffuse" is included, because it is used somewhere else in your scene. So you can use another shader or place a shader in the Resources folder and use that one. :D
  • MarbasMarbas Posts: 112
    Im positive that "Self-Illum/diffuse" isnt in use in my project. Actually I tried a bunch of different shaders to find one that works visually for the skybox, and build ofcourse. Each of them worked, but not the "Unlit/texture" :mrgreen:
  • NoraNora Posts: 16
    Virtual Boy (or Girl)
    Update SkyboxMesh.cs.

    - Fix shader(material) code.
    Instead of Unlit/Texture, I made ​​it to initialize the shader dynamically.

    > Marbas
    Thank you for your report, In the old script, Shader.Find () would fail if the Unlit/Texture is not included in the build.
  • daatgamingdaatgaming Posts: 36
    This is awesome! Thank you for taking the time to write this.
  • Thanks Nora! Nice work.

    Everything works fine except Follow a target. Maybe it's my misunderstanding, but change "PostUpdate" to "Update" solved this problem. How will "PostUpdate" work to update the transform?
  • daatgamingdaatgaming Posts: 36
    Hey, wait. This is unity, so shouldn't it be LateUpdate()?
  • NoraNora Posts: 16
    Virtual Boy (or Girl)
    Update SkyboxMesh.cs

    - Bugfix follow target. ( Correction of spelling errors. PostUpdate () to LateUpdate() )

    > DarkMagicCK, daatgaming
    Thanks, and be sorry that it has not been tested.
  • MarbasMarbas Posts: 112
    Thanks Nora for fixing these minor issues. Works perfect! :)
  • jmoreyjmorey Posts: 1
    I cannot get Nora's script to run. I am doing the following:

    1. Creating a sphere object and scaling it up.
    2. Attaching Nora's script to the sphere object.
    3. Setting the Skybox parameter to a Mobile/Skybox that I have setup with my textures.

    The sphere object just appears without any texture, inside or out. This is the same in both scene and game mode. Any hints as to what I might be doing wrong?

  • CheshyrCheshyr Posts: 74
    I'm going to add my rookie voice to this question. Can someone give a brief description on how to use the script?

    I've imported the SkyBox prefab from earlier in the thread, and it appears to work great. With a little work, I can build out the tiles.

    At this point, I create an Empty Object, and assign the script. I assign a follow object, and then I have 2 materials left to attach... which is my first point of confusion. If I attach a Material to the skybox variable, it will render the color, but not the texture, regardless of the shader I associate with the material. The second Material variable, just labeled material, leaves me confused.

    Does this script preempt the prefab? What is proper usage?
  • brendenfrankbrendenfrank Posts: 32
    Virtual Boy (or Girl)
    I have the script working, instructions are as follows:

    1) Make an empty game object
    2) Attach the script
    3) Drag your (previously unity skybox) material onto the "Skybox" slot
    4) Run the game
    5) In the scene hierarchy tab, expand the empty game object to find that several planes were created and mapped to your skybox texture. These planes form a physical box around the player if your Radius is set correctly,

    Note: if using a box, turn the segments down to 1 or else you are just wasting polygons.


    JMorey, the object you place the script on will not get a skybox mapped to it. The script creates the mapped object automatically and assigns it as a child of the object your script was run from.
  • CheshyrCheshyr Posts: 74
    Thank you for the step by step. I followed your instructions, and everything worked... except the textures were empty. The problem must be with the Skybox textures I'm attempting to use. Now I just need to find a way to convert them from cylinderical reflection map into a standard skybox map. :-/

    Thanks again!
  • brendenfrankbrendenfrank Posts: 32
    Virtual Boy (or Girl)
    Glad to hear it worked out.

    The material you want to use is RenderFX/Skybox
    It should have a Front/Back/Left/Right/Up and Down (optional and usually never seen).
  • CheshyrCheshyr Posts: 74
    Right. I've got a texture pack I want to use that runs a RenderFX/Skybox Cubed shader to translate his cylinder reflection map to the standard skybox. It's getting all twitchy when I try to use it with this script... texture never shows up; just white planes. I've contacted him about it, but in the mean time, I'll likely have to find a way to convert his texture to the legacy 6-sided cube manually.

    Either way, if I use normal skybox maps, works great.
  • CheshyrCheshyr Posts: 74
    I wanted to post the answer I found to my own question... how do you take custom images, and break them out into skybox components? I've found 2 methods so far. Note; i'm a rookie, so these may have been obvious to the real developers.

    If your skymap is a single texture, already rendered Equirectangular, Cube, Cube Cross, Mercator, or Gall-Peters... your problem is solved. Use Planettool (command line), and crop the results with Photoshop or some other image editor (Note Photoshop PNG export causes seams; import directly from PSD to avoid these).

    My other solution was to generate the scene in 3DSM, then capture it using the Reflect/Refract Map tool.
    Ogre Forums Thread
    Autodesk Documentations

    This method has its own set of gotchas: the new Slate Material Editor blocks in-line rendering calls from their reflect/refract tool. You need to run the 'Pick Object and Render Maps' while in Compact Mode. Also, check your ambient lighting levels.

    I found the first method created cleaner images, but the second was usable with more diverse environments. Combined with Nora's SkyboxMesh script from this thread, you should be happily immersed in your virtual sky from now on. I've been importing AllSky, and it's beautiful.
  • BrianNewBrianNew Posts: 12
    Fantastic, Nora, Thank you.
  • BecomingBecoming Posts: 11
    Thanks for this script, very handy!! Does it do anything special or is it just a mapped cube/sphere following the player? I'm artist and no programmer so its not obvious for me from looking at the code... however, i have a little problem with it... it does work well but when i look up to about 45° to 50° angle the skybox gets much brighter... its only on this very little angle though.

    Its not because of the farclip plane, i have checked this. but other than that i'm clueless :?:
  • ssshakessshake Posts: 72
    adam wrote:
    I figured out how to create a package, so here is the OVRSkyBox, ready to drop into any scene.


    Cheers, Adam.

    can you post a photo of the expected end result? I just get a box with images in it, which based on all the other items in this package i dont think is the expected outcome.
Sign In or Register to comment.