Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transgreedy mesher #16

Closed
deathcap opened this issue Feb 23, 2014 · 4 comments
Closed

Transgreedy mesher #16

deathcap opened this issue Feb 23, 2014 · 4 comments

Comments

@deathcap
Copy link
Collaborator

Add a mesher with transparent material support

voxel-texture 0.5.7+ and voxel-texture-shader 0.1.1+ now support semitransparent textures (screenshots in deathcap/voxel-texture-shader#7 (comment)), but the current meshers in 'voxel' do not. Testing with the 'greedy' mesher: placing transparent voxels on top of opaque voxels lets you see through the opaque voxels (xray effect).

@vogonistic developed a mesher called 'transgreedy' a while back, available here: https://github.com/vogonistic/mineflayer-voxel/blob/d2c541d3d83a3f16d55390b98668ce7e4a4ab1dd/transgreedy.js - it does seem to work in some cases:

screen shot 2014-02-22 at 7 09 25 pm

but needs more testing, so I haven't PR'd it yet. May need to be updated for the latest voxel-engine (last updated a year ago), or other fixes. Tentative list of problems I've noticed so far:

  • Uses wrong textures? Not sure if this is my bug (needs more isolation), but in my testing I've noticed leaves use the water texture (and so does water). As in the screenshot above. transgreedy sets the 16th bit if transparent, may need to be changed?
  • Placed transparent voxels still exhibit the xray effect — unlike the generated voxels in the above screenshot, which are fine. No idea what is going on here, but if I place the same voxels myself, it xrays:

screen shot 2014-02-23 at 12 30 11 am

  • Bottom face not transparent? (place voxel on ground, see through it)

screen shot 2014-02-23 at 12 33 47 am

  • Incessant flickering - overlapping faces?
@deathcap
Copy link
Collaborator Author

transgreedy hardcodes the transparent voxel types:

kTransparentTypes[16] = true

Fixing this (dynamically detecting transparent voxels, like voxel-texture., should fix most of the above problems.

deathcap added a commit to deathcap/voxel-texture-shader that referenced this issue Feb 23, 2014
deathcap added a commit to deathcap/voxel-texture-shader that referenced this issue Feb 23, 2014
deathcap added a commit to deathcap/voxel-engine that referenced this issue Feb 23, 2014
@deathcap
Copy link
Collaborator Author

Fixed the hardcoded transparent voxel types, but required changes to generate the list in the texturer and pass it to the mesher via voxel-mesh via voxel-engine. May be a better way to do this (set a bit in the voxel block ID?), and there are a few minor glitches, but it basically works:

screen shot 2014-02-23 at 1 08 14 pm

@vogonistic
Copy link

Cool that the mesher is coming in useful to someone. The reason I didn't commit it was because it ran a lot slower than the usual mesher and I think someone else was working on a faster version. I can't remember who right now though.

@deathcap
Copy link
Collaborator Author

Cool that the mesher is coming in useful to someone. The reason I didn't commit it was because it ran a lot slower than the usual mesher and I think someone else was working on a faster version. I can't remember who right now though.

Ah, yes; forgot about that. There is some discussion in this voxel-engine open issue: max-mapper/voxel-engine#34 - I think @shama was working on it, and @mikolalysenko has a working implementation in https://github.com/mikolalysenko/ao-mesher but it is not compatible with three.js, so it would require ndarray/gl-now integration voxel/issues#4 – which is probably a good idea anyway, but might be a ways off because of the number of three.js-dependent voxel.js-related modules that would have to update.

I went ahead and PR'd this transgreedy mesher as it is now, not perfect and may be replaced with ao-mesher, but it usable with voxel.js now ;) #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants