Jump to content

Unity Layers and Tags updated 12 June 2018


Recommended Posts

I did some experiments with Layers and Raycast on KSP 1.2.1 and like to update this list with my findings :

Spoiler

Layer 1 TransparentFX

Layer 2 Ignore Raycast

Layer 4 Water

Layer 5 UI

Layer 8 PartsList_Icons

Layer 9 Atmosphere

Layer 10 Scaled Scenery (used for planets and sun)

Layer 11 UI_Culled UIDialog

Layer 12 UI_Main UIVectors

Layer 13 UI_Mask

Layer 14 Screens

Layer 15 Local Scenery

Layer 16 Kerbals ( used for anything you want visible in IVA views)

Layer 17 Editor_UI EVA

Layer 18 SkySphere

Layer 19 Disconnected Parts PhysicalObjects

Layer 20 Internal Space ( used to prevent IVA camera views being blocked by props or hull parts also used when creating internal props)

Layer 21 Part Triggers ( used for hatches and ladders and in conjunction with box colliders " is Trigger " check box)

Layer 22 KerbalInstructors

Layer 23  AeroFXIgnore  (prevents parts from showing aero effects)

Layer 24 MapFX

Layer 25 EzGui_UI UIAdditional

Layer 26 WheelCollidersIgnore ( used to prevent weird interactions between wheel colliders and node colliders, wheel colliders pass through any collider set to this layer, be warned it also makes things invisible )

 

Layer 27 wheelColliders ( the layer for wheel colliders )

 Layer 28 TerrainColliders

Layer 29: DragRender

Layer 30: SurfaceFX

Layer 31: Vectors

 

Link to comment
Share on other sites

  • 3 months later...

Hi, sorry for the bump , the thread is still being referenced in troubleshooting. so to my mind still useful and relevant

So I have updated the first post with the latest info from @Li0n and a little gem on what to do when  Craft lights are illuminating a planets surface from orbit, discovered by @Nils277

Cheers

 

Link to comment
Share on other sites

  • 8 months later...

@SpannerMonkey(smce)

Let me see if I can get it to paste into these forums...

Erm... nope.  Link it is I suppose.  Probably won't be permanently hosted there, but should be around for at least a few days/weeks.  Going to try and put it up on a GH wiki page, but apparently I'm going to have to hand-write the table.

https://www.dropbox.com/s/950kxhny2dczcrh/cameraData.xlsx?dl=0

 

Edited by Shadowmage
Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...

This still seems like the most valid location to ask this question, my apologies for minor thread necromancy. Any ideas on what could be done to have an object appear in game and be interactive with all of the game physics, but not be mouse-interactive? Trying to figure out a way to make a energy-shield that would surround a craft without having said shield block the ability to click on and interact with parts.

Link to comment
Share on other sites

51 minutes ago, Darinth said:

Any ideas on what could be done to have an object appear in game and be interactive with all of the game physics, but not be mouse-interactive?

Hi, if the shield is meant to stop projectile weapon missiles etc, there's no way for that to work, ( from a pure part standpoint) anything that's intended as a shield has to have some form of collider , the hit/hits has to be detectable  ,  I tried every layer in the book including made up ones , and thats the way of it. No collider/rigidbody = no shield  

Also worth noting , that as we've done shields already I can tell you for certain that you do not want full physics acting on your shield,  in fact the less effect it has the better , shields are supposed to be energy shields, so you have to compromise. otherwise you can't use the shield in atmosphere, which is the only real place you need it as there are still only limited possibilities for space combat, full physics means massive drag , and gawd awful atmospheric and re entry effects .
I suspect there may be a way to do it purely through code, but the shell/shield will still need some of of being detected easily as being hit , so  maybe a collider will always be needed
For ref see thread below

 

Link to comment
Share on other sites

@SpannerMonkey(smce) Actually the atmospheric effects are more what I'm expecting and looking to make use of. The shield isn't really designed for combat, it's designed for late game atmospheric reentry. My current stated objectives for the shield are "At a bare minimum, should serve as a craft-wide heat shield and air resistance to slow you down on re-entry. Ideally, should also be able to soak collision and allow parts (solar panels, radiators, antenna) to ignore aerodynamic forces as long as the shield holds."

