For example : https://managore.itch.io/planetarium

Something like this, create random sprite circles who at least are realistic looking, as far as realism can be pixel, I don't think this can be done on Unity alone so i think i might need to implement it after i coded it in another language or another engine, so my how do i do it? can i do it on unity? and how would i implement if i decided that unity isn't fit for this thing?

The usage of the planets will be throughout the game and will be used as the main planet so it is of great value to the game

closed as unclear what you're asking by Philipp, Alexandre Vaillancourt, DMGregory, Arcane Engineer, congusbongus May 2 '17 at 4:52

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Do you want these to be creatable and interactive at runtime or would it be OK to prerender the animation and put it into Unity as a simple sequence of sprite frames? Are you more concerned with the functionality or with the aesthetics of that graphic demo? – Philipp Apr 20 '17 at 18:14
  • Actually either way it works I guess, I was thinking interactive at run time but wouldn't be a problem to just import it, I could upgrade later. At the moment I'm more concerned about the functionality – Lendrit Ibrahimi Apr 20 '17 at 18:20
  • 2
    Procedurally generating...anything, really...requires a decent understanding of the process behind how you'd go about doing it by hand and just giving the computer some rules to follow. In this case... "start with a circle. give it some perlin noise, generate some blobs we'll call clouds, animate the shit out of them." If you aren't sure how you'd create the image by hand, you won't be able to write a computer to do it for you. – Draco18s Apr 20 '17 at 18:41
  • Where though, I know C++ enough to start but because pure C++ isn't graphical I have no idea where to start programming it – Lendrit Ibrahimi Apr 20 '17 at 18:44
up vote 3 down vote accepted

Short Answer:if you want generate random planet, you should generate Random rotation,distance,color,etc for instantiated planets.

enter image description here

you asked about pixel effect to your sprites. you can do this by using shaders:

Shaders are small scripts that contain the mathematical calculations and algorithms for calculating the colour of each pixel rendered, based on the lighting input and the Material configuration. https://docs.unity3d.com/Manual/Shaders.html

you asked about language:

In Unity, shader programs are written in a variant of HLSL language (also called Cg but for most practical uses the two are the same).https://docs.unity3d.com/Manual/SL-ShadingLanguage.html

next you mentioned problem with orbiting sprites in 3d position, so instead of using sprites you can shadering 3d objects to 2d objects(like the upper image) or by using World Space UI:

Creating a World Space UI The UI system makes it easy to create UI that is positioned in the world among other 2D or 3D objects in the Scene. Start by creating a UI element (such as an Image) if you don’t already have one in your scene by using GameObject > UI > Image. This will also create a Canvas for you.https://docs.unity3d.com/Manual/HOWTO-UIWorldSpace.html

this is generator and planet script that I explained all thing in my code(by commenting)

Generator Script:

using UnityEngine;
using System.Collections;

public class Generator : MonoBehaviour {
    public GameObject prefab;//planet prefab
    public static GameObject Earth;//All object will orbit around this
    public static float lastTime;//last time


    void Update () {
        Earth = GameObject.FindGameObjectWithTag("Earth");//Find Earth
        if (Input.GetKeyDown(KeyCode.Space))//if press space generate planet
        {
        lastTime = Time.time;//when object instantiated store Time.time as last time we use it in planet script
        Instantiate(prefab, Earth.transform.position, Quaternion.identity);
        }
    }
}

Planet Script:

using UnityEngine;
using System.Collections;

public class Planet : MonoBehaviour {
    [Range(0,100)]//Range for speed
    public float speed = 20;// Rotation Speed
    public float alpha; //will use for cos & sin (as angle)
    public float distance;//distance from center
    public float Rotation;//rotation angle
    public float currentTime;//Time start when Instantiated


    void Start () {
        //Initialize new planet with Random rotation & distance & size

        //Random Rotation between -2 & 2
        Rotation = Random.Range(-2.0f, 2.0f);
        //Random distance  between -1 & 2
        distance = Random.Range(1.0f, 2.0f);
        //Random Size between 0.2f & 0.7f
        var Size = Random.Range(0.2f, 0.7f);
        //Set localScale with random size
        transform.localScale = new Vector3(Size, Size, Size);

        //calculating current time by subtraction Time.time and lastTime
        currentTime = Time.time - Generator.lastTime;

        //GetComponent<MeshRenderer>().material.color = new Color(Random.value, Random.value, Random.value); //Random Color
    }

    void Update () {
        //Timer
        currentTime += Time.deltaTime;

        var X =  (distance * Mathf.Cos(currentTime));//X
        var Y =  (distance * Mathf.Sin(currentTime));//Y
        var R =  (Rotation * Mathf.Cos(currentTime));//Rotation

        //give earth from generator class
        var Earth = Generator.Earth;
        transform.position = Earth.transform.position + new Vector3(X, R, Y);// RotateAround Earth

        //Basic Orbit:
        //this is simple way that you can orbitting objects around other object
        //transform.Rotate(transform.up * speed * Time.deltaTime);
        //transform.RotateAround(Earth.transform.position, Vector3.up, speed * Time.deltaTime);
    }
}

I put this project in my github: https://github.com/smkplus/orbit/archive/master.zip

  • Well this is the answer I've been looking, pointed me in the right direction and helped me understand quite a lot about what I'm trying to do and how to. Thank you very much! – Lendrit Ibrahimi Apr 22 '17 at 17:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.