Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Space Graphics Toolkit & Planets

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

  1. SinDeSiecle

    SinDeSiecle

    Joined:
    Sep 30, 2017
    Posts:
    67
    @Darkcoder : I am trying to make large planets. Everything works fine until around 10-12k radius. After that, I get a weird rotation of the planet under the feet of my character. Using my own floating origin system, so problem is not that kind. Actually it is a constant rotation rather than a flickering back and forth. I thought it might be because of the floating precision, but is there any other possible reasons? The planet is definitely not moving, in fact, it is marked as static.

    Also about making large planets: when shader calculate everything according to the planet center which stays far away from the origin, you can't increase detail level to get a good result, because when you do you get a flickering on the surface. Also I see the colliders are set as children of the planet. If both meshes and colliders were not children of the planet and their pivots were set on themselves rather than the planet center, then we wouldn't get those floating point errors. Is it possible to do this? If it is then even 4-5M radius planets could be possible.

    And my last question: is it possible to search for plains on the planet surface to place buildings, or even a city, programmatically? I mean, how can I find plain areas of certain size on the planet and get the surface point of their center point (I know hot to get surface point but I am trying to figure out the other thing).
     
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    No idea, must be something with your setup. If I modify the "Terrestrial Planet" demo scene to have a 10,000 radius then it works as expected.

    The collider precision can indeed be improved by using a separate GameObject parent, as well as the terrain meshes, but at the scales where this becomes an issue the planet surface itself can't be rendered properly due to UV map precision issues, so I don't think it matters so much.

    There's no easy way to find flat surfaces on an arbitrary planet besides probing it and manually searching. The easiest way to do this is to just define where the flat surfaces should be by flattening the terrain there via the heightmap, and removing procedural noise there via the areas feature. Another approach is to write a custom terrain height generator that overwrites a specific area with a specific height.
     
  3. SinDeSiecle

    SinDeSiecle

    Joined:
    Sep 30, 2017
    Posts:
    67
    @Darkcoder Ok, I see what you mean. I experimented more on this and came to such conclusions: Trying to use a character with root motion animations is another thing. Especially when you have sprinting... You have to apply spherical gravity as hard as possible for your character to be pulled down on the surface when sprinting down on the hill surfaces. Otherwise, your character starts to sprint on the air. Then, when you stop and stand on idle animations, this much force continues to pull the character down which creates little fluctuations on the character position on the surface. Because of these fluctuations, foliage on the surface begins to flicker and also the position of the character changes with little values which appears as planet is rotating under the feet.

    I tested with both my own spherical gravity script and the sgt gravity scripts separately. With sgt script, when you need more force to be applied to the character you increase mass of the gravity source script. When it gets high enough, you can run down the hills with appropriate gravity feeling, but when you stop, you get that flickering in large planets, larger than 10000 radius...

    I tried to apply no force but assign to a surface pos by raycasting when character is idle and it worked well.

    Then, I wanted to see how far I can do this when I increase the planet radius. The test is, spawn charachter, run, stop, look around and observe if planet seems to be rotating or the foliage (mostly rock plates) flickers, or the surface texture flickers, and so on. With a 10000 radius planet, you won't notice the pseudo planet rotation effect even without applying the trick (and without floating origin correction on HDRP). With a 100000 radius planet, with floating origin correction, as long as the trick is applied, you are fine. There is a barely noticeable artifact when moving in this case but it is fine. When looking around on idle, very very little flickering that can be covered with some stone plates and the foliage generated on the surface, barely noticeable. With a 500000 radius planet, with floating origin correction, even when on idle and looking around, every mouse movement causes flickering. In all cases, no movement, no applied force to the character, no flickering.

    In all tests, parent of player is set to null.

    This is all done in HDRP. I remember reading Unity documentation mentioning the light calculations are done with a floating origin that centers on camera so the graphics are corrected before they are drawn before the screen. In deed, you can't even walk around a planet of 10000 radius on standard pipeline without flickering, but in HDRP it works fine. However, 100000 and 500000 radius planets need floating origin system. The 500000 radius planet is not usable for this purpose at all since drawing calculations are deformed by floating point precision.

    I believe this is because the pivot of all surface meshes are at the planet center which causes floating point errors. So, if there was a way to generate those chunk meshes with their pivots on their own centers (I can follow how SgtTerrainPrefabSpawner handles chunks, I mean in a similar fashion), then in the case of 500000 radius planet, the meshes would still be close enough to the origin not to flicker. Also, their parents would need to be null because even in that case, parenting will cause the flickering.

    So, I just wanted to give an idea for the future versions, by not knowing that such a thing is possible or not. I felt so because this is really beautiful asset, very good looking, very practical, and planets look breathtakingly good. I have spent enormous amount of time to control the foliage generation on another system, but Sgt already made more of that in 2 weeks which is mostly spent for the system adaptation (the system of my game, I mean, using addressables, generation logic, all other stuff) and little on the learning curve.

    On the other hand, a planet with 500000 radius, as a game field, is quite hard to fill in. It is a meaningless effort to provide game mechanics like just land on, do some activities around 2000 unit square area, get on the ship, land off and go to another planet and repeat this on 500000 radius planets. All the other unused areas... Well, considering that, even a 10000 radius planet may provide one more than she/he needs. The only desire for me to have 500000 or larger planets is when you hang around in orbit, you get an awesome feeling by looking at that large planet under you; I seek to create that hugeness...

    Anyway, I hope this contributes to your future ideas. Thanks for this very good asset.
     
    Last edited: Feb 4, 2021
  4. SinDeSiecle

    SinDeSiecle

    Joined:
    Sep 30, 2017
    Posts:
    67
    So, to provide some footage, I've recorded some videos...

    This is the performance on 10000 radius planet with no floating origin corrections in HDRP:


    This is the performance on 100000 radius planet with floating origin correction in HDRP:


    And this is the performance of 500000 radius planet with floating origin in HDRP:


    And this is from another setup which is much more demanding. This is a 320000 radius planet:


    Those little flickerings can be covered with a smart setup like 10000 and 100000 radius planets examples.

    These videos are captured while another intensive unity project was open. So, the editor performance when opened alone should be slightly better. However, that does not fix the flickering problem.
     
  5. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Very nice and interesting looking tests, this is certainly beyond the scales I've experimented with!

    The main reason why the meshes are all centered on 0 is because this makes setup very easy, and it allows all the components to be very modular. For example, the planet components have no knowledge of the floating origin system's usage, so there is no code dependency.

    Due to the way the new planet LOD works, it shouldn't be too difficult to make them compatible though. With previous versions this would have been much more difficult. I currently have quite a big task backlog (including rewriting SgtSingularity to support HDRP) so this kind of new feature will have to wait a bit.

    Out of curiosity, what assets did you use for the rocks and such in the first video? They look great! Were these spawned using only SgtTerrainPrefabSpawner?
     
  6. SinDeSiecle

    SinDeSiecle

    Joined:
    Sep 30, 2017
    Posts:
    67
    I can't wait to see the new planet LOD. The foliage prefabs are from The Vegetation Engine. Yes, spawned by SgtTerrainPrefabSpawner. Also, I used GPUInstancer to instance the spawned prefabs. The rock prefabs are in planar shape so I had to get surface position of 4 corners and set each to its position when spawning. Also, I added a singleton object pool and got objects from there in SgtTerrainPrefabSpawner to avoid rapid instantiate - destroy sequence. (This is the only modification I did to your code, every other thing is handled separately).

    Hmm.. Also, the planet is not moving. Instead, the sun is moving around the planet. That way, any flickering is minimized.

    I also thought about implementing a similar geocentric system to your universe demo, but it is too complicated. Also, may not be needed.

    Another contribution might be, if you accept, that handling that large scene is not practical in means of memory usage and Unity handicap of 4GB resources folder problem in build. When making games as you add assets to your setup, the latter one becomes a definite problem. Solution is addressables. And when you save the scene of one particular planet, define it as addressable, and load it async when close to the planet (and unload the space scene), it works pretty much like the universe demo. With that, it is possible to make a geocentric setup easily. If the design in Sgt implements such a mechanism it would add great value to the asset. It might be confusing for the first time user to understand the setup but they will appreciate it when they face the 4 GB problem.

    Another note: I will try to put everything in Resources folder in Sgt to addressables and reduce the build size to 20-50 MB, especially for the apple tv. But, this is a spare time project for now.
     
    Last edited: Feb 7, 2021
  7. antsonthetree

    antsonthetree

    Joined:
    May 15, 2015
    Posts:
    93
    Hello Pixiehorse - did you ever figure out how to resolve this? I'm having the same issue.
     
  8. Steve2375

    Steve2375

    Joined:
    Mar 28, 2015
    Posts:
    27


    In the video to your awesome asset you show a star with these bright and dark patches. Left is the star from the demo scene, but I am not able to create these patches. How can you add these to make the star looking more interesting?
     
  9. joshua_42

    joshua_42

    Joined:
    Jun 23, 2016
    Posts:
    102
    Here's a video of my tests using a colour chart shader with a tiled heightmap version of SGT terrain. There are six different heightmaps. Each feature has it's own normal map, mask map (for the detail normal placement) and two grey-scale maps that represent erosion.
    The grey scale maps give the coordinates to sample from the colour chart; map 1 for the x coordinate, map 2 for the y.
    The planet has it's own x,y maps, the features have theirs and the details have theirs. Controlling the contribution levels of the maps eases the tiling effect. The details only contribute a little as any more reveals obvious tiling.

    There are 3.5 million tris (although it runs smoothly with 10 million on my old computer).
    @Darkcoder I was unable to figure out how to add additional mask maps to the terrain generator. With them we could add that last level of detail to the largely smooth features.
    You'll notice the banding effect on large variations in colour (e.g the sediment flow) and how features cut off unrealistically. I think that both of these can be mitigated with the ability to paint the colour chart and the mask map respectively.
    I'm using two separate mask maps for the features; reading the r,g,b channels this gives me six features but with no ability to control where they are applied (the masks are just random noise). Being able to paint features directly onto the planet and having more than three colours to use (like in your last trial) is a must in my opinion.

     
    shadmar, Bartolomeus755 and hopeful like this.
  10. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    This is the "Sun 1" demo scene from the Solar System Pack you can get HERE. This texture was extracted from NASA's SDO imagery, so it's just static. Maybe one day the animated sun surface shader will look this good :D


    This looks incredible!

    I'm not sure what you mean by being unable to control where they go, you mean you're currently using this mask:

    upload_2021-2-11_11-25-32.png

    And need the ability to paint this, as well as the unused B and A channels? If so, I've more or less finished working on the little side project that combines SGT with my Paint in 3D asset that would allow you to paint this. If you don't have it already I can give you a free copy of this asset if you'd like since you've already contributed so much!
     
    Steve2375 and joshua_42 like this.
  11. joshua_42

    joshua_42

    Joined:
    Jun 23, 2016
    Posts:
    102
    This looks incredible!

    I'm not sure what you mean by being unable to control where they go, you mean you're currently using this mask:

    View attachment 793262

    And need the ability to paint this, as well as the unused B and A channels? If so, I've more or less finished working on the little side project that combines SGT with my Paint in 3D asset that would allow you to paint this. If you don't have it already I can give you a free copy of this asset if you'd like since you've already contributed so much![/QUOTE]

    I'm using masks I made using spherical-fractal noise - red, green and blue channels. I only know how to read the channels individually in the shader. Not sure how to read a specific colour. And the tiled terrain generator you gave me only reads the channels individually but this is just an experiment so I can stick to using three channels.
    And yes please! If I can paint the masks via the planet I can place the features where I want them.
    Cheers dude!
     

    Attached Files:

  12. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Looks good, I'll send it when it's closer to being ready!

    Another interesting development is Jason Booth recently released THIS asset, which is a replacement of Unity's ShaderLab system. The great thing about this is that it also supports SRP (URP and HDRP), and end users don't need this asset to use the shaders (only to modify them). A lot of my time has been wasted last year remaking my shaders in Shader Graph, which is terrible to use for complex shaders. I will have to experiment with this new system, but if it works as expected then it means I can easily add new features and have them more or less instantly work across all render pipelines. There have been many features in this asset and others that I've postponed or scrapped because I simply couldn't be bothered to make them in Shader Graph too, and this should solve that.

    Hopefully one day Unity can buy it out and integrate it natively!
     
    hopeful and joshua_42 like this.
  13. kfireven

    kfireven

    Joined:
    Oct 18, 2016
    Posts:
    5
    @Darkcoder When I try to set the "night power" parameter, or any of the other parameters under night in
    SgtAtmosphere, they don't seem to change anything, the night side looks the same no matter what value I give to them, what am I missing?
     
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Hey everyone,

    Here's a sneak peak of what I've been working on:

    upload_2021-2-21_12-4-38.png

    Left: The existing SgtSingularity component, which works with the Standard rendering piepline and URP.

    Right: The new SgtBlackHole component, which works in the Standard rendering piepline, URP, and HDRP.

    As you can see, the warp effect is improved to look like SgtLens, though you can still get it looking the same as SgtSingularity if you prefer that. This component will replace SgtSingularity in the next version.

    This was all done using a new shader pipeline based on the Better Shaders asset, and some custom code of mine. The way I've set it up is that you no longer have to use the PIPELINE tool to switch shaders, and it will now automatically detect and switch based on your current pipeline setting. I've also set it up so that I (or anyone else with the Better Shaders asset) can quickly modify these shaders and have them instantly work across all pipelines.


    This setting only changes the opacity of the 'sky' when the camera is on the dark side, allowing you to see the stars outside. When viewed from outside there is no change.
     
    hopeful likes this.
  15. Ploops

    Ploops

    Joined:
    Nov 3, 2014
    Posts:
    1
    Hey @Darkcoder, can you please explain the "CameraOffset" property on various components? (e.g. SgtAtmosphere, SgtCorona..)

    I read the property tooltip and checked the documentation, but I don't really understand when this should be used, or how to determine what it should be set to.

    Thanks for your time.
     
  16. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    If you have two transparent objects on top of each other (e.g. Atmosphere + Cloudsphere), you often want one to render in front of the other depending on the visual result you want. Unity implements this in their particle system as 'SortingFudge', but doesn't provide it for anything else. This DepthOffset value is that, and basically just moves the object toward/away the currently rendering camera.
     
    Ploops likes this.
  17. SinDeSiecle

    SinDeSiecle

    Joined:
    Sep 30, 2017
    Posts:
    67
    Hi @Darkcoder if I want to make an attempt to render quad pivots at their own center which will be closer to the player on large planets, where should I look at to start with on your code?
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Here's another sneak peak of the next version:

    upload_2021-2-24_7-54-52.png

    Planet night lights now work on all rendering pipelines.



    upload_2021-2-24_8-1-15.png

    The new black hole effect is complete and works well.



    With the BetterShaders system, the planet shader is set up like this:

    upload_2021-2-24_8-3-4.png

    So right now the planet is the base planet (albedo, normal, etc), and then layered on top are 'effects' like the detail mapping, night lights, and water. Unlike normal material layering, BetterShaders automatically combines these layers into the same shader with no overhead, which is great. The previous planet shader was a bit of a monolith and annoying to edit, but since each layer is now completely separate it's really easy to develop new layers and provide alternative shaders with different features. For example, adding a 'snow' layer that applies to mountain peaks would be very easy to do.

    This new version should be coming out very soon :)



    Which quads? If you mean the starfield, then you have to modify the vertex shader for them. Currently they're transformed into MV space as 4 verts on top of each other, stretched out on the xy axis, then transformed into MVP. You would have to rotate it somewhere during this process.
     
  19. SinDeSiecle

    SinDeSiecle

    Joined:
    Sep 30, 2017
    Posts:
    67
    My apologies for the confusion: I meant the planet surface. I thought it was similar to quad tree planets that the surface was divided again and again when close to player. So, I thought if I could set their pivots close to the player entire planet size sgt planets would be possible.
     
  20. SinDeSiecle

    SinDeSiecle

    Joined:
    Sep 30, 2017
    Posts:
    67
    The new version seems and sounds cool...
     
  21. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Ah, no the planets use a geometry clipmap approach. The SgtTerrainQuad refers to the whole surface of one side of the cube for a single LOD. To offset each quad you would have to store the offset, pass it to the SgtTerrainPlanet.VerticesJob, offset the positions when written, and when drawing the mesh offset the matrix.
     
  22. pratt_timmy

    pratt_timmy

    Joined:
    Jun 30, 2019
    Posts:
    13
    I have a question about SgtPosition script.

    Can the methods in the script be used for more stable and precise calculations when dealing with large numbers?
    Or are the methods just for supporting the floating origin system? I'm looking at the code and I'm just not sure. It looks like you add/subtract long and add/subtract double to long then cast to double which should be more precise right? I don't fully understand what C# is doing there. I don't mind a bit of extra overhead using long if I get more accurate results for some calculations.
    For example in my project I am using double precision to calculate most things which becomes a slight problem when dealing with very large numbers due to precision error. The results may change slightly over time depending on the distance and amount of time. And if I could use these methods to keep track of data, that would be fantastic.

    Edit: I guess your floating origin system wouldn't work unless the answer is yes...And it works great so
     
    Last edited: Feb 25, 2021
  23. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    As you notice, even doubles have precision issues at extreme ranges. SGT fixes this by combining them with longs, which effectively 'resets' the double precision when you go over 50000000 units in any direction. This allows for higher precision than floats, across a range that extends beyond the observable universe. Internally, doubles are used for many of the floating calculations though (e.g. distance, direction), because this is usually good enough. One exception is warping, which requires higher precision when travelling long distance, so this uses a its own more complex calculations.
     
    pratt_timmy and hopeful like this.
  24. pratt_timmy

    pratt_timmy

    Joined:
    Jun 30, 2019
    Posts:
    13
    Awesome. Thanks for taking the time to explain as always. Smart, simple and effective code.(genius) With this clever idea the potential of scale is staggering for a simulation.

    What I really need this for (after some thought) is precise time keeping. With how my sim works the positions of objects and intercept points can involve big numbers but the calculations are all done in the backround of the sim deterministically with doubles where the origin never shifts from (0,0,0) so position is always consistent albeit not very precise with large distances I can address that later with the help of your SgtPosition script. I use a floating origin system for rendering. The real problem I have is time keeping. I have to keep track of enter/exit points when you enter/exit gravity wells When it can take several years to arrive at a destination the precision of time is not good using doubles and the position the player will be at a certain time kinda "jiggles" around and can cause a chain reaction of progressively bad position prediction.
    I'm going to use your methods as a 1 dimensional vector for time and I think that should solve my problem
     
    Darkcoder likes this.
  25. John_MLS

    John_MLS

    Joined:
    Sep 11, 2013
    Posts:
    24
    Hello, So far the plugin is pretty cool! However when I download the Packs I am getting some errors...

    I just bought the program yesterday, so I imagine I am updated.

    For example when I load the "Ring Nebula" from the "Stars Package" I get
    __________________________________________________________________________
    'SpaceGraphicsToolkit.SgtInputManager' is missing the class attribute 'ExtensionOfNativeClass'!

    SGT Upgrade: Destroyed old Quads Model
    UnityEngine.Debug:Log (object,UnityEngine.Object)
    SpaceGraphicsToolkit.SgtHelper:DestroyOldGameObjects (UnityEngine.Transform,string) (at Assets/Space Graphics Toolkit/Features/Shared/Scripts/SgtHelper_Editor.cs:136)
    SpaceGraphicsToolkit.SgtQuads:Start () (at Assets/Space Graphics Toolkit/Features/Shared/Scripts/SgtQuads.cs:116)

    And in the Heirarchy of the scene is a missing prefab.
    _________________________________________________________________________


    If I load the "Alien2" package from the "AlienWorldsPack" I get...

    ___________________________________________________________________________
    SGT Upgrade: Destroyed old Quads Model
    UnityEngine.Debug:Log (object,UnityEngine.Object)
    SpaceGraphicsToolkit.SgtHelper:DestroyOldGameObjects (UnityEngine.Transform,string) (at Assets/Space Graphics Toolkit/Features/Shared/Scripts/SgtHelper_Editor.cs:136)
    SpaceGraphicsToolkit.SgtQuads:Start () (at Assets/Space Graphics Toolkit/Features/Shared/Scripts/SgtQuads.cs:116)

    SGT Upgrade: Destroyed old Atmosphere Model
    UnityEngine.Debug:Log (object,UnityEngine.Object)
    SpaceGraphicsToolkit.SgtHelper:DestroyOldGameObjects (UnityEngine.Transform,string) (at Assets/Space Graphics Toolkit/Features/Shared/Scripts/SgtHelper_Editor.cs:136)
    SpaceGraphicsToolkit.SgtAtmosphere:Start () (at Assets/Space Graphics Toolkit/Features/Atmosphere/Scripts/SgtAtmosphere.cs:285)
    ___________________________________________________________________________


    I should note that I know they are not working because when I run the scene it looks no different than when its not running.


    Thanks in advance for any help.
     
    Last edited: Feb 27, 2021
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    It's possible I didn't update the packages to the latest version. If you don't mind waiting a few days I'm about to release a big update that also improves these packs.
     
  27. jm3game

    jm3game

    Joined:
    Aug 7, 2018
    Posts:
    3
    Hello, actually i am trying to add some atmosphere to a planet, but as you can see in the screenshots attached, something is going wrong, i tryed to resolve this by myself but i couldn't find a solution, so please @Darkcoder could you help me resolving this? Something that looks like a shadow or i don't know what is flickering on the surface of the planet. When i disable Atmosphere there is no more problem. I would like to give you some more informations, just tell me what you need... i am running on Unity 2020.2.4, using HDRP.
    Regards, jm3game.
     

    Attached Files:

  28. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    This will be fixed in the next version, which includes many many HDRP improvements. It should be out in a few days, but I can send you a quick fix for this now.
     
  29. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Here's another sneak peak of the next version:

    sun_2b.gif

    sun_1b.gif

    I've been working on improving the Star shader. As you can see, the animation quality is improved, and you can add sun spots.

    sun_3b.gif

    This shader can also be combined with real star images. Here's the sun from the Solar System Pack with this improved shader.

    As soon as the new version of BetterShaders drops with some important fixes I'll submit this new version of SGT!
     
  30. jm3game

    jm3game

    Joined:
    Aug 7, 2018
    Posts:
    3
    Thank you :D nice work "clap clap"
     
    Darkcoder likes this.
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Hey everyone,

    While waiting for that BetterShaders update to release, I decided to work on improving the planet shader:

    upload_2021-3-2_11-56-8.png

    upload_2021-3-2_12-37-52.png

    upload_2021-3-2_11-56-14.png

    Top = Current shader with one detail layer.
    Middle = Current shader with two detail layers mixed together with a mask.
    Bottom = New shader with one detail layer.

    As you can see, the previous solution of mixing two layers together works fairly well at hiding the tiling/repetition. However, it doubles the amount of texture samples required, and requires a special 'mask' texture to be created, which can be difficult to author.

    I experimented around and came up with this new system, which basically solves all of this. It's based on the technique described HERE. Since mapping the texture around a sphere requires at least 2 samples anyway, I was able to basically integrate it into the existing detail sampling function without adding any extra samples, just a bit more math.

    Overall, this makes the planets look much better, and it also allows the mask texture to instead be used to define different biomes, and have their own detail textures appear there. I also applied this same technique to the water, and it looks much better!
     
    joshua_42, amack2u, hopeful and 2 others like this.
  32. antsonthetree

    antsonthetree

    Joined:
    May 15, 2015
    Posts:
    93
    Hello! I just bought this on today's sale (50% !!). It's great!

    Question - are you planning on adding any volumetric clouds to the planets? I'd love to see this particularly with the Jovian planets. I get that "round shaders are hard" but I'm wondering if a hemispherical curved effect could be applied to a flat shader? Just spitballing. Anyway great product I'm gonna have a lot of fun playing with it!

    Jake
     
  33. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Thanks!

    Actually, round shaders aren't that hard. The challenge is the draw order, which is a famously difficult problem in 3D graphics when dealing with transparent objects. If two transparent objects are far from each other then it's usually not a problem, you just draw the distant object first, and the closer object in front. But what about clouds? For a gas giant they would be inside it, so which do you draw first? There are many ways to render these objects and make it work for specific scenarios, but there is no perfect solution, this is why no such component exists. You can experiment with the SgtAurora and SgtJovian together to experience these issues (see "Jovian" demo scene), as they're both transparent.
     
    antsonthetree likes this.
  34. joshua_42

    joshua_42

    Joined:
    Jun 23, 2016
    Posts:
    102
    Screenshot (32).png More shader progress.
     
    shadmar, SinDeSiecle and hopeful like this.
  35. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Looking good, looks like the UV is breaking down at this scale though :D


    Speaking of shaders, I've been experimenting with flow mapping:

    jupiter.gif

    It works okay, but making a good flow map is really difficult for a texture as complex as Jupiter, so I think maybe a different approach is better. This technique works well for more artistic gas giants though, so I guess I'll leave it in.
     
    antsonthetree, hopeful and joshua_42 like this.
  36. joshua_42

    joshua_42

    Joined:
    Jun 23, 2016
    Posts:
    102
    It would look good hanging in the sky of this moon :)



    Yeah I think I've reached my technical limit with this shader - no idea how to fix the giant pixels. I tried reducing the scale of the planet but no joy. Maybe it's because the detail textures are tiled five thousand times?
    A major benefit of using the colour chart method is the ability to almost totally hide any tiling without having to rotate or scale the main features or the details: there are six features and seven details (same details on each feature at the moment) and by simply using the heightmap as one of the axis maps the colour range of each detail or feature is different enough from it's neighbours to hide any tiling (It also looks freakin' awesome).
    A drawback is mip maps. Turn them off and it's a pixel-jittering mess. Turn them on and as the mip-maps swap, so do the colours from the colour chart. You can see this in the video. I believe Unity allows finer control of mip-maps in developer mode?
    Regarding the uv break down, do you have any suggestions?
     
    Darkcoder and hopeful like this.
  37. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    4,766
    It's GPU precision.

    You can get this same issue if you tile a texture 50k times on a plane in Unity as well. Imagine that you have a 0-1 UV space divided into 5000 times, now imagine that you have a 1024 texture tiled 5000 times. That means the distance between one pixel and the next is only 1.953125e-7, or in other words, way smaller than a float can accurately represent. So essentially, these get rounded to the nearest value, and you see the same pixel result for several pixels until you reach the next value that can be represented by a float.

    To fix this, you must wrap the domain of all UV calculations to fit better within precision limits.
     
    hopeful and joshua_42 like this.
  38. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Wow! The screenshot doesn't do this justice!!

    Since the planet shader is now so easy for me to update, I could modify the way SgtTerrainPlanet writes UV data to allow for greater tiling. This next version already has a lot of changes going into it though, so maybe I'll leave this for the next-next version.
     
    dmenefee and joshua_42 like this.
  39. bthanse

    bthanse

    Joined:
    Jun 24, 2019
    Posts:
    64
    Newtonian Physics ― Quickly add realistic gravitation to your scene. This allows your player and spaceship to realistically orbit and land on planets, and even allows planets to orbit each other.

    I can not see anything in the manual about this. The problem is that gravity only works on the top of planets. When I fly to the bottom, iI fell of the planet. What is the name of the script I have to use ? And I think I must set the gravity to zero in the project settings ?
     
  40. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    It sounds like you left the default (Y axis only) Rigidbody gravity on, you need to disable that. The Features/Shared folder has the "06 Newtonian Gravity" and "07 Planet Gravity" demo scenes that explain how to set the Newtonian gravity up. This is also shown in the "Terrestrial Planet" demo scene for a more typical scenario.
     
  41. bthanse

    bthanse

    Joined:
    Jun 24, 2019
    Posts:
    64
    Ok, works now, was looking in wrong folder. Is it working so the gravity is lower far away from the planet ? What mass do I set to a planet so it is the same as on Earth ? How do I place objects manually ? They think I want to place them at walls and ceiling when I go from north to south. Any setting so they rotate so the bottom of prefab is to the middle of planet ? Is it any script that simulate air on planets so spaceships that come close to planets in athmosfere reduse speed when the air get thicker ?
     
  42. Hungry-Lion

    Hungry-Lion

    Joined:
    Sep 2, 2018
    Posts:
    18
    Hello,

    So I have a main project but I don't want to import everything this package has in. I have made another project to test things and get what I want from this or other assets into my main project. I have my own Gas Giant and Planet Albedos, normals etc.

    Can you tell me how to use my own textures with your scripts to make them look better and how to then export them into the main project?

    Can you inform me of script and shader dependencies and what I need to make my Gas giant and planet work with your features in my main project without "clutter"?

    Is this somewhere in the documentation that I might have missed?

    Thanks in advance.
     
  43. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    1 - Yes.

    2 - The same as Earth in kg? Assuming your Earth is the same radius. Not sure if it will work at such scales though.

    3 & 4 - You can add the SgtTerrainObject to auto snap objects to your planet, and then move them like normal in the Scene view. If your planet is large enough then it may not render properly in the scene view unless your camera is near the planet though.

    5 - The SgtCameraMove component can do this (see "Terrestrial Planet" demo scene). This only works for the main/player object though, not all objects in the scene. I'll see if I can come up with a solution to this.


    For the most part each Feature folder is standalone, so you can delete them if not required. The only exception is the Shared folder. Also, inside each Feature folder is the Media folder, which you can usually delete, though the Shared/Media folder has components used in many demo scenes, but they aren't necessary for any rendering features.
     
    Hungry-Lion likes this.
  44. bthanse

    bthanse

    Joined:
    Jun 24, 2019
    Posts:
    64

    4:The snapping working on trees, but i have problems with a object. I see the trees align with terrain, and not Y axe. It it possible to get them stright up like when they mass spawn ? Have a video here when the object not snap to planet:
     
  45. bthanse

    bthanse

    Joined:
    Jun 24, 2019
    Posts:
    64
    A missing prefab and some error messages in the Star Pack: upload_2021-3-7_20-1-57.png
     
  46. bthanse

    bthanse

    Joined:
    Jun 24, 2019
    Posts:
    64
    I think I have seen something how to use spawning prefabs in different areas. Is it a video ? Can not rememer where.
     
  47. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    The SgtTerrainObject component currently overrides the rotation to always point 'up' relative to the terrain underneath. Not sure why I didn't add more settings like in previous versions, I'll fix this in the next-next version!


    The packs will all get updated in the next version coming out very soon! (just waiting for Unity to accept the submission)

    The "07 Areas" demo scene in the Terrain folder shows you how to do this. I plan to improve the terrain rendering features in the next-next version, so these scenes will be improved.
     
  48. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Hey everyone,

    Version 3.8.0 of Space Graphics Toolkit and Space Graphics Planets is now out!
    • Fixed variable SgtJovian.Occlusion setting output.
    • Added SgtFloaringOrbit.Offset setting.
    • Fixed SgtFloatingFollow component's rotation handling.
    • Added SgtBlackHole component to Singularity feature.
    • Removed SgtSingularity component.
    • Replaced SGT Planet shader with Planet shader.
    • Added Has Lights setting to Planet shader.
    • Added Has Water setting to Planet shader.
    • Added night lights to Planet shader for all rendering pipelines.
    • Fixed bug with SgtPlanet when disabling SgtAtmosphere component.
    • Removed PIPELINE tool (material switching is now automatic).
    • Fixed atmosphere flickering in HDRP.
    • Added renderer-specific intensity settings to SgtLight.
    • Added SgtManager component to scenes to auto modify settings for HDRP.
    • Renamed SgtLight.Intensity to IntensityInSgt.
    • Improved demo scenes for the Star feature.
    • Added Flow settings to SGT Star shader.
    • Added Sunspots settings to SGT Star shader.
    • Fixed SgtCorona inspector values not updating.
    • Added support for new InputSystem package.
    • Rewrote SgtCameraMove component.
    • Rewrote SgtCameraLook component.
    • Added SgtDragSource component.
    • Added SgtDragReceiver component.

    Keep in mind this is a massive update, so you should back up your project before updating. I also recommend you delete the old SGT folder before updating, assuming you didn't make any modifications to the asset contents.

    I forgot to update it in the documentation, so here are the links to the new free media packs:

    >> Alien Worlds Pack <<
    >> Solar System Pack <<
    >> Star Pack <<

    One cool new feature is the SgtPlanetWaterGradient and SgtPlanetWaterTexture components. These allow you to quickly create animated water for your (non-SgtTerrainPlanet) planets, and control the colors much more easily than before.

    upload_2021-3-9_20-35-5.png

    Let me know if you encounter any issues. Enjoy :)
     
  49. amack2u

    amack2u

    Joined:
    Dec 22, 2016
    Posts:
    15
    getting this error on build:
    Assets\Space Graphics Toolkit\Features\Singularity\Scripts\SgtBlackHole.cs(70,53): error CS0117: 'SgtHelper' does not contain a definition for 'LoadFirstAsset'
     
  50. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    2,457
    Oops! I've submitted a fix for this, it should be out tomorrow.
     
    JFI66 likes this.
unityunity