cocos2d-js icon indicating copy to clipboard operation
cocos2d-js copied to clipboard

texture issue with setDepthTest(true)

Open Xiaoyang-Huang opened this issue 9 years ago • 4 comments

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

but when I move the DrawNode to the between of barbarian and tile map. the texture of barbarian will break the DrawNode like his: texture_issue

the issue looks caused by VertexZ. it also happened on object in tiles. compare top of two grasses, and barbarian behind a high tile texture_issue3

Xiaoyang-Huang avatar Jul 04 '15 16:07 Xiaoyang-Huang

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)

stevetranby avatar Jul 06 '15 21:07 stevetranby

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.

Xiaoyang-Huang avatar Jul 12 '15 15:07 Xiaoyang-Huang

@pandamicro Please take a look for this bug on web, I need you help~ Thanks

Xiaoyang-Huang avatar Jul 23 '15 12:07 Xiaoyang-Huang

@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;)

ZhangMenghe avatar Aug 19 '15 08:08 ZhangMenghe