Search Unity

Space Graphics Toolkit & Planets

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

  1. TheGreaterGameCreator

    TheGreaterGameCreator

    Joined:
    Nov 18, 2020
    Posts:
    9
    Do you think there is any attempt in voxel imlementation on a software like this? I really would like this for my project. I first though of scanning over the whole mesh with voxels and loading it out but the fact there would be procedurally generated infinite worlds, this seems like a bad idea.
     
  2. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    I've experimented with voxels a little bit, but I have no plans to release anything like this yet. Even if I did make such a system it would be released as a separate asset because it would require an incredible amount of work to develop. I'm currently working on an improved planet terrain asset that should allow you to make something closer to what you see in say Star Citizen, and even this is very tricky to make. I'll hopefully have something to show off here soon!
     
  3. holodevice

    holodevice

    Joined:
    May 29, 2017
    Posts:
    28
    Is it possible to create only one continent like Pangea in the planet with the current resources in this package?
     
  4. Eraile

    Eraile

    Joined:
    Aug 14, 2012
    Posts:
    16
    @Darkcoder any showcase of your "star citizen" asset ??? :)))
    Need some beta testers?
     
  5. wheee09

    wheee09

    Joined:
    May 21, 2018
    Posts:
    68
    Hi @Darkcoder,

    Finally had the chance to play around with your asset - thanks for the nice work!

    I've been trying to find good alternatives to using a skybox for the galaxy/star background that didn't suffer from the fisheye distortion from using a (perspective) camera.

    And I ran into the Debris example scene where it used a BakedBackdropStars mesh + billboard texture which looks like the very thing I was looking for!

    I did want to ask about the mesh that was generated - it basically looks like a number of triangles placed in a sphere with clustering around the midline. With the BackedBackdropClouds, it looks like large triangles spaced more evenly around in the sphere.

    I could probably recreate the script but I was wondering if you could share how you created that mesh and save me the hassle!

    Appreciate any help there, thanks!
     
  6. Papanix

    Papanix

    Joined:
    Mar 13, 2020
    Posts:
    5
    Hi @Darkcoder
    Bought your asset and super impressed. Thank you so much for creating this!
    I just have a bit of a noob question / request. I am a designer (2d/3d) by trade so I am not great with creating or manipulating shaders for Unity (yet!). I've been using a couple of Toon shaders from the Unity asset store called MK Toon and Flat Kit. I was just wondering if there would be a way combine the shaders with the planet shader? Basically I am looking to do a more stylised cartoony looking planet. Do you have any tips how I could achieve this?
    Thank you and hope you had a great NY!
     
  7. kamicth

    kamicth

    Joined:
    Sep 30, 2018
    Posts:
    32
    Hyi @Darkcoder can you add a some Dark matter like generator for radar and maps 2D/3D ?
    not nessessary to see DM but to have nice visuals on extreme zoom out

    as you provide a universe size positioning system, it could be cool to be able to use 3D map for navigating from one to another region (star / galaxy / cluster / nebulae), and use this map to start the procedural generation of nessted orbital objects and spawners

    but for now i have no idea how to generate a map from such order

    pictures are better than words :

    firs at the larger view DM is just a purpule glow arround the normal matter in yellow.

    in less extreme view DM is partially fading out and we can see galaxy clusters and others normal very large objects like superclusters and big neabulae




    "chunked"
     
    dirkjacobasch likes this.
  8. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    If you create or modify a heightmap so it only has one content then yes.



    It still needs lots of work. I have enough testers for now!


    This background mesh was basically extracted from the SgtBackdrop component (Backdrop feature) and saved as a Mesh asset. If you want this kind of mesh in your scene then assuming you have SGT then just use that, as it will look the same but also allow you to customize it. This mesh was originally made for the "SGT Basic Pack" asset, because I didn't want to include this feature with it. I since deprecated this asset though, but it still proves to be useful for the Space Graphics Planet asset, and the basic demo scenes that come with SGT.


    You can just replace the SGT Planet shader used in the planet materials with your cartoon one. Your cartoon shader would of course have to implement the features seen in the SGT Planet shader if you still want them though (e.g. water level).


    You can create something like this already using the infinite starfield feature, and a texture that looks like one of those clusters. However, making it look more realistic and actually connected like this is incredibly difficult to do. Also, in real life I don't think it would be possible to see the first image, because any point within that purple field would put you relatively close to one of the clusters, thus your view would always look like the second image. The first almost looks like a slice of the universe when viewed from an extreme distance, which could also be done using the aforementioned strategy.
     
  9. mschwarz1

    mschwarz1

    Joined:
    Oct 22, 2013
    Posts:
    7
    Hi there. I picked up this asset when it was on sale and it's been really fun to tinker with. One of the things I'd like to be able to do is parent the sgt free camera to an orbiting and rotating planet when it gets close enough. From looking at past posts it seems like when it comes to parenting floating follow is the usual route but this doesn't really work for dynamic objects like a moving camera. Is there an existing way to easily parent a dynamic floating object to another dynamic floating object?
     
  10. TheGreaterGameCreator

    TheGreaterGameCreator

    Joined:
    Nov 18, 2020
    Posts:
    9
    @Darkcoder Do you think you will ever make youtube tutorials again? I think they are very convenient especially since visual learners like me won't have to come here and ask you all the time. If you don't, I understand you probably have a good reason not to like time or updates. Thanks either way if you respond.
     
  11. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    There's currently no built in way to do this with the origin shifting system. This system is designed so that each object is separate, otherwise you will inherit the floating point precision issues of the object you parent to.

    To implement something like this you must store the local position + rotation of your object when it's 'captured' by the planet, and then each frame you can increment its position + rotation based on the world space delta of these values. The tricky part is that you must update these local position + rotation values if you move your object or its moved by physics or something.


    I plan to begin making new videos within a week or two. I have an entirely new setup and places to record so we'll see if I can make anything good. Just keep in mind these will never cover everything, and the tutorial demo scenes (which allow you to visually see changes very easily) will always be the main focus. One big issue with video tutorials is that they become out of date very quickly, because I like to update settings and features all the time. Whereas the tutorial scenes update with the asset and rarely require modification, so they're much easier for me to manage.
     
    Last edited: Sep 24, 2022
    TheGreaterGameCreator likes this.
  12. kamicth

    kamicth

    Joined:
    Sep 30, 2018
    Posts:
    32
    It was one of my first thoughts (using sgtstarfields/infinite), but it not usable as is in for some reasons :at "real" scale stars are not visibles and it introduce a huge flickering.so y have to figure out how to handle the position using sort of parallax for generated quads and make them fade out while spawnings galaxies, then clusters/groups then stars then planets and other featured stuffs.
    I also thought about octree with celular noise generation but i'm not skilled enouth to do it myself and connecting it with SgtFloatingObject system
    merging Nesting floating spawners and orbits from stars to moons with and most of features its ok. But at very large scale "like the universe" i haven't find a way to wake them working from stéarfields stars that appears to be quads forming a unique big mesh if i understand the code.
    Its why i was asking.

    Other question, do you plan to do something (if its possible) to fix scene viewport when dealing objects with orbital scale ltransforms ?
     
  13. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    I'm trying to add curl noise and a flow map to SgtJovian, but I don't understand the transform it applies to sample the cube map.

    What does it do?
     
  14. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Making a large universe actually populated with stuff is something I plan to experiment with this year, so I'll experiment with this kind of stuff when I get to it.

    I also have some ideas to improve scene view rendering of large scenes, though there's no way to make the existing scene view tools (e.g. move gizmo) work with such large values. Making a new set of scene editing tools for universe scale stuff is possible, but it also doesn't sound fun, and I don't think most people actually want to manually place many things in such a large universe. I think the better approach is to improve the procedural generation components so you can more easily spawn things where you want and just have the code place them where you expect.


    Which transform? The cubemap is sampled using texcoord5. This is the cubemap point where the eye-vertex vector intersects the jovian sphere. The x inversion on line 112 is because the cubemap is actually inside out and this fixes that.
     
    Thygrrr likes this.
  15. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    Thanks for the reply, I found a way to do it in shader without TCs (and yes, inside-outness was what was confusing me), i didn't see where the mesh was flipped or something. Cheers
     
    Darkcoder likes this.
  16. Papanix

    Papanix

    Joined:
    Mar 13, 2020
    Posts:
    5
    Thanks for the reply @Darkcoder . Tinkered with the cartoon shader some more to get some of the features from your shader. Still needs more work though. Wanted to just ask another thing or maybe get some advice rather. Been trying to get a sort of border around the continents to outline them more. Managed to do this by essentially creating another water level and colouring it differently. However this method creates more rough looking outlines. Do you have any tips on how I could maybe make them into smooth looking lines? Here is a video test of the planet in action.


    Also unrelated, but maybe a handy thing to add at some point (will add this into my shader). As i noticed the main way to animate the water is by using the water distortion perimeter. However when you are standing still, its kinda is noticeable that its just the normals inverting and the water is static. I was thinking of adding a Normal position offset, so at least it looks like it flowing in a direction (ever so slightly). Anyway just something to consider :)

    Thank you again for this toolset its so awesome! :)
     
    Darkcoder and joshua_42 like this.
  17. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Looks nice!

    How are you coloring the border right now? If it's sharp like this you must be doing a transition that is either instant (e.g. x > y - 0.1f && x < y + 0.1f) or sharp enough to be very similar to this. To smooth it out you must use a smoother transition (e.g. saturate(1.0f - abs(x - y) / 0.1f)), which you can make even smoother with smoothstep or something.
     
    Papanix likes this.
  18. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    Hi @Darkcoder is there a built in way for making billboards out of planets? What do you suggest for that?
     
    Darkcoder likes this.
  19. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    There's no such system to auto generate them. In the Universe examples I use a star flare for the planets when at a distance, because this is similar to how other planets look from Earth. If you're simulating a realistic sized universe then this solution should work well, because you usually won't be able to see any detail from multiple planets at the same.

    If you're using a smaller scale, then you will have to worry about texture memory if multiple planets get loaded though. In this scenario I recommend you set up a basic LOD stage for your planets with a low res texture (e.g. 128x64), which you can easily swap between using SgtFloatingLod if you're using the origin shifting system.
     
    Last edited: Sep 24, 2022
  20. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165

    Ok, got it! Thanks for fast reply.
     
    Darkcoder likes this.
  21. mschwarz1

    mschwarz1

    Joined:
    Oct 22, 2013
    Posts:
    7
    Thanks for the fast reply. My reply is a bit delayed but I appreciate how active you are on the forum.

    I went ahead and attempted to implement this and I came up with something that seems to work for me. I certainly haven't put it through a whole lot but I can "parent" the floating camera to an orbiting, rotating planet well enough. I'm putting the code below in case anyone else wants a copy.

    The implementation relies on decimals being large enough to store the universal world position. I think that should be fine for the most part but if you're getting to the edge of the universe you might start losing precision. @Darkcoder I'm curious to hear your opinion on that as I'm sure you've thought more than I have about what data structures can work on that kind of scale. I'm currently working within a small solar system so I haven't stressed it thus far.

    Anyways this would be the behavior you would stick on the camera or other floating object.
    Code (CSharp):
    1. using UnityEngine;
    2. using SpaceGraphicsToolkit;
    3.  
    4. namespace SpaceGraphicsToolkit
    5. {
    6.     // This class mimicks the behaviour of an object parented to another object.
    7.     // By adding this behaviour to some kind of floating point and assigning the
    8.     // parent the object will move and rotate along with the parent while still
    9.     // being able to be moved due to outside forces/scripts.
    10.     [RequireComponent(typeof(SgtFloatingPoint))]
    11.     public class SgtChild : MonoBehaviour
    12.     {
    13.         public SgtFloatingPoint parent;
    14.         private SgtFloatingPoint prevParent;
    15.        
    16.         private SgtFloatingPoint sgtFloatingPoint;
    17.         private SgtFloatingMatrix4x4 childLocalMatrix;
    18.         private SgtPosition previousPos;
    19.         private Quaternion previousRot;
    20.         private bool captured;
    21.  
    22.         void OnEnable()
    23.         {
    24.             if (sgtFloatingPoint == null)
    25.             {
    26.                 sgtFloatingPoint = GetComponent<SgtFloatingPoint>();
    27.             }
    28.  
    29.             previousPos = new SgtPosition();
    30.             captured = false;
    31.         }
    32.  
    33.         void Update()
    34.         {
    35.             if (parent != null)
    36.             {
    37.                 if (captured && prevParent != parent)
    38.                 {
    39.                     // if the parent changes the existing values need to be reset or else the object will
    40.                     // teleport to the previous local position relative to the new parent
    41.                     captured = false;
    42.                 }
    43.  
    44.                 SgtFloatingMatrix4x4 parentWorldMatrix = new SgtFloatingMatrix4x4(parent.Position, parent.transform.rotation, Vector3.one);
    45.  
    46.                 if (captured)
    47.                 {
    48.                     // Get the world deltas based on the previous frames world position and apply them
    49.                     SgtFloatingMatrix4x4 worldMatrix = parentWorldMatrix * childLocalMatrix;
    50.                     SgtPosition idealPos = worldMatrix.GetPosition();
    51.                     Quaternion idealRotation = worldMatrix.GetRotation();
    52.                     sgtFloatingPoint.Position += (SgtPosition.Delta(ref idealPos, ref previousPos));
    53.                     sgtFloatingPoint.transform.rotation = transform.rotation * (Quaternion.Inverse(previousRot) * idealRotation);
    54.                 }
    55.                 else
    56.                 {
    57.                     captured = true;
    58.                 }
    59.  
    60.                 // Capture the updated local posiiton/rotation in order to use it next frame
    61.                 SgtFloatingMatrix4x4 childWorldMatrix = new SgtFloatingMatrix4x4(sgtFloatingPoint.Position, sgtFloatingPoint.transform.rotation, Vector3.one);
    62.                 childLocalMatrix = parentWorldMatrix.Inverse() * childWorldMatrix;
    63.  
    64.                 // Save the previous world position/rotation for determining the delta next frame
    65.                 previousPos = sgtFloatingPoint.Position;
    66.                 previousRot = sgtFloatingPoint.transform.rotation;
    67.  
    68.                 prevParent = parent;
    69.             }
    70.  
    71.         }
    72.     }
    73. }
    74.  
    This is a matrix implementation to allow for the math that lets the behavior work. It's probably got pretty bad performance considering it's using all decimals and doing a bunch of converting.
    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3.  
    4. namespace SpaceGraphicsToolkit
    5. {
    6.     [System.Serializable]
    7.     // A 4x4 matrix class with some functions to allow for use
    8.     // with a SgtPosition value. This is by no means a fully fleshed
    9.     // out matrix class. I just implemented what I needed.
    10.     public class SgtFloatingMatrix4x4
    11.     {
    12.         // Cells are defined in column row notation
    13.         // so m02 is the first column and third row.
    14.         //
    15.         //           m00  m10  m20  m30
    16.         //           m01  m11  m21  m31
    17.         //           m02  m12  m22  m32
    18.         //           m03  m13  m23  m33
    19.         //
    20.  
    21.         public decimal m00;
    22.         public decimal m33;
    23.         public decimal m23;
    24.         public decimal m13;
    25.         public decimal m03;
    26.         public decimal m32;
    27.         public decimal m22;
    28.         public decimal m02;
    29.         public decimal m12;
    30.         public decimal m21;
    31.         public decimal m11;
    32.         public decimal m01;
    33.         public decimal m30;
    34.         public decimal m20;
    35.         public decimal m10;
    36.         public decimal m31;
    37.  
    38.         // Default constructor, just zeroize all the cells for now.
    39.         public SgtFloatingMatrix4x4()
    40.         {
    41.             m00 = m33 = m23 = m13 = m03 = m32 = m22 = m02 = m12 = m21 = m11 = m01 = m30 = m20 = m10 = m31 = 0m;
    42.         }
    43.  
    44.         // Rotation portion of this code was acquired from
    45.         // https://automaticaddison.com/how-to-convert-a-quaternion-to-a-rotation-matrix/
    46.         // Creates a new matrix out of the supplied position, rotation, and maybe eventually
    47.         // scale.
    48.         public SgtFloatingMatrix4x4(SgtPosition pos, Quaternion rot, Vector3 scale)
    49.         {
    50.             // TODO: Add scale usage. For now I'm not worried about it.
    51.  
    52.             m30 = pos.GetWorldX();
    53.             m31 = pos.GetWorldY();
    54.             m32 = pos.GetWorldZ();
    55.  
    56.             decimal q0 = Convert.ToDecimal(rot.w);
    57.             decimal q1 = Convert.ToDecimal(rot.x);
    58.             decimal q2 = Convert.ToDecimal(rot.y);
    59.             decimal q3 = Convert.ToDecimal(rot.z);
    60.  
    61.             //First row of the rotation matrix
    62.             m00 = 2m * (q0 * q0 + q1 * q1) - 1m;
    63.             m10 = 2m * (q1 * q2 - q0 * q3);
    64.             m20 = 2m * (q1 * q3 + q0 * q2);
    65.  
    66.             // Second row of the rotation matrix
    67.             m01 = 2m * (q1 * q2 + q0 * q3);
    68.             m11 = 2m * (q0 * q0 + q2 * q2) - 1m;
    69.             m21 = 2m * (q2 * q3 - q0 * q1);
    70.  
    71.             // Third row of the rotation matrix
    72.             m02 = 2m * (q1 * q3 - q0 * q2);
    73.             m12 = 2m * (q2 * q3 + q0 * q1);
    74.             m22 = 2m * (q0 * q0 + q3 * q3) - 1m;
    75.  
    76.             m33 = 1m;
    77.         }
    78.  
    79.         // Converts the decimal position values back into an SgtPosition value
    80.         public SgtPosition GetPosition()
    81.         {
    82.             SgtPosition pos = new SgtPosition();
    83.             decimal decCellSize = Convert.ToDecimal(SgtPosition.CELL_SIZE);
    84.  
    85.             pos.GlobalX = Convert.ToInt64(Math.Truncate(m30 / decCellSize));
    86.             pos.LocalX = Convert.ToDouble(m30 % decCellSize);
    87.  
    88.             pos.GlobalY = Convert.ToInt64(Math.Truncate(m31 / decCellSize));
    89.             pos.LocalY = Convert.ToDouble(m31 % decCellSize);
    90.  
    91.             pos.GlobalZ = Convert.ToInt64(Math.Truncate(m32 / decCellSize));
    92.             pos.LocalZ = Convert.ToDouble(m32 % decCellSize);
    93.  
    94.             return pos;
    95.         }
    96.  
    97.         // Code was generated by a slightly modified version
    98.         // of https://github.com/willnode/N-Matrix-Programmer
    99.         // Returns the inverse of the current matrix.
    100.         public SgtFloatingMatrix4x4 Inverse()
    101.         {
    102.             var A2323 = m22 * m33 - m32 * m23;
    103.             var A1323 = m12 * m33 - m32 * m13;
    104.             var A1223 = m12 * m23 - m22 * m13;
    105.             var A0323 = m02 * m33 - m32 * m03;
    106.             var A0223 = m02 * m23 - m22 * m03;
    107.             var A0123 = m02 * m13 - m12 * m03;
    108.             var A2313 = m21 * m33 - m31 * m23;
    109.             var A1313 = m11 * m33 - m31 * m13;
    110.             var A1213 = m11 * m23 - m21 * m13;
    111.             var A2312 = m21 * m32 - m31 * m22;
    112.             var A1312 = m11 * m32 - m31 * m12;
    113.             var A1212 = m11 * m22 - m21 * m12;
    114.             var A0313 = m01 * m33 - m31 * m03;
    115.             var A0213 = m01 * m23 - m21 * m03;
    116.             var A0312 = m01 * m32 - m31 * m02;
    117.             var A0212 = m01 * m22 - m21 * m02;
    118.             var A0113 = m01 * m13 - m11 * m03;
    119.             var A0112 = m01 * m12 - m11 * m02;
    120.  
    121.             var det = m00 * (m11 * A2323 - m21 * A1323 + m31 * A1223)
    122.                     - m10 * (m01 * A2323 - m21 * A0323 + m31 * A0223)
    123.                     + m20 * (m01 * A1323 - m11 * A0323 + m31 * A0123)
    124.                     - m30 * (m01 * A1223 - m11 * A0223 + m21 * A0123);
    125.  
    126.             // if the determinant is zero there is no inverse
    127.             if (det == 0m)
    128.             {
    129.                 return null;
    130.             }
    131.  
    132.             det = 1m / det;
    133.  
    134.             SgtFloatingMatrix4x4 inv = new SgtFloatingMatrix4x4();
    135.  
    136.             inv.m00 = det * (m11 * A2323 - m21 * A1323 + m31 * A1223);
    137.             inv.m10 = det * -(m10 * A2323 - m20 * A1323 + m30 * A1223);
    138.             inv.m20 = det * (m10 * A2313 - m20 * A1313 + m30 * A1213);
    139.             inv.m30 = det * -(m10 * A2312 - m20 * A1312 + m30 * A1212);
    140.             inv.m01 = det * -(m01 * A2323 - m21 * A0323 + m31 * A0223);
    141.             inv.m11 = det * (m00 * A2323 - m20 * A0323 + m30 * A0223);
    142.             inv.m21 = det * -(m00 * A2313 - m20 * A0313 + m30 * A0213);
    143.             inv.m31 = det * (m00 * A2312 - m20 * A0312 + m30 * A0212);
    144.             inv.m02 = det * (m01 * A1323 - m11 * A0323 + m31 * A0123);
    145.             inv.m12 = det * -(m00 * A1323 - m10 * A0323 + m30 * A0123);
    146.             inv.m22 = det * (m00 * A1313 - m10 * A0313 + m30 * A0113);
    147.             inv.m32 = det * -(m00 * A1312 - m10 * A0312 + m30 * A0112);
    148.             inv.m03 = det * -(m01 * A1223 - m11 * A0223 + m21 * A0123);
    149.             inv.m13 = det * (m00 * A1223 - m10 * A0223 + m20 * A0123);
    150.             inv.m23 = det * -(m00 * A1213 - m10 * A0213 + m20 * A0113);
    151.             inv.m33 = det * (m00 * A1212 - m10 * A0212 + m20 * A0112);
    152.  
    153.             return inv;
    154.         }
    155.  
    156.         // Returns the quaternion representing the current
    157.         // matrix rotation.
    158.         public Quaternion GetRotation()
    159.         {
    160.             Vector3 forwards = new Vector3(Convert.ToSingle(m20), Convert.ToSingle(m21), Convert.ToSingle(m22));
    161.             Vector3 upwards = new Vector3(Convert.ToSingle(m10), Convert.ToSingle(m11), Convert.ToSingle(m12));
    162.  
    163.             Quaternion rotation = Quaternion.LookRotation(forwards, upwards);
    164.             return rotation;
    165.         }
    166.  
    167.         // Multiplies two matrices together for more information on how this works see
    168.         // https://www.mathsisfun.com/algebra/matrix-multiplying.html or just type matrix
    169.         // multiplication in google and pick your favorite result
    170.         public static SgtFloatingMatrix4x4 operator *(SgtFloatingMatrix4x4 a, SgtFloatingMatrix4x4 b)
    171.         {
    172.             SgtFloatingMatrix4x4 matrixProd = new SgtFloatingMatrix4x4();
    173.  
    174.             matrixProd.m00 = (a.m00 * b.m00) + (a.m10 * b.m01) + (a.m20 * b.m02) + (a.m30 * b.m03);
    175.             matrixProd.m10 = (a.m00 * b.m10) + (a.m10 * b.m11) + (a.m20 * b.m12) + (a.m30 * b.m13);
    176.             matrixProd.m20 = (a.m00 * b.m20) + (a.m10 * b.m21) + (a.m20 * b.m22) + (a.m30 * b.m23);
    177.             matrixProd.m30 = (a.m00 * b.m30) + (a.m10 * b.m31) + (a.m20 * b.m32) + (a.m30 * b.m33);
    178.  
    179.  
    180.             matrixProd.m01 = (a.m01 * b.m00) + (a.m11 * b.m01) + (a.m21 * b.m02) + (a.m31 * b.m03);
    181.             matrixProd.m11 = (a.m01 * b.m10) + (a.m11 * b.m11) + (a.m21 * b.m12) + (a.m31 * b.m13);
    182.             matrixProd.m21 = (a.m01 * b.m20) + (a.m11 * b.m21) + (a.m21 * b.m22) + (a.m31 * b.m23);
    183.             matrixProd.m31 = (a.m01 * b.m30) + (a.m11 * b.m31) + (a.m21 * b.m32) + (a.m31 * b.m33);
    184.  
    185.             matrixProd.m02 = (a.m02 * b.m00) + (a.m12 * b.m01) + (a.m22 * b.m02) + (a.m32 * b.m03);
    186.             matrixProd.m12 = (a.m02 * b.m10) + (a.m12 * b.m11) + (a.m22 * b.m12) + (a.m32 * b.m13);
    187.             matrixProd.m22 = (a.m02 * b.m20) + (a.m12 * b.m21) + (a.m22 * b.m22) + (a.m32 * b.m23);
    188.             matrixProd.m32 = (a.m02 * b.m30) + (a.m12 * b.m31) + (a.m22 * b.m32) + (a.m32 * b.m33);
    189.  
    190.  
    191.             matrixProd.m03 = (a.m03 * b.m00) + (a.m13 * b.m01) + (a.m23 * b.m02) + (a.m33 * b.m03);
    192.             matrixProd.m13 = (a.m03 * b.m10) + (a.m13 * b.m11) + (a.m23 * b.m12) + (a.m33 * b.m13);
    193.             matrixProd.m23 = (a.m03 * b.m20) + (a.m13 * b.m21) + (a.m23 * b.m22) + (a.m33 * b.m23);
    194.             matrixProd.m33 = (a.m03 * b.m30) + (a.m13 * b.m31) + (a.m23 * b.m32) + (a.m33 * b.m33);
    195.  
    196.             return matrixProd;
    197.         }
    198.  
    199.         public override string ToString()
    200.         {
    201.             string output = "";
    202.  
    203.             output += string.Format("{0:F2} {1:F2} {2:F2} {3:F2}\n", m00, m10, m20, m30);
    204.             output += string.Format("{0:F2} {1:F2} {2:F2} {3:F2}\n", m01, m11, m21, m31);
    205.             output += string.Format("{0:F2} {1:F2} {2:F2} {3:F2}\n", m02, m12, m22, m32);
    206.             output += string.Format("{0:F2} {1:F2} {2:F2} {3:F2}\n", m03, m13, m23, m33);
    207.  
    208.             return output;
    209.         }
    210.  
    211.     }
    212. }
    and lastly three functions to add to SgtPosition just to get the world positions in decimal form

    Code (CSharp):
    1.         public decimal GetWorldX()
    2.         {
    3.             decimal wrldValX = (System.Convert.ToDecimal(GlobalX) * System.Convert.ToDecimal(CELL_SIZE)) + System.Convert.ToDecimal(LocalX);
    4.             return wrldValX;
    5.         }
    6.  
    7.         public decimal GetWorldY()
    8.         {
    9.             decimal wrldValY = (System.Convert.ToDecimal(GlobalY) * System.Convert.ToDecimal(CELL_SIZE)) + System.Convert.ToDecimal(LocalY);
    10.             return wrldValY;
    11.         }
    12.  
    13.         public decimal GetWorldZ()
    14.         {
    15.             decimal wrldValZ = (System.Convert.ToDecimal(GlobalZ) * System.Convert.ToDecimal(CELL_SIZE)) + System.Convert.ToDecimal(LocalZ);
    16.             return wrldValZ;
    17.         }
    I also gave SgtChild a script execution order of -500. I'm not sure if that actually makes a difference but I figured it should go before everything else to avoid interfering with any other movement behavior.

    Generally speaking the code could be cleaned up a bit and improved but hopefully it's understandable and usable enough in case anyone else wanted to do something similar.
     
    Darkcoder likes this.
  22. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Looks good at first glance. I'm curious what your use case is though, since you could have implemented this with doubles. This would give you enough precision for handling anything captured by a planet, and probably have much better performance and compatibility with other systems.
     
  23. mschwarz1

    mschwarz1

    Joined:
    Oct 22, 2013
    Posts:
    7
    I was trying to make the matrices work with the same level of precision that the SgtPosition can support since the implementation has to convert them into a world position at a bunch of points. Or at least as close as I could without getting into something like BigRational. Decimal seemed like the best candidate although it's still not quite enough significant figures. I originally wanted to split up SgtPosition into 3 "SgtFloatingValues" and figure out how to multiply them together in a smooth way so I could create a matrix out of those but I haven't been able to figure that out.

    There's probably a better solution out there that just involves deltas and local coordinates which would mean you could use less precision assuming you weren't incredibly far away from the parent but I didn't see it and just went down the traditional transform matrix route.

    My use case is really just sticking a camera to a planet or have a player character stick to a planet atm. I don't have any strict requirements or goals since I'm just tinkering so I wanted to make it as universally workable as possible without using something like BigRational.
     
  24. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Yeah, storing and calculating this using local (relative to the planet) coordinates is what I had in mind. If this setup works then there's no need to worry about it now though!
     
  25. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    Hi. Just a little dummy question but I couldn't figure it out: I am trying to access my usual scripts under a folder named "0-Scripts" from inside Sgt namespace and new version of Sgt throws an error saying it can not find the namespace for my class. Also when I encapsulate my class under SpaceGraphicsToolkit namespace it does not work until I put it under Space Graphics Toolkit folder. The thing is, I can not apply this workaround I found on a trial project, because my main project requires many scripts moved that way and then many others needed to be include sgt namespace. Is there an easier way to include no namespace script inside sgt namespace? Just, a dummy question I now but appreciate any help.
     
  26. chalupaul

    chalupaul

    Joined:
    Oct 2, 2018
    Posts:
    3
    Howdy! I do believe I have found a bug regarding eclipse shadows using the SGT Shadow Sphere component. When it draws the shadow texture, it will draw it to all objects it encounters. I took a screenshot of what I'm talking about. There are 3 planets. The smallest (and closest to the camera) casts a shadow on the planet behind it and also on the jovian that would otherwise be obscured. All planets have a shadow sphere component on them.

    Secondly, the SGT Shadow Sphere component seems to drastically alter the shadowing. If you see in picture 2, enabling the shadow sphere seems to turn off the shadow being cast by the jovian (disabling the jovian in the scene creates that beautiful bright atmosphere effect, same as if the shadow sphere is enabled). A very curious note, enabling an sgt shadow sphere script on the atmospheric planet (not the baby moon) removes the jovian shadow over its rings which is utterly baffling since the light is coming from the opposite direction.

    Question 3: Adding a shadow sphere to the jovian is actually what creates the shadow against the ring and the dimness of the planets behind it. If I were to put the sun on the other side of those planets, I would expect the smaller planets to be entirely obscured by the jovian. Yet the face of the planet is lit from the SGT Light as though the jovian wasn't even there (see picture 3, it is both in the scene and game views). How can I overcome the illumination being cast on the planet?


    Image 1: SGT Shadow Sphere casting through planet



    Image 2: SGT Shadow Sphere before/after (note brightness change)



    Image 3: Expecting the small planet and moon on right to be completely black, yet they are illuminated
     
    Last edited: Jan 21, 2021
  27. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    All SGT code inside its own assembly which is in the root SGT folder (SpaceGraphicsToolkit.asmdef). If you want to write code that accesses SGT code then you must make your own assembly (asmdef), and make that reference the SGT one. You can read more about it HERE.

    SGT objects can only receive up to 2 SgtShadows at a time, and in your scenario you have up to 3. To fix this you must move your objects so they aren't in perfect alignment like this. In most game scenarios this 2 limit is fine with careful scene design, but I plan to look into expanding this later in the year.
     
  28. ms02

    ms02

    Joined:
    Jun 8, 2020
    Posts:
    3
    Hi I'm trying to figure how to get this asset to work with VR? I did check out the VR Stars scene but none of the planets are showing up sadly. Could you please help me out?

    Thanks!
     
  29. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Which planets? The "VR Stars" scene only has stars.

    You can copy+paste planets from the other scenes into this and it should work.
     
  30. pratt_timmy

    pratt_timmy

    Joined:
    Jun 30, 2019
    Posts:
    32
    Hey there I have a issue when using the SgtAtmosphere components.

    I'm using the SgtAtmosphere with a planet generation script that uses quad trees. I do this by adding the planets generated quads to the renderers list in the attached SgtSharedMaterial script at runtime. The atmosphere component is working great for me other than this issue.

    When inside the atmosphere and using Unity's Directional Light component the "sun's'" position doesn't line up with where it should be. The "sun" flare generated by SgtAtmosphere disappears beneath the horizon before the planets surface becomes dark.
    I added a Flare component to the scene's directional light so you can see the displacement.
    upload_2021-1-22_22-57-14.png
    So you can see that the flare, generated by SGT (bottom flare) isn't matching the flare from the directional lights position.
     
    Last edited: Jan 23, 2021
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    It looks like you didn't enable the SgtLight.TreatAsPoint setting? For large scenes you must enable this, because the flare is at a 3D point, whereas directional lights don't have a point, so there will normally be a discrepancy. Enabling this setting makes the direction match the current direction of the point.
     
    hopeful likes this.
  32. pratt_timmy

    pratt_timmy

    Joined:
    Jun 30, 2019
    Posts:
    32
    Ah ok, you are right. I thought I tried that already but I didn't or I did it wrong. Anyways thanks for taking the time. Much appreciated ty
     
    Darkcoder likes this.
  33. jessejarvis

    jessejarvis

    Joined:
    Aug 9, 2013
    Posts:
    303
    Hello, I'm trying to get this working with Game Creator. More specifically I am trying to figure out how to get my character oriented with the planet. I believe I need to make modifications to the Player Character.cs and CharacterLocomotion.cs and I was wondering if anybody could help or has done something like this before? It would be amazing to get a character on the terrain planet and running around! :)

    Thank you!
     
  34. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    There is the SgtTerrain.GetNearest static method, which allows you to find a planet. You can then just set your character's up axis to point toward this planet's transform.position. If you want to hug the planet surface then you can call the .GetWorldNormal method, which is how the SgtTerrainObject component works.
     
    iOwls likes this.
  35. ajlert11

    ajlert11

    Joined:
    Feb 4, 2016
    Posts:
    3
    Hey there!
    I'm trying to create some type of locations generator for the Terrain planet. Currently, am facing some problems of how to accomplish this for the planet that's generated via scripts. The idea is to put some Points all over the planet right near the terrain (e.g. like a grid on 2d plane), then calculate UVs for the position where the Point was placed and using a special texture, called "Locations Map", check if we can put location there or not.

    The problems are:
    - to get the exact positions on the terrain, thought I can just use a usual sphere with the planet radius, put Points and then perform Raycast to stick it to the terrain, but not sure if it'll work with the SGT Terrain Collider, as it doesn't cover entire planet from what I've read, so stuck at this
    - to get UVs, I know it's possible to do via mesh triangles and barycentric coordinates, but I just couldn't find where and if the entire mesh of the planet is stored

    Here is an example of what I've made for 2D plane, now need the same but for Terrain Planet from your asset. Tried to convert this via UVs, but, obviously, Quad and Icosphere applies UVs in a different way :)
    Also this should work either from Editor or at runtime.
    So, would like to know if this is possible and how hard it is. The main reason for using the Terrain Planet is the LOD system.
    Thanks for the tips if any!
     

    Attached Files:

  36. jessejarvis

    jessejarvis

    Joined:
    Aug 9, 2013
    Posts:
    303
    Sounds easy enough but I got told Game Creator requires the World-Up direction always at least as the intention. I tried looking but I can't figure it out. Apparently since it doesn't work with a RigidBody it just uses the Unity Character Controller. It's fine though I just keep getting told things are impossible and I can't do this on my own, I don't know what I was thinking. I used to be so much of a better programmer lol.
     
  37. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    Hi @Darkcoder thank you for your fast and efficient support. I am on HDRP and I need to change planet light layer to a specific layer by code after planets are generated on the scene. HDRP does that by setting GetComponent<MeshRenderer>().renderingLayerMask but I do not know how to access MeshRenderer on a Sgt planet. How can I do this?
     
  38. jessejarvis

    jessejarvis

    Joined:
    Aug 9, 2013
    Posts:
    303
    I decided not to use Game Creator because of its limitations but I have Opsive's TPC and got it working with Space Graphics Toolkit. I am however wondering how you all work with unity scene navigation dealing with the down direction being towards the center of the planet. Unity doesn't seem to be made for that kind of navigation in mind. Is there something I can do or use to navigate the scene in 3d space?
     
  39. ajlert11

    ajlert11

    Joined:
    Feb 4, 2016
    Posts:
    3
    So I managed to generate a grid over the Terrain Planet, it looks pretty good. Hence, my 2nd problem is left only - how to get UVs based on the position on the Planet. I found out that you store Meshes inside Terrain cubes, so, in fact, I can iterate through all triangles and find the closest triangle to the grid point, but I'm not sure if this is the best method as it can contain hundred thousands of Indeces.
    So would like to know if there is any better solution
     

    Attached Files:

  40. Razmot

    Razmot

    Joined:
    Apr 27, 2013
    Posts:
    346
    Try https://assetstore.unity.com/packages/templates/systems/game-kit-controller-40995
     
  41. chalupaul

    chalupaul

    Joined:
    Oct 2, 2018
    Posts:
    3
    Thanks for everything, @Darkcoder this asset is amazing.

    I threw together a shader that adds flowmaps to jovian textures which makes them move. Works super well and gives the appearance of storms and windy mixing cloud stripes. I am having a devil of a time combining the jovian shader with that though. Is there any way you could produce the sgtjovian shader as a shadergraph? Then I could just change the shader name in the code to call the graph generated shader.

    I'm happy to send you the shadergraph I threw together too if you want to just make it a 1st class feature (if that would help). If i weren't such a noob shader author, I could probably figure it out myself.

    This is basically what I did in shadergraph:


    Side note: I'm pretty sure incorporating the stuff in that video into SGTJovian would be insane. People could just create whatever jovians they wanted, color, animation, and all. They could customize everything just by adding a texture, flowmap, and color gradient.
     
    Steve2375 likes this.
  42. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    Every now and then - if not every frame - you have to get gravity line which is

    gravityLine = (planet.transform.position - yourObject.transform.position).normalized

    and set your players rotation every frame by

    player.transform.rotation = Quaternion.LookRotation(player.transform.forward, -gravityLine)

    or by more resource intensive one

    player.transform.rotation = Quaternion.LookRotation(Vector3.Cross(player.transform.right, -gravityLine), -gravityLine)

    I would prefer the first one to do in every frame and the other in a few hundred frames if target platform is mobile. PC is good to perform those every frame. I mean, if your target is iPhone 6s you are still safe to do it every frame.

    If you can write a function in a Utilities class that returns a spherically synced rotation that takes a targetObject and a targetPlanet as parameters, you can call that on every object you need to align.

    I first concentrated on alignment assuming that positioning is much easier. You can use API of Sgt to get the position on surface. I don't remember what it was exactly but it is in SgtTerrainPlanet class. You can also get surface normal even by another function in the same class. However, that is mostly needed for foliage and there is SgtTerrainPlanetSpawner for that, you don't need to worry for anything in that matter.

    Then, for navigation, I use a simple circular distance algorithm that takes a start latitude longitude and target lat lon to get the distance to my target object on the planet. You can google with "spherical distance" and wikipedia article is quite good; just apply the simplest one because you won't need the others in a game. You can even simplify that by using that algorithm after a linear distance threshold because it won't matter much if the target object is away from you like 1000 units on a 17000 units radius planet.

    Then, the last thing to do is to show current lat lon of the player. I am not sure if Sgt has a function for this but it is no difficult job. Preferences may differ but simply

    Vector3 testVector = player.transform.position - planet.transform.position;
    lon = Vector3.SignedAngle(testVector, planet.transform.right, planet.transform.up);
    lat = Vector3.SignedAngle(testVector, planet.transform.up, planet.transform.right);

    It shows some discrepancies through the 180 and -180 degrees but if Sgt does not have a better one it is a slight defect not to be worried about.

    One class for spherical gravity, and one for utilities, make utilities a singleton or static instance at least... Nothing more you should need for navigation.

    Then, on your ui, to show the target to the player, you should show the icon of the target according to the local position on planet. So, if the target is on the other side of the sphere under the player, the icon will appear on the scree when the player looks down, but the distance to target on the icon will show the spherical distance. There is a simple code on internet to do this on UI.

    Ok, one more thing: if you want to put the icon of your target as they do in no mans sky, find angle between targetPos to playerPos vector and player forward vector,

    folat offset = Mathf.Cos(that angle) * distance between target and player;
    Vector3 pseudoTargetPos = targetPos + (player.transform.up * (-offset));

    use that pseudoTargetPos in your UI code as target. For stem like it appears in no mans sky you should consider additional tweaking.

    But, for AI navigation... Well... If you can apply navmesh to that dynamic system, in fact it is no different job than applying navmesh to a procedurally generated conventional terrain, and if you use your SphericalGravity class on your agents, it should be fine, as long as you show the pseudoTargetPos to your enemy (in enemy's point of view). Actually, on second thought, directional distance vector should be fine with this, no need for pseudo vector. but, the key is making unity navmesh system to adopt foliage generation. Not so hard. There are videos out there about this. But, in most cases, it is easier to write your own algorithm specifically derived from the logic of your game, which is not too hard.

    There is work to do but not that much. In fact, it no different than using a traditional terrain when you get used to it. In my case, it might have been caused an addiction. :)
     
    Last edited: Jan 25, 2021
  43. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    The SgtTerrainPlanet component has methods like GetLocalPoint and GetLocalHeight that can be used for this.

    You can get the UV of a point using the SgtHelper.CartesianToPolarUV method.

    If you want proper navigation like Unity's NavMesh then you would have to use (or write) a custom asset to do this. It would be very difficult to build the nav mesh itself though since the planet terrain is dynamically generated so you can't just directly use that (unless you did something like the SgtTerrainCollider). A much easier solution would be to use a more rudimentary navigation system that uses some kind repulsion to avoid walking into walls, like a boid system might do.

    Shader graph is a nightmare to use for anything complex, and the jovian shader is complex. I plan to revisit the way jovians render in the future though, but it sure won't be with shader graph!


    Currently the planet is rendered using the current GameObject layer only. I'll send you an updated SgtPlanet component with this ability.

    [Edit] It looks like renderingLayerMask allows you to set a layer mask, but the Graphics.DrawMesh used for the planet has no such option. At best I could add the ability to override the layer index? You could also just change the GameObject layer to do the same thing, unless your GameObject needs to be a different layer?
     
    Last edited: Jan 26, 2021
  44. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    Hi @Darkcoder I am using SgtTerrainPlanet component for the planet the player is on and planning to use SgtPlanet component for the far planets. Currently it is all SgtTerrainPlanet.

    The problem I encounter is: when I put my directional light that is responsible for shadows at the position of star, shadows flicker. The solution is to set directional light layer to Light Layer 0, and there is this other point light which is for lighting the atmospheres of all of the planets, that will be set to Light Later 1. All atmospheres and all of the planets except player's will be on Light Layer 1, and only player's planet will be on Light Layer 0. With that setup, I can position the directional light close enough to the player so that shadows will not flicker.

    In HDRP, GameObject layers are independent from light layers. So, changing GameObject layer does not work.

    In SgtTerrain class, as far as I remember, you create meshes. Then I think they must have MeshRenderers. If I can access those, I can set renderingLayerMask. However, I am not sure if this is a good plan or if this is the case, even.

    Or maybe I will chase for another setup...

    Edit:
    On a second thought, Actually I have just made some illumination diagrams positioning the observer and the planets in variations and it might be ok in such a setup to keep all the lights on the same light layer. I tested this, no significant illumination changes occur on the pther planets in space when I turn off the directional light. And I can apply the distancing which fixes shadows. Interestingly, my point light on the position of star is set to illuminate Light Layer 1 but all of the planets are illuminated by it. I guess SgtLight script handles the illumination no matter what light layer is used. Is that right?
     
    Last edited: Jan 26, 2021
  45. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    Shadows may flicker if your camera draw distance is too high (at least in the standard pipeline), so you may want to see if that changes things. The "Terrestrial Planet" demo scene uses settings near the limit last time I checked.

    These meshes are rendered with Graphics.DrawMesh, so there is no MeshRenderer used. While Renderer has the renderingLayerMask setting, DrawMesh does not.

    The SgtLight's Intensity setting is used for SGT shaders that implement their own lighting like SgtAtmosphere, SgtJovian, SgtRing. The Light's Intensity setting is used for shaders that implement Unity's lighting system like the SgtPlanet shader, and any other standard shaders that come with Unity or are made with shader graph, etc.
     
  46. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    This is a really very good asset. Thanks to DrawMesh that frame rates are really high with dust storm effects and decent amount of foliage generation. Thanks to Sgt that I am now able to think about the art aspect of the game.

    My current problems are mostly unity related and have temporary fixes. Shadows... Well, I have double camera setup first of which has a far plane distance of 50000u and the other 50000u for near plane. The first cam is for shadows. Its far plane was originally at 5000. But then, I have this intersection band between the visuals provided by two camera on dense atmospheres. If anyone knows how to avoid it I would appreciate for sharing.

    One thing to share on this issue: in all of my setups, I use a separate directional light to cast shadows and no others do that. That I call ground light. If you use ground light close enough to the planet the flickering goes away. Then, in HDRP, you can override shadows and increase the shadow distance to have a good quality of shadow range. 1500 is ok in most cases, 3000 is really good quality. Then, in the HDRP asset settings, under directional lights, increase max shadow resolution to 8192. Then, in your shadow casting directional light, set the shadow resolution you need. In most cases 4096 gives a good result and high frame rates. Then, the last thing to do is, to set the distances for shadow cascades, try to get them to the left most possible setup. Well, still need to get that far clip plane to 5000 for best results...

    Anyway, Sgt really speeds things up. I really appreciate each bit of it.
     
  47. pratt_timmy

    pratt_timmy

    Joined:
    Jun 30, 2019
    Posts:
    32
    I am having some trouble with renderers that use multiple materials with the SgtSharedMaterial script attached to the SgtAtmosphere script.
    Only the parts of the mesh that utilize the first material assigned to the MeshRenderer are effected by the SgtAtmosphere component. All other parts of the mesh that use materials beyond the first material are not effected.
    The mesh I am using has multiple sub meshes if that might be causing the problem?
    In SgtSharedMaterial it looks like the code collects all sharedMaterials from the renderers...and does something with them? Maybe a bug? I'm leaning more towards I am making a mistake.
    I really need to combine meshes at runtime so that I can generate objects(in this case a city) procedurally. I could combine the meshes of renderers that use the same material. But I figured I'd ask before I went that route if I could get better performance/ease of use.
    Any help would be appreciated
     
    Last edited: Feb 1, 2021
  48. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,412
    This is a limitation with how sub meshes work in Unity. Every extra material you add to a MeshRenderer only renders the last sub mesh with it. This is great if you have no submeshes, but it doesn't work with multiple, so you have to split your mesh up into one mesh per submesh.
     
  49. pratt_timmy

    pratt_timmy

    Joined:
    Jun 30, 2019
    Posts:
    32
    OK that makes sense. Thank you for taking the time to explain as always. Really excited with how this project is turning out. It's a Keplerian orbital mechanics simulator, bit like KSP with realistic scale. Now thanks to Sgt it's also very pretty
     
    Darkcoder likes this.
  50. Wawwaa

    Wawwaa

    Joined:
    Sep 30, 2017
    Posts:
    165
    @Darkcoder : I am trying to make large planets. Everything works fine until around 10-12k radius. After that, I get a weird rotation of the planet under the feet of my character. Using my own floating origin system, so problem is not that kind. Actually it is a constant rotation rather than a flickering back and forth. I thought it might be because of the floating precision, but is there any other possible reasons? The planet is definitely not moving, in fact, it is marked as static.

    Also about making large planets: when shader calculate everything according to the planet center which stays far away from the origin, you can't increase detail level to get a good result, because when you do you get a flickering on the surface. Also I see the colliders are set as children of the planet. If both meshes and colliders were not children of the planet and their pivots were set on themselves rather than the planet center, then we wouldn't get those floating point errors. Is it possible to do this? If it is then even 4-5M radius planets could be possible.

    And my last question: is it possible to search for plains on the planet surface to place buildings, or even a city, programmatically? I mean, how can I find plain areas of certain size on the planet and get the surface point of their center point (I know hot to get surface point but I am trying to figure out the other thing).