Link to comment
Share on other sites

  • 5 months later...
  • 3 weeks later...

I am trying to play around with Cameras in KSP and I having a hard time getting everything to render as I want.

for now I am trying a simple experiment, just take a picture of the outside of KSC.

 

if I put a camera in position and Render, I can manage to get the terrain and the ocean, scaled space objects

I also found a way to get the skybox, but that requires me to move the camera before taking the image

 

however, I can't figure out any way to get the atmosphere or the sunflare to be rendered >_>

 

does anyone know if those objects require some change in order to be rendered?

Link to comment
Share on other sites

1 hour ago, Sigma88 said:

I am trying to play around with Cameras in KSP and I having a hard time getting everything to render as I want.

for now I am trying a simple experiment, just take a picture of the outside of KSC.

 

if I put a camera in position and Render, I can manage to get the terrain and the ocean, scaled space objects

I also found a way to get the skybox, but that requires me to move the camera before taking the image

 

however, I can't figure out any way to get the atmosphere or the sunflare to be rendered >_>

 

does anyone know if those objects require some change in order to be rendered?

SkySphere is closest.

ScaledScenery and Atmosphere are next closest.

Default, LocalScenery, and Ocean are the only ones that are at their actual depth.

 

The way I approached it is to have a skybox that SkySphere is rendered into, then added that Skybox to the Scaled camera and set it to clear-flags skybox, and have scaled rendered into another skybox which is used for the local camera, and the local camera too is set to clear-flags skybox. This way you have 3 layers of renders with each showing at their proper depth and don't overlap the local stuff. There are other ways you can approach it too.

 

As a note, scatterer does not work with anything but the main camera, and in fact removes the rendering from most other layers. For example, the atmosphere will be completely black when scatterer is installed, so with Eve you would have clouds, but they would be floating in a black sky. Eve by itself works fine.

Edited by Electrocutor
Link to comment
Share on other sites

15 minutes ago, Electrocutor said:

SkySphere is closest.

ScaledScenery and Atmosphere are next closest.

Default, LocalScenery, and Ocean are the only ones that are at their actual depth.

The way I approached it is to have a skybox that SkySphere is rendered into, then added that Skybox to the Scaled camera and set it to clear-flags skybox, and have scaled rendered into another skybox which is used for the local camera, and the local camera too is set to clear-flags skybox. This way you have 3 layers of renders with each showing at their proper depth and don't overlap the local stuff. There are other ways you can approach it too.

As a note, scatterer does not work with anything but the main camera, and in fact removes the rendering from most other layers. For example, the atmosphere will be completely black when scatterer is installed, so with Eve you would have clouds, but they would be floating in a black sky. Eve by itself works fine.

I'm not sure what you mean.

I managed to get the skysphere layer (18) rendered on a skybox,  but I had to move the camera to do so.

I can't figure out how to get the atmosphere layer rendered properly.

Default is always empty for me, and I can get local + ocean just fine.

 

how did you solve the atmosphere problem?

Link to comment
Share on other sites

14 minutes ago, Sigma88 said:

I'm not sure what you mean.

I managed to get the skysphere layer (18) rendered on a skybox,  but I had to move the camera to do so.

I can't figure out how to get the atmosphere layer rendered properly.

Default is always empty for me, and I can get local + ocean just fine.

 

how did you solve the atmosphere problem?

  • SkyBox Galaxy
    • Rendered into directly from Camera
      • Clear-Flags: Black
      • Layers: SkySphere
  • Skybox Scaled
    • Rendered into directly from Camera
      • Clear-Flags: Skybox
      • Layers: ScaledScenery, Atmosphere
      • Skybox: Galaxy
  • Camera
    • Clear-Flags: Skybox
    • Layers: LocalScenery, Ocean, Default
    • Skybox: Scaled

