Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Space Graphics Toolkit & Planets

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

  1. greenmonster

    greenmonster

    Joined:
    Jan 18, 2013
    Posts:
    26
    Thanks to that little bit of insight, I think I've figured it out. Unity's new shader compilation has a problem with different cginc's with the same name ("Include.cginc") in different folders. A quick diff shows that was the simple change you made to all your shaders between the older SGT and the newer versions. Good move on your part, but that's quite a bug on Unity's end. In any case, the way forward is clear now so thanks again for the reply!
     
  2. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,240
    I've used SGT in a mobile project quite successfully, but now I'm using it in a new project, and on iPad, the Earth object isn't rendering correctly. In one scene (with Day Earth textures only) the clouds appear, but the surface is black. In another scene (with Day, Night, Normal, and Specular textures), the Earth is extremely overexposed, with a dark spot that seems to be the specular centerpoint. I can't figure out what's gone wrong. It all looks perfect in the Editor, but bad on the device. Happens in iPad 2 and Air. Any ideas?
     
  3. Deleted User

    Deleted User

    Guest

    Hi there,
    I noticed an issue in a "SurfaceTessellatorCubeMap" scene.
    Everything works fine,though it makes me a little nervous:D
    P.S. Unity 4.5
     

    Attached Files:

    • 0.PNG
      0.PNG
      File size:
      19.7 KB
      Views:
      904
  4. Deleted User

    Deleted User

    Guest

    Any news on the new version?:)
     
  5. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    What I would really really like is to know how to export my wonderful scene created with this wonderful asset, as a SkyBox.
     
  6. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    I'm getting this warning lately;

    Cleaning up leaked objects in scene since no game object, component or manager is referencing them
    Material Hidden/SGT/Corona/VariantCullNearRing has been leaked 3 times.
    Material Hidden/SGT/StarAtmosphere/VariantOuter has been leaked 1 times.
    Material Hidden/SGT/StarSurface/VariantOuterPerPixel has been leaked 1 times.
    Material Hidden/SGT/Starfield/Variant has been leaked 1 times.
    Texture2D has been leaked 2 times.


    also, is there a way to reduce the Sun & corona's requirements for mobile... seems that they suck up a lot of everything.

    I'm using the sun with 3 coronas and 1 starfield... gets pricy.
     
  7. GTGD

    GTGD

    Joined:
    Feb 7, 2012
    Posts:
    436
    This must be an incredibly dumb question but how do I bring up the opacity bar that should be above the gradient bar?

    gradient.png
     
  8. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Sorry guys, I didn't receive any notifications about new posts so I haven't been replying here. In the future it may be best to send me an e-mail instead.

    I'm not sure, perhaps your project settings have changed? e.g. I noticed that enabling HDR causes some scenes to look out of whack without some tweaking.


    I haven't really tested it, but I'm pretty sure you can ignore that error. Eliminating it requires quite a bit of recording due to the way the serialization system works. Though this error is fixed in the upcoming SGT 3.



    You can use a script like this: http://wiki.unity3d.com/index.php?title=Skybox_Generator


    If you're using SGT stuff in prefabs then you may get these errors, as it's kinda tricky cleaning that data up.

    To make the corona less expensive make sure you're using the Ring type instead of Plane, you might also want to limit it to one slice, and reduce the thickness of the ring to reduce the fillrate. The star component can't be optimized too much, but disabling the atmosphere (and relying on the corona) should halve the fillrate required.

    Good question! Looks like something caused the GUIlayout to break.

    I'll check it out tomorrow, but for now you can:

    1 - open: SpaceGraphicsToolkit\Required\Scripts\Editor\SGT_AuxWindow_ColourGradient.cs
    2 - before line 31 insert: EditorGUILayout.Separator();

    ----------------------------------------------------------

    On a different note:

    Since Unity finally added visitor tracking data to assets, I want to do a small experiment to see if I can change viewer counts and stuff. My idea is to make a small Unity asset and release it for free, so I need ideas for what to make. I'm thinking something related to space, but is perhaps slightly outside of the scope of SGT, ideally nothing too involved!
     
  9. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    how about gravity pull in space, which can be manipulated towards whichever direction through the inspector/script/code...

    specific on layers, only certain things should be affected dependent on layers, could be useful for many things this asset.

    Not just in space but even on "earth" :)


    What I was really planning to make is "a left gravity, a center neutral, and a right pull gravity" so as the character goes to the left gravity pulls, middle neutral, right gravity pulls..

    I thought it would be a cool effect, especially if the pull merely "rotates" all the objects around like real life planets in a circly motion like (so eventually they come back)
     
  10. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    I don't really follow, besides the layering, can't this already be achieved using the GravitySource and GravityReceiver components?

    Also, planets don't rotate objects (besides the atmosphere), instead things in orbit are constantly falling in and missing the earth. You can already do this with SGT, but getting the right velocity for an orbit might be tricky, unless you use the SimpleOrbit component which will do the "rotate" thing you mention.
     
  11. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    No idea I never tried playing around with the GravitySource and GravityReceiver components :)

    I guess I will do so in the future and try to figure it out :p

    thanks for the info
     
  12. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Can you please explain how the GravitySource and Receiver works,

    I assume for my character's rigidbody I would have to have the freeze position unchecked for x and z ?

    how will I include this "gravity" system on top of my walking system?

    not sure how to work this really if you could please explain it that would be great,

    thanks
     
  13. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Take a look at the Gravity demo scene to see how to set it up. For it to work with a character controller, your character controller must support an arbitrary 'up' direction, rather than assuming that +y is up. If you take a look at the Spaceship On Surface demo scene then you can see how you might use the Snap To Surface component to change the up direction of a rigidbody and apply controls to it.
     
  14. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Alright thanks I will try to make sense out of it, I did look at it before.
     
  15. trudeaudm

    trudeaudm

    Joined:
    Apr 17, 2013
    Posts:
    116
    Something that I hope you will consider adding is an atmosphere component that can be added to objects independently from the "Planet" component.

    So if I already have a highly detailed planet model, I could simply drop your nice atmosphere onto it and be a happy camper.
     
    Last edited: Sep 15, 2014
  16. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Yes, this feature will be part of the next version of SGT. However, doing this is actually slower than integrating the atmosphere shader with the planet surface shader, so I will need to make both types for it to run well on mobile devices etc.
     
  17. trudeaudm

    trudeaudm

    Joined:
    Apr 17, 2013
    Posts:
    116
    How much slower? Is there a certain number of draw calls more? or is it more dependent on the detail on the surface?

    Good news though, can we expect this version soon?
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    It would double the amount of pixels rendered, and increase the draw calls by one.

    I have no idea when it will be ready because there's lots of code still to be done, and my other projects are taking up a lot of time.
     
  19. trudeaudm

    trudeaudm

    Joined:
    Apr 17, 2013
    Posts:
    116
    Well that is not awful, I doubt that is worse than what I currently have, as right now I simply place your planet script on my planets and disable the surface rendering and only use the atmosphere.

    No offense to your planets :) I just need very detailed surfaces that I cannot quite achieve with your surfaces.

    And as far as the next release I look forward to that, I really appreciate your asset, easily the best atmospheric scattering I have found. Not to mention the pile of other features.

    Maybe you should consider a proper spherical ocean shader... Would be amazing for this asset.
     
    Last edited: Jul 30, 2014
  20. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Thanks, this is planned for the next version.

    -----------------------------------

    I've been thinking about this a lot recently and perhaps I should release all the major SGT3 features as separate packages, and once I've finished them all I can merge them into the current SGT package at a discounted rate. This way people who only need starfields or something don't have to pay for the whole thing, and you lot don't have to wait ages for me to finish all the new features.

    My main concern with doing this is that SGT currently uses quite a large shared code library, so if I had say 5 separate packages then it may become difficult to keep them all compatible. Perhaps this isn't too much of an issue though if I make separated libraries for each package that are really lean and optimized.

    Another big issue is that separating the packages means I couldn't include demo scenes that incorporate features of two different packs, but perhaps I could host the demos externally and simply provide links to them on this thread or in each package and specify which packages it requires. That way the actual assets remain smaller in size (thus import much faster), and it would make adding and updating the demo scenes easier.

    Anyone have any thoughts regarding this idea?
     
  21. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Hey guys, I don't know if Unity even reads these things, but I've just made a Unity feature request.

    Take a look at it HERE!

    If implemented this would really help SGT (and no doubt some other projects) out, so take a look and hopefully vote :)
     
  22. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    I'll vote just because you are great !
     
  23. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Hey guys, Sebastian Davies has just released an awesome iOS game that uses SGT!

    Check it out HERE, it's free to play.
     
  24. Deleted User

    Deleted User

    Guest

    Hello everybody.

    I'm experiencing some problems with SGT:

    1. Atmospheric scattering is not working properly on Mali GPU (in my case it was Mali-400) on Android.
    Scattering on planetary rings is affected too.

    2. Just take a look at editor.PNG :D

    Also i'd like to ask what is better to use on mobile devices (in terms of performance obviously),Surface Tessellator or Surface Displacement?

    Looks awesome,however it's sad that this game is not available for Android.
     

    Attached Files:

    Last edited by a moderator: Aug 19, 2014
  25. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    1 - I haven't noticed this issue before so I'm not sure what's causing it. But it looks like it might be a texture issue, or a shader float precision issue. Do you get this issue with the sunrise demo scene that comes with SGT?

    2 - Expand the inspector? The text is just too wide for that.

    Surface displacement is much faster, but it's not dynamic.
     
  26. Deleted User

    Deleted User

    Guest

    1 - Well, i'm able to reproduce this issue with every 'planet' where atmospheric scattering is enabled.
    I noticed that this is not reproducible with Andreno GPU,only reproducible with Mali-400.

    Also I have a new problem with planetary rings.
    As i said scattering on planetary rings is affected too and i wanted to make some screenshots to show you,but with Unity 4.6 planetary rings are not working in the build (as you know target platform is Android) о_о
     

    Attached Files:

    Last edited by a moderator: Aug 21, 2014
  27. justinpark01

    justinpark01

    Joined:
    Jul 15, 2014
    Posts:
    4
    Hey, I just purchased SGT and it's really great. I'm having problems loading the SurfaceTessellator examples though. I get the error "Serialization depth limit exceeded at '::patch'. There may be an object composition cycle in one or more of your serialized classes." when I try to run the scene. I can't double click to see what line is causing the problem. Ideas?
     
  28. Deleted User

    Deleted User

    Guest

     
  29. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Interesting, I haven't tried 4.6 yet so I'll check it out tomorrow.

    I just ordered a Mali-400 Android tablet so I'll test the scattering shaders out when it arrives (in a week or so).
     
  30. Deleted User

    Deleted User

    Guest

    I just installed Unity 4.3.4,so here is the problem with scattering on planetary rings.
    P.S. From examples, I disabled Gas Giant component specifically to show this issue ;)
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      22.5 KB
      Views:
      797
    • 2.jpg
      2.jpg
      File size:
      22.1 KB
      Views:
      898
    • 3.jpg
      3.jpg
      File size:
      22.2 KB
      Views:
      864
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    I can replicate this issue. I can still kind of see the rings, so it looks like there's some issue with the textures, but I don't know what (gotta love debugging across multiple platforms!). I'll take a deeper look when I have more free time, as I imagine fixing this will be quite complicated. How quickly do you need this fixed?
     
  32. Deleted User

    Deleted User

    Guest

    It's not very very critical for me, so fix it when you can ;)
     
  33. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
  34. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    If you know how to write shaders then yes, you need to modify the SpaceGraphicsToolkit/Required/Shaders/CGInclude/StarSurface.cginc file and edit the star script a bit to pass the shader values you want. Though doing al this is pretty complex.
     
  35. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    Hmmm, I was afraid of that. If the star script accepted Materials, couldn't you make a Material which applies the shader to the star texture, which is then applied to the star surface?
     
  36. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    No, because you can't combine shaders like that. The surface of the star is one mesh, and it uses one shader to render it. In SGT the actual shader will depend on your star settings, but to change the visual effect you will have to modify the base shader.

    In SGT3 I have added the ability to apply the atmosphere effect as a separate layer, so you can use a custom shader for the star surface, but there is a performance penalty for doing this (because the surface must be rendered twice). But these features aren't all ready for release.
     
  37. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    Seems like I might be better off waiting for SGT3. I might give it a go myself, though; I do think it would add a lot to the effect. Thanks for the information.
     
  38. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    So I wrote a Spiral Galaxy procedure for SGT, pretty much based off of this suggestion: http://gamedev.stackexchange.com/questions/47680/procedural-generation-of-galaxy. I finally got it pretty much how I want it:

    upload_2014-8-27_17-23-31.png

    Code (CSharp):
    1. case SGT_StarfieldDistribution.SpiralGalaxy:
    2.             {
    3.                 var i = Random.Range (0, distributionConstantI);  
    4.  
    5.                 position = Random.insideUnitSphere;
    6.                
    7.                 var magnitude = position.magnitude;
    8.                 position = position.normalized * (1.0f - magnitude);
    9.                 magnitude = Mathf.Abs (position.z);
    10.                 position *= (1 - magnitude) * distributionConstantA;
    11.                 position.z += magnitude;
    12.                 position.y *= (1 - magnitude);
    13.                
    14.                 position = Quaternion.AngleAxis(i * (360 / distributionConstantI) + position.z * distributionConstantB * 360, Vector3.up) * position;              
    15.             }
    16.             break;
    If you like it, please feel free to incorporate it into SGT.
     
    danien and John-G like this.
  39. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Looks awesome, I'll see what I can do :)
     
  40. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    This one doesn't have the distortion from rotating:

    Code (CSharp):
    1. case SGT_StarfieldDistribution.SpiralGalaxy:
    2.             {
    3.                
    4.                 var i = Random.Range (0, distributionConstantI);
    5.  
    6.                 position = Random.insideUnitSphere;
    7.                 var magnitude = 1 - (Random.insideUnitSphere).magnitude;
    8.                 position = position.normalized * (1.0f - position.magnitude);
    9.                
    10.                 position *= (1 - magnitude) * distributionConstantA;
    11.  
    12.                 position += Quaternion.AngleAxis(i * (360 / distributionConstantI) + magnitude * distributionConstantB * 360, Vector3.up) * Vector3.forward * magnitude;
    13.             }
    14.             break;
    I'm interested in using your starfield code to generate a map for a 4X space game, where the starfield would display at a distance then the individual star meshes would be displayed in close proximity. Having looked through your code a bit it seems that the stars are batched in groups into meshes, probably making it difficult to access individual stars.

    The maps would be less than 1000 stars, do you have any suggestions on how to approach this problem?
     
    danien likes this.
  41. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    The easiest method is to store an array of star positions and populate it when the positions are procedurally picked. I believe I ran through some code examples for how to do this in an earlier post, but I don't have the post or the code at hand.

    If you don't need this feature too quickly then next week or so I can send you the SGT3 version of the starfield component, which includes this feature, as well as some others.
     
  42. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    Well that would be hella dope. It's a personal project, and I'm still in the proof-of-concept/prototyping phase, so I can wait.

    Thank you.
     
  43. Deleted User

    Deleted User

    Guest

    That is such a beautiful scene. Wow..that took my breath away.
     
  44. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    SGT_SimpleOrbit

    Hello,

    is there any chance that we can have offsets on this one, I'd prefer to orbit it in the -y axis, so if we can specify those values that would be great...
    I'd probably need to offset the orbit about 200 axis.

    thanks
     
  45. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    Can you achieve this using two GameObjects and offsetting the child by 200 units? I'm away from the PC for the next 5 days so I can't make any script changes.
     
  46. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    That works, I guess I have to stop thinking so limited and get out of the box to achieve things :)

    thanks
     
  47. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    Hello,

    so when I have Occlusion and bake my game, the "sun" turns transparent... why is this?

    upload_2014-9-7_21-36-2.png


    it should look something like this

    upload_2014-9-7_21-37-2.png


    thanks
     
  48. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,406
    No idea, I've never used those features before. Can you run me through a few simple steps so I can replicate this issue in one of the demo scenes?
     
  49. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    438
    What I did was:

    mark a few set geometry as "Static" then in the Occlusion tab I baked the scene, only after doing that the "planet" started looking that way otherwise before that it was fine... that was literally all the steps just setting some set geometry as static and i double checked the planet is not marked as static so i'm not sure why its affected maybe i have to mark it as something else to not occlusion it - first time i done that too so i really dont know, also the only thing i could see that changed after doing that was the planet.
     
  50. nburlock

    nburlock

    Joined:
    Apr 11, 2013
    Posts:
    65
    Is there some way to adjust the tint of the light hitting a planet's ring? I was able to change the appearance of planet to match the light from a non-white star, but I can't find any way to adjust the ring to match.

    Edit:

    I altered the ring shadow shader to use the penumbraColour to tint the ring. Is there a better way?

    This is what I changed in Ring.cginc. I also changed penumbraColour to float4 so that the alpha would affect the ring.

    Code (csharp):
    1. #ifdefVARIANT_SHADOW
    2. floatshadowRadius = length(shadowPoint.xy);
    3. floatshadow = saturate(saturate(shadowPoint.z) * (1.0f - (shadowRadius - shadowRatio) * shadowScale));
    4. float3shadowColour = lerp(umbraColour, umbraColour, shadow);
    5.  
    6. colour.xyz = lerp(colour.xyz * penumbraColour, shadowColour, shadow);
    7. colour.a = colour.a * penumbraColour.a;
    8. #endif
     
    Last edited: Sep 10, 2014