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 Omti1990 · Sep 26, 2018 at 09:11 PM · meshmaterialstexturestilesgrid based game

How to texture huge tile grids?

Hello,

I'm designing a grid based 3d game. My grid can potentially get several thousand tiles wide and deep and maybe 5-10 layers high at most.

Now the general recommendation for large tile maps seems to be to create your own custom mesh instead of instantiating several million planes or cubes. There's tutorials for that kind of thing it's handled.

But how do I actually texture the result? There seems to be a semi-hard cap for textures of about 4000 x 4000 pixels, but in a 1000 x 1000 tile map that'd leave me with 16 pixels for each tile. So not an option.

Now there's two options I'm currently seeing myself capable of implementing, but both seem to be suboptimal.

The first would be to create a million materials for that mesh with clamped textures (and 0 alpha edges) which are maneuvered into place by using offset and tiling, so each tile would have it's own materials. The problem is I'm not convinced this is actually significantly more effective than just spawning a million cubes if not worse. (If I'm wrong it'd be good to know)

The other option would be to give up on having one mesh for my field and just move and instantiate the field as needed and run everything over the game logic. I'd have like 4000 cubes that I'd move under the camera and reskin as needed. The problem with this is that it'd be a huge pain in the ass to program and it'd put hard limits on my zoom.

I'm thinking about having one material for each field/tile type and just having those appear where they're needed while all other tiles would be transparent for the material. But I have no clue how I'd go at that.

Or are there other potential solutions?

Comment
Add comment · Show 2
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 Wolfie · Sep 27, 2018 at 04:22 PM 1
Share

Are we talking about voxels here? If so then the usual way to solve this is to use a texture atlas and dynamically build the mesh in chunks through code. Each voxel's stored material just sets the relevant triangles' UV coordinates to the appropriate place in the atlas. Definitely don't have a bazillion cubes unless you're going to combine meshes at runtime, that way you avoid having too many draw calls and can optimise in many other ways too.

avatar image Omti1990 Wolfie · Sep 28, 2018 at 05:21 PM 0
Share

So I wouldn't build one large texture for the whole thing, but I'd have one texture and just position the vertices of each triangle on that graphic with the UV coordinates? So I can have several vertices mapped to the same position on the texture?

alt text

Sort of like in this picture? (I mean I'm using squares here but that's the idea.)

Alright, I can imagine this would work. But isn't there some sort of limit on vertices?

baddrawing.png (14.9 kB)

1 Reply

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

Answer by Pakillottk · Sep 28, 2018 at 12:01 AM

Hi, I don't know exactly the visual style you are trying to achieve but I'm thinking two possible ways to solve it: 1) You make a texture with a palette of colors and then you match parts of your grid mesh into the correct color coords. (Could work for a toon-looking game I think...) 2) You make a single texture with some squared tiles (for example: one for grass, one for rocks...) and then you assign the uvs of your mesh to match the desired texture at specific sections. The resolution could be big for this texture but you only need one for all the objects. This have been done before, check Doom megatextures for example.

Comment
Add comment · Show 2 · 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 Omti1990 · Sep 28, 2018 at 05:35 PM 0
Share

Wouldn't it make more sense to have several materials ins$$anonymous$$d? I imagine the settings I'd want for each texture would be different.

Anyway the idea is to have something like a civilisation 5 map only with square fields and 3d. alt text

That's the editor scene view on my 3600 cube field that I want to replace/expand. (The blue fields are random water areas I spawned to test something else)

Either way if I go with the mapping idea, won't I run into the Vertex limit? As I understand it you can't have more than 65000 in a grid. Which considering I need like a million fields isn't exactly a satisfying solution consindering it only gives me 16250 fields.It's 5 orders of magnitude better than just instantiating cubes, but it'd be nice if I only needed one mesh (if possible).

Either way thank you for your advise.

uglyfield.png (206.2 kB)
avatar image Omti1990 · Sep 30, 2018 at 11:37 AM 0
Share

Okay, so the solution I've picked is to generate meshes for each texture/field type. With ~60000 vertexes maximum for a mesh this gives me 15000 fields for each mesh object. It's helpful that parts of meshes don't need to be connected.

In a 1000 by 1000 grid this means I require a $$anonymous$$imum of 67 meshes, but I think/hope that's not a problem. I also don't need to go with a megatexture as a result and can have diverse shaders.

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

104 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 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

Random Tiling Textures 0 Answers

How to Best Implement a Tileset 1 Answer

can we use same material and same mesh with different texture scaling in the project.....??????? 1 Answer

Graphics Performance Question 2 Answers

Does loading a Resource load that resource's dependencies? 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