4

I am trying to simulate a solar system with three suns. That works fine: Surface of planet looking at 2 suns

The problem is that it doesn't look great. I don't need a photorealistic image, but I want better than this. I have determined that the greatest problem is the lack of an atmosphere. I tried this but even after a couple hours messing with code and settings, it can only capture one sun at a time.

The next thing I tried was an inside-out sphere with a transparent material, with some success. The problem is that the suns reflect on the opposite side of the sphere, since it's inside out. This is the code I'm using to make it inside out, just in case it's important:

using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using UnityEngine;
public class FlipNormals : MonoBehaviour
{
    void Start()
    {
        Mesh mesh = this.GetComponent<MeshFilter>().mesh;
        Vector3[] normals = mesh.normals;
        for (int i = 0; i < normals.Length; i++)
            normals[i] = -1 * normals[i];
        mesh.normals = normals;
        for (int i = 0; i < mesh.subMeshCount; i++)
        {
            int[] tris = mesh.GetTriangles(i);
            for (int j = 0; j < tris.Length; j += 3)
            {
                //swap order of tri vertices
                int temp = tris[j];
                tris[j] = tris[j + 1];
                tris[j + 1] = temp;
            }
            mesh.SetTriangles(tris, i);
        }
    }
}

I was thinking (with my rudimentary knowledge of lighting and polygons) that maybe having the sphere render on both sides might help, but I haven't found a way to do that nor do I have much hope for its success.

I was hoping someone else would have some better ideas?

  • You may find this video from Sebastian Lague interesting, where they implement an atmosphere via shaders (in Unity) https://www.youtube.com/watch?v=DxfEbulyFcY – K Scandrett Sep 15 '22 at 23:20

0 Answers0