cocos2d-js
cocos2d-js copied to clipboard
texture issue with setDepthTest(true)
there are a tile map layer, a DrawNode, and a barbarian Sprite.
I use DrawNode follow mouse point to makr up which tile was selected.
but when I move the DrawNode to the between of barbarian and tile map. the texture of barbarian will break the DrawNode like his:
the issue looks caused by VertexZ. it also happened on object in tiles. compare top of two grasses, and barbarian behind a high tile
You'll either need to fully sort all tiles, sprites, or other nodes using topological sorting.
Or if you are using Native-only, or WebGL and not canvas, you can use the alpha discard shader with an appropriate alpha value (likely in your case 0.5 will work if all your textures transparent areas are all or nothing, on or off)
Hi, Steve, I tried fully sort all tiles, but seems not help for the issue. https://github.com/BrookHuang/SRPG here is my code, you can clone it as a test case.
@pandamicro Please take a look for this bug on web, I need you help~ Thanks
@BrookHuang Hi! I ran your project and it's surely bit odd. In my opinion, you could refer to our js-test/TileMap test/TMX ISO ZOrder, which may suit your occasion;)