As long as there is a Skybox component inside the same GameObject as a Camera, the camera will use that Skybox instead of the universal one.

Link to comment
Share on other sites

46 minutes ago, Electrocutor said:
  • SkyBox Galaxy
    • Rendered into directly from Camera
      • Clear-Flags: Black
      • Layers: SkySphere
  • Skybox Scaled
    • Rendered into directly from Camera
      • Clear-Flags: Skybox
      • Layers: ScaledScenery, Atmosphere
      • Skybox: Galaxy
  • Camera
    • Clear-Flags: Skybox
    • Layers: LocalScenery, Ocean, Default
    • Skybox: Scaled

As long as there is a Skybox component inside the same GameObject as a Camera, the camera will use that Skybox instead of the universal one.

I guess you are using the editor to set up that stuff.

I am writing a plugin and I think I'm missing something...

if I setup a camera that sits in front of the KSC and render it to a cubemap,
setting the layers 9 (Atmospher) and 10 (scaled scenery), I don't get the atmosphere at all.

this is what I see when I export the NegativeZ face:

https://imgur.com/a/q8QpgWH

 

the first is layer 15 (PQS)

the second is layer 9 (Atmosphere)

and the third is layer 10 (ScaledScenery)

Edited by Sigma88
Link to comment
Share on other sites

11 minutes ago, Sigma88 said:

I guess you are using the editor to set up that stuff.

I am writing a plugin and I think I'm missing something...

if I setup a camera that sits in front of the KSC and render it to a cubemap,
etting the layers 9 (Atmospher) and 10 (scaled scenery), I don't get the atmosphere at all.

this is what I see when I export the NegativeZ face:

https://imgur.com/a/q8QpgWH

 

the first is layer 15 (PQS)

the second is layer 9 (Atmosphere)

and the third is layer 10 (ScaledScenery)

No, I'm not using the editor.

