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
    Strange. The flare shader is in the "Space Graphics Toolkit/Features/Flare/Resources" folder, so it should always get included in the build. Maybe there's some way for resources to not auto get included into builds that I'm not aware of.


    Which version of SGT? And what steps must I do to replicate this?
     
  2. AkhaSkull

    AkhaSkull

    Joined:
    Mar 6, 2014
    Posts:
    10
    In my project folders tree, the flare shader is in the "Space Graphics Toolkit/Features/Flare/Shaders" folder.
    Could this be the source of the problem ?
     
  3. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    According to the Asset store it's in /Resources:

    upload_2021-8-4_22-33-31.png

    Although there is a .asset and .surfshader in the /Shaders directory, there is no shader file.
     
  4. GTG101

    GTG101

    Joined:
    Feb 1, 2017
    Posts:
    24
    3.7.11, but I just saw there are new versions so I'll update and see if it works.
     
    Darkcoder likes this.
  5. YetiBytes

    YetiBytes

    Joined:
    May 12, 2017
    Posts:
    2
    Does anyone know what would cause the Space Graphics Planet to look like this? I've copied the planet & star from the Orbit demo scene (which works) into my own scene and the shadow doesn't seem to exist. Using standardRP, no pp/fog/other lights.
    upload_2021-8-24_13-2-34.png
     
  6. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Hard to see what's going on there. You mean the planet is all fully lit like this? You may need to adjust your scene lighting settings so the ambient color is black.
     
    YetiBytes likes this.
  7. YetiBytes

    YetiBytes

    Joined:
    May 12, 2017
    Posts:
    2
    That was it! Thank you :D
     
    Darkcoder likes this.
  8. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    57
    Uhh me again,Before the old version had working atmosphere but now it's just flickering everywhere.The debug is saying error about
    InvalidOperationException: The previously scheduled job SgtTerrainPlanet:QuadJob writes to the NativeArray QuadJob.CurrentPoints. You must call JobHandle.Complete() on the job SgtTerrainPlanet:QuadJob, before you can deallocate the NativeArray safely.
    Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckDeallocateAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) <0x18041fe70 + 0x00052> in <395e53cb10ec4f219829828132f04c5c>:0
    Unity.Collections.LowLevel.Unsafe.DisposeSentinel.Dispose (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle& safety, Unity.Collections.LowLevel.Unsafe.DisposeSentinel& sentinel) (at /Users/builduser/buildslave/unity/build/Runtime/Export/NativeArray/DisposeSentinel.cs:75)
    Unity.Collections.NativeArray`1[T].Dispose () (at /Users/builduser/buildslave/unity/build/Runtime/Export/NativeArray/NativeArray.cs:169)
    SpaceGraphicsToolkit.SgtTerrainQuad.Dispose () (at Assets/Space Graphics Toolkit/Features/Terrain/Scripts/SgtTerrainQuad.cs:77)
    SpaceGraphicsToolkit.SgtTerrain.Dispose (SpaceGraphicsToolkit.SgtTerrainQuad quad) (at Assets/Space Graphics Toolkit/Features/Terrain/Scripts/SgtTerrain.cs:446)
    SpaceGraphicsToolkit.SgtTerrain.Dispose (SpaceGraphicsToolkit.SgtTerrainCube cube) (at Assets/Space Graphics Toolkit/Features/Terrain/Scripts/SgtTerrain.cs:440)
    SpaceGraphicsToolkit.SgtTerrain.OnDisable () (at Assets/Space Graphics Toolkit/Features/Terrain/Scripts/SgtTerrain.cs:309)
    SpaceGraphicsToolkit.SgtTerrainPlanet.OnDisable () (at Assets/Space Graphics Toolkit/Features/Terrain/Scripts/SgtTerrainPlanet.cs:80)
    UnityEngine.Objectdestroy(Object)
    SpaceGraphicsToolkit.SgtHelperDestroy(GameObject) (at Assets/Space Graphics Toolkit/Features/Shared/Scripts/SgtHelper.cs:192)
    SpaceGraphicsToolkit.SgtFloatingSpawnerDespawnAll() (at Assets/Space Graphics Toolkit/Features/Universe/Scripts/SgtFloatingSpawner.cs:168)
    SpaceGraphicsToolkit.SgtFloatingSpawner:OnDisable() (at Assets/Space Graphics Toolkit/Features/Universe/Scripts/SgtFloatingSpawner.cs:61)


    And more memory leak issue

    Here's a screenshot https://ibb.co/wCD3Nvr
     
  9. ApocalyVec

    ApocalyVec

    Joined:
    Dec 20, 2018
    Posts:
    1
    Hey, I'm using SGT for my VR project, and everything had worked well. The scene looks gorgeous in VR.

    So far, I've viewed the planets from space. I recently started making some close fly-by scenes and looked into the Terrain feature in SGT. But it seems the terrain scripts are not correctly loaded. Please see this screenshot of the Planet Surfer demo from the Basic Pack.
    upload_2021-8-27_14-13-17.png

    It says the scripts are not loading due to compile errors, but there doesn't seem to be any.

    This is on Unity version 2020.3.8f1, standard rendering pipeline. I then created a clean project in version 2019.4.16f1 and imported the SGT asset. But it gives the same results.

    I think the terrain feature is super cool and I'd love to try it out. But this issue has been blocking me for a while. Any insights on how this might be resolved?

    Thanks
     

    Attached Files:

    Last edited: Sep 1, 2021
    eSkaSoft likes this.
  10. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    You can adjust the SgtAtmosphere component's InnerOffset setting to remove flickering. The best value depends on render pipeline, camera draw range, planet scale, and possibly some other factors so it's difficult to make it automatically work in all scenarios.

    That error is unrelated to the atmosphere. Does this occur when you change scenes or exit play mode or something similar? It seems to be coming from disabling the SgtFloatingSpawner component, which normally doesn't happen in-game.



    You must manually install the Burst package, as seen HERE.
     
    eSkaSoft likes this.
  11. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    57
    Well the error apear in both,Sometime there are no error,Sometime They occur When I press play,and sometime when i presses stop.and the maximum render distance is 3 lightyears???
     
    Last edited: Aug 31, 2021
  12. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    If you can give me a step by step process to replicate this in one of the example scenes then I can try to fix this.

    I can set the camera's far clipping plane to 3.402823e+38, which is 35966842828453651833844 lightyears. Rendering may break down before you get this far though.
     
  13. lolaswift

    lolaswift

    Joined:
    Jan 10, 2019
    Posts:
    151
    I'll switch back from Unreal Engine if water/ocean is supported.I mean player can walk into the water and probably even under water fx.
     
  14. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    Hi there. A little trailer I made for a sponsor recently. Not yet using latest Sgt. Surface will look much better when I integrate with it.

     
    Darkcoder and blacksun666 like this.
  15. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    The latest version has ocean as seen HERE. This doesn't have any water interaction or underwater rendering though, and I probably won't implement any.


    Nice editing! Yeah the surface could probably look better with the latest terrain and some tweaking of the settings.
     
    lolaswift likes this.
  16. lolaswift

    lolaswift

    Joined:
    Jan 10, 2019
    Posts:
    151
    Still the best and most comprehensive space kit.
     
    Darkcoder likes this.
  17. Susihiisi

    Susihiisi

    Joined:
    Jan 11, 2018
    Posts:
    32
    Is there easy way to change the gravity scripts so that I would be able to set acceleration per seconds squared from the planet radius instead of setting the mass? I think that would be way easier than guessing right mass for the planet. For some reason changes I make in SgtGravitySource script won't show in Inspector. And I'm also having problems accessing other scripts from there.
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    You can use THIS site to calculate the mass from the other variables if you set Mass 2 to 1 kg.

    The code for SgtGravitySource looks fine. Are you sure you didn't enable AutoSetMass? If not, let me know the exact version of Unity you're using so I can test it. The inspector code for this is the same as any other SGT component though, so if this doesn't work none of the others should either.
     
  19. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    Hi. I am now trying latest Sgt. In Earth Sized Planet scene, HDRP, as you get closer to the surface, terrain starts to flicker. I suspect that I experienced a similar thing while making grass shader with shader graph: using absolute world pos on position node fixed that issue. Not sure that is the case, here, but is there an easy fix?
     
    Last edited: Sep 16, 2021
  20. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    I think disabling the camera-relative rendering feature will eliminate this issue, but I haven't tested it. This scene implements the origin shifting system that comes with SGT, so there's no need to use camera-relative rendering.
     
    Last edited: Sep 24, 2022
  21. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    57
    Is there a way for multi player floating point using mirror and stg universe?
     
  22. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Yes, you just need to sync the SgtFloatingObject component's .Position data between each client. Don't sync the Transform.position data, because it will be different.
     
  23. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    Hi. I am trying to implement visual effect graph grass example on the github project to sgt system. The example graph takes a heightmap and calculates the y coordinate of the particle to place the grass since unity terrain is used. Similarly, in sgt system, I plan to spawn the root object on the terrain then get surface position for each particle and position them at the coordinates. Is there a way to do this in sgt other than using calculations in Sample_Cubic_Equirectangular on SgtTerrainTopology.cs?
     
  24. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    If your terrain is displaced using only a heightmap then you could use the same setup, except sample the terrain height using spherical coordinates. If it uses the procedural simplex noise, areas, etc then there's no reasonable way to do this.
     
  25. Deleted User

    Deleted User

    Guest

    Hello. Is it possible to using just one number (like seed) generate whole planet, which every time will be the same? Like is it pseudo-random number generator compatible?
     
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    The SgtTerrainSimplex component has the Seed setting, which can do this. The same seed value should produce the same results. It looks like I forgot to add a seed setting to SgtTerrainPrefabSpawner though, which I should do.

    The overall look of the planet is mostly defined by the planet texture, heightmap, and atmosphere settings though, which have no procedural generation aspect. It would be easy enough to make a simple script that can procedurally alter these values though.
     
    Deleted User likes this.
  27. Delforce

    Delforce

    Joined:
    Jun 3, 2015
    Posts:
    23
    Darkcoder, love your work, your code is very clean and easy to follow.

    I have a couple of questions about the Floating Origin system in terms of making a large galaxy of stars and planets.

    After going through the SGT documentation a few times mainly around floating origin and the Universe, it's left me wondering about what u refer too when it mentions for a universe not saving certain positions or use a transform.

    What I'm trying to do
    So if I wanted to create something similar to a universe that stores all of the coordinates of stars, planets etc. on file and during gameplay or at the start of the game loading in the universe to objects. I would then try to follow your documentation suggestion around rendering billboards through loading/streaming in the prefabs of what the player is seeing, based on their current position using the floating point origin system.

    I could inherit from your spawner classes and update the SpawnAll() method with what I want to do if that is feasible, I've been coding for 30 years professionally so I have no issue with C# and coding.

    Questions
    1) is what I'm trying to do above possible using the floating origin system and how would u suggest I do that in terms of using the warp too and rendering stars in their correct locations, as I warp to them?
    2) what coordinates should I be saving to file so I can reload it when needed? The prefabs transform? or the FloatingObject positions? or Prefabed game objects transform?

    Extra on my current problem I'm trying to solve
    I tried doing question 1 however it seems that even though star co-oridinates are located far away from each i.e. Global positions, the stars are rendering billboards in the same area of space and the warp to goes to a completely different area of space. I've checked and the loaded floating object position is the same as the position the prefab is rendering however I think I'm missing something about the snap to stuff in your documentation and the floating origin system and what it is doing.

    Any guidance would be appreciated I'm not understanding how to make the render of stars where it should be after saving to file.

    Thanks in advance.
     
  28. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    In a normal scene the Transform component's .position is the 'global position', which you can save and load and have everything work as expected. However, with a origin shifting system this .position data could have any value depending on how you moved your camera during gameplay - even if you move your camera to the exact same location. Therefore, saving/loading these values is pointless. Instead, you must save the .Position data inside the SgtFloatingObject component. This position is the 'global position', which will be the same across all runs of your game.

    If your scene contains manually placed objects (i.e. not generated using a spawner), then you should be manually saving/loading this .Position data. However, if your scene is procedurally generated using spawners then there's no need to store any positions, because the spawners will automatically spawn them at the same location every time given the same seed values.

    The warp feature works by adding the SgtFloatingTarget component alongside any SgtFloatingObject. The SgtFloatingWarp component can then be called with WarpTo(x), where x is the reference to the floating target (the demo scenes have an example GUI that does this without any code). The point you have specified within the floating warp component should then warp to that point. Keep in mind the floating target component has the WarpDistance component to stop you warping into your object (e.g. a planet), so maybe you have that set too high.
     
    Last edited: Sep 24, 2022
  29. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    this worked fine. thanks.
     
    Darkcoder likes this.
  30. Delforce

    Delforce

    Joined:
    Jun 3, 2015
    Posts:
    23
    Thanks for clarifying all of that Darkcoder I now understand what I need to do and what I was doing wrong.
     
    Darkcoder likes this.
  31. raydekk

    raydekk

    Joined:
    Mar 14, 2013
    Posts:
    100
    Hey,

    Is there a way I can make a lens flare effect in the Floating Origin system?

    Thanks!
     
  32. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    You should be able to use any existing lens flare setup with the origin shifting system. All it does it move the camera and objects around after all.
     
    Last edited: Sep 24, 2022
  33. Darkcoder

    Darkcoder

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

    Version 3.9.4 of Space Graphics Toolkit is now out!
    • Fixed starfield pulse not working.
    • Improved SgtTerrainPlanet floating point precision.
    • Added SgtTerrainOcean component for improved ocean mesh rendering.
    • Rewrote Terrain Ocean shader depth coloring.
    • Added TRANSPARENCY / Mode setting to Terrain Ocean shader.
    • Added TRANSPARENCY / Fresnel setting to Terrain Ocean shader.
    • Added TRANSPARENCY / Depth Scale setting to Terrain Ocean shader.
    • Added REFRACTION / Enabled setting to Terrain Ocean shader.
    • Added WAVES settings to Terrain Ocean shader.

    Mostly improvements to the ocean shader. It now no longer requires the camera depth texture or grab pass/opaque texture (they can still be manually enabled), so it should allow for higher performance on devices that need it. I also added an experimental 'waves' feature to the ocean shader, which you can enable from the ocean material settings. The waves are just white rings that go into the shores. This effect is based on vertex data, so it can look a little blocky until you get up close. I still need to work on it some more before I make dedicated demo scenes or list it as a feature though, but it might already be good enough for some projects.

    Enjoy :)
     
  34. Natalynn

    Natalynn

    Joined:
    Apr 21, 2013
    Posts:
    197
    Any videos of this new update? Kind of curious, been away for awhile.
     
  35. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    No video, but here's a screenshot:

    waves.jpg

    Those 'waves' just scroll in slowly.
     
    Rowlan likes this.
  36. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    57
    Does this mean the open gl depth buffer is fixed?
     
  37. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    No, there's no way to 'fix' it since OpenGL (at least the versions and APIs Unity uses) doesn't support reversed depth buffers. There are only techniques to work around it in certain scenarios. In the latest version the SgtTerrain meshes are generated and rendered local to the chunk, rather than the center of the planet, so for very large planets there is higher vertex position precision. This improvement isn't that drastic, but it does mean the terrain no longer shakes in HDRP due to their camera-relative-rendering feature.
     
  38. CosmicStud

    CosmicStud

    Joined:
    Jun 13, 2017
    Posts:
    55
    Hey, awesome asset btw! Thank you! I have a question about jovians, all my objects are appearing above the jovians even when they are positioned behind. Is there a solution to the depth rendering?
     
  39. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Transparent objects get rendered in order of their distance to the camera. If this order appears incorrect then the center of your object must be in front or behind of the Jovian, but some or all visual parts of it are on the opposite side.

    This scenario is common if your object is very large. For example, planetary rings are very big and appear both in front and behind the planet, so there is no correct order to render it. SGT solves this particular scenario by splitting the ring into segments, so there is no one segment that renders both in front and behind.

    If your object is very large like this then you could also split it up. Another approach is to make the Jovian write depth so it behaves more like an opaque object (though this can cause the Jovian edges to render incorrectly). You can see the “Basic Pack/Jovian” demo scene to see how this can be configured with the “Depth” Material on a sphere around the Jovian GameObject.
     
  40. CosmicStud

    CosmicStud

    Joined:
    Jun 13, 2017
    Posts:
    55
    You're right they are rendering correctly depth wise when the object is behind, thats my bad. My problem is objects positioned inside the jovian, the objects are rendered on top, but I understand the issue
     
  41. Deleted User

    Deleted User

    Guest

    Hello,
    what can cause this problem? Terrain is visible only near to the surface. Then all planet turns into gray (when camera further from planet). Terrain radius is 1000 and there is no atmosphere (SGT 3.9.4). Appreciate some tips ;) Thank you.

    upload_2021-10-8_14-27-20.png
     
  42. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    I see, well the jovian volumetric effect is calculated entirely within the jovian shader, so it won't work with other objects entering it. The only way this could be done automatically is if this effect used the depth buffer (like the ocean transparency can), but this would only work with opaque/cutout/dithered objects. To make it work with transparent objects the object itself must have a custom shader that implements a more complex version of the jovian shader, but this isn't really practical.

    Another approach is that the SgtJovian component has a (private) method called HandleCalculateOcclusion (or public SgtHelper.InvokeCalculateOcclusion), which can calculate how much jovian 'fog' exists between the two specified points (e.g. camera and your object). This is normally used to fade out the light flares, but it could also be used in this scenario with a little bit of custom code and maybe some tweaks to your shader if it doesn't already have some kind of opacity setting. Earlier versions of SGT had a similar feature, but I found it a little bit too advanced since it usually requires a custom shader, and there are some edge cases like it doesn't work too well with huge objects that should probably have multiple sample points.


    The Scene tab's camera has its own hidden settings that have a low camera clipping range, and other fun stuff that makes it not so useful for viewing space scenes. I recommend using the Game view instead where possible. While it is possible to override the Scene camera settings, I'd rather not touch any internal Unity stuff. The gray looks like you have fog enabled?
     
  43. Darkcoder

    Darkcoder

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

    I've been working on improving the waves for the next version, here's a sneak peek of what they will look like:

    waves.gif

    Still some room for improvement, but it looks pretty cool now.

    However, now the shoreline on the land in comparison looks very boring. I think I'll have to implement some kind of 'beach' rendering setting to improve this, hmm.
     
    Last edited: Oct 11, 2021
  44. ProtoPoly

    ProtoPoly

    Joined:
    Jan 5, 2014
    Posts:
    34
    I would actually love to see something like a Crest Ocean System Integration option
     
  45. Darkcoder

    Darkcoder

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

    Version 3.9.5 of Space Graphics Toolkit is now out!
    • Added SHORE settings to Terrain Planet shader.
    • Added new SHORE settings to Terrain Ocean shader.
    • Added new WAVES settings to Terrain Ocean shader.
    • Added Moon to SolarSystemPack/Explore demo scene.
    • Added Terrain/Waves demo scene.
    • Added Terrain/Shore demo scene.
    • Fixed SgtAtmosphere flickering in some scenarios.
    • Fixed SgtCorona flickering in some scenarios.
    • Removed SgtAtmosphere.InnerOffset setting.
    • Removed SgtCorona.InnerOffset setting.

    I believe the atmosphere flicking issue has been resolved for most scenarios now. In my testing I can only notice it in OpenGL and OpenGL ES at far camera ranges (e.g. 100,000 units+), or if the camera's near clipping plane distance is low (e.g. below 1). Both of these scenarios can be worked around somewhat by adjusting the camera clipping ranges and camera distances.

    I've also added a basic shore/beach setting to the Terrain Planet shader, which makes the transition between the ocean and land look better. Here's a screenshot of the new Earth Sized Planet demo scene:


    upload_2021-10-13_13-29-34.png

    Enjoy :)




    Spherical worlds work completely differently to the flat worlds from Crest, so this will never happen.
     
    dirkjacobasch likes this.
  46. ProtoPoly

    ProtoPoly

    Joined:
    Jan 5, 2014
    Posts:
    34
    I am making a sailing game using spherical worlds and wanted gerstner waves
     
  47. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    Modifying the heights of the ocean to make waves and such is not possible (at least not with the atmosphere on top).
     
  48. ChristianLinnell

    ChristianLinnell

    Joined:
    Jan 7, 2013
    Posts:
    18
    I'm getting some issues with the SgtTerrain object.

    • Fresh project
    • Tested in Unity 2020.1.14f1, 2021.1.20f1, and 2021.1.25f1
    • Fresh import of SGT 3.9.5
    Problem occurs in both URP and 3D projects.

    To be clear, normal planets work, backdrops work.

    If I try to add the SgtTerrainPlanet component to a gameobject, I get this:

    upload_2021-10-17_13-35-49.png


    SgtPlanet works no problem, anything descended from SgtTerrain does not. Below is a screenshot from the inspector in the "Waves" demo scene.

    upload_2021-10-17_13-29-48.png


    There don't appear to be any script errors, but there are 37 shader warnings in the console in Unity 2021, 63 in Unity 2020 (but only in a URP project??).

    upload_2021-10-17_13-40-21.png

    upload_2021-10-17_13-40-39.png
     
  49. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,414
    See the description of terrain scene 00, or HERE.
     
  50. ChristianLinnell

    ChristianLinnell

    Joined:
    Jan 7, 2013
    Posts:
    18
    Yup, that was it. I just needed to RTFM.

    I can't believe how good your support is, my friend, thank you.

    In case this helps anybody else, if you get an "EBUSY: resource busy or locked, open" while installing Burst, you just need to close your code editor, as it locks certain project files.
     
    Darkcoder likes this.