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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

High quality skydome

Discussion in 'General Graphics' started by newt2017, Jan 19, 2018.

  1. newt2017

    newt2017

    Joined:
    Jan 16, 2017
    Posts:
    8
    I would like to create a skydome (skysphere) to include it in my game. For that purpose I tried to create a sphere (GameObject) and to wrap the sky texture from inside (by inverting its normals and manipulating with mesh vertices). Then I encountered a problem: game objects cannot be placed inside a sphere - the game crashes immediatly after it runs. How do people usually implement skyspheres in Unity? Or the only possibility is to use skyboxes?..

    I also have additional question. When I stretch a skytexture on the inner surface of a sphere, some kind of pole singularity arises (see the figure below). It looks like there should be some interpolation in order to make our texture smooth on a pole. How can one deal with it?




    P.S. I have already asked this question on Unity Answers, but it seems to be that nobody is going to reply there (I have created 3 different topics there so far, and none of them were answered).
     
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,383
    Use a Skybox.
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,230
    Does the game object the sphere mesh is on have a collider still?

    To expand on this, there are shaders specifically for use as the scene's skybox that can take textures of various kinds. Make a new material, set the shader to Skybox / Cubemap or Skybox / Panoramic. For the Skybox/Panoramic option you can take your texture as is and use it as the texture. Alternatively you can change your texture to "Texture Shape > Cube" in the asset's import options and it'll create a cube map texture asset you can use with the Skybox/Cubemap shader which is a little more efficient to render.
    You then assign this material to the Skybox setting in the lighting tab.

    No need to use a sphere mesh at all.
     
    DavidLieder and newt2017 like this.
  4. newt2017

    newt2017

    Joined:
    Jan 16, 2017
    Posts:
    8
    Thank you! The reason I was asking this was that in other game engines people use sky domes.

    One more question. If I want to create custom skybox, I just need to create cube map in some other soft for given textures of sky?
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,230
    Unity is using a sky dome mesh too, it's just one that is automatically setup for the user. It's also one that uses a special transform so it is always centered on the camera and as far away as possible. There's no reason why you couldn't use your own skydome mesh if you wanted, and some people do for certain reasons. However if you're just trying to render a panorama the built in one works.

    Cubemap or panorama, yep, add long as the built in solution meets your needs.
     
    DavidLieder and newt2017 like this.
  6. newt2017

    newt2017

    Joined:
    Jan 16, 2017
    Posts:
    8
    Thank you!

    Currently I am using skybox, it enables to avoid these artefacts of skysphere that I tried to use before (see the screenshot in my first post). However, for some reason all free skyboxes (namely, cubemaps) are of pretty low quality.

    Just as an academic interest, is there something in Unity that controls how the texture is spread along a given gameobject (i.e. sphere)? Why does this wrong "gluing" occur (see the screenshot in my first post)?
     
  7. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,230
    Search for free HDRI panoramas. Plenty of nice high quality examples for those, don't worry about cube maps since you can use Unity to do that conversion for you.

    That's just your standard UV mapping problem. That'll happen in your average 3d modelling program when using the same geometry. Unity's sphere is a spherized cube rather than the more common long / lat "UV sphere" or icosahedron based representations. It has a number of benefits, but how it handles UVs at the poles is not one.
     
    DavidLieder and newt2017 like this.
  8. newt2017

    newt2017

    Joined:
    Jan 16, 2017
    Posts:
    8
    Thank you!