Spoiler

    public class FixReflections
    {
        private EventData<Vessel, bool>.OnEvent VesselControlStateChangedEvent;

        private Material _GalaxySkybox;
        private Material _AtmoSkybox;
        private GameObject _AtmoReflectObject = null;
        private List<Camera> _AtmoCameras = new List<Camera>();
        private float _TimerSeconds = 0f;

        public void Start()
        {
            this.VesselControlStateChangedEvent = new EventData<Vessel, bool>.OnEvent(VesselControlStateChangedEventHandler);
            GameEvents.onVesselControlStateChange.Add(this.VesselControlStateChangedEvent);

            SceneManager.activeSceneChanged += SceneManager_activeSceneChanged;
        }

        public void Update()
        {
            _TimerSeconds -= Time.deltaTime;

            if (_TimerSeconds <= 0)
            {
                UpdateAtmoSkybox();
                _TimerSeconds = 1f;
            }
        }
        
        private void UpdateAtmoSkybox()
        {
            if (_AtmoReflectObject == null || FlightIntegrator.ActiveVesselFI == null || FlightIntegrator.ActiveVesselFI.Vessel == null || FlightIntegrator.ActiveVesselFI.Vessel.vesselType == VesselType.SpaceObject)
            { return; }

            Vessel oVessel = FlightIntegrator.ActiveVesselFI.Vessel;

            _AtmoReflectObject.transform.SetParent(oVessel.transform);

            foreach (Camera oCamera in _AtmoCameras)
            { oCamera.Render(); }

            _AtmoReflectObject.transform.SetParent(null);
        }

        private void SceneManager_activeSceneChanged(Scene arg0, Scene arg1)
        {
            if (_GalaxySkybox == null)
            {
                _GalaxySkybox = new Material(Shader.Find("Skybox/6 Sided"));

                Texture2D[] oTextures = Resources.FindObjectsOfTypeAll<Texture2D>();
                foreach (Texture2D oTexture in oTextures)
                {
                    if (oTexture.name == "GalaxyTex_PositiveZ")
                    { _GalaxySkybox.SetTexture("_FrontTex", oTexture); }
                    else if (oTexture.name == "GalaxyTex_NegativeZ")
                    { _GalaxySkybox.SetTexture("_BackTex", oTexture); }
                    else if (oTexture.name == "GalaxyTex_PositiveX")
                    { _GalaxySkybox.SetTexture("_LeftTex", oTexture); }
                    else if (oTexture.name == "GalaxyTex_NegativeX")
                    { _GalaxySkybox.SetTexture("_RightTex", oTexture); }
                    else if (oTexture.name == "GalaxyTex_PositiveY")
                    { _GalaxySkybox.SetTexture("_UpTex", oTexture); }
                    else if (oTexture.name == "GalaxyTex_NegativeY")
                    { _GalaxySkybox.SetTexture("_DownTex", oTexture); }
                }
            }

            RenderSettings.defaultReflectionResolution = 256;
            RenderSettings.reflectionBounces = 3;
        }

        private void VesselControlStateChangedEventHandler(Vessel oVessel, bool bIsControlled)
        {
            if (oVessel == null || oVessel.vesselType == VesselType.SpaceObject)
            { return; }

            ReflectionSetup(oVessel);
        }

        private void ReflectionSetup(Vessel oVessel)
        {
            if (_AtmoReflectObject == null)
            {
                _AtmoSkybox = new Material(Shader.Find("Skybox/6 Sided"));
                _AtmoReflectObject = new GameObject("AtmoReflectObject");

                _AtmoCameras.Clear();

                AddAtmoCamera(Quaternion.AngleAxis(0, Vector3.up), "Front");
                AddAtmoCamera(Quaternion.AngleAxis(180, Vector3.up), "Back");
                AddAtmoCamera(Quaternion.AngleAxis(90, Vector3.up), "Left");
                AddAtmoCamera(Quaternion.AngleAxis(-90, Vector3.up), "Right");
                AddAtmoCamera(Quaternion.AngleAxis(90, Vector3.left), "Up");
                AddAtmoCamera(Quaternion.AngleAxis(-90, Vector3.left), "Down");

                RenderSettings.skybox = _AtmoSkybox;
            }

            AddReflectionProbe(oVessel);
        }

        private void AddAtmoCamera(Quaternion qRotation, string sSide)
        {
            GameObject oCameraObject;
            Skybox oSkybox;
            Camera oCamera;
            RenderTexture oTexture;
            List<KSPLayer> oLayers = new List<KSPLayer>();

            oLayers.Add(KSPLayer.Atmosphere);
            oLayers.Add(KSPLayer.ScaledScenery);

            oCameraObject = new GameObject("AtmoReflect_" + sSide);
            oCameraObject.transform.SetParent(_AtmoReflectObject.transform, false);

            oSkybox = oCameraObject.AddComponent<Skybox>();
            oSkybox.material = _GalaxySkybox;

            oCamera = oCameraObject.AddComponent<Camera>();
            oCamera.enabled = false;
            oTexture = new RenderTexture(RenderSettings.defaultReflectionResolution, RenderSettings.defaultReflectionResolution, 24);
            oCamera.targetTexture = oTexture;
            oCamera.transform.rotation = qRotation;
            oCamera.fieldOfView = 90.0f;
            oCamera.clearFlags = CameraClearFlags.Skybox;
            oCamera.cullingMask = GetCullingMask(oLayers);

            _AtmoCameras.Add(oCamera);

            _AtmoSkybox.SetTexture("_" + sSide + "Tex", oTexture);
        }

        private void AddReflectionProbe(Vessel oVessel)
        {
            Transform oTransform;
            GameObject oReflect;
            ReflectionProbe oProbe;
            List<KSPLayer> oLayers = new List<KSPLayer>();

            oTransform = oVessel.gameObject.transform.Find("ReflectProbe");
            if (oTransform == null)
            {
                oReflect = new GameObject("ReflectProbe");
                oReflect.transform.SetParent(oVessel.gameObject.transform, false);

                oProbe = oReflect.AddComponent<ReflectionProbe>();
                oProbe.mode = UnityEngine.Rendering.ReflectionProbeMode.Realtime;
                oProbe.refreshMode = UnityEngine.Rendering.ReflectionProbeRefreshMode.EveryFrame;
                oProbe.timeSlicingMode = UnityEngine.Rendering.ReflectionProbeTimeSlicingMode.IndividualFaces;
                oProbe.clearFlags = UnityEngine.Rendering.ReflectionProbeClearFlags.Skybox;

                oLayers.Add(KSPLayer.LocalScenery);
                oLayers.Add(KSPLayer.Water);
                //oLayers.Add(KSPLayer.Default);

                oProbe.cullingMask = GetCullingMask(oLayers);
                oProbe.nearClipPlane = 0.1f;
                oProbe.farClipPlane = 1000000f;
                oProbe.center = oVessel.gameObject.GetRendererBounds().center;
            }
        }

        public static int GetCullingMask(List<KSPLayer> oLayers)
        {
            int iCullingMask = 0;

            foreach (KSPLayer oLayer in oLayers)
            { iCullingMask = (iCullingMask | (1 << (int)oLayer)); }

            return iCullingMask;
        }

        public enum KSPLayer
        {
            Default = 0,
            TransparentFX = 1,
            IgnoreRaycast = 2,

            Water = 4,
            UI = 5,


            PartsList_Icons = 8,
            Atmosphere = 9,
            ScaledScenery = 10,
            UI_Dialog = 11,
            UI_Vectors = 12,
            UI_Mask = 13,
            Screens = 14,
            LocalScenery = 15,
            Unknown = 16,
            EVA = 17,
            SkySphere = 18,
            PhysicalObjects = 19,
            InternalSpace = 20,
            PartTriggers = 21,
            KerbalInstructors = 22,
            AeroFxIgnore = 23,
            MapFX = 24,
            UI_Additional = 25,
            WheelCollidersIgnore = 26,
            WheelColliders = 27,
            TerrainColliders = 28,
            DragRender = 29,
            SurfaceFx = 30,
            Vectors = 31
        }
    }

 

