• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by krsunny · Aug 26, 2011 at 04:48 AM · prefabsspacestars

Place stars (prefabs) in random locations

Hi,

I would like to generate a 3d star field and I was thinking some prefabs of basic small white spheres with a self illuminating shader applied to them would be a good start. Whats a good way of inserting prefabs in random locations or feel free to suggest a better way to go about creating a nice 3d star field.

Thanks

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Eric5h5 · Aug 26, 2011 at 06:00 AM

Use a particle system.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image krsunny · Aug 26, 2011 at 08:25 AM 0
Share

Are you suggesting that I generate them then freeze them in place? Not sure I would want them moving otherwise.

avatar image Rennat · Aug 26, 2011 at 04:02 PM 0
Share

Using an ellipsoid particle emitter with a very large ellipse encompassing the entire playable area (generates them everywhere) very large energy (how long each will last) and no forces applied (they wont move) will probably do what you want

avatar image Eric5h5 · Aug 26, 2011 at 04:32 PM 1
Share

Rather than a very large number, use "infinity" for the energy, so the particles don't expire.

avatar image Rennat · Aug 26, 2011 at 04:44 PM 0
Share

I didn't realize infinity was an option. sweet!

avatar image mitchmeyer1 · Apr 18, 2017 at 02:26 PM 0
Share

What do you think would be less expensive: A 3072x2304 starfield png (see$$anonymous$$g random stars) or using a particle system like you say with 3 or 4 like 25x25 star pngs for particles?

I currently use the former but am trying to cut all the fat off my system

avatar image
0

Answer by Rennat · Aug 26, 2011 at 04:09 PM

I recommend going the particle system route but if you want to try the prefab way you could use something like this

javascript

var starPrefab : GameObject; // set in the inspector var starCount : int = 100; var starFieldSphereSize : float = 1000;

 function Start () {
     for (var i=0; i < starCount; ++i) {
         var position = Random.insideUnitSphere * starFieldSphereSize;
         Instantiate(starPrefab, position, Quaternion.identity);
     }
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by DaveA · Aug 26, 2011 at 05:56 AM

How many stars are you wanting to make? I'd use billboarded simple planes (sprites) if it's a lot

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image krsunny · Aug 26, 2011 at 08:24 AM 0
Share

Lots. I will give this a shot, thanks.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Outer Space Visuals 5 Answers

Spherical Light for Solar System Illumination 0 Answers

Unity 3D Starfield Particle System Help 1 Answer

How to make a universe scenery 2 Answers

Render 3D object to a 2D texture at runtime 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges