Isometric vertexz problem with sprite

Hi friend i want to know if somebody can help me to resolve my problem
i wanna make a city simulator in a isometric way but i cant figure out what happened

as you can see, when the building is behind trees its work find vertex z but when i wanna create a building behind another building is like images lost her transparency

sorry for my english i hope someone can help me

It may be as simple as declaring the tile layer to use automatic vertexZ in the .tmx file for the layer. In Tiled you would give the layer a custom property “cc_vertexz” with a value of “automatic”

Otherwise the issue might be that you need to use the depth buffer with an alpha shader using discard. It is best to avoid using discard for performance reasons in the fragment shader, but it may be unavoidable in your case if you’re using the TMX classes and we use them without issue. If you can fully topologically sort all tiles and sprites and they all have fully opaque (or fully transparent) pixels then you wouldn’t have this issue.

Here’s another topic that may be related.

thanks a lot for your answers my friend but it seems that the only solution is to include the sprite in the tiles of the tilemap. So the sprite cant be animated easly

if i found another solution i will post here

thanks a lot!

It is actually possible to have a regular sprite display between two tiles in the same layer while also avoiding the transparency issue. It’s what we do actually in one of our games.

We do use the cocos2d::experimental::TMXTiledMap instead of the regular one cocos2d::TMXTiledMap.

In this screenshot you can see that we have floor tiles (z = -999), wall tiles (z = auto), and two sprites with player unit outlined in magenta and a machine. The sprites are children of the tilemap, but are not tiles themselves. You’ll notice we have the two sprites behind and/or in front of wall tiles (which exist in the same TMX tile layer with cc_vertexz property automatic). As I mentioned above this requires depth testing, setPositionZ, and using a alpha discard shader.

Feel free to post your relevant code changes to modify the cpp-test project or a new project such as prob that building image and what looks to be the TMXIsoZorder class.

any progress? is the issue solved already? please share your solution…

no my friend. I cant solved it, im too new here and i dont understand some things. Im trying with discard shader but i cant
sorry :S

Sorry to bother, but I’ve been going forth and back on this issue for about two months to no avail, repeatedly investing time that could be better applied in actual development instead of tedious research that keeps getting my hopes up with old solutions that don’t appear to work anymore ._.

Did you find a solution @robertnn ? Anyone?

hope someone can help with this soon, it sure would be greatly appreciated

cheers