Transparency#29
Conversation
|
Whats the speed like on this? |
|
@MountainLabz Here's the perf from the Terrain test scene I added - its a duplicate of the old one, just with transparent blocks instead. The transparent code will skip a column if no transparent bits are set and only check bits where the Transparent mask is set, so this scene is sort of a worst case scenario. Non-transparent terrain:
1000 iterations took 131144us (131.144ms)
vertex count: 7201
Transparent terrain:
1000 iterations took 960640us (960.64ms)
vertex count: 11374
|
|
Woah, thats quite the performance cost. Thats like 7x more time. |
|
@MountainLabz The change in my commits works for Transparent Blocks against Transparent Blocks, but if you really need the perf you can do the change below for all the faces. Basically just repeat the same code as for the opaqueMask with a binary or for the transparentMask. With this method transparent blocks will render fine against opaque blocks, its just that the face will be culled between differing transparent blocks. It should be pretty much as fast as the Opaque terrain if you use this method in exchange for the inaccuracy. The fix I have in the pull request takes a lot longer since you need to check the block IDs of all the neighboring transparent blocks to see if they are the same. faceMasks[baIndex + 0 * CS_2] = ((columnBits & ~opaqueMask[aCS_P + CS_P + b]) >> 1) | ((columnBits & ~transparentMask[aCS_P + CS_P + b]); |



Add support for transparency, based off of https://github.com/Inspirateur/binary-greedy-meshing.
Add an example to showcase the transparency working, its the 2nd tab example (MESH_TYPE::TRANSPARENT_TERRAIN)