# Space Graphics Toolkit & Planets

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

Joined:
Mar 6, 2014
Posts:
4
Hi.

I would like to manipulate SgtLengths (convert them, add them, subtract them, etc.) and I am a bit confused by this operator :
Code (CSharp):
1. public static implicit operator double(SgtLength length)
2.         {
3.             switch (length.Scale)
4.             {
5.                 case ScaleType.Meter:      return length.Value;
6.                 case ScaleType.Kilometer:  return length.Value * 1000.0;
7.                 case ScaleType.AU:         return length.Value * 149600000000.0;
8.                 case ScaleType.Lightyear:  return length.Value * 9461000000000000.0;
9.                 case ScaleType.Parsec:     return length.Value * 30856740000000000.0;
10.                 case ScaleType.GigaParsec: return length.Value * 30860903000000000000000.0;
11.             }
12.
13.             return default(double);
14.         }
if I have a value in meters and I want to convert it to kilometers I should divide it by 1000, not multiply it.
This is quite confusing. I must not be doing things correctly.
It would probably be clearer with a small example, if possible.

2. ### blacksun666

Joined:
Dec 17, 2015
Posts:
197
I would think that if the scale is meters then 1 unit is 1 meter, if kilometers, then 1 unit is 1000 meters. If the scale is AU, then 1 unit is 149600000000.0 meters, LightYear scale => 1unit = 9461000000000000.0meters, etc.

Joined:
Mar 6, 2014
Posts:
4
So SgtLength is always expressed in meters.
And I have to write the conversion functions.
Ok. Thanks a lot!

4. ### Darkcoder

Joined:
Apr 13, 2011
Posts:
2,510
You mean like how the stars aren't visible in moon landing photos, because they're so feint compared to the foreground? If so, the correct way to do this is to make the stars dim, the foreground bright, and use adaptive exposure to go between the two. HDRP can do this, and probably the other pipelines with some kind of post processing with HDR.

The floating origin system internally uses meters and global cells (50000000 meters). These are both difficult to comprehend at large scales though, so the SgtLength is used to allow you to manually type positions and distances in using smaller and more familiar terms. Indeed, there's no conversion the other way, but you can just copy+paste that code and change it to a divide I guess.

5. ### SinDeSiecle

Joined:
Sep 30, 2017
Posts:
74
Yes. It is possible. Working on a few mode things, will try to post another video when finished. Thanks...

6. ### mrnas

Joined:
Jan 13, 2018
Posts:
14
Hi! There seems to be a problem with the Terrain samples lately. I can't see any terrain and the scripts can't be loaded. When i open one of the scripts there are no errors though.
Everything besides terrain seems to work fine, no compiling errors...

Screenshot:

Oh and im using Unity 2020.3.3f1 might that be the problem?

Last edited: Apr 15, 2021
7. ### Darkcoder

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

Here's a little something I've been working on.

As you may know, in terms of mesh generation massive planets work well in SGT. However, up close the surface can look bland because the detail textures can't tile enough times due to floating point precision issues. For example, here's what the "Earth Sized Planet" demo scene looks like near the surface:

Here's what it will look like in the next version:

I still need to work on a few things before it's ready for release, but so far it's looking good!

You forgot to follow the second section of the documentation HERE

8. ### S1m0np3t3r

Joined:
Dec 22, 2016
Posts:
8
This is beautiful! I look forward to!

Darkcoder likes this.
9. ### Papanix

Joined:
Mar 13, 2020
Posts:
3
Hi! Just thought i would pop in again and thank you for your help earlier. Also to show off a little of what we used your tools for and our modification to it to make it work with a toonshader (MK). Still in Pre-Alpha, but figured you might want to take a look.

Thanks again!
and here is the link :

dmenefee likes this.
10. ### Darkcoder

Joined:
Apr 13, 2011
Posts:
2,510
Wow, looks great! So many features already implemented

Papanix likes this.
11. ### mrnas

Joined:
Jan 13, 2018
Posts:
14
Uh yea indeed!
Thanks for the reminder
Wasn't there an error before when you forgot to import the burst package?

12. ### SinDeSiecle

Joined:
Sep 30, 2017
Posts:
74
Warping between 2 Mars sized planets... Please, note the destination planet surface. When colors of surface plates and the sgt terrain match, it is possible to create close details. This plays over 35 fps on an M1 mac. The only thing I would add to this is a third detail level when I am closing to surface before the surface plate chunks are generated. It shouldn't be hard to do in shader. BTW this is still Sgt 3.7.10, I haven't looked at the last version, but will do so as I realized this milestone.

