Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Alekz · Mar 18, 2012 at 02:43 AM · proceduralprocedural mesh

Creating 3D representation of procedurally generated 2D tile map

I am trying to build a simple procedurally generated map, which basically is just a 3D representation of a 2D tile map; let's assume, for simplicity's sake, that there are only two types of tiles: "wall" and "floor".

alt text

Now I'm looking for a good way to build mesh of such map. My first (somewhat naive) attempt was to create walls by cloning and positioning a cube model (the floor is just one big plane mesh).

alt text

This is somewhat working, but now I get random dark lines between wall blocks (pointed by red arrow on the screenshot). Also, I don't like it anyway, because there always will be a lot of faces that will never be displayed, which is probably not very optimal.

So, the question is, what would be the best way to build such map? I don't want to just generate the whole mesh vertex by vertex, because later I will probably want to make models of wall blocks a bit more complicated, by adding some details to them. I thought about constructing the map by cloning not cubes, but separate faces (squares); I haven't tried that yet, but I'm not really sure if it'll help me with that "dark line" glitch. May be I should not just create group of cube/square clones, but rather combine them into a single mesh somehow? Or is there some other way I haven't thought about?

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 Eric5h5 · Mar 18, 2012 at 03:00 AM

You should use the Mesh class and construct the maze as a mesh, or a group of meshes. That's what I did with Realmaze3D...the walls, ceilings, and floors are quads built completely procedurally, whereas the details such as ladders, lights, and wall ornaments are meshes made in Blender. They are stored as an array of meshes in Unity, and the appropriate mesh data is copied into the maze mesh as needed. It's rather more complicated than just instantiating objects, but it's also far faster than having hundreds/thousands of separate objects, and there are no seams. The maze is broken into a number of smaller mesh sections, which are enabled/disabled based on the player's view, in order to provide custom occlusion culling (since it's impossible to use Unity's built-in occlusion culling in a dynamically-generated environment).

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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Procedural animated mesh 1 Answer

Shared Meshes, do they auto-update? 0 Answers

UV problem on procedural mesh generation 1 Answer

Why does this script put Unity into a not responding state? 0 Answers

How to apply PBR material to Procedurally generated Mesh? 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