Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Galaxy effect

Discussion in 'General Graphics' started by Vasek_42672828, Aug 7, 2023.

?

How to make galaxy

  1. idk

    1 vote(s)
    33.3%
  2. galaxy

    2 vote(s)
    66.7%
Multiple votes are allowed.
  1. Vasek_42672828

    Vasek_42672828

    Joined:
    Aug 7, 2023
    Posts:
    4
    Hello, I want to make galaxy map, but I don't know what. I tried particle system but it was bad (she was always changing position and shapes). How to make "nebula" gas arms galaxy? How to make galaxy stars light ? I don't need to have very detailed ones like planets. Please help
     
  2. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,069
    Are you trying to make a map, or a galaxy?
     
  3. Vasek_42672828

    Vasek_42672828

    Joined:
    Aug 7, 2023
    Posts:
    4
    I want a galaxy because I need a 3D effect when scrolling (there will be a 2D gameobject with a border above it) I want the user to be able to tilt 30°. I am now trying to use the particle system to make the Nebula gas cloud effect, but I cannot save the positions of the particles. I need it to be static and the same, which unfortunately the particle system does not do. Please help
     
  4. Torbach78

    Torbach78

    Joined:
    Aug 10, 2013
    Posts:
    296
    VortexSpeed.gif Shuriken can process about 5000 billboards loop & prewarm and they can be made to orbit like a vortex
    It can also come to a halt by adjusting the sim time down to 0
    and it is random based on a seed, so you could set the seed to a single value

    the billboard can be a smokey texture and some shader you construct to add more visual complexity

    though this can help you make a galaxy, it is not the only way, nor optimized for whatever function/visual target you actually need
     
    Last edited: Aug 16, 2023
  5. impheris

    impheris

    Joined:
    Dec 30, 2009
    Posts:
    1,519
    i think you can make the particles to always be at the same position, there is an option to make them "random" you just need to unchek it, i'm not 100% sure tho
     
  6. Vasek_42672828

    Vasek_42672828

    Joined:
    Aug 7, 2023
    Posts:
    4
  7. Vasek_42672828

    Vasek_42672828

    Joined:
    Aug 7, 2023
    Posts:
    4
    I need help the most, how to set the positions of individual particles. My code not working.

    using UnityEngine;
    using System;
    using System.IO;

    [Serializable]
    public class ParticlePositionData
    {
    public Vector3 position;
    }

    public class ParticleSystemManager : MonoBehaviour
    {
    public ParticleSystem particleSystem;

    private void Update()
    {
    if (Input.GetKeyDown(KeyCode.S))
    {
    Debug.Log("S key pressed. Saving particle positions...");

    particleSystem.Stop();

    SaveParticlePositions();

    particleSystem.Play();
    }
    }

    public void SaveParticlePositions()
    {
    ParticleSystem.Particle[] particles = new ParticleSystem.Particle[particleSystem.main.maxParticles];
    int particleCount = particleSystem.GetParticles(particles);

    ParticlePositionData[] particlePositionDataArray = new ParticlePositionData[particleCount];

    for (int i = 0; i < particleCount; i++)
    {
    particlePositionDataArray = new ParticlePositionData();
    particlePositionDataArray.position = particles.position;
    }

    string jsonData = JsonUtility.ToJson(particlePositionDataArray);
    string filePath = Path.Combine(Application.dataPath, "particlepositiondata.json");

    using (StreamWriter writer = new StreamWriter(filePath))
    {
    writer.Write(jsonData);
    }

    Debug.Log("Particle positionss saved to: " + filePath);
    }
    }