13. ### kamicth

Joined:
Sep 30, 2018
Posts:
26
1 - as i strecth starfields to 280 parsec (half max size objects that allow being at the edge without generating errors like in this post), some very very big objects are visible from very very far and i want beeing able to define a fade distance that would allow quads to smothly disapear instead beeing hardly clipped (i think about nebulas, galaxies and clustered stuffs built with starfields)

plus im searching for impostor technique to fake the render of farther objects, but it's another story (feature)

2 - oh yeah, i wasn't sure. i think this is a similar limitation of size order i had to deal with with extreme scale views and objects (isInfinite and InvalidWorldAAB). dealing the Starfield Position to reduce the boundaries values seem to be the good aproach, everything is not intuitive though.

other subject,
i'm very close to reach the result i want with my spawnerfields / StarfieldSpawners, dealing with 50K+ stars in starfield, and objects spawning in a reduced range (nesting spawners or wathever you want is possible) allow scene generations like third person walkingthrough realscale planets to the edge of a galaxie at blazingly hight FPS.
I will send screens and clips later as i have to fix two blockers before : got some spawners positioning issue when rotation are applied to starfields transforms, and errors that block the despawn of some outRange objects. think all my problems are related to positions.

Joined:
Feb 6, 2020
Posts:
13
Does anybody have a first person controller script that i can use that works with gravity around a planet? I.E. walking around a planet.

15. ### kamicth

Joined:
Sep 30, 2018
Posts:
26
you can look at planet surfing in basic pack scenes and gravity scenes in shared features
you can also look at third person in universe

Darkcoder likes this.
16. ### Darkcoder

Joined:
Apr 13, 2011
Posts:
2,510
Yep, and through the magic of asmdef files it now just doesn't compile the terrain scripts until you import burst. This is preferable to just throwing a ton of errors in the console.

Looking good! The next version of SGT will include 3 detail levels for the new SGT / Terrain Planet shader. Can't wait to see what you can achieve when it comes out

1 - Oh I see. For such massive objects I recommend using billboard/impostors, that way it's much easier to manage and will give you better performance. The current set of components haven't been tested at sizes on the order of parsecs, so there may indeed be some issues here. Even if it did work, one issue is that Unity's shadow system doesn't seem to work with a camera range beyond a million or so units, so the current setup for rendering large scenes is not ideal for all projects.

One idea I have in mind is to use a camera range that maintains shadows, and instead scale distant objects toward the camera. In theory this should work, but it requires a lot changes to set up. When I get around to testing large universe scenes I will look into this.

hopeful likes this.
17. ### kamicth

Joined:
Sep 30, 2018
Posts:
26
At this scale i do not need to handle shadows because far stars and object doesnt have one, or it's so diluted in the space background that it doesnt really matter. ans there is no issues using your components like this.

The issues i'm facing are related to the customisations i made to transform a starfield into a spawnfield like and manging the instances to keep the count as low as possible and the FPS as High as possible

Rendered scene are trully amazing, i've reused some of gameObjects in your demo scenes (nebulas galaxies stars planets) and the result is very satisfying for now.

syncronyse spawn world positions with starfield quads position whatever the parents global transform position rotation and scale is now working well.

Still have one blocker with some instances that would not despawn when going out of spawn range... still digging.

For rendered objects i'm sticking half the the max order unity is able to deal without poping errors. ('i think to reduce at the quarter and make a 3Dgrid of starfields spawning and despawning to keep the player at the center, like your terrains LOD tilles, filled with custom starfields populated with my procedural algorithm (simplex and fractal cellular 3D noise) to reproduce the density shapes of the verse from extreme to local scale.

For farthest objects i do not render them and it's okay for now. But later, for faking thoses who should be visible at extreme distances, i thought to take the direction vetor and raycast those vector to a sphere, at the intersect i would scale the object using a ratio lumen / size / distance and then back the texture or quad into a sort of dynamic Backdroup that would be rendered behind anything alse as the lasts and farthests objects using layout or other stuffs

i already loked at bilboards, but the starfield component is more conveniant for such a usage as it use only one game object. tough i woulkd pick some logics from and add somes like scaler and backdrop to get the sort of impostor i want to build. will see that later

Last edited: Apr 17, 2021

