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.
  2. Dismiss Notice

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,332
    Could do, isn't there something like this on the wiki though?


    I plan to experiment with some kind of procedural texture generation component, but it's not a high priority yet.

    You can add water by making a second terrain with a water material, but in the future I will experiment with this more and create some kind of water shader that hopefully looks nice.

    Do you have example pictures of what you mean by ground scatter?
     
  2. LazyMan

    LazyMan

    Joined:
    Dec 7, 2013
    Posts:
    26
    As i know ground scattering already exist in SGT. See the SGT_Atmosphere Ground Scattering settings in editor.
    Water. You can use another sphere with water shader, or render special mesh from DrawMesh method.
    Anyway - you can't do anything without "tonn" of math :)
     
    Patico likes this.
  3. Cliftonm

    Cliftonm

    Joined:
    Nov 15, 2015
    Posts:
    36
    I mean by putting a bunch of trees on the surface, or having grass, etc.
     
  4. LazyMan

    LazyMan

    Joined:
    Dec 7, 2013
    Posts:
    26
    Just code...
     
  5. beer_money

    beer_money

    Joined:
    Feb 28, 2013
    Posts:
    8
    Nice asset. There's a crash using the undo stack.
    -Open the lightning scene
    -Remove the sgtCloudSphere component from the RedRocky gameObject. (This also removes a child go)
    -Press control+Z to undo last action.
    -Unity crashes
     
  6. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    There's no built in component to do this yet, but I plan to add one at a later date. You can check the SgtSnapToTerrain component to see how you can access the terrain surface height and stuff so you can spawn your own stuff though.


    Yea, the undo system doesn't really work for much beyond changing field values and other simple things. I think I tried to get it working properly before for these more complex operations, but it was just a massive waste of time, and gave me too many headaches. With complex assets like SGT, it's simply too difficult to have full undo support while still having code that is flexible and doesn't become too complex.
     
    FaberVi likes this.
  7. Cliftonm

    Cliftonm

    Joined:
    Nov 15, 2015
    Posts:
    36
    Thank you!
     
    FaberVi likes this.
  8. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    820
    I don't know what is going on, but every single time I load my scene all the planet cloud models and sun corona models are offset from the main body and I have to go through and reset everything back to 0,0,0
     
  9. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    Do you have any special components attached to your objects?

    There's no code in SgtCorona or SgtCoronaOuter that touches any transform positions. When a corona GameObject needs to be spawned it's created from SgtCoronaOuter.cs:45, and that ultimately calls SgtComponentPool:245, which resets the local position to 0,0,0 anyway, so I don't see any reason why SGT would cause it to change position.
     
  10. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    820
    Ok I was wrong. It isn't the saving and loading of the scene that causes it. It is far weirder than that :p

    I do not have any custom scripts or special components.

    If I have the object which in your demos is called "Model" selected, which is the GO that has the SGT Cloudsphere Model script on it, and then click anywhere else in the scene to select something else, the "Model" oddly will get a small transform applied to it. Always the exact same shift in position from 0,0,0 to -0.01550568, -0.01059308, -0.006881714.

    Now it isn't that I am accidentally moving it. I know that for a fact for three reasons:
    1. It also ends up with the exact same movement down to the 8th significant digit :)
    2. It doesn't happen to any other objects
    3. The object's position gets moved even if I click away while in Rotate or Scale mode in which case it would be impossible for me to be translating it.

    But it gets even odder!

    That was the cloud "Model" which is a child of the planet. This also happens to the "Plane" objects that are children of the Sun, the ones that control the star's prominence (Sorry I mis-spoke when I said corona). These have the same issue, but with a different (but still consistent) position bump of -0.001290636, -0.00095015, -0.001196442

    But here is the super wierd part. The two sets are somehow linked in their bug. By that I mean that if I reset it all to 0,0,0. Select either a Prominence Plane or the Cloud Model, then click on something else, BOTH of them will always get this weird offset.

    I don't know if it matters, but I made the sun and planets from several of your demo scenes into prefabs that I then add to my own scenes (and relink the lights).

    EDIT: You don't even need to select these and then click away to make it happen. I just discovered it is anytime I click in the viewport, whether those are selected or not. If I just click in empty space in the viewport, they move. Each time I click they move more, so I can sit there just left clicking empty space in my scene and watch them slowly move :D
     
    Last edited: Dec 24, 2015
  11. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    Ah, I see the issue, strange indeed.

    It's caused by the 'Observer Offset' value. Basically, to prevent the clouds from intersecting with the atmosphere they are moved toward the currently rendering camera in the CameraPreCull event, and their position is reset in the CameraPostRender. However, for some reason the CameraPostRender event isn't being called as expected, so it causes it to constantly keep shifting across.

    For now, you can fix this by replacing SgtCloudsphere line 313 with: model.transform.position = Vector3.zero;
     
  12. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    820
    Hmm that actually makes it far worse. That causes the cloud model to get set to the same position as the planet, but since the cloud model is a child of the parent, this puts it way off in left field somewhere. The cloud model should end up with a transform of 0,0,0.

    Not sure why that is since your code clearly says Vector3.zero but I double and triple checked it ansd that is what it was doing :(

    Also another issue I have run into, sorry to hit you again lol, is that everything in my scene works perfectly when I test by playing in the editor. However if I Build and Run standalone (Windows), the planet shaders seem to fall apart and I am left with ugly brown spheres :(

     
    Patico likes this.
  13. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    Oops, I meant: model.transform.localPosition = Vector3.zero;

    I've fixed the problem anyway, I'll send you an updated build a bit.
     
  14. emjereza

    emjereza

    Joined:
    Aug 16, 2015
    Posts:
    1
     
  15. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    You can visualise orbits using the SgtRing component. I don't remember the name of the scene off the top of my head, but there is one that shows how to do this with gas giants. If your orbits are based on gravity then you can always use Unity's built in trail renderer.
     
  16. beer_money

    beer_money

    Joined:
    Feb 28, 2013
    Posts:
    8
    would be nice if the earth/planet shader worked correctly with point lights, at the moment the illum/emission map does not work (requires a directional light to work)
     
  17. neodorus

    neodorus

    Joined:
    Mar 4, 2015
    Posts:
    41
    Hey @Darkcoder ,
    I love your space kit, it's by far the best in the store. One small favor, would it be possible to make the lightning only spawn on the alpha of the atmosphere?
    Thanks and happy new year!
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    It does work with point lights, it's just that the atmosphere shader doesn't calculate the light's range for performance and shader instruction reasons. So if your point light is far from your planet then you need to increase the Range of it so it goes over the planet, then the Illumination map will work.


    I'm not entirely sure what you mean. You only want it to show up on the lit side of the planet?
     
  19. neodorus

    neodorus

    Joined:
    Mar 4, 2015
    Posts:
    41
    Sorry for not being clear enough. I meant showing the lightnings only on the opaque zones of the cloud sphere (or of a texture in general). As of now, they render everywhere.
     

    Attached Files:

  20. beer_money

    beer_money

    Joined:
    Feb 28, 2013
    Posts:
    8
    Possibly it's bugged then.

    If you try changing the directional light to a point light in the earth scene in the planets pack, increase the range of the point light to 10000, move it back -100 so it's not at the same position as the earth planet... hit play then rotates the earth planet by adjusting the transform in the inspector. You can see the earth nightlights flicker as if the light direction in the shader was not well defined.
     
    Last edited: Jan 9, 2016
  21. GhulamJewel

    GhulamJewel

    Joined:
    May 23, 2014
    Posts:
    351


    Is there a way we can do a day night cycle of the Earth? Like if it is not facing the sun the dark side the lights come on like in the picture.
     
  22. beer_money

    beer_money

    Joined:
    Feb 28, 2013
    Posts:
    8
    there's an example of this in the solar system pack, it works well with directional lights ;)
     
  23. Gozdek

    Gozdek

    Joined:
    Jun 21, 2015
    Posts:
    356
    Looks fantastic!
     
  24. GhulamJewel

    GhulamJewel

    Joined:
    May 23, 2014
    Posts:
    351
    Hey I imported the solar system and galaxy pack but the scenes are empty? The basic pack scenes are fine?.
     
  25. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    Oops, I got bit by the notification monster again!

    The lightning and clouds are completely separate systems so this isn't easy to do. The only way I can think of would be to modify the lightning shader to take the cloud spheremap as a texture input, and in the fragment shader you sample the cloud alpha and multiply it with the lightning color.

    Another way is to make the lightning spawning code smarter, by checking the cloud opacity at the spawn location and not spawn it if there's nothing there, this could be done from C#.


    I don't notice any flicking using the steps you describe, in fact everything looks fine. If you look at the Earth shader it's based on Unity's old specular shader, so I don't think it can be that wrong.


    Do you have the latest SGT package installed first, then you installed the packs?
     
  26. neodorus

    neodorus

    Joined:
    Mar 4, 2015
    Posts:
    41
    That would be great, except I have no clue how to modify your code :D. If you'd be able to add this at a later point (whenever you have some time), it would be greatly appreciated :).
     
  27. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    Hi, when a planet reaches the edge of my camera it changes to a different color, it looks like the atmosphere color, is it too close to my camera when it starts rotating close enough? Also is there a way to rotate the stars slowly to make it look as they would on a planet?
     
  28. GhulamJewel

    GhulamJewel

    Joined:
    May 23, 2014
    Posts:
    351

    I have installed 3.07. Asset store does not give me a update option just import or download.
     
  29. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    I'm pretty busy this month, but if you still need this feature next month then send me a message and I'll see if I can implement it.


    Do you have a video showing this issue? There should be no abrupt changes in color, after all it was designed so the camera can go from space to the surface seamlessly.


    You mean 3.1.7? Assuming you're using at least unity 5.0.0, then it should work. What happens if you make a new empty project, install SGT, then install the pack?
     
  30. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    Yeah here's two screenshots. The volcanic texture is what it originally looks like, then when it gets to the edge of the screen it turns to the atmosphere color. If I disable the atmosphere, then once the planet reaches halfway off the screen it just disappears instead.
     

    Attached Files:

  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    Looks like it might not be an issue with the atmosphere then. Perhaps this lava planet surface mesh has incorrectly calculated mesh bounds? Are you using a custom sphere mesh for the planet? Does this also happen if you copy & paste a planet from one of the SGT example scenes?
     
  32. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    I'm using the Geosphere10 mesh, also it was a displaced mesh Planet for the terrain.I just copied and changed a couple things, it happens with any texture I use on the planet.
     
  33. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    Oops, it looks like I don't recalculate the bounds for displaced meshes. To fix this open SgtDisplacedMesh.cs, and after line 88, add this: displacedMesh.RecalculateBounds();
     
  34. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    Thanks, works perfect!
     
    Darkcoder likes this.
  35. neodorus

    neodorus

    Joined:
    Mar 4, 2015
    Posts:
    41
    I, for one, would definitely appreciate it, even if it's done later (I mean, whenever you have the time). As of now, as awesome as the lightnings are, it's hard to make them visible (unless one increases their occurrence by a lot) and they don't make much sense without clouds either.
     
    Darkcoder likes this.
  36. GhulamJewel

    GhulamJewel

    Joined:
    May 23, 2014
    Posts:
    351
    Most likely the cause I use unity 4 that is why probably scenes are not showing up.
     
  37. michaljabrzyk

    michaljabrzyk

    Joined:
    Apr 15, 2013
    Posts:
    57
    Hey.
    Am looking for some package similar to Planetary Terrain. Unfortunetly HenryV close project. Maybe some program to creating hightmaps for planets but good resolution. THX and regards.
     
  38. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    SGT has some features similar to Planetary Terrain, but nothing as in-depth. If you want to create good planet textures then I recommend you get Grand Designer on Steam.
     
  39. salex100m

    salex100m

    Joined:
    Mar 13, 2013
    Posts:
    103
    Nice package, well done, although be careful of the links for download. They take you to a spam website that redirects your browser. This is a very terrible way to distribute software and feels very scam-y to me. I feel like I got a virus just using the first link, and there are multiple ones to get the "full" package. I would suggest to teh developer that they use a more professional distribution like Unity's downloader or GitHub. For now, I've only been able to grab a few of the asset files. I expected more from a $100 package.
     
  40. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    Are you talking about the MediaFire links?

    [Edit] I've now added BitBucket mirrors to all the media pack downloads.
     
    Last edited: Jan 20, 2016
  41. Jackrabbit82

    Jackrabbit82

    Joined:
    Mar 13, 2013
    Posts:
    16
    Good package, but I'm struggling with many aspect of your scripts and assets. It seems impossible to animate the object such as the sun beside animating the script, but i couldn't found any ways of making it at least rotate(even with parent game object), nor animating the tiling of uv since property block is used everywhere even if it is not needed (like for the standard unlit for the sun). I was expecting something more fluid and "shadery" on the sun itself instead of a static one. I've tweak and tested many thing but was never able to animate the plane for a proper solar explosion effect at least I wasen't able to make it propely loop. Am I missing something ?

    Other than that the various checkbox on allow pulse on the elliptical Starfield is not doing anything, i bypassed this by animating the radius and brightness making value to loop, but still what is the purpose of this "Allow Pulse" ?? The ones on the nebula work perfectly tho :) The nebulas are really awesome and the black hole singularity effect also.

    Please if you can hit me back on the animation side for the sun it would be great ! :) Thx a lot in advance

    Also Anyone got interface freeze while moving camera ?? :/
     
    Last edited: Jan 20, 2016
  42. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    Are you using the latest version of SGT with Unity 5.X.X? If so, you should be able to rotate the sun no problem. For example, if you open the Examples/basic Pack/Sun scene, you can just select the 'Star' GameObject, and rotate/position/scale it without issues.

    Also, the star surface uses the Unlit/Texture shader, so you can easily animate it since it's a default Unity shader.

    If you need a more impressive star shader then you can easily replace it while still keeping the corona/atmosphere glow around it.


    'Allow Pulse' works in conjunction with the 'Star Pulse Max', 'Age', and 'Time Scale' settings. If you set Star Pulse Max to 1.0, and shift the Age around, you should see the stars pulse in size over time. Perhaps your Time Scale value is too low for you to currently notice this pulse? The way pulse works is it causes the stars to randomly pulse between their default size (between Star Radius Min & Max), and that size multiplied by a random value between 'Star Pulse Max' and 1.
     
  43. Jackrabbit82

    Jackrabbit82

    Joined:
    Mar 13, 2013
    Posts:
    16
    Thx a lot i was using the Solar System Pack Sun scene and notice the difference between the Star scene on the basic Pack folder it was missing the Sgt Rotate script, i tried by animating and was about to write a simple self rotate script to see if it was working but it's all good now ! thx :)

    For the solar explosion i might use an accretion disk instead to make them more dynamic i'm testing stuff :p

    I've figure out the star pulsing settings thx a lot !

    Another question tho for the blackhole shader there seems to be an issue with it when its going offscreen the black dot fade when getting on the border of a camera or the viewport any insight on this ? I noticed the distortion is fine only the black dot.
     
  44. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    The distortion works by pulling in surrounding pixels, but at the edge of the screen there are no extra pixels on the other side. If I do nothing then it will pull in the last pixel color at the edge of the screen, which looks really bad, so I just made the effct fade out. It might be possible to keep the black center, but just fade out the distortion, I'll do some experiments soon.
     
  45. Jackrabbit82

    Jackrabbit82

    Joined:
    Mar 13, 2013
    Posts:
    16
    o.color.a = warp + pow(saturate(i.texcoord3 + _HoleSize), _HolePower); seems to be doing the trick ;)
     
    Darkcoder likes this.
  46. tbg10101_

    tbg10101_

    Joined:
    Mar 13, 2011
    Posts:
    191
    Hello everybody! Procedural gas giants (Jovians) are here now!

    I just created an asset for the Asset Store which takes any ProceduralMaterial and converts it to a Cubemap which works with SGT_Jovians!

    Did I mention that it is free?

    Get it here: https://www.assetstore.unity3d.com/en/#!/content/53091
     
  47. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    Nice! Earlier versions of SGT included some planet textures that were made by converting normal textures to cylindrical ones.
     
  48. Irish-Merlin

    Irish-Merlin

    Joined:
    Apr 23, 2015
    Posts:
    5
    If I used character controller in Space Graphics Toolkit with stretched starfield, the stretched stars flickers as I move.

    The solution to fix this is in:
    SgtObserver.cs, Line: 67.

    Change this:
    protected virtual void LateUpdate()

    To this:
    protected virtual void FixedUpdate()

    DarkCoder, if you don't mind, please add this fix for your next update?

    Thank you.
     
  49. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,332
    This isn't really a bug, as it's just the way I designed the stretching to work. You can also fix it by making your character controller's rigidbody use Interpolation, or override the stretching use the velocity.

    Also, changing the observer to use physics time steps like that will cause other effects to not render correctly in all situations.
     
  50. salex100m

    salex100m

    Joined:
    Mar 13, 2013
    Posts:
    103
    Yes I was. Thank you for fixing that. This code base and package are incredible, it was a shame you had those links. It's like selling a Rolex out of some dude's dirty trunk.
     
    Darkcoder likes this.