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 radwan92 · May 25, 2015 at 11:08 PM · renderingtiledepthisometricsorting

Isometric tiles depth

Hey!

I'm trying to create an isometric game using isometric tilesets (rather than actually achieving isometry through the camera). Tiles are being placed on layers. Every layer is a single mesh. Every tile is a quad. Layers are based on object's depth - for example: grass = layer 0; bottom part of stone block = layer 1; top part of stone block = layer 2. Layers provide us some depth, but nothing really helpful (character and the wall).

alt text

The problem is I can't set rendering order basing on player's position because we can't really determine whether player is behind the wall or in front of it. (If each stone block was a single object we could set Z/sorting layer simply basing on Y/X position. But that's really impractical and performance hungry solution).

I've come up with an idea of rendering tiles column by column with layer's in mind. Here is what I mean:

alt text

  1. All tiles in a column aligned with Y axis are being rendered (Y descending). After an entire column is rendered we jump to the next one.

  2. If there are more layers present at given (X,Y), they are being rendered from the bottom to the top. So, if 3 layers use tile (1,2), we render them as follows: layer 0 (the lowest - ground), layer 1 (bottom part of the stone block), layer 2 (top part of the stone block).

  3. Same as 2.

  4. If there is an object (player in this case) on a given tile, it is rendered as if it was next layer.

  5. Just like in 2 and 3 (to make thing clear).

Question: Is it a viable solution? I was thinking about using a shader that would somehow set tile's rendering queue basing on its position and layer level. However, I have never written any shader so I don't know if it is actually possible.

Is there any other approach I could take to solve this?

Any help would be appreciated (as well as pointing me in the right direction). Thanks!

charpres2.png (163.9 kB)
c1.png (179.4 kB)
Comment
Add comment · Show 7
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 maccabbe · May 25, 2015 at 11:13 PM 0
Share

Seems easier to just define the tile layers based on how close they are to the front. Group tiles using a diagonal line (left to right), since the tiles closest should always be drawn before tiles behind them. The character then just needs to have a layer higher than the diagonal he is standing on but smaller than the diagonal in front of him.

avatar image radwan92 · May 25, 2015 at 11:18 PM 0
Share

@maccabbe Well, I'm not sure if I understand you correctly, but that would require creating as many layers as there are rows (or even more). Also, what about standing behind 3 levels high wall? (3rd level block could be technically placed on tile over player, thus player will be rendered in front of it - wrong). Also the number of meshes increases greatly. I really like your solution though, for sure it's worth putting some thought into it.

avatar image maccabbe · May 25, 2015 at 11:40 PM 1
Share

alt text

Player is on tile that is layer 5 so his layer is 4. This causes him to be drawn before the tile he is on (layer 5) and the tiles behind him (including the tile and wall on layers 7)

Tiles in front of player are draw before player. This causes player to be "behind" wall on layer 3, otherwise no interaction.

Player's layer and entire walls are based only on the tile they are on. Even though the wall on layer 3 covers a tile on layer 7, the entire thing is layer 3. If the player was to step onto the wall on layer 3 his layer would be 2, just like if he were to step on a tile on layer 2.

47044-example.png (34.7 kB)
avatar image radwan92 · May 25, 2015 at 11:48 PM 0
Share

Yeah, this solution is really neat, but I fear one thing - high number of meshes. Assigning different layers require different renderers which mean 1 mesh for every layer out there. I'm not sure if it poses a real problem, but I'd like to stick to the most performance efficient solutions. If I won't find any more efficient solution I'll use this one for sure. Thanks alot!

avatar image maccabbe · May 25, 2015 at 11:55 PM 0
Share

If you do every row then it will require more meshes. It probably won't be a significant number but of you run into problems you can do it for just the tiles near the character. In this case it seems like only tiles 7, 10, 11 (from your method) could block the player. So make make one mesh with all the tiles and put it behind the player. $$anonymous$$ake two more meshes (one for tiles 7&10 and one for tile 11). Then the displayed order would be map then player, then 7&10, then 11.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

19 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

Related Questions

Problems with Depth Normals and variable CullMode 0 Answers

Set depth buffer for z test on mobile platform 0 Answers

How to have sorting order/layers used when Z depth is the same? 1 Answer

Rendering to DepthTextureMode.Depth 0 Answers

Selecting a tile with z as y isometric tilemaps? 3 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