Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 michael-cameron · Oct 02, 2018 at 09:57 PM · runtimelevel-design

In Game level builder - Combine Mesh? Or Stick with Cubes?

Hi All,

I have been working on a prototype for a couple of weeks now, and I have a basic system that let's me snap a door to a wall of 1x12x1 cubes that disable rendering to put a door in place of the wall.

This feels very inefficient, especially if I have the user create more walls that are a bunch of 1x12 rectangles. Is there a more efficient way of doing this? I see articles of using Combine Mesh, but I don't see a way of taking the mesh apart after it has been combined. Taking the point where I create a wall, and its combined but then want to put a door on the wall.

I could also be looking at this all wrong. What has been your experience in building maps at run-time?

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
0

Answer by toddisarockstar · Oct 03, 2018 at 03:43 AM

if proficiency is your worry, the way the meshes are combined or parenting shouldn't make much difference. one thing that could slow you down is the amount of faces.

if you are building with cubes and you have a big flat wall of cubes. the video card needs to process each cube's faces individually. if you are planning to build large levels, this puts strain on the Video rendering and slows down FPS.

instead if you scale one cube to match the height and width of the wall, then set the tiling so the texture repeats, you could have an identical wall and the video card only needs to render one cube and you will render much much faster.

remember size/scale doesnt matter when rendering info is sent to the video card. a small cube takes the same effort to process as a large cube.

This is a problem i found making my last level generator when levels got big.

you should consider an algo to detect and replace the long strait walls with single streched cubes.
if you want help with how to setup an algo for something like this let me know

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 Bunny83 · Oct 03, 2018 at 10:27 AM 0
Share

This answer is actually misleading. The number of faces is actually not that much important. Of course the more faces the more work has to be done by the GPU, but it can process millions of triangles without any issues. However seperate objects is a real problem. Seperate objects require seperate drawcalls / SetPass calls unless it can be batched. Though static batching only works for objects that never move and are marked as static. Dynamic batching has a lot restrictions and only work for very small object (only a few vertices). Dynamic batching als gets very inefficient if you have a lot objects. It's generally more efficient to have a few large meshes with just a single material than having many small meshes with many different materials.


Replacing long strips of quads with a single one doesn't really help much and is just way too complicated to work out. $$anonymous$$inecraft for example renders every cube face as a quad. Though it works on chunks of 16x16x16 cubes which form a single mesh. Rendering seperate cubes or even faces would totally kill performance. The bottleneck is the CPU to GPU bus if you have too many seperate drawcalls. Also setpass calls are quite slow. So having many different materials require to change the shader / shader parameters between the draw calls. That's why it's more efficient to use a single material with a texture atlas.

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.

Follow this Question

Answers Answers and Comments

92 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Export objects to a .3DS file at runtime 1 Answer

Game runs painfully slow in Unity 0 Answers

WWW.texture vs WWW.textureNonReadable 1 Answer

Overwriting a prefab in runtime? 1 Answer

Problem with texture swapping at runtime (Android only) 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