Search Unity

Space Graphics Toolkit & Planets

Discussion in 'Assets and Asset Store' started by Darkcoder, Aug 18, 2012.

  1. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    What device are you testing this with? Maybe it's just not powerful enough for this.

    The atmosphere shaders in SGT are highly optimized, and the planet surface shader is very simple if you disable everything. However, there is only so much that can be done since they take up so much screen space. If your display is 1024x768 then that's almost 1 million pixels that must be rendered for the ground, and if you have an atmosphere that's 2 more million pixels because the outside/sky and ground are rendered separately.

    If your background clouds are made using SGT's backdrop feature then you may want to disable it, as that's probably another full screen rendering.

    You can enable the Overdraw rendering mode in the editor's Scene view to see how many times each pixel is being rendered.
     
  2. Grommax

    Grommax

    Joined:
    Feb 26, 2019
    Posts:
    5
    Honor 20s, the phone is not weak, but the resolution is large 2312×1080.
    Yes, background clouds are created using Sgt Backdoor. It's a pity that I can't even use them.
    It looks like overdraw mode is disabled in urp. But, apparently, there is no such problem in the editor, it is only on the phone.
    It turns out that there are no options to make an approach to the planets on a mobile phone using Sgt?
     
  3. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    The Honor 20 isn't weak, but because of its high resolution its graphical benchmark results are similar to iPhone 7.

    You can use backdrop, but it's not necessary when you land on the planet since you won't be able to see it, so it's a good simple optimization to fade it out and hide it in this scenario. You can also try doing the same with the backdrop stars. You should try and profile everything as much as possible. If you can't see overdraw in URP then try making a built in pipeline project to check it.

    Another optimization for such a high resolution display is to render at a lower resolution and upscale.
     
  4. michaljabrzyk

    michaljabrzyk

    Joined:
    Apr 15, 2013
    Posts:
    57
    Hi Darkcoder i send you a private(conversation) message. I have little problem with spawning and destroying objects.

    When player out of range with code "if(distance < range)" {destroy object} - and that works. But spawns many times in different points. It looks like SgtPosition is other for spawning or calulated position when i add object to spawn list, is diffrent from that what is calculated (PointFromFile * unit). Range = new SgtLenght(range, SgtLenght.Scale.Parsec).
    distance = new SgtPosition.Distance(sgtPostion, cameraposition);
    I know it looks messy :) but it's only a test script.
     
  5. michaljabrzyk

    michaljabrzyk

    Joined:
    Apr 15, 2013
    Posts:
    57
    Fixed :). all works good silly mistake
    systemGameObject.GetComponent<SgtFloatingObject>().Position = systems.PositionSgt;
    systemGameObject.GetComponent<SgtFloatingObject>().DerivePosition(); - changing SgtPosition to transform.position.
    ------ //systemGameObject.transform.position = systems.Position;---- that was wrong.
     
    Darkcoder likes this.
  6. Les-Bird

    Les-Bird

    Joined:
    Apr 22, 2013
    Posts:
    12
    Just an FYI, I made a game called Super Starship out on the App Store now where you can fly down to the planet surfaces and the performance is very good, even on iPhone 7 Plus (several generations old). See video of the game running on iPad here: https://superstarshipgame.com

    I use SgtBackground for stars/clouds, different settings for atmospheres depending on planet type and different types of terrain, again depending on planet type. All of this was based on the Earth Sized planet demo with some minor tweaks. One thing that made a big difference on the lower end devices is setting the detail value of the terrain based on device. For lower end devices I set it to 0.5, for higher end phone devices I set it to 1.0 and for higher end iPads I set it to 2.0.

    This game is 100% powered by Sgt.

    So you can absolutely make a game where you fly down to the planet surface on mobile devices using Sgt.

    I believe the limiter is the device itself. I don't know anything about the Honor phones so can't say how it performs compared to iPhones.

    Les
     
  7. ethaneditsbusiness

    ethaneditsbusiness

    Joined:
    Feb 6, 2020
    Posts:
    31
    Is there any way you could create a demo scene with an earth sized planet, camera+basic mesh with the floating origin system? I can't figure out how to get my scene configured correctly with the floating origin system I just get a bunch of mesh issues.
     
  8. Grommax

    Grommax

    Joined:
    Feb 26, 2019
    Posts:
    5
    Thanks. I'm glad to hear that. So it's still about the settings and I just need to figure them out and experiment.
     
  9. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    The Earth Sized Planet demo scene does exactly this, and it implements the origin shifting system.
     
    Last edited: Sep 24, 2022
  10. Les-Bird

    Les-Bird

    Joined:
    Apr 22, 2013
    Posts:
    12
    I updated my website with a bit of technical info that might help. The one thing that made a huge difference is the “detail” setting on the SGT_PlanetTerrain. For low end mobile you’ll want to set it to 0.5 or less. This setting adjusts how many triangles and vertices are rendered on a planet. I’ve seen as much as 6m tris and 3m verts at a planet surface with a setting of 2 and down to 1.8m tris and 940k verts by dropping it to 0.5. A huge difference in performance and memory usage.

    https://superstarshipgame.com/

    Les
     
    Grommax likes this.
  11. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    I don't think he's using the dynamic LOD system. It's likely a fill rate issue with such a high resolution display paired with a relatively lower sped GPU, so the easiest solution is to manually lower the resolution.
     
    Les-Bird likes this.
  12. ethaneditsbusiness

    ethaneditsbusiness

    Joined:
    Feb 6, 2020
    Posts:
    31
    I mean like a player mesh, I have been working off the Earth Sized Planet demo for a while
     
    shadm likes this.
  13. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    Hey there! I've got my national government tech support for my game. He is the trailer:


    Thanks to Space Graphics Toolkit!... Here is 3 more links that are up to date:







    Again, thanks to SGT!
     
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    There's no player mesh walking on a planet example because SGT doesn't come with a character controller. The closest is the "Planet Surfing" demo scene, which also uses the origin shifting system and works if you swap the planet to the Earth Sized Planet. I notice this planet has too many SgtTerrainSimplex Octaves though, so it makes the spaceship movement very bumpy. If you decrease these from 15 & 12 to something like 10 & 9 then it should be smooth.

    Looks great! I think that red ship drastically needs a graphical overhaul to match most of the other media :D
     
    Last edited: Sep 24, 2022
  15. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    Yep! That is the test ship which waits for an artist's touch.
     
    Darkcoder likes this.
  16. fatbeat

    fatbeat

    Joined:
    Nov 4, 2013
    Posts:
    3
    Hi, have you implemented that walking in a a way that player can go around whole planet?
     
  17. mattxreality

    mattxreality

    Joined:
    Dec 11, 2018
    Posts:
    57
    Hello @Darkcoder , I have a question about the planet ring system and texture aliasing. I am developing a VR app. In one of the scenes the player is on the ring near the edge. From this vantage point, there is a strong aliasing at the far edge of the ring. I know there is a setting in standard textures to configure the "Aniso Level" which creates mip maps for textures at oblique angles. To compensate for the aliasing, I've increased anti-aliasing to 4x, but the edge of the ring has relatively strong aliasing. Is there a setting on the ring script to adjust ring edge aliasing? Thank you
     

    Attached Files:

  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    It looks like I forgot to enable the Alpha Is Transparency setting. Here's what it looks like with the current settings:

    upload_2022-1-17_12-14-25.png

    And with that enabled:

    upload_2022-1-17_12-15-26.png

    You may also want to set WrapMode = Clamp. To get better results you may want to modify or use a different ring texture. I made this ring texture a veeeery long time ago before I even started using Unity, and it looks like the edges of the texture blend into white. For better results these should go to black, or maintain their edge color. For example, here's a different ring texture:

    upload_2022-1-17_12-18-17.png
     
    mattxreality likes this.
  19. nighty2

    nighty2

    Joined:
    Dec 29, 2020
    Posts:
    29
    Hi Darkcoder,

    have you been able to replicate the raycast issue?

    I know that time is sparse, but please take a look at it.
    A thorough solution by you would be much more preferable to workarounds I could think of.
     
  20. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Not yet, still have many support requests to go through :(
     
  21. nighty2

    nighty2

    Joined:
    Dec 29, 2020
    Posts:
    29
    That is unfortunate. I'll just ask again in some time :)
    Cheers!
     
    Darkcoder likes this.
  22. mattxreality

    mattxreality

    Joined:
    Dec 11, 2018
    Posts:
    57
    Thank you @Darkcoder That's just what I needed to know. I'll work with the texture and make some modifications.
     
    Darkcoder likes this.
  23. michaljabrzyk

    michaljabrzyk

    Joined:
    Apr 15, 2013
    Posts:
    57
  24. ethaneditsbusiness

    ethaneditsbusiness

    Joined:
    Feb 6, 2020
    Posts:
    31
    Could you share how you got the spaceships to work with the floating origin system? I have been trying for so long to get it to work but I can never figure it out.
     
  25. ethaneditsbusiness

    ethaneditsbusiness

    Joined:
    Feb 6, 2020
    Posts:
    31
    I have been able to get a spaceship working with a small planet with no problem, but when I try to use it on the earth-sized planet it doesn't work. I've used floating origin objects on all the meshes in the spaceship, on the spaceship main game object, and nothing works. Obviously, I'm just doing something wrong, I don't doubt that the floating origin system works, I've just found it difficult to set up.
     
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    It's very unlikely they will be directly compatible. If this other asset has the ability to manually output a double precision position from a set of inputs then you would be able to combine them with some custom code though.


    The "Terrestrial Planet" demo scene uses the origin shifting system on the spaceship. If I copy+paste the scenes together and modify the camera range them then it works as expected, see the attached scene.
     

    Attached Files:

    Last edited: Sep 24, 2022
    michaljabrzyk likes this.
  27. michaljabrzyk

    michaljabrzyk

    Joined:
    Apr 15, 2013
    Posts:
    57
    Problem is with construction of CalculatePosition() in SgtFloatingOrbit. i can't hermetize Rotate(). If I atach object with orbit to some parent object , his rotation = child object rotation (asteroid). I add some modification's :
    tilt.z = i https://en.wikipedia.org/wiki/Orbital_inclination and
    tilt.y = Ω https://en.wikipedia.org/wiki/Longitude_of_the_ascending_node.
    but ther is not possible to add ω https://en.wikipedia.org/wiki/Argument_of_periapsis.

    Hire is eg. : http://orbitalmechanics.info/

    Hire is elipse construction script with ω ,where ω = theta:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. [ExecuteInEditMode]
    5. [RequireComponent(typeof(LineRenderer))]
    6. public class EllipseTest : MonoBehaviour
    7. {
    8.  
    9.     public float a = 5;
    10.     public float b = 3;
    11.     public float h = 1;
    12.     public float k = 1;
    13.     public float theta = 45;
    14.     public LineRenderer lr;
    15.     public int resolution = 1000;
    16.  
    17.     public Vector3[] positions;
    18.  
    19.     void Start()
    20.     {
    21.         positions = CreateEllipse(a, b, h, k, theta, resolution);
    22.         lr = GetComponent<LineRenderer>();
    23.        
    24.        
    25.     }
    26.  
    27.     private void Update()
    28.     {
    29.         positions = CreateEllipse(a, b, h, k, theta, resolution);
    30.         lr.SetVertexCount(resolution + 1);
    31.         for (int i = 0; i <= resolution; i++)
    32.         {
    33.             h = this.gameObject.transform.position.x;
    34.             k = this.gameObject.transform.position.y;
    35.             lr.SetPosition(i, positions[i]);
    36.         }
    37.     }
    38.  
    39.     Vector3[] CreateEllipse(float a, float b, float h, float k, float theta, int resolution)
    40.     {
    41.  
    42.         positions = new Vector3[resolution + 1];
    43.         Quaternion q = Quaternion.AngleAxis(theta, Vector3.forward);
    44.         Vector3 center = new Vector3(h, k, 0.0f);
    45.  
    46.         for (int i = 0; i <= resolution; i++)
    47.         {
    48.             float angle = (float)i / (float)resolution * 2.0f * Mathf.PI;
    49.             positions[i] = new Vector3(a * Mathf.Cos(angle), b * Mathf.Sin(angle), 0.0f);
    50.             positions[i] = q * positions[i] + center;
    51.             positions[i].z = this.gameObject.transform.position.z;
    52.         }
    53.  
    54.         return positions;
    55.     }
    56. }
    The best way is to encapsulate the Rotate () function, but how to do it without changing the construction. The SgtFloatingObject.CalculatePosition () construct is the best in terms of memory usage (in my opinion).
     
  28. ethaneditsbusiness

    ethaneditsbusiness

    Joined:
    Feb 6, 2020
    Posts:
    31
    Thanks for the example scene, its super helpful! One question, where is the movement script for the ship located? Currently with my spaceship im not using a rigidbody (Im using one on my First Person controller), but not on my spaceship controller. Do i need to be using physics with my spaceship controller for it to work with the floating origin system?
     
  29. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414

    I'm not sure what you asking? Your CreateEllipse function has the ability to calculate a position based on an input angle, so you could replace the CalculatePosition code with that. Just keep in mind your code uses single precision floats, which may not be good enough for large orbits.



    This is handled by the SgtCameraMove component on the camera. Normally this component moves the current Transform (e.g. Camera), but you can specify a Rigidbody to move instead, which can be used to move the spaceship. It's not supposed to be a full spaceship control system, it's just a simple example.
     
  30. vengefullfoot

    vengefullfoot

    Joined:
    Sep 24, 2018
    Posts:
    31
    Hello,
    I'm trying to use a heightmap generated with Grand Designer (4096x2048), greyscale 8bits in a Sit Terrain Heightmap component and it fails (the whole planet is raised by the displacement parameter. Is there some extra filtering of the image to be done from the one exported from Grand Designer ? I've noticed the Planet_Heightmap included as example is alpha8 and not sRGB...
     
  31. joshua_42

    joshua_42

    Joined:
    Jun 23, 2016
    Posts:
    104
    Sounds like you haven't changed the texture input alpha setting to "from grayscale"
    Also probably need to check the readable/writable box.
     
  32. vengefullfoot

    vengefullfoot

    Joined:
    Sep 24, 2018
    Posts:
    31
    I think all that is ok, here is the the screenshot of the settings and my file, I'm sure it's something stupid I have the nose on it but can't see... Can you see something ?
     

    Attached Files:

  33. joshua_42

    joshua_42

    Joined:
    Jun 23, 2016
    Posts:
    104
    Have you tried standard texture type?
     
  34. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    You must use an uncompressed format. The height sampling is done on the CPU with a basic array lookup which won't work with compressed formats.
     
  35. HeXiaomMin

    HeXiaomMin

    Joined:
    Mar 17, 2015
    Posts:
    9
    Excuse me, How can i make a equirectangular cylindrical projection texture?
     
  36. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    You must either use a tool that can generate them directly (e.g. Grand Designer), or make a normal 2D texture and warp it to be cylindrical and then fix up the seams (I think you can do this in Photoshop and other image editing tools, but it's more difficult).
     
  37. pratt_timmy

    pratt_timmy

    Joined:
    Jun 30, 2019
    Posts:
    32
    Hey,
    Need some troubleshooting advice in regard to the sgtShadowSphere and SgtRingShadow components.

    I have these components attached to a jovian asset which I spawn into the game world from a resources folder. The shadows do not cast unless I toggle them enabled/disabled in the inspector. I tried re-calculating the shadows at runtime using CalculateShadow(SgtLight) after the game starts and I tried enabling/disabling the components at runtime but that doesn't seem to work either.
    Any advice?
    Thank you
     
  38. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Does your scene contain many shadows? Components like SgtJovian have the MaxLights and MaxSphereShadows setting, which you can increase. If you hit these limits then they will apply shadows in order that they are enabled, which would explain why toggling them on and off would change this behavior. However, this should work the same from script as well, so I'm not sure why that would be different.
     
  39. pratt_timmy

    pratt_timmy

    Joined:
    Jun 30, 2019
    Posts:
    32
    You're right. Thanks for taking the time.
    I was spawning in a number of jovian type planets. And like you said, the last jovian to be spawned in the shadows worked. So what I did was disable the SgtShadowSphere and SgtShadowRing components on the prefab and added some code that enables/disables these components as you approach or move away from the planet. Makes sense.
    Thanks for taking the time. Very helpful
     
    Last edited: Feb 18, 2022
    Darkcoder likes this.
  40. GTG101

    GTG101

    Joined:
    Feb 1, 2017
    Posts:
    24
    What's a good component to use to create a planet in the sky that the player can look at from the ground? I'm basically looking to make a planet part of a skybox.
     
  41. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    In most demo scenes the atmosphere is opaque when you're at sea level, so in this scenario you would have to increase the render queue of your planet material to render after the atmosphere. Alternatively you can make the atmosphere not become fully opaque by reducing the Sky setting. The Night setting can also be used to adjust the Sky setting when the camera is on the dark side.
     
  42. Eltharis

    Eltharis

    Joined:
    Aug 30, 2018
    Posts:
    17
    Hello Darkcoder,
    Thanks again for this great asset. But I just noticed that in URP the SGT terrains don't work in deferred mode at all. Can we expect some fix for that coming? They're just patches of one color at this point.
    In built-in render mode deferred is working fine. The problem is, I'm in URP and must use deferred due to the limits (number of lights) of forward. Yes, this new option came in 2021, but it's gonna stay and is crucial. That thing alone seems to force me to consider rebuilding my whole project in legacy built-in... Not going to be fast, nice process I guess, so I have to ask how you'd realistically expect it go with SGT.
     
    Last edited: Feb 21, 2022
  43. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    All SGT shaders are made using the Better Shaders asset/compiler. According to the documentation the latest version supports "URP12.x in Unity 2021.2". If this version has Deferred then you may be in luck. It's been a while since I updated the shaders, so I'll look into that for the next major version of my assets which should be finished by the end of the week.
     
    Eltharis likes this.
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Hey everyone,

    Version 4.0.0 of Space Graphics Toolkit & Planets is now out!
    • NOTE  This is a massive update. To update you must first back up your project, delete the root SpaceGraphicsToolkit folder, then install the new version.
    • Changed folder structure to be inside Plugins/CW/SpaceGraphicsToolkit.
    • Changed folder structure of each feature's examples to be inside /Examples.
    • Changed folder structure of each feature's core to be inside /Required.
    • Updated inspector code to support third party assets that implement nested inspectors.
    • Reverted SgtJovian shader change to support older devices.
    • Updated SgtTerrainCollider to support larger planets.
    • Updated all features to use external shaders/materials for smaller and faster builds.
    • Moved most component material settings to external shader/material.
    • Added Unity Fog / Disable setting to all material settings.
    • Merged Accretion feature into Ring feature.
    • Merged Corona feature into Atmosphere feature.
    • Removed SgtRingMesh component.
    • Removed Width/Height and Format settings from all texture generating components.
    • Renamed SgtFlareMaterial component to SgtFlareMainTex.
    • Added SgtOcclusionScaler.MaxRaycastDistance to reduce flickering issues at extreme distances.
    • Replaced BakedBackdrop meshes with SgtBackgroundMesh component for greater flexibility.
    • Changed SgtLens component's default execution order to 100, so it first renders after most components finish updating.
    • Fixed terrain ocean transparency in HDRP.
    • Mostly fixed SgtLens rendering in HDRP.

    If you're in the middle of a project I don't recommend you upgrade.

    This version substantially changes the folder structure of SGT to be cleaner, and also share more parts with my other assets. This makes it easier to update everything.

    I've also updated all features to use a separate SourceMaterial setting, rather than having the component generate the material behind the scenes. This makes it work the same as the Planet/Terrain/Spacetime features worked in the previous version. This makes it easier to add new material settings, reduces build size, speeds up compilation, etc. It also allowed me to combine the Accretion feature into Ring, and the Corona feature into Atmosphere.

    Almost all features now render using the MeshFilter+MeshRenderer setup again, rather than using Graphics.DrawMesh. I liked DrawMesh because it made the scene hierarchy cleaner, but it doesn't work properly with HDRP, it doesn't allow users to cutomize renderer settings, and it's very difficult to get working properly with the prefab scene, so going back to this approach is better overall.

    If you encounter any issues please let me know.

    As always, enjoy :)
     
  45. michaljabrzyk

    michaljabrzyk

    Joined:
    Apr 15, 2013
    Posts:
    57
    Sorry but SgtTerrain not working. Is that mean to have planes I will have to buy your Planets asset?
     
  46. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Did you install burst as described HERE?
     
    michaljabrzyk likes this.
  47. XyrisKenn

    XyrisKenn

    Joined:
    Dec 8, 2015
    Posts:
    92
    I love this asset. I have so many uses for it.

    If I alter a starfield's theshold, it induces a welcome twinkling of stars. Is there a way to animate a "blink rate" or twinkling of stars, to simulate viewing through an atmosphere?
     
  48. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Good point, the pulse speed is currently hard coded. With the new material system I can easily make this more flexible, so for the next version I will add many more features. I'll see if I can get a new version out this week!
     
    XyrisKenn likes this.
  49. XyrisKenn

    XyrisKenn

    Joined:
    Dec 8, 2015
    Posts:
    92
    So AWESOME :)
     
    Darkcoder likes this.
  50. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Hey everyone,

    Version 4.0.1 of Space Graphics Toolkit & Planets is now out!
    • Fixed planet emission in HDRP.
    • Added Pulse demo scene to Starfield feature.
    • Added PulseMin setting to starfield shader.
    • Added PulseMax setting to starfield shader.
    • Added StarPulseSpeedMin setting to starfield components.
    • Added StarPulseSpeedMax setting to starfield components.
    • Added Pulse demo scene to Backdrop feature.
    • Added PulseMin setting to backdrop shader.
    • Added PulseMax setting to backdrop shader.
    • Added StarPulseSpeedMin setting to backdrop components.
    • Added StarPulseSpeedMax setting to backdrop components.
    Enjoy :)