Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Space Graphics Toolkit & Planets

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

  1. nighty2

    nighty2

    Joined:
    Dec 29, 2020
    Posts:
    28
    Thanks! Works like a charm with the new version!
     
    Darkcoder likes this.
  2. S1m0np3t3r

    S1m0np3t3r

    Joined:
    Dec 22, 2016
    Posts:
    8
    Hi @Darkcoder ,

    I had a little time, so I tried the new version, and I have some question. To get faster progess, I would like to ask them:
    1. 1. I tried to intstall objects to an Earth sized planet with the SGT Prefab Spawner, but nothing happens. (I can do it with lesser planets, which are based on sphere).
    2. 2. How can I modify the atmosphere? I would like, to the closest moon can be visible from the planet surface. Is it possible?
    3. 3. I played a little with the Explorer model from the Solar System Pack. If I see the Scene: if I like to add a moon to the Earth, I have to install it like like the Earth has installed to the sun?

    SGT_0001.png

     
  3. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    1 - I wasn't able to notice a problem:

    upload_2021-5-1_22-58-46.png

    The Cube prefab here is a standard 1,1,1 cube. Maybe you didn't increase the SgtTerrainPrefabSpawner.Resolution setting enough? If it's too high then each chunk will be massive, and with the default 10 prefabs per chunk would result in perhaps one prefab per thousand km.


    2 - The atmosphere uses alpha blending. By default, it reaches 100% opacity when near the surface, so you cannot see anything outside. You can make it not reach 100% by reducing the SgtAtmosphere.Sky setting (e.g. 0.75 for 75% max). This will allow you to see moons etc, but it will also allow you to see the stars. In the future I want to make it so the starfields can auto fade out to allow for this, so I made a card for it HERE, don't expect it too soon though.

    3 - Yes, you should be able to just set the SgtFloatingOrbit.ParentPoint to the Earth, maybe I should add it. HERE's a card for that.
     
    S1m0np3t3r likes this.
  4. ProtoPottyGames

    ProtoPottyGames

    Joined:
    Dec 18, 2015
    Posts:
    77
    Fog Volume Showroom.png
    Ah..sorry for the confusing explanation. I guess the most simple way I could describe what I'm trying to do is use a typical flat Unity terrain, but have the atmosphere change as the player ascends similarly as it does on a round planet. I'll try and see about putting together some sort of example to better display what I'm trying to achieve.

    Edit:
    Something along the lines of this screen from the Fog Volume asset's Showroom scene, but with an atmosphere change that becomes sort of a space "layer".
     
    Last edited: May 1, 2021
  5. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    You could maybe hack together something like this in SGT with some custom meshes that are just a tiny chunk of a full planet, but it would be really difficult to work with. You're better off just making a scene setup like in that picture with a hand built terrain mesh, some particle clouds on top. I'm not sure how you'd do the space, maybe an inside out cube with a black texture?
     
    ProtoPottyGames likes this.
  6. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    142
    Hi. I'm using SGT with the Virtual Reality Interaction Framework, and have started to see this error when I attempt to fly the spacecraft, after a few seconds:

    Screen position out of view frustum

    It appears to be coming from UnityEngine.GUIUtility: ProcessEvent and I’ve tried disabling any UI related components. Has anyone seen this? Do I need to add the floating origin components to the scene?
     
    Last edited: May 2, 2021
  7. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    Which version of Unity, SGT, and which demo scenes or features do you get this error with?
     
    dmenefee likes this.
  8. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    142
    Unity 2020.3.25
    SGT latest release (3.8.4?)
    I don’t see this with a demo scene; I’m pretty sure it is the result of using VRIF with SGT. I’ve posed the question with that asset author too. It may also be the result of using the new input system, or any number of other variables in the somewhat complicated arrangement. It does look as if the problem occurs when I move out of a rather narrow zone; if I drive forward without any turns I can go quite far before seeing this. I had thought it might be the scene camera, but closing the scene tab didn’t fix the issue... hm. I haven’t tried disabling the VRUI component (which was definitely causing one of these crashes) *and* closing the scene tab. I might try that next time I work on this project today.

    If I decide to add floating origin support, should I just add the SgtFloatingCamera component to one camera (the center eye camera) and SgtFloatingObject components to the spacecraft containing the player/XR rig and to other scene components (there are very few right now)?

    thanks!
     
    Last edited: May 2, 2021
  9. S1m0np3t3r

    S1m0np3t3r

    Joined:
    Dec 22, 2016
    Posts:
    8
    Ohh, I'm sorry, there were some troubles with the numbers.

    I've got another question: on the Earth sized planets, I can't produce the shadow with the standard settings, or the PostProccess camera setting. In these two cases the shadow works on the 1000 m diametres planet, but on the Earth sized planet, it doesn't. I did the same things both of the two sized planets. Maybe it's necessary to use other settings in the case of the Earth sized planet?
     

    Attached Files:

  10. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    102
    Still did not upgrade to latest Sgt, but this is a second type of planet I was trying to design for a few days... I have 7 types of planets in that procedurally generated system, and I want first to finish the design of all of those planets, then share a video with you guys including flight mechanics from one planet to another, then I will upgrade to latest Sgt (which I can't wait for)... Hopefully, in 2 weeks, I will be done with the upgrade... That is because, sometimes we dive into technical capabilities to deep, but a game is about how you tell the story. I think, it is time for me to see the story in my mind... At least, a blink of it... And, Sgt enables that for me...

    This is a planet that is loosing its atmosphere due to many earthquakes that cause severe loss of mass, therefore, gravitational force. At this moment of its history, the planet is resisting to loose its atmosphere. I have to work on this concept more including some orbital elements and some elements that can be surprizing how life can be persistent even in those conditions. For now, this is just a draft.

     
    shadmar and joshua_42 like this.
  11. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    142
    Regarding my problems with VR in SGT, I've tried setting up the floating origin system, but when it snapped my VR camera was disconnected from its original position and everything went kind of crazy (spinning out of control). The VR rig is inside a rigidbody (the spacecraft), so that's probably a clue.

    Anyway, the problem comes down to the rounding error that happens in Unity related to the clipping planes for a camera. Here's the complete error message:

    Screen position out of view frustum (screen pos 0.000000, 0.000000, 100000.000000) (Camera rect 0 0 1440 1440)
    UnityEngine.GUIUtility: ProcessEvent (int,intptr,bool&)

    The clipping planes are set up for .025 near, 100000 far, which is obviously problematic. However, I don't know how else to get a starry backdrop to work. If there's an alternative way to get stars that doesn't require such a huge clip plane setting I'd love to know what it is.
    thanks!
     
  12. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    Yeah I'm not sure if VR would work with the origin shifting system, at least not without changing the setup from the fairly simple one I use in the demo scenes. The lack of an origin shifting system shouldn't be causing these errors anyway, so you should try to find the source of that first.

    If you lower the clip planes then you must lower the background scale/radius so it doesn't go outside.


    Unity's built-in shadow system doesn't work if the camera draw range is above 100,000 or 1,000,000 depending on Unity version or pipeline. There's a possible way to overcome this I plan to experiment with later this year, but for now you can change the draw distance when on the planet or use smaller planets.


    Looks great! Can't wait to see more videos :)
     
    Last edited: Sep 24, 2022
    dmenefee likes this.
  13. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    142
    It was me, as I suspected. One of my components adjusts the rigidbody mass of the spacecraft as fuel is consumed (did I mention that this is a simulation-oriented racing game?). There was a bug in that adjustment code that would reduce the mass to zero. Once that happened, the spacecraft, still under thrust (because I was pushing the throttle) would accelerate to infinity and beyond: crash.

    I fixed that bug and things look and work very well. I did create a modified version of the SgtFloatingCamera component that also adjusts an attached rigidbody component. When I use floating origin, it doesn't quite adjust the position of the other floating objects correctly, so I disabled that for now. I may want to revisit it depending on how large my racecourses get... at which time I'll look into that and may have more questions.

    thank you for your time! and sorry for taking it up with my bug!
     
    Darkcoder likes this.
  14. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    102
    Sorry for the late answer... I do not spend much time on forum but I need to look at forum more carefully when I do so...

    With the latest sgt, you may not need this trick. But, on that video, with 2 or 3 previous version of Sgt, Sgt already does most of space to planet flight (with latest version this is, even, awesome). For walking on the surface, I just modelled a 15-20 m radius of a convex surface plate and generated them with SgtTerrainPrefabSpawner aggressively around the planet. They stack on top of each other forming irregular intersections. Also, the model itself is not a straight planar surface, I moved some of the vetices up and down a little bit. Actually, I put a sphere object on probuilder, cut the top of it, and lowered the inner vertices of the top piece. Then, I exported it as prefab, and used GPUInstancer to gain some performance. It seems to be doing the job, but this technique still needs some more optimizations.

    Hope, this helps.
     
    Darkcoder likes this.
  15. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    102
    This is amazing... I downloaded and checked it on SRP today. I even considered to migrate my project back to SRP from HDRP. Then, luckily, I remembered to breathe... :)

    Can't wait for the HDRP shader completed.
     
  16. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    56
    Wait im so stupid i think STG 3.8.4 is stg 3.8.3
     
  17. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    56
    Sorry for bumping again but all my other asset are fine,But yours are broken somehow...? i never tested the new version since i was busy deleting my memory so i'll give a try
     
  18. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    56
    And also how am i suppose to place road? or straight long landmark feature as it will get higher the more the planet curve,I don't know how KSP done it
     
  19. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    56
    It didn't work...
     
  20. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    You probably need to delete your Asset Store download cache first. The latest version downloads and installs fine for me.


    You would need to deform the road mesh around the planet surface.
     
  21. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    56
    Also thank you again from the Gmail private message
     
  22. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    56
    the new water glitch out it appear to be same as the atmosphere bug on a nested obit prefab i modify to use ocean
     
  23. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    Can you give me step by step procedures to replicate this?
     
  24. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    56
    Ok on my pc,Just open Earth sized planet and it should glitch out and the planet is wobbling(No atmosphere) Screen Shot 2564-05-10 at 9.41.05 PM.png
     
  25. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    56
    And when you moved the camera closer there's seem to be a wave of water coming (Earth sized demo with 20* the moutain height ) Screen Shot 2564-05-10 at 9.47.27 PM.png
     
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    Works fine for me in 2019.4.12f1 URP, you'll need to give me more details to replicate this.

    Some level of waviness is inevitable due to floating point precision with the way the meshes are rendered. I'll try and fix this eventually.
     
  27. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    56
    Well darkcoder,The error is just by opening the unmodified earth sized planet demo.and in the second picture you see the line?,that's the wave i was talking about.
     
  28. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    Well I can't replicate this first issue, and you've given me basically no details of your system or project setup so I don't know what to test...
     
  29. DethKwok

    DethKwok

    Joined:
    Mar 13, 2017
    Posts:
    15
    Hello, possible to have SGT Starfield Nebula spawn 'stars' that does not rotate with camera roll?
    Or is there a similar script I can use to that does not rotate with camera? thanks!

    EDIT: Just tried the Nebula Scene in Starfield, it doesn't show the problem I'm having in my game scene. Did I set something wrong? My game camera has SGT Camera

    EDIT: Ok It seems like the Nebula Scene Version has completely round 'stars' so rotating the camera doesn't really show anything
     
    Last edited: May 16, 2021
  30. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    Thanks for pointing this out, it seems like I forgot to write the camera angle for the SgtStarfieldNebula shader. I'll fix this and send you an updated build shortly!
     
    DethKwok likes this.
  31. pratt_timmy

    pratt_timmy

    Joined:
    Jun 30, 2019
    Posts:
    30
    Hello again.
    Awesome work on this latest release. Thank you!

    I have a feature request/question in regards to the SgtAurora component:
    Is there a way to modify the Aurora shader so that it is only visible on the dawn/dusk and nightside of a planet?
    I tried fiddling with the fields in the unity inspector for SgtAurora and no joy. I'm looking into modifying the shader but I'm not really sure where to start. I figured that if I could find the dot product of the scenes directional light and a normalized vector that points out on the aurora sphere I could multiply the color output by 10 clamped to [0,1] or something
     
    Last edited: May 18, 2021
  32. XyrisKenn

    XyrisKenn

    Joined:
    Dec 8, 2015
    Posts:
    89
    Greetings - is there a way to render the planet surface as a compiled texture map? I'd like to convert a planet to a hologram-style render. Wonderful toolkit!
     
  33. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    Sorry for the late reply.

    Instead of modifying the aurora it sounds like you may just want to make the atmosphere transparent at dawn/dusk/night? If so, you can enable the SgtAtmosphere.Night setting, where the NightSky is the night opacity, and the sliders can adjust where it appears.



    You mean combine the albedo + water into a single albedo texture? There's no feature like this. The easiest way to do this is to make an inside-out planet mesh, place a camera in the center, and then render it to a cube map using Unity's built in method. Any other approach would basically be rewriting the planet shader.
     
    pratt_timmy likes this.
  34. DethKwok

    DethKwok

    Joined:
    Mar 13, 2017
    Posts:
    15
    I'm trying to detect terrain on the planets using a raycast, but its not triggering. Is there a way to do this?
     
  35. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    You must add the SgtTerrainCollider component ("Terrain/05 Collider" demo scene). Keep in mind for performance reasons this generates them based on camera proximity based on the Radius and Resolution settings, so you can't raycast a distant planet with this. If you need long distance raycasts you would have to implement a custom raycast routine that revolves around the idea ray marching using the terrain's GetLocalHeight method.
     
  36. DethKwok

    DethKwok

    Joined:
    Mar 13, 2017
    Posts:
    15
    Hey guys, made a procedural universe using this amazing asset!

    Its a small project to practice procedural generation and Unity DOTS. I may incorporate a game in the future, who knows!

    https://reactiveentertainment.itch.io/stardust
     
    Darkcoder, shadmar and Bartolomeus755 like this.
  37. RetnuhStudio

    RetnuhStudio

    Joined:
    Jan 4, 2013
    Posts:
    27
    Hey Carlos

    Loving the new update features. Updating my project has gone smoothly so far but I just had a quick question to see if you know what might be causing this bright patch on my planet.

    Some things of note:
    1 - Nothing to do with the albedo texture.
    2 - The center of the circle seems to be at Position (0, 0, 0) when the game starts however it moves with the planet because of the floating origin system.
    3 - Has the same issue with atmosphere turned off.

    Any ideas on what I can try.

    [Edit] Also this is in Unity 2020.3.4f1 URP.

    Thanks
    Matt

    506756783.jpg
    34556456.jpg
    6574387.jpg
     
  38. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    Nice to see lots of projects being posted using SGT!

    Keep up the good work :)


    Does this light spot move with the camera, or does it appear to be baked into the planet?

    Does this issue appear in any of the example scenes with planets or planet terrains?
     
  39. RetnuhStudio

    RetnuhStudio

    Joined:
    Jan 4, 2013
    Posts:
    27
    It seems to be baked onto the planet. I wasn't able to reproduce it on any of the example scenes.
     
  40. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    It's hard to say then, try copy+pasting the planet into a new scene and seeing it the issue still appears. If so, can you send me a package of it to test out via private message or email?
     
  41. RetnuhStudio

    RetnuhStudio

    Joined:
    Jan 4, 2013
    Posts:
    27
    Hmm it's fixed now except I don't know why. I exported the problem planet to a package and imported it and SGT into a new project and there were no issues. So after I couldn't reproduce it in a new project I decided to delete it from my main project and re-import it from the package I created. I'm not sure why but there are no issues and everything looks great now. Thanks for your replies though.
     
    Darkcoder likes this.
  42. sxnorthrop

    sxnorthrop

    Joined:
    Sep 29, 2014
    Posts:
    43
    This new shader is amazing. I wonder how hard it would it be to add color texture support to the shader using a lerp based on camera distance?
     
  43. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    You mean to the DETAIL settings? So each detail layer can have an albedo as well as normal?
     
  44. Quiznos323

    Quiznos323

    Joined:
    Oct 26, 2015
    Posts:
    14
    Hi! Is there a way to cut a hole in the terrain/collider so that it would be possible to create a structure or cave underground that is accessible from the surface? What would be awesome is a component that we could add to a gameobject that acts as a sort of mask, so that wherever we place the object, a hole would be cut in the terrain.
     
  45. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    There's no feature like this. You can always place objects on top to create a kind of over ground cave like with THIS asset.
     
    Quiznos323 likes this.
  46. sxnorthrop

    sxnorthrop

    Joined:
    Sep 29, 2014
    Posts:
    43
    Yeah, that would be so nice but I'm sure there's some limitations to the amount of samplers or something like that.
     
  47. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,318
    Probably lots of limitations, but I guess there's not much harm in adding it as an option.
     
    sxnorthrop likes this.
  48. sxnorthrop

    sxnorthrop

    Joined:
    Sep 29, 2014
    Posts:
    43
    Made a few mods because there was a sampler limit. I'm just reusing a sampler state for the albedo textures on each baked level. I will update with progress soon. This works great though!

    Now imagine this with the existing splatmap system you made. You could really make some insanely nice planets.



    Also, would love to try and add in multiple texture maps with a noise mask for each detail channel so that you can have more than 1 texture blended together.

    Another cool idea would be to add "parameters" to each of the mask channels, like "Min Surface Angle" and "Convex Strength" (to only apply to steep angles or convex / concave areas).

    Dude, there's so many possibilities with this new shader you made.
     
  49. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    142
    Hello! Feature request, if you don't mind:
    My racing spacecraft needs to use the floating origin system so that UI elements and other texture details don't start jittering as I fly further from origin. This is a VR setup, and for the most part it works. However, the spacecraft, being a rigidbody, needs special handling to snap to the origin. I copied the code from the floating camera component and added the rigidbody handling code, but now I need to create my own copy of the floating object code, as it currently calls for the SGT floating camera to handle snaps, *not* my own version of that component.

    So... would it be possible to add a rigidbody option to the SGT floating camera that, when toggled 'on', verifies that it's attached to a rigidbody and updates its position attribute as needed? That way I can use all your code and don't need to maintain my version.

    thanks! I love this asset, BTW.
     
  50. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    56
    Hey Darkcode,Can STG handle procedural texture at runtime and changing of atmosphere at runtime?