Joined:
Feb 6, 2020
Posts:
13

Thats incredible! Im trying to go for a low-poly art style, and I'm trying to get LOD planets working like that. How did you do it?

Joined:
Feb 6, 2020
Posts:
13
Ive asked before, but how can you make actual large scale planets like in the showcase videos? Ive had this asset for like 9 months and I've never gotten it to look good in the planet. It looks great on the outside, but it starts to look very bad once you go into the planet, and looks nothing like the videos where there is high detail, how can i do this?

20. ### Darkcoder

Joined:
Apr 13, 2011
Posts:
2,510
Hey everyone, here's a sneak peak of the new terrain feature coming in the next version of SGT. You may notice something new

The planets in SGT are split into two features: Planet, and Terrain. The Planet feature is designed to render with a single 'baked' mesh, which looks good at medium to far distances. The Terrain feature is designed to render with a dynamic LOD mesh, so you can get much closer. The Packs/Basic Pack folder comes with the "Earth Sized Planet", "Obsidian Planet", and "Terrestrial Planet / + Ring" demo scenes that show terrains off, the rest are planets. All the planet scenes can be converted to use terrains if you switch from the SgtPlanet component to SgtTerrain and configure them how you like (see the Features/Terrain folder for tutorial scenes).

Joined:
Feb 6, 2020
Posts:
13
Dude, that trailer looks so great! Will that be a demo in the new update? And could you perhaps give us an ETA on the new update?

Joined:
Feb 6, 2020
Posts:
13
Thank you for the clarification, I was quite confused as to how to get my planet to look like yours. I'll give it a shot later today.

23. ### dmenefee

Joined:
Oct 14, 2019
Posts:
58
Hello! I’m building a VR game with SGT, and would like some advice on how to set up a singularity with my Vr rig. I’m using the VR interaction framework, and don’t know how the Lens camera would work with the rig. I can’t use the Black Hole component because it distorts in screen space, and since the player is positioned inside a cockpit the distortion includes cockpit elements... so I think I need the SgtLens instead.

Last edited: Apr 18, 2021
24. ### Darkcoder

Joined:
Apr 13, 2011
Posts:
2,510
These planets are updated versions of the "Earth Sized Planet" and "Obsidian Planet" demo scenes, and will be included in the next version. It should come out in a few days

SgtLens should work in VR. The lens cameras are separate from the screen/rig rendering, so I don't imagine they would conflict.

In a perfect world I would make it so SgtBlackHole renders using its own camera with a FOV that's larger than the main camera, that way the 'edges' can still be rendered due to them being part of the render texture. It would also allow for different rendering layers to ignore the cockpit, etc. However, last time I tried this it didn't work at all in HDRP and maybe URP, and supporting all pipelines is pretty important.

Let me know if you encounter any issues!

dmenefee likes this.

Joined:
Nov 17, 2020
Posts:
3
I love that , been struggling getting those huge planets look good on the ground.!!

Darkcoder likes this.
26. ### michaljabrzyk

Joined:
Apr 15, 2013
Posts:
49
Last update give new positive changes. For me SGT is the best.

Waiting for new update.

27. ### Darkcoder

Joined:
Apr 13, 2011
Posts:
2,510
Looks great! Really atmospheric feel to the whole scene

28. ### michaljabrzyk

