Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How do I go for a custom skybox using HD Render Loop?

Discussion in 'Graphics Experimental Previews' started by Indiefreaks, Mar 31, 2018.

  1. Indiefreaks

    Indiefreaks

    Joined:
    Nov 12, 2012
    Posts:
    89
    Hi all,

    I'm starting to evaluate and test the HD Render loop and I found an issue I don't seem to be able to get around.

    I'm trying to see if I can set my own custom skybox instead of using what seems to be the new forced procedural sky within it.
    Each time I try to replace the material set in the Sky material within the Lighting window, it gets back to that Skybox/Cubemap internal material instead.

    Could anyone tell me what I should disable in order to render my own custom skybox?

    Thanks

    Philippe
     
    lmgiorni likes this.
  2. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    To use a custom skybox doesn't require a material anymore (Well just a custom HDRI), only a few options to change.

    So on your scene settings, you will need to change Visual Environment to HDRI Sky (This only changes the sky in the viewport not lighting)

    upload_2018-3-31_10-5-59.png

    Now to make this sky affect Lighting you will need to add the HDRI component

    upload_2018-3-31_10-10-51.png

    This will allow you to input your cubemap for sky lighting/contribution.

    upload_2018-3-31_10-10-42.png

    All settings changed
    Also Baking Sky - Not too sure what this does (Might be ambient light bake, not sure) but I'd change it from Procedural Sky to HDRI as well

    upload_2018-3-31_10-18-49.png
     

    Attached Files:

    MadeFromPolygons and one_one like this.
  3. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    932
  4. lmgiorni

    lmgiorni

    Joined:
    Mar 14, 2014
    Posts:
    7
    Hi, is there anyway to link a direct light to the HDR texture as to get the shadow proyection from the light source in the HDR texture and when rotating the HDR the light moves along?
     
  5. Lorca1031

    Lorca1031

    Joined:
    May 4, 2018
    Posts:
    10
    Does anyone know if the sky can be set by code at runtime?
     
  6. Lorca1031

    Lorca1031

    Joined:
    May 4, 2018
    Posts:
    10
    NVM I just figured it out! In case you're wondering:

    You can make a separate Volume profiles and swap em out via code like this

    Code (CSharp):
    1. public UnityEngine.Experimental.Rendering.VolumeProfile profile;
    2.     UnityEngine.Experimental.Rendering.Volume Volume { get { return FindObjectOfType<UnityEngine.Experimental.Rendering.Volume>(); }}
    3.  
    4. void Start()
    5. { Volume.profile = profile; }
     
  7. Kriszo91

    Kriszo91

    Joined:
    Mar 26, 2015
    Posts:
    181
    Hello!

    How can i use the old skybox/6sided materials? which has 6 texture?
     
  8. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    642
    Prefer using the HDRI sky for skybox then. Convert your 6 textures to a cubemap, and use it as source for the sky.
     
  9. Kriszo91

    Kriszo91

    Joined:
    Mar 26, 2015
    Posts:
    181
    Thank you, how can i convert? i only find 1 texture converting
     
  10. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    642
    You can use the "Legacy Cubemap" described here : https://docs.unity3d.com/Manual/class-Cubemap.html
    Create a "Legacy Cubemap" asset, drag your 6 textures, and voilà.
     
    hippocoder likes this.
  11. Kriszo91

    Kriszo91

    Joined:
    Mar 26, 2015
    Posts:
    181
    I tried that but its look totaly different in 2018.2.11f1 and not working its give back only full white box
     
  12. Kriszo91

    Kriszo91

    Joined:
    Mar 26, 2015
    Posts:
    181
    looks like this..
     

    Attached Files:

  13. Kriszo91

    Kriszo91

    Joined:
    Mar 26, 2015
    Posts:
    181
  14. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    642
    That's strange. I just tested on the same Unity version, with latest (3.0.0) available HDRP version for it, and I have a proper cubemap asset :
    upload_2018-10-12_14-37-1.png

    Could it be that you have enabled the Debug inspector by mistake ? : upload_2018-10-12_14-37-49.png
     
  15. Kriszo91

    Kriszo91

    Joined:
    Mar 26, 2015
    Posts:
    181
    No, its in normal view mode, how do you created the cubemap? right click -> legacy -> cubemap?
     
  16. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    642
    Yes, that's exactly how I did.
     
  17. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    642
    A solution could be to create manually (with an image editing tool) a single texture cubemap, by layouting all the 6 images side by side like in the doc :


    And then import it as a cubemap texture.
    It's also recommended in the doc to use this method.
     
    Kriszo91 likes this.
  18. HASSANHR

    HASSANHR

    Joined:
    Feb 23, 2018
    Posts:
    18
    @Remy_Unity
    i have the exact same problem
    when i create a legacy cubemap and drag the 6 tiff textures into that !!!
    that's really hanging my entire project . i'm trying to make promotional stuff in HD Render pipeline
    but the cubemap won't work for me i'm using unity 2018.2.11f1
     

    Attached Files:

  19. impman

    impman

    Joined:
    Jun 17, 2016
    Posts:
    7
    Experiencing the same issue, just done some testing, and the cubemap asset loads correctly on new projects using the old render model, and the LWRP but not using the HDRP, interestingly.
     

    Attached Files:

  20. HASSANHR

    HASSANHR

    Joined:
    Feb 23, 2018
    Posts:
    18
    i fixed the problem making a 6 sided layout in photoshop and imported it as a cubemap
     
  21. EJSainz

    EJSainz

    Joined:
    Mar 24, 2015
    Posts:
    29
    I'm on Unity 2018.2.8f1 and I'm also getting the same problem.
    I'm getting the same problem. 2018.2.8f1.

    I started a new project to test HDRP with the launcher option. After fiddling a little looking for refraction, I upgraded HDRP to 3.0.0 (was 2.0.8, I think).

    I don't know it this may be of help to point out the issue, just hope so. For now going for the photoshop solution.
     
  22. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    642
    So I inspected a bit deeper. The issue is that in HDRP we override the cubemap inspector in c# to allow to have an exposure control in the cubemap preview. But this breaks the lecagy cubemap, and we can't get back the c++ inspector of it.
    I highly recommend to use the new way to import cubemaps (6 sides layouted single texture) as it allow more control on the final generated cubemap.
     
  23. Kriszo91

    Kriszo91

    Joined:
    Mar 26, 2015
    Posts:
    181
    Any photoshop or gimp layout for the 6 sided cube? or an easy way to generate this 6 texture from one texture?
     
  24. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
     
  25. Kriszo91

    Kriszo91

    Joined:
    Mar 26, 2015
    Posts:
    181
    thats good, but sizes? not the best way to mess with this in photoshop
     
  26. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,065
    A power of 2 height and that *6 for the width.

    What height you want is up to you more or less.
     
  27. akthiele

    akthiele

    Joined:
    May 15, 2017
    Posts:
    2
    hello,
    really old thread but somehow still relevant it seems... so... i have been trying to sort out the skybox in Unity 2019.2.12 HDRP and as unity seem to change the way to create this every other day I am at a loss. so bear with me. i am trying to take a single image, make it into an 'environment' background. i am not a game developeer, but an artist creating immersive experiences, so less familiar with the coding side of things.
    i have added shader graphs etc, so the lighting coming from the skybox is not really relevant in this instance. I have tried to create cubemaps but they don't really work. any ideas, much appreciated.
     
    zeropointblack likes this.
  28. kamleshdurgab

    kamleshdurgab

    Joined:
    Jul 5, 2018
    Posts:
    1
    Hi,
    it solved in 2020.1.0a20.2541 unity version where you can have "using UnityEngine.Rendering.HighDefinition;". In this you can find "HDRISky" class. By creating instance of this class first find the HDRISky reference in the scene by this code " hDRISky = GameObject.FindObjectOfType<HDRISky>() as HDRISky;". This instance provides option to add custom cubemap " hDRISky.hdriSky = (any cubemap)".
    By adding RenderSettings in Scene change Visual Enviroment Type to HDRI Sky and by "Add Override" add HDRI Sky element
     
    Last edited: Jan 29, 2020
  29. DoomPriestK

    DoomPriestK

    Joined:
    Nov 23, 2019
    Posts:
    154
    Still getting this problem in Unity 2020.1.0b4 using HDRP, can Unity add a feature to let us drag-and-drop seperate textures into a cubemap without it breaking? I've been asking on discord about this, I'm using Spacescape and it exports as a single .dds cubemap or 6 PNG files, when I use the .dds the textures render but two of the 6 faces are incorrect (it's been suggested that the texture may be wrong but I find this hard to believe as a lot of people use the software without any problems), so my only other alternative is to export as 6 files, using Create - Legacy - Cubemap it shows an array of 6 fields where I should be able to drag-and-drop the textures but when I do and assign it to the cubemap section of the HDRI Sky component, my scene is still grey, it just wont show the textures at all.





    I tried to find some kind of free online tool that will generate a cubemap from 6 textures but nothing, I followed all the documentation (which is completely out of depth for someone with little coding experience), being told on Discord by a moderator "is it using the right default shader", how on earth should I know? I know the materials are different in HDRP but i'm assuming (probably incorrectly) that Unity would automatically use the right shader for it? he also said to look at " https://docs.unity3d.com/Packages/c...manual/Creating-a-Custom-Sky.html#SkySettings ". I asked why on earth I should have to write my own shader just to get a simple sky working, and he said "the code is already provided in the link". So I copy-and-paste the code into a brand new script - BOOM, 12 errors, if your going to provide a "code example" of something that should be in a single script, then perhaps it should be a complete script, or better yet let people download the scripts via link so people who are new to the engine can start with something that should apparently be simple like "adding a sky". If anything is going to push someone to use Unreal instead, it's basic things like this.

    The other option I have is I have to learn an entire image editing suite (actually pay money for photoshop or get GIMP) just to learn how to create my own cubemap textures........all because Unity wont let me use 6 seperate ones in HDRP.....thats just wow..

    Sorry if this seems a bit angry, but when I started with Unity I knew there would be problems, I just never expected there to be this many problems with what should be basic functionality. HDRP insists on a cubemap for sky otherwise I could have just used a Skybox texture, why isn't that an option in HDRP?

    I'll brace myself for the inevitable "this should be ticked" one-liner that fixes my entire problem :p
     
  30. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    642
    SassyPantsy, radiantboy and Olmi like this.
  31. DoomPriestK

    DoomPriestK

    Joined:
    Nov 23, 2019
    Posts:
    154
    Nice tool, this might highlight a bug in either software, for example, above I said that 2 faces of the cubemap are incorrect, using your tool I swapped the left and right sides, and it lines up perfectly.

    This means either Spacescape is exporting sides that are incorrectly labelled seperately and incorrectly placed in the .DDS file, or Unity is asking us to enter the left and right faces backwards, i'll post on Spacescape and let them know it could be their end, my only hesitation is that other people are using the exported images fine (unless they have the same problem but just havent said anything).

    I take it nobody has had this problem with Unity recently? I did a search but couldn't find anything.
     
    Last edited: Apr 9, 2020
  32. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    @Remy_Unity
    I came across this thread looking for help with HDRP skyboxes, and you give some great info here on that topic

    The struggle I'm having is that my goal is for a skybox that works in outer space, and all the HDRP skyboxes assume your feet are on the ground and that there's a "sky" above, a horizon in the middle, and a backplane below.

    Any suggestions on how to do a hdrp outer space skybox? I was hoping an old school sphere placed around the camera with the cubemap would do it, but using the Sky and Fog Volume still does weird things, even if the sky type is None.
     
    SassyPantsy and Gryflir like this.
  33. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,593
    Awesome tool! Saved me a ton of pain, left and right did need to be flipped though, so maybe a bug there?
     
    SassyPantsy likes this.
  34. SassyPantsy

    SassyPantsy

    Joined:
    May 17, 2020
    Posts:
    136
    Yo man, I just want to say that you're an absolute legend, and that I hope you're living lavish like the king that you are
     
  35. Elle_Spark

    Elle_Spark

    Joined:
    Apr 28, 2021
    Posts:
    1
    • Make 6 textures that correspond to each of the 6 sides of the skybox and put them into your project’s Assets folder.
    • For each texture you need to change the wrap mode from Repeat to Clamp. If you don’t do this colors on the edges will not match up:
    • Create a new Material by choosing Assets->Create->Material from the menu bar.
    • Select the shader drop-down in the top of the Inspector, choose Skybox/6 Sided.
    • Assign the 6 textures to each texture slot in the material. You can do this by dragging each texture from the Project View onto the corresponding slots.
    • In this screen shot the textures have been taken from the 4.x StandardAssets/Skyboxes/Textures folder. Note that these textures are already used in SkyBoxes.

      To Assign the skybox to the scene you’re working on:
      • Choose Window->Lighting from the menu bar.
      • In the window that appears select the Scene tab.
      • Drag the new Skybox Material to the Skybox slot.
     
    Last edited: Jul 2, 2023