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
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.
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
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.
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 ._.