Joined:
Apr 15, 2013
Posts:
49
I try to create planet cold like Europe( one of Jupiter moon's). Europe is Icy moon all surface is ice. In this egsamle planet have rocku surface but cold atmosphere. Planet also is in shadow of the rings that's why. Update after update planets created in SGT are more natural. Light's, gravity, water, surface, terrain, natural scales all that make SGT very usefull and best in Unity3D asset to create procedural universe.

Darkcoder likes this.
29. ### harpingseal

Joined:
Sep 3, 2020
Posts:
19
Hello im buying this asset around today and i've test the WebGL demo,And it is amazing so here's some question
1.Why is the pulsar scene laggiest,Because of dust field or the pulsar effect
2.Does the gravitational wave consume more power that black hole effect or vise versa
3.So im making a large almost realscale universe so i am wondering,How to spawn some galaxy randomly in the universe,I've look through the wiki but spawn range seem to only work with emty,But i want galaxy spawning around the camera

30. ### harpingseal

Joined:
Sep 3, 2020
Posts:
19
Ok so it work in SRP but the Atmosphere dont work until your close in the Earth sized planet and how to add water to terrain planet

31. ### Darkcoder

Joined:
Apr 13, 2011
Posts:
2,510
1 - This scene requires a lot of fill rate, which can be slow depending on your GPU and display resolution. For example, the accretion disc can take up the whole screen, the light flare in the middle can also take up the whole screen, the jets going up the top can take up a lot and they are layered many times, the dust clouds can take up the whole screen, and the background starfield can take up the whole screen. This means that if your display is 1920x1080 then you will need to render at least 2 million pixels, and since many of these effects take up the whole screen this will require rendering 10 million pixels or more depending on the amount of overdraw:

To optimize this you can reduce the size of the dust clouds, or remove them. You can reduce the size of the starfield stars, you can decrease the PlaneCount in the Accretion Disc/Prominence, etc.

2 - The gravitational wave effect is very efficient, but it can also fill up the whole screen which may be slow on some GPUs. The black hole effect is usually slower, since it has to render the scene again and may also fill up the whole screen.

3 - Take a look at the Universe feature folder. The "12 Star Cluster" demo scene shows you how to spawn 100 stars within 2 lightyears. You can take this same idea and spawn some galaxy prefabs within an even larger radius, and make those spawn stars inside, etc. There's currently no example for scene configurations of this scale though, so you will have to study the examples with stars and planets and figure out how to extend this to larger bodies.

Which exact version of Unity?

SRP = Standard rendering pipeline? You'll have to provide way more details, like screenshots of videos of your issue.

The SgtTerrainPlanet component currently doesn't support water. In the next version there will be an ocean system added, you can see a video of it I posted the other day. I found a slight issue with water rendering in HDRP for this new feature, so it may take some extra days for this version to come out.

hopeful likes this.
32. ### harpingseal

Joined:
Sep 3, 2020
Posts:
19
2019.4.2f1 URP
And yes it is Standard rendering Pipeline

Ok so The atmosphere seem to glitch as it is like this (Earth size planet demo)
And close up it look fine

File size:
412 KB
Views:
23
33. ### harpingseal

Joined:
Sep 3, 2020
Posts:
19
if the atmosphere on earth sized planet demo were set to Geometry it will work
But strangely normal planet and 1 km terrain work

34. ### Darkcoder

Joined:
Apr 13, 2011
Posts:
2,510
Can you check the "Assets/Space Graphics Toolkit/GUIDE" and tell me which version you see? The current main build is for 2019.4.12f1, so it's possible you're downloading an old build for 2018.4. If so, I recommend you update to at least this version, because it includes some important asmdef updates. I also fixed an atmosphere bug like this quite a while ago for the 2019 build.

35. ### harpingseal

Joined:
Sep 3, 2020
Posts:
19
Ok I click install why it install 3.7.11 instead of 3.8.3
Also a few question
-Can you make a planet totally procedural with no texture or heightmap
-How can you change each planet property,I want to change it when it was created in the orbit spawn and never change it after

36. ### harpingseal

Joined:
Sep 3, 2020
Posts:
19
And it seem that not the guide was broken,but it is the 3.7.11 there is no STG Blackhole,But the STG Singularity was still present,And the update after 3.7.11 add these feature so,In my pc the version must be 3.7.11

Last edited: Apr 22, 2021
37. ### Darkcoder

Joined:
Apr 13, 2011
Posts:
2,510
This is a bug with the Package Manager. You must manually delete the previously downloaded package, restart Unity, then download & import the asset. See HERE for where the downloaded files are. For me it's in: %appdata%\Unity\Asset Store-5.x\Carlos Wilkes

38. ### harpingseal

Joined:
Sep 3, 2020
Posts:
19
Well it didn't seem to work

Joined:
Sep 3, 2020
Posts:
19

40. ### Darkcoder

Joined:
Apr 13, 2011
Posts:
2,510
This is using at least Unity 2019.4.12f1 right?

41. ### harpingseal

Joined:
Sep 3, 2020
Posts:
19
Well i use 2019.4.21f

42. ### Darkcoder

Joined:
Apr 13, 2011
Posts:
2,510
So you have closed Unity, deleted the previously downloaded .unitypackage for SGT from the Package Manager cache, opened Unity 2019.4.21f, opened the Package Manager again, downloaded SGT, and it still shows you have the old version?

If so, I don't know. Perhaps you didn't delete all the cached .unitypackage files? Depending on your Unity version it can download them to a slightly different directory, like "Asset Store-5.x" and/or "Asset Store".

43. ### harpingseal

Joined:
Sep 3, 2020
Posts:
19
Yes i already done all your step,Twice actually but it still dont work,I've delete one in Asset Store-5.x

44. ### nighty2

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

thank you for continously improving this awesome asset!

In the Update to 3.8.0, you mention "Added support for new InputSystem package."
Do I have to do something for this to work?

When I create a new project, import Burst, the Inputsystem and sgt, the packet demo scenes (e.g. obsidian or dark star,) give me the following error (and the movement doesn't work):

I tested this with Unity versions 2019.2 and 2020.2 and 2020.3 (and on different systems) and this occurs in all of them when the input setting in the player options is set to "both" or "new".

A previous version of sgt runs fine in my project with input = "both" but when I update sgt, I get those errors, too.

Btw. in the past, Burst was installed automatically. This doesn't work anymore. Now I worry that more packets which I would need are missing. The Assembly Reference looks like this, can this create a problem? I am using the standard render pipeline:

Hope you can help.
Cheers

Last edited: Apr 23, 2021
45. ### ProtoPottyGames

Joined:
Dec 18, 2015
Posts:
74
Hello. I was hoping maybe someone might be able to help me figure out something..
The project I am currently working on requires that the player be able to travel from the bottom of the ocean up to the crest of the planet's atmosphere. This seems like a good asset to use for this, but an entire planet is just a bit too much planet for my needs..lol
I was wondering if there were any suggestions on a good way to go about doing this. Something like using just the atmosphere with a standard flat terrain maybe? I've tried a few things in the way of this already but I ofc start running into issues with scale and/or going through the atmosphere unintentionally when traversing horizontally due to the system being designed for round planets vs. more of a platform style.
If anyone has any ideas i would really appreciate hearing them. I'm not really sure the best way to go about it.

46. ### Darkcoder

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

Version 3.8.4 of Space Graphics Toolkit is now out!
• Added up to 4 optional detail channels to SGT / Planet shader.
• Added mouse wheel support back to SgtCameraMove component.
• Added new tutorial scenes to Terrain feature.
• Fixed error in some scenes when using new InputSystem package.
• Fixed memory leaks from SgtTerrainPlanet and related components.
• Fixed Planet Surfing demo scene spaceship controls.
• Simplified SGT / Planet shader detail settings.
• Removed water settings from SgtTerrainPlanetMaterial component.
Lots of improvements to the planet and terrain features in this version!

NOTE: The new Terrain Ocean shader doesn't work properly in HDRP right now, but it will soon *pokes @JasonBooth *

Enjoy

This sounds like an issue with Unity's Package Manager, try contacting them or seeing if anyone else has had a similar issue on the forum/etc.

In theory you just import the new InputSystem package and it 'just works' with default settings. I didn't test it with 'both' input systems enabled though.

Those missing references just mean you aren't using URP/HDRP, or the BetterShaders package. None of these are required for SGT to fully function.

It's hard for me to imagine what you're trying to achieve. Do you have a video of some similar game look you're after?

Joined:
Nov 17, 2020
Posts:
3
Wow fantiastic update!

Darkcoder likes this.
48. ### Tiberius1701

Joined:
Sep 16, 2014
Posts:
55
Can't wait to dig into this release! It looks amazing!

Darkcoder likes this.
49. ### SinDeSiecle

Joined:
Sep 30, 2017
Posts:
74
Ok, still behind the latest Sgt, but i had to concentrate on optimizations on various levels... This is a trial of generating a dense foliage with Space Graphics Toolkit, GPU Instancer, The Vegetation Engine, and Amplify Impostors. This is a 16000 radius planet. However, I have a camera setup that can draw the galaxy view according to the position you are at (when you warp to another star system). Still, I can do more optimizations on that galaxy view concept which is hard to conceive in this video... Well, you have to see the flight mechanics; I will do a longer video for that, sooner... Also, in another version, I have a city with a radius of 3000 meters that you can land on and enter inside buildings. Haven't updated this version with that capability, yet. The problem is, when you want to include such a skyscrapper city, a 16000 radius planet seems to be too small. When you put it in a real size world, everything looks fine, but then, you have to work harder on the foliage generation since wider fields expose your limitations better... So, it seems there are various artistic setups for various kinds of planets. Still, exploring it... Anyway, thanks to @Darkcoder for such a nice asset. Next goal is to update and adopt the latest version of Sgt...

Cheers...