Search Unity

Space Graphics Toolkit & Planets

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

  1. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    57
    so,your atmosphere shader can be used in variety of volumetric scenario,so if i put a point like on a very distorted mesh,will the part that is thicker and further from the light source be more dim,and also does the shadow component render shadow based on object mesh?
     
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The atmosphere light source is assumed to be some kind of 'sun', so it doesn't implement any distance based attenuation since it will be about the same everywhere. If you mean the depth fog, then yes it is based on distance from the camera through the atmosphere.

    Yes the shadow uses the pixel position when calculating.
     
  3. phrenq

    phrenq

    Joined:
    Mar 10, 2015
    Posts:
    3
    I'm getting the following error in SGT 3.9.5 when using the editor to inspect Corona properties.:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. SpaceGraphicsToolkit.SgtEditor.GetPropertyAndSetCustomContent (System.String propertyPath, System.String overrideTooltip, System.String overrideText) (at Assets/Space Graphics Toolkit/Features/Shared/Scripts/SgtEditor.cs:415)
    3. SpaceGraphicsToolkit.SgtEditor.Draw (System.String propertyPath, System.String overrideTooltip, System.String overrideText) (at Assets/Space Graphics Toolkit/Features/Shared/Scripts/SgtEditor.cs:297)
    4. SpaceGraphicsToolkit.SgtEditor.Draw (System.String propertyPath, System.Boolean& dirty, System.String overrideTooltip, System.String overrideText) (at Assets/Space Graphics Toolkit/Features/Shared/Scripts/SgtEditor.cs:308)
    5. SpaceGraphicsToolkit.SgtCorona_Editor.OnInspector () (at Assets/Space Graphics Toolkit/Features/Corona/Scripts/SgtCorona.cs:389)
    6. SpaceGraphicsToolkit.SgtEditor.OnInspectorGUI () (at Assets/Space Graphics Toolkit/Features/Shared/Scripts/SgtEditor.cs:41)
    7. UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <98effce1f3cf489fb7ce6830410f351c>:0)
    8. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

    This can be reproduced in the
    Features/Corona/00 Corona
    scene by expanding Star > Sphere in the hierarchy, and selecting the Corona object.
     
  4. phrenq

    phrenq

    Joined:
    Mar 10, 2015
    Posts:
    3
    Looks like the problem is a lingering reference to innerOffset in SgtCorona.cs, and is fixed by removing line 389:

    Code (CSharp):
    1. Draw("innerOffset", ref dirtyMaterials, "The corona will be offset from the surface by this many units in world space to avoid z-fighting.");
     
  5. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Oops, thanks I'll fix this.
     
  6. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    57
    Uhh darkcoder,Now the planet CPU thread is 700 ms old version 3.7.11,And the atmosphere clipping when i scale it to fit in nested orbit,When my last preview testing,Work just fine,With the same setup,Last time i got 30 fps,Now i got 1 when generating planet eg entering a system,
    https://ibb.co/vh10R2S
     
    Last edited: Oct 21, 2021
  7. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    You'll have to provide more details. The new terrain system was added in 3.7.4. Between 3.7.11 and 3.9.6 is mostly incremental changes. But with 0 information as to what is causing such lag I have no idea.
     
  8. mdxk

    mdxk

    Joined:
    Jun 24, 2020
    Posts:
    2
    Excuse me, is there an original shader file? If so, where should I find it
     
  9. harpingseal

    harpingseal

    Joined:
    Sep 3, 2020
    Posts:
    57
  10. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Hi, Awesome space toolkit.
    I'm exporting to low level android phones. Is there a guideline of mobile optimizations that I can follow.
    Cheers
     
  11. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    197
    Need a point in the right direction here... I must be missing something. Empty HDRP project under 2020.3.20f1 LTS, installed Burst 1.4.11... installed SGT 3.9.6. Tried Earth sized planet demo scene, stars have a speed effect while camera is still, atmosphere is also strange/glitchy. Am I missing something else to install?

     
  12. Eltharis

    Eltharis

    Joined:
    Aug 30, 2018
    Posts:
    17
    Hi, I love your system. But how can I switch to URP in current version? It doesn't switch automatically and I don't see any manual converter now.
     
  13. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The .surfshader files are the original BetterShaders source files, but you will need to buy and install BetterShaders to be able to modify and compile them for SGT.


    Maybe you have disabled the Jobs/Burst/Enable Compilation setting by mistake? Maybe your planet's Detail setting is too high? Hard to say, you must experiment and find the cause.


    No specific guide, just use lower detail settings. Mobiles tend to have very low GPU fill rate, and it's easy to increase the fill rate using dust clouds and other effects that fill up the whole screen. You can view the Overdraw in the Scene view to see this:
    upload_2021-10-23_18-47-17.png

    The brighter your Scene view becomes, the worse the performance will be, so you should reduce various effects so there's not so much layering happening.


    It looks like the motion blur is breaking for some reason due to the camera range. If you decrease the camera's Clipping Planes / Far to 1e+07 then this effect stops. You can also modify the scene Volume component to override Motion Blur / Intensity = 0.


    You can select one of the shader assets like "SGT_Solid" and click the 'Switch All Shaders To URP___' button.

    The automatic switching works using the class name of the asset you set here:

    upload_2021-10-23_20-35-51.png

    If you're using URP then this should auto detect it, unless you're using the experimental 2D renderer or something. Maybe you can post a screenshot of what you see here.
     
  14. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    197
    Thanks, that did seem to fix that effect but caused another. I found that you need to set the radius to 800 for SGT Backdrop as well.

    Just a suggestion, but maybe set the HDRP status for the asset to "Beta" since there seems to be a few issues with the shaders, etc.

     
  15. tswhitfield

    tswhitfield

    Joined:
    Jan 22, 2015
    Posts:
    7
    This is a terrific set of assets and I hope I can use it for a project, but I have been trying to comb through these forums to see if anyone had come up with a workflow to create more customized areas on the planet terrain. It seems as if there are multiple layers of noise designed to create detail when at closer resolution than the heightmap. While I think this is terrific work, is there any way to include a more detailed heightmap in certain areas rather than use the noise? More importantly, does anyone have a good workflow yet for creating content on these planets? I suppose there are a dozen tools for heightmap generation, though not taking the curvature into account could make the results somewhat different. Also the spawners and terrain object together seem like they could be used to add buildings,etc; but has anyone tried their luck yet with rivers and roads?
     
  16. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    197
    So in the demo, when the camera enters the atmosphere, gets close to the water, the reflection pattern on the ocean updates consistently in respect to where the camera is. However, in the Earth Sized Planet demo scene, when the camera gets close to the ocean, it appears not to update smoothly and causes the reflection pattern to jump irregularly as the camera moves.

    I'm also noticing that some parts of the terrain dont smoothly transition during an atmosphere entry, it appears like a jagged LOD update as it's processing the level of detail, so it kind of ruins the effect. This only happens near shorelines though. It might be related to the input updates relative to the demo scenes? I notice that moving with the input keys causes frame rate to go from 2ms to 4ms then gets worse as you near the surface, starting at 400fps in space and dipping down to 80fps near the water. I dunno, something is wonky here but I don't want to spend my time to troubleshoot a code from the developer.

    I really wanted to use the space to atmosphere to terrain transition system as part of my project. It looks great in the demo, but either I'm looking at the wrong demo scene or it doesnt work as intended in HDRP. Kind of bummed out about it, hopefully the developer can take another crack at fixing the HDRP shaders & bugs.

    I'm going to give it more time before writing a review, so far, I'm bummed out with it, so I hope another update or two will make it better. I'm guessing everyone using this is either using the Standard shader or URP (?)...
     
    Last edited: Oct 24, 2021
  17. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The motion blur calculations appear to be broken somehow with the BetterShaders asset which is used to compile the SGT shaders. The author of that asset can replicate the issue and I'll update the SGT shaders when a solution is found.


    There is no component to apply tiled heightmaps. I've experimented with a component like this, but on its own it isn't too interesting, it really needs to be combined with some kind of procedural texturing feature as well to make the features stand out. The current terrain shader and terrain mesh generation isn't designed for generating this kind of data though, so it's not so easy. You can add buildings using the SgtTerrainSpawner easily enough, but spawning them in a realistic distribution with roads, rivers and other features is very complex. If I ever add features like this it would be in an entirely new asset.



    The shore effect is made using vertex data, so its resolution depends on the mesh resolution. You can control this from the SgtTerrainOcean component's Resolution setting, but there are of course limits before you end up with ridiculous amounts of triangles. To smooth this effect out the precise ocean depth would have to be calculated in the pixel shader, but this isn't feasible to do. I agree that this effect isn't that good for all games, which is why I don't advertise this as a feature and only include it as a kind of bonus.

    The terrain mesh updates using a double buffering system, which can cause noticeable jumps if you move too fast relative to the time it takes to generate the next mesh. The time it takes depends on your framerate, CPU, camera speed, and SgtTerrainPlanet/Ocean detail settings. The terrain generation code is very optimized, but this can still be millions of triangles per step which will always take some time to update. To reduce this effect you should slow your camera down proportional to your camera's altitude.

    As for the shaders, I develop and test them using the standard render pipeline. I use the Better Shaders asset which can cross compile them to the other pipelines, and last time I tested this it worked fine. I let the author know about the motion blur issue and he says it's now fixed (maybe it goes live in a few days?). I also pointed out the specular highlight issue, which should get fixed soon. HDRP is a mess with regard to shaders, for example a simple shader that outputs one color is over 10,000 lines of code. Not to mention there are multiple completely incompatible versions of HDRP that are currently supported by Unity and used by many people, so these all have to be maintained. I'd rather not touch any of that stuff so I'm just relying on Better Shaders to do the conversion for me. It seems like these are just small issues that will get fixed quickly though.
     
  18. Sebastian1983

    Sebastian1983

    Joined:
    Oct 24, 2021
    Posts:
    2
    Hi,

    I would want to make a "2d" galaxy map and want to click on a star and go to the solar system overview. Is this possible and are there any examples? Is it better to create the galaxy in code or in editor?
     
  19. tswhitfield

    tswhitfield

    Joined:
    Jan 22, 2015
    Posts:
    7
    Thought it is always dangerous to say what people do or don't want to do. I am going to go out on a limb and say I don't think most people want to custom define the terrain for an entire planet. On the other hand, being able to place a piece of terrain at the finer resolution with the ability to merge heights near the edges with the underlying procedural values (isn't this how clipmaps work?) ...

    I will have to consider whether I really want to implement that. I am always scared of going down a rabbit hole inventing technology rather than working on the game itself.

    I am afraid I don't understand the problem with precision placing structures. I understand that more than one lod of the structure may need to be provided or there is a possibility that it could just "pop" into view when you finally reach the distance where the LOD can place it correctly. Is that the issue or is there a larger issue with persisting a coordinate on a planet terrain?
     
  20. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    I bought this asset today and was playing around with the demo scenes within a HDRP (Unity 2020.3) project. When opening the Earth Sized Planet demo I'm getting a bunch off behaviour is missing message those originate from the Ocean gameobject having a bunch of missing scripts. Did I miss an installation step or something else?
     
  21. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    197
    Try an empty project and you need Burst installed too. That being said, see my above post, HDRP for the assets has a lot of issues.
     
  22. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    There is no 2D galaxy map feature or example. You could make a UI with a big galaxy image, and then place buttons on it with star textures that when clicked perform some kind of action, but this is very game specific and depends on what you need.


    Clipmaps are just a way to organize terrain data with multiple LODs in such a way that stitching them together is trivial to do. This can be combined with any number of terrain height data sources (e.g. the SgtTerrainSimplex and SgtTerrainHeightmap components are just two approaches).

    The feature you describe of a single heightmap 'patch' is fairly easy to do, and would basically just be a modified SgtTerrainHeightmap component. However, it would suffer the same issue as the tiled heightmaps of not looking too interesting up close. In any case, I've added it to the todo list HERE.

    Not sure what you mean by precision, where did I mention that? I mean that the SgtTerrainSpawner component places objects in a random uniform distribution, but in real life buildings aren't just randomly placed. To make the placement look realistic the spawner code would have to have some kind of logic behind it that follows what civil engineers do, but that's far outside the scope of what I plan to implement.

    You probably missed THIS step, which is also mentioned in terrain demo scene 00.
     
  23. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    Indeed, this fixed my issue. I should read the manual more carefull. Thanks.
     
    Darkcoder likes this.
  24. tswhitfield

    tswhitfield

    Joined:
    Jan 22, 2015
    Posts:
    7
    Don't make more work for yourself based on me. I bought your asset long ago for a different project. I was just trying to decide if this was the way I wanted to go this time. I am fairly certain I could implement the changes I require. Only keep it on your TODO list if you think your other users would get use out of it.

    The last time I wrote a quadtree terrain engine was back in 2004 myself, so it is true that I don't totally understand clipmaps. Reading about them spawned an idea for trying to tame noisy terrain in areas that I want to populate. I figured that an alpha component could be used on different parts of the terrain to determine how much the noise already created underneath could bleed through on different parts of the heightmap. This would allow "bulldozing" of the terrain for buildings and roads where the terrain underneath needs to be flat rather than interesting.

    You didn't say anything about precision. I suppose I should have asked more directly if there was a reason I couldn't create a spawner to spawn a single object at a specific transformation relative to the terrain. Layering this technique for different ranges would allow various LODs of "buildings" which of course wouldn't line up perfectly at the lower number of triangles, but at that distance I am not sure it matters.

    A lot of this is me just trying to work out exactly how I want to accomplish this and I was trying to bother a bit of your expertise to do it. I wasn't trying to increase your work load. This is a wonderful asset. I just have a specific need.
     
  25. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    767
    How can I get the backdrops working in HDRP?
     
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    This will be fixed in the next version that should be coming out by the end of the week.

    [Edit] New version should be out now!
     
    Last edited: Nov 12, 2021
    cygnusprojects likes this.
  27. kamicth

    kamicth

    Joined:
    Sep 30, 2018
    Posts:
    32
    Hello,

    is it possible to use FLOW alongside SGT terrain at planetary scale ?
     
  28. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
  29. Darkcoder

    Darkcoder

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

    Version 3.9.8 of Space Graphics Toolkit is now out!
    • Fixed spaceship motion blur issue in HDRP.
    • Fixed specular highlight angle on massive planets in HDRP.
    • Fixed backdrop blur issue in massive scenes in HDRP.
    • Removed BlendMode setting from SgtBackdrop component.
    • Removed BlendMode setting from SgtStarfield component.

    Just HDRP changes this time. Most of those bigger issues should now be fixed. I noticed two smaller issues that I noted in the Known Issues list. I'll have to try and narrow these down a bit more to see exactly what's causing them and if they can be fixed.



    The SgtTerrainSimplex component has the Area setting, which can be used to remove all noise from specific areas of your planet based on colors in a texture. This same feature can be used with SgtTerrainPrefabSpawner to direct spawning of prefabs to specific areas.

    There's no feature to spawn prefabs (e.g. buildings) around a spawned prefab, but you can easily make a little custom script to do this from a prefab spawned from SgtTerrainPrefabSpawner. You can add the SgtTerrainObject component to these to make them snap to the terrain height and normal.
     
    dirkjacobasch likes this.
  30. Mike57575

    Mike57575

    Joined:
    Oct 19, 2019
    Posts:
    1
    Hey, I was thinking to buy your asset, but I have a couple of questions to make sure the asset is suitable for my idea.
    1. Can I change(or choose) the size of the planet before generating it?
    2. Can I change(or choose) the terrain before generating a planet? I mean if it's hills, mountains or plain surface.

    Thanks!
     
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    1 - Yes, you can pick any planet radius, atmosphere height, etc.

    2 - You can choose any planet heightmap or material for your planet, as long as you configure them (SGT and the free media packs come with some examples). Just keep in mind there is no procedural generation, so you can't pick 'hilly planet' from a drop-down list and have it auto generate a unique planet or anything.
     
  32. Susihiisi

    Susihiisi

    Joined:
    Jan 11, 2018
    Posts:
    32

    Hay,
    After updating to latest version from the previous one, star and cloud backdrops started having those black box areas. Planet atmosphere also has that orangey-yellow-brown band thing in HDRP. That was there before update. Not getting that in built-in. Meow.

    Updating fixed laggy sun reflection on ocean which was really nice. :)

    //Edit: Setting Sunset Sharpness values to 0 seems to get rid of that band thingie. Though maybe not very good solution as there's no proper sunset.
     
    Last edited: Nov 13, 2021
  33. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    You must manually enable the SgtAtmosphere component's Lit / Scattering / Scattering Hdr setting to remove the band. See the Atmosphere Scattering section HERE.

    I can't replicate the star issue. Is this the "Earth Sized Planet" demo scene? If so, let me know exactly which version of SGT you're using. If not, let me know how to replicate this.
     
  34. Susihiisi

    Susihiisi

    Joined:
    Jan 11, 2018
    Posts:
    32
    Thanks!

    I used the Earth Sized Planet scene as a base. Star issue was fixed by copying Background again from the original scene. Missed that Scattering HDR somehow. Now it works way better, but for some reason I get 2 sunsets. One in direction of the sun and one away from it when I'm in middle of the area. Happens in the original Earth Sized Planet scene and in the modified copy of it. My Unity version is 2020.3.15f2 and SGT 3.9.8. Not really a critical problem right now and I can work with it.

    Edit. Changing sunset start and end values seems to fix it. I'm bit silly.
     
  35. dirkjacobasch

    dirkjacobasch

    Joined:
    Apr 24, 2018
    Posts:
    418
    Hi,

    is this water possible in SGT? It doesn't sounds very complicated for you. :)

     
  36. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The issue with the stars is the SgtBackdrop component's RenderQueue was set to Geometry, when it should be Transparent - 1. The double sunset is due to the ScatteringRayleigh setting, which you can reduce. Maybe I'll add an additional Bias setting to make it more flexible.


    Deforming the water surface is not possible with the current way the atmosphere works. It would require the whole atmosphere system to be rewritten, and also the way it integrates with the planet surface and such would have to be rewritten, which is too much work. Maybe the new planet asset that will come out soonI can experiment with something more adavnced.
     
    Eltharis and dirkjacobasch like this.
  37. WarForGalaxy

    WarForGalaxy

    Joined:
    Sep 8, 2021
    Posts:
    1
    Hi, Carlos! Our team is working on a 4X game. Can we use this kit for the Universe map? I mean, will it work on mobiles still having decent FPS and graphics quality?
     
  38. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    142
    Hello! I'm building a VR space racing game (you may recall my pestering you about the floating origin system awhile ago). Anyway, I'm seeing some new weirdness with f.o. that concerns me. When piloting the spacecraft, its movement periodically slows to a crawl, and then abruptly resumes prior velocity. This isn't tied to the periodicity of the f.o. 'snap', but it's connected with f.o. If I turn off the SgtFloatingCamera component, the problem goes away (though I then have a limited space to play in!).

    Here's a link to a YT video showing the issue. Please forgive the performance issues; I recorded this in play mode. In the build, I get consistent 72fps, and don't see any drops when the issue occurs. No errors in the log, no overt changes to the rigidbody (I looked for accidental application of drag, but nope). Any ideas? Have you seen this before?

    Edit: in case it wasn't clear, the issue occurs in both play mode and in the build.

    Edit 2: More information:
    - it only happens when Oculus XR is active (i.e a headset is enabled)
    - its periodicity is regular and changes depending on the fixed time step
    - as already said, if the SgtFloatingCamera is disabled, the problem goes away

    thank you!

     
    Last edited: Nov 18, 2021
  39. HeXiaomMin

    HeXiaomMin

    Joined:
    Mar 17, 2015
    Posts:
    9
    How do I create a terrain on my planets like this. I bought sgt but I cant create terrains like this
     
  40. Susihiisi

    Susihiisi

    Joined:
    Jan 11, 2018
    Posts:
    32
    Have a look at the Obsidian Planet scene in Basic Pack folder. It's pretty close at least.

    I'm currently having bit of a problem with SGT Terrain Collider. Kind of getting how to balance with surface detail and collider detail, but I'm having objects bouncing on planet surface and not settling on it. Happens in Earth sized planet demo and a scene I copied from it. Meow. //Edit: Also in scenes with small planets.

    //Edit: Been thinking of a workaround where an invisible collider object would follow the ground position of the object I want to collide with, but that could get overly complex if the amount of objects gets too high.

    //Edit edit: For now it seems having invisible collider object which first copies the target's position and then snaps itself to the planet surface with SgtTerrainObject is fine workaround for now. With some refinement getting it to ignore all other objects might be viable. Not sure about performance, but the collider object is kinematic and doesn't move by physics so maybe it's not a problem. Adding Simplex noise causes stuttering in big planet, but otherwise it seems to be viable way to get accurate and stable collision in Earth sized planet. Meow.
     
    Last edited: Nov 20, 2021
  41. HeXiaomMin

    HeXiaomMin

    Joined:
    Mar 17, 2015
    Posts:
    9
    can i use custom heightmap in planet corner? Terrain Areas is the goal?
     
  42. HeXiaomMin

    HeXiaomMin

    Joined:
    Mar 17, 2015
    Posts:
    9
    Space Graphics Planet is not work in Unity2021.2.1 HDRP?
     
  43. HeXiaomMin

    HeXiaomMin

    Joined:
    Mar 17, 2015
    Posts:
    9
  44. michaljabrzyk

    michaljabrzyk

    Joined:
    Apr 15, 2013
    Posts:
    57
    Hi i think about using SgtStarfieldCustom to load stars data from .xml file. Do you have any file or stars catalogue or what I can use for that?

    upload_2021-11-21_11-4-55.png
     
  45. mattxreality

    mattxreality

    Joined:
    Dec 11, 2018
    Posts:
    57
    Hello @Darkcoder I am using the "SGT Occlusion Scaler" script on a flare object, part of my star model, and want the scaling to happen at the edge of the star. My star is currently at 1000 units is size. I am trying to get the scaling to only happen at the edge of the star. To do this, I assume I should use the 'Radius' value on the "SGT Occlusion Scaler", but when I change that setting nothing is difference in the occlusion scaling. Scaling always starts at the Transform origin of the object, regardless of the 'Radius' value. Please let me know if I'm using this incorrectly. Thank you.

    upload_2021-11-25_15-51-23.png
     
  46. mattxreality

    mattxreality

    Joined:
    Dec 11, 2018
    Posts:
    57
    I have another question, this time regarding materials at high distances. I have two stars revolving around the player location. When they reach a certain distance, the star material is clipped, but flares remain. This is also the same issue for standard URP/lit materials, so isn't specific to SGT star materials. Do you have any suggestions on why this is happening? I've set my camera clipping distance to 1 million, and the stars are only 20k away from the camera.
    UPDATE: I found out that this issue occurs on any material and it only happens when a skybox is present.
    SOLUTION: This root cause was a render precision issue. To solve, I changed my Camera > Clipping Planes > Near from 0.01 to 0.1. This allows the material to render at greater distances.

    upload_2021-11-25_17-59-33.png
     
    Last edited: Nov 26, 2021
  47. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Probably, but it depends on the visual style you want.



    I updated the way the SgtFloatingObject component handles position changes in the latest version, so you may want to try that. Also, I'm not sure if you're using it but the origin shifting system currently doesn't properly handle rigidbodies with interpolation enabled, so you should set it to None. I've tried to get this working, but these values are all hidden which makes it very tricky to figure out if it's even possible to properly solve when the camera origin snaps.



    As Susihiisi says, the "Obsidian Planet" demo scene is very similar to this. I believe I posted the exact demo scenes in this video to this thread a long time ago, not sure if the scenes still work in the latest version of SGT though.



    Not sure what you mean by 'planet corner'. You can use the new SgtTerrainFeature component to place a custom heightmap at a specific location of a planet though.


    Try the latest version, it should now be updated to work in HDRP 2021.2.


    I've never tried this so I have no examples to share, but it should work.


    The SgtOcclusionScaler component merely adjusts the Transform component's localScale value based on objects between it and the camera. There's no way to achieve the behavior you describe using the Transform settings alone. It sounds like you want to modify the SgtProminence component's RadiusMax setting based on occlusion, which you do by making a copy of this component and modifying it. The Radius setting in this component is used to prevent small objects (e.g. asteroid) from causing large objects (e.g. star flare) from occluding as they pass in front, unless the small object is very close. Otherwise you might end up with strange scenarios where the larger flare just flickers for seemingly no reason as many small objects pass in front.


    Indeed, the demo scenes used to have a near camera range of 0.01 which caused issues with the other pipelines. I think I've updated all the demo scenes to use a range of 1.
     
    Last edited: Sep 24, 2022
  48. mattxreality

    mattxreality

    Joined:
    Dec 11, 2018
    Posts:
    57
    @Darkcoder Thank you for the responses on my previous questions!

    Question about the SGT Shadow Sphere and SGT Ring components. The SGT Ring component Lit settings default to (2) Max Sphere Shadows. I have three in my scene: Jovian planet and two moons. With 3 SGT Shadow Spheres in the scene my SGT Ring component will not receive the shadow from the Jovian planet correctly. I have adjusted the SGT Ring "Lit" > Max Sphere Shadows to "3", but receive a console error and don't see the shadows.
    WORKAROUND: only have 2 SGT Shadow Spheres in the scene. Screenshot attached.

    Code (CSharp):
    1. //Console Error
    2.  
    3. Shader error in 'Hidden/SgtBelt_Opaque': redefinition of '_LightDirection' at line 2821 (on d3d11)
    4.  
    5. Compiling Vertex program
    6. Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PASS_SHADOWCASTER UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
    7. Disabled keywords: INSTANCING_ON SHADER_API_GLES30 UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_VIRTUAL_TEXTURING _ALPHA_TEST _LIT _POWER_RGB
     

    Attached Files:

    Last edited: Nov 29, 2021
  49. mattxreality

    mattxreality

    Joined:
    Dec 11, 2018
    Posts:
    57
    This is the workaround: upload_2021-11-28_8-54-22.png
     
  50. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    142
    I'm sure the interpolation setting is the culprit, as I set it for the player's spacecraft to minimize jitters. I'll try with it 'off' and let you know if I continue to see issues. Thanks!

    On a completely unrelated note, I just updated to the newest SGT and am seeing a new issue when starting play mode. It looks as if the SgtShaderBundle code is switching to the builtin pipeline (I'm *always* in builtin, so not sure why) and enters a loop with ShaderImporter that really slows down startup. Is there something I need to set in the compiler defines to prevent this?

    Edit: the code is testing shader variants and finding URP2019, and then initiates the switch. This happens over and over, every time I startup. So I'm guessing this isn't correct behavior... ? Any suggestions as to how I can correct this in my project?

    Edit2: I see a lot of shader warnings:

    Shader warning in 'Hidden/SgtStarfieldInfinite': Use of UNITY_MATRIX_MV is detected. To transform a vertex into view space, consider using UnityObjectToViewPos for better performance.

    Maybe these are preventing the bundle scriptable code from properly setting the pipeline for that bundle, triggering the repeated calls to AutoSwitch()?
     
    Last edited: Nov 28, 2021