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. Dismiss Notice

Question can i get inside a sphere object?

Discussion in 'Editor & General Support' started by lz7cjc, Jan 16, 2022.

  1. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    520
    Hi
    I am trying to create an area of my scene dedicated to space. I want to be able to put a material onto e.g. a sphere, then inside the sphere, I would like to have various objects.

    I am guessing that isn't possible so what is the best approach? I do not want to leave the scene and the rest of the scene is in daylight. I looked into skyboxes but i think these need to be scene dependent?

    thanks for any ideas on how to approach
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,713
    Steps to success:

    - make a sphere in your favorite 3D modeling program

    - get inside it

    NOTE: beware that generally polygons only render on ONE side, so when you make your sphere, flip all the polygons so they face inwards. Here's how to see this as you work in Blender:

    backface_culling.png
     
    Lethn likes this.
  3. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    For his purposes @Kurt-Dekker that will be fine because the player is never going to go outside the sphere in this instance to begin with. This is a method I'd been looking at myself but hadn't had time to research properly as I'm focused on other stuff right now so I'm glad it came up, didn't realise all it would take is some flipping in 3D software.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,713
    You can actually even do it at runtime or import time or wherever you like within Unity... you just need to wind the triangles in the opposite direction:

    https://answers.unity.com/questions/476810/flip-a-mesh-inside-out.html

    If you have a triangle with indices
    0, 1, 2,


    It just needs to become
    2, 1, 0,
     
    Lethn likes this.
  5. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    520
    ok so i can do this with an imported sphere but not a gameobject sphere?Only problem there is that I have no idea how to use a 3d editing app.. have downloaded blendr and seeing what I can work out but if there is a way to do this in unity that would be welcome

    -I do need to TP into and out of the sphere but assuming that won't be a problem?
     
    Last edited: Jan 17, 2022
  6. TOES2

    TOES2

    Joined:
    May 20, 2013
    Posts:
    135
    You can use a two sided material on the sphere.In HDRP/Lit there is a checkbox for double sided. For Lightweight render engine, there is a dropbox for Render Face. Various ways for different pipelines. You can also take an existing built in shader and modify it to be double sided.
     
    lz7cjc likes this.
  7. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    520
    thanks - that did it