• 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
1
Question by Bombshell93 · Apr 18, 2013 at 02:01 PM · renderingbatchingdrawinginstancing

how should I approach drawing thousands of projectiles in a bullet hell?

I've found it difficult to find help in this regard as I know nothing of how to handle unity's drawing in script.

I know my way around graphics programming for the most part, if the option is available I'd draw the projectiles via hardware instancing (with a custom instance layout so I can define a per instance colour and UV offset) and I would like to draw them using a shader of my writing.

I'd prefer an article or deep tutorial as I'd rather learn than copy.

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

1 Reply

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

Answer by TonyLi · Apr 18, 2013 at 02:33 PM

If you're targeting DirectX 11, you could look into TC Particles (http://u3d.as/content/arthur-brussee/tc-particles/4gn) or develop something similar. Someone developed a similar DX11 system that's free, too: http://forum.unity3d.com/threads/172553-DX11-Particle-System-Free. There's also Unity's Shuriken particle system. They wouldn't give you per-projectile collision, but it could work depending on your needs. You could just do a single SphereCast() that encompasses the particle effect to see if it hits anything.

If you're targeting lower end platforms, what about using a single texture/mesh? Again, you wouldn't get per-projectile collision detection, but it really depends on your needs.

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 Bombshell93 · Apr 18, 2013 at 02:43 PM 0
Share

I've got collision detection covered, I've written physics engines in the past and this doesn't exactly require complex hit boxes, I'll be handling collision via a spatial hashmap with the projectiles in, each object capable of being hit by the projectiles will get their relative areas projectiles from the spatial hashmap and test against them, I'm doing it this way in particular as I imagine there will be less entities than projectiles. Also I'm targeting lower end platforms, my PC itself is a bit dated only boasting a GTX 260 so I cant run most of DX11. what do you mean by using a single texture/mesh? do you mean batching? if so is this possible in unity free and how would I do this?

avatar image TonyLi · Apr 18, 2013 at 03:11 PM 0
Share

Using a single texture is an ultra low-tech, inexpensive approach that may or may not satisfy your needs. In a 2D game, you just draw a texture with transparency that contains a ton of bullets, or a texture atlas with multiple frames that you can animate. Then apply this to a plane that moves in the direction of the shot. In 3D, you could put it on one or more spheres. You could even apply some animated scaling or rotation for effect.

I guess you could say it takes advantage of Unity Free's dynamic batching, since it's only using a single texture/material. But it's even more rudimentary than that, and may not be sophisticated enough for what you need. Then again, the best solution is the simplest one that gives you the effect you want, right?

avatar image Bombshell93 · Apr 18, 2013 at 03:17 PM 0
Share

well I was intending to use a texture atlas anyway, my concern is handling the geometry, I don't want a gameobject for each projectile for obvious reasons (its a complete waste of resources) I'm just not sure how to draw efficiently in script, I made the assumption that batching didn't work in script, if batching does work in script them by all means thats a solution found.

avatar image TonyLi · Apr 18, 2013 at 04:08 PM 0
Share

Batching works by geometry (and material), whether it's script-controlled or not. $$anonymous$$y single-plane or single-sphere suggestion uses only one mesh with one material, but then again it has its limits.

avatar image Bombshell93 · Apr 18, 2013 at 04:38 PM 0
Share

if by 1 mesh you mean 1 big mesh then I don't know how I would move the projectiles around, but I'm assu$$anonymous$$g by 1 mesh you mean multiple instances of 1 mesh, which I'm most likely to do, the camera being orthographic I can just use images and billboard planes.

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

12 People are following this question.

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

Related Questions

The combined mesh is different between static-batched objects? 0 Answers

Why aren't my particle systems batched? 1 Answer

Batching runtime instanced Objects 0 Answers

Dynamic batching stops when I disable "cast shadow" 0 Answers

Do statically batched meshes need to have the same pivot point(not position)? 0 Answers


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