In my case, I need a 360 degree view for a reflectionProbe, so it's more complicated than yours needs to be if you need one camera angle.

That said, the setup would be very similar except that you would have a Camera instead of a reflectionProbe, and you could set that camera's skybox to atmo instead of using the universal skybox (which would be better anyway). You also wouldn't need all 6 faces of the atmo, but only the one you are looking at.

Also, make sure you don't have scatterer installed: it deletes the atmosphere.

Edited by Electrocutor
Link to comment
Share on other sites

22 hours ago, Electrocutor said:

No, I'm not using the editor.

  Reveal hidden contents


    public class FixReflections
    {
        private EventData<Vessel, bool>.OnEvent VesselControlStateChangedEvent;

        private Material _GalaxySkybox;
        private Material _AtmoSkybox;
        private GameObject _AtmoReflectObject = null;
        private List<Camera> _AtmoCameras = new List<Camera>();
        private float _TimerSeconds = 0f;

        public void Start()
        {
            this.VesselControlStateChangedEvent = new EventData<Vessel, bool>.OnEvent(VesselControlStateChangedEventHandler);
            GameEvents.onVesselControlStateChange.Add(this.VesselControlStateChangedEvent);

            SceneManager.activeSceneChanged += SceneManager_activeSceneChanged;
        }

        public void Update()
        {
            _TimerSeconds -= Time.deltaTime;

            if (_TimerSeconds <= 0)
            {
                UpdateAtmoSkybox();
                _TimerSeconds = 1f;
            }
        }
        
        private void UpdateAtmoSkybox()
        {
            if (_AtmoReflectObject == null || FlightIntegrator.ActiveVesselFI == null || FlightIntegrator.ActiveVesselFI.Vessel == null || FlightIntegrator.ActiveVesselFI.Vessel.vesselType == VesselType.SpaceObject)
            { return; }

            Vessel oVessel = FlightIntegrator.ActiveVesselFI.Vessel;

            _AtmoReflectObject.transform.SetParent(oVessel.transform);

            foreach (Camera oCamera in _AtmoCameras)
            { oCamera.Render(); }

            _AtmoReflectObject.transform.SetParent(null);
        }

        private void SceneManager_activeSceneChanged(Scene arg0, Scene arg1)
        {
            if (_GalaxySkybox == null)
            {
                _GalaxySkybox = new Material(Shader.Find("Skybox/6 Sided"));

                Texture2D[] oTextures = Resources.FindObjectsOfTypeAll<Texture2D>();
                foreach (Texture2D oTexture in oTextures)
                {
                    if (oTexture.name == "GalaxyTex_PositiveZ")
                    { _GalaxySkybox.SetTexture("_FrontTex", oTexture); }
                    else if (oTexture.name == "GalaxyTex_NegativeZ")
                    { _GalaxySkybox.SetTexture("_BackTex", oTexture); }
                    else if (oTexture.name == "GalaxyTex_PositiveX")
                    { _GalaxySkybox.SetTexture("_LeftTex", oTexture); }
                    else if (oTexture.name == "GalaxyTex_NegativeX")
                    { _GalaxySkybox.SetTexture("_RightTex", oTexture); }
                    else if (oTexture.name == "GalaxyTex_PositiveY")
                    { _GalaxySkybox.SetTexture("_UpTex", oTexture); }
                    else if (oTexture.name == "GalaxyTex_NegativeY")
                    { _GalaxySkybox.SetTexture("_DownTex", oTexture); }
                }
            }

            RenderSettings.defaultReflectionResolution = 256;
            RenderSettings.reflectionBounces = 3;
        }

        private void VesselControlStateChangedEventHandler(Vessel oVessel, bool bIsControlled)
        {
            if (oVessel == null || oVessel.vesselType == VesselType.SpaceObject)
            { return; }

            ReflectionSetup(oVessel);
        }

        private void ReflectionSetup(Vessel oVessel)
        {
            if (_AtmoReflectObject == null)
            {
                _AtmoSkybox = new Material(Shader.Find("Skybox/6 Sided"));
                _AtmoReflectObject = new GameObject("AtmoReflectObject");

                _AtmoCameras.Clear();

                AddAtmoCamera(Quaternion.AngleAxis(0, Vector3.up), "Front");
                AddAtmoCamera(Quaternion.AngleAxis(180, Vector3.up), "Back");
                AddAtmoCamera(Quaternion.AngleAxis(90, Vector3.up), "Left");
                AddAtmoCamera(Quaternion.AngleAxis(-90, Vector3.up), "Right");
                AddAtmoCamera(Quaternion.AngleAxis(90, Vector3.left), "Up");
                AddAtmoCamera(Quaternion.AngleAxis(-90, Vector3.left), "Down");

                RenderSettings.skybox = _AtmoSkybox;
            }

            AddReflectionProbe(oVessel);
        }

        private void AddAtmoCamera(Quaternion qRotation, string sSide)
        {
            GameObject oCameraObject;
            Skybox oSkybox;
            Camera oCamera;
            RenderTexture oTexture;
            List<KSPLayer> oLayers = new List<KSPLayer>();

            oLayers.Add(KSPLayer.Atmosphere);
            oLayers.Add(KSPLayer.ScaledScenery);

            oCameraObject = new GameObject("AtmoReflect_" + sSide);
            oCameraObject.transform.SetParent(_AtmoReflectObject.transform, false);

            oSkybox = oCameraObject.AddComponent<Skybox>();
            oSkybox.material = _GalaxySkybox;

            oCamera = oCameraObject.AddComponent<Camera>();
            oCamera.enabled = false;
            oTexture = new RenderTexture(RenderSettings.defaultReflectionResolution, RenderSettings.defaultReflectionResolution, 24);
            oCamera.targetTexture = oTexture;
            oCamera.transform.rotation = qRotation;
            oCamera.fieldOfView = 90.0f;
            oCamera.clearFlags = CameraClearFlags.Skybox;
            oCamera.cullingMask = GetCullingMask(oLayers);

            _AtmoCameras.Add(oCamera);

            _AtmoSkybox.SetTexture("_" + sSide + "Tex", oTexture);
        }

        private void AddReflectionProbe(Vessel oVessel)
        {
            Transform oTransform;
            GameObject oReflect;
            ReflectionProbe oProbe;
            List<KSPLayer> oLayers = new List<KSPLayer>();

            oTransform = oVessel.gameObject.transform.Find("ReflectProbe");
            if (oTransform == null)
            {
                oReflect = new GameObject("ReflectProbe");
                oReflect.transform.SetParent(oVessel.gameObject.transform, false);

                oProbe = oReflect.AddComponent<ReflectionProbe>();
                oProbe.mode = UnityEngine.Rendering.ReflectionProbeMode.Realtime;
                oProbe.refreshMode = UnityEngine.Rendering.ReflectionProbeRefreshMode.EveryFrame;
                oProbe.timeSlicingMode = UnityEngine.Rendering.ReflectionProbeTimeSlicingMode.IndividualFaces;
                oProbe.clearFlags = UnityEngine.Rendering.ReflectionProbeClearFlags.Skybox;

                oLayers.Add(KSPLayer.LocalScenery);
                oLayers.Add(KSPLayer.Water);
                //oLayers.Add(KSPLayer.Default);

                oProbe.cullingMask = GetCullingMask(oLayers);
                oProbe.nearClipPlane = 0.1f;
                oProbe.farClipPlane = 1000000f;
                oProbe.center = oVessel.gameObject.GetRendererBounds().center;
            }
        }

        public static int GetCullingMask(List<KSPLayer> oLayers)
        {
            int iCullingMask = 0;

            foreach (KSPLayer oLayer in oLayers)
            { iCullingMask = (iCullingMask | (1 << (int)oLayer)); }

            return iCullingMask;
        }

        public enum KSPLayer
        {
            Default = 0,
            TransparentFX = 1,
            IgnoreRaycast = 2,

            Water = 4,
            UI = 5,


            PartsList_Icons = 8,
            Atmosphere = 9,
            ScaledScenery = 10,
            UI_Dialog = 11,
            UI_Vectors = 12,
            UI_Mask = 13,
            Screens = 14,
            LocalScenery = 15,
            Unknown = 16,
            EVA = 17,
            SkySphere = 18,
            PhysicalObjects = 19,
            InternalSpace = 20,
            PartTriggers = 21,
            KerbalInstructors = 22,
            AeroFxIgnore = 23,
            MapFX = 24,
            UI_Additional = 25,
            WheelCollidersIgnore = 26,
            WheelColliders = 27,
            TerrainColliders = 28,
            DragRender = 29,
            SurfaceFx = 30,
            Vectors = 31
        }
    }

 

In my case, I need a 360 degree view for a reflectionProbe, so it's more complicated than yours needs to be if you need one camera angle.

That said, the setup would be very similar except that you would have a Camera instead of a reflectionProbe, and you could set that camera's skybox to atmo instead of using the universal skybox (which would be better anyway). You also wouldn't need all 6 faces of the atmo, but only the one you are looking at.

Also, make sure you don't have scatterer installed: it deletes the atmosphere.

ok, I managed to get all the layers I was missing... thanks a lot for the help!

apparently I wasn't supposed to move the camera for some reason... if I leave it at position = Vector3.zero and just change the direction it renders the skybox and the atmosphere just fine

 

now I just need to figure out how to get the sunflare to show, apparenty the object is on layer 10 like the scaledspace, however I can't manage to get it to render

 

EDIT: so, in my various tests to get the lensflare to show I discovered this weird behaviour

if I render the camera once, the flare is visible but very small, almost invisible

however, for each subsequent rendering the flare gets bigger and bigger, up to the eleventh rendering

this is how it looks:

ZNvdEbR.png

this is extremely weird

 

EDIT2: in addition, the lens flare is visible in the images exported with Camera.Render() but not with the images exported with Camera.RenderToCubemap(cubemap)

Edited by Sigma88
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...