Skip to content

[ndarray] Missing voxel faces at chunk boundaries, 34x vs 32x #13

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

Closed
deathcap opened this issue May 13, 2014 · 0 comments
Closed

[ndarray] Missing voxel faces at chunk boundaries, 34x vs 32x #13

deathcap opened this issue May 13, 2014 · 0 comments
Labels

Comments

@deathcap
Copy link
Member

screen shot 2014-05-12 at 5 50 02 pm

with #12

voxel-mesher/mesh.js:

function computeMesh(array, voxelSideTextureIDs, voxelSideTextureSizes) {
  var shp = array.shape.slice(0)
  var nx = (shp[0]-2)|0
  var ny = (shp[1]-2)|0
  var nz = (shp[2]-2)|0

so voxel/index.js generate() (ndarray version max-mapper/voxel#18) does:

  // To fix the display gaps, we need to pad the bounds
  lo[0]--
  lo[1]--
  lo[2]--
  hi[0]++
  hi[1]++
  hi[2]++

e.g., with 32x chunks, game.voxels.getBounds(0,0,0) is from [0,32), (1,1,1) is from [32,64), etc — but the voxel array is actually 34x, with the voxels on each side one outside of the chunk bounds. -1, 0, ... 32, 33. The boundary voxels are generated twice, in each adjacent chunk.

Generating twice is fine for the simple example generators but causes difficulty in adapting voxel-land for ndarray. Not sure how to best handle this, currently it generates 32x chunks (opts.chunkSize) but this creates empty voxel face borders at chunk boundaries since 34x is expected. Padding the boundaries with air:

  for (var k = lo[2]+1; k < hi[2]-1; k++)
    for (var j = lo[1]+1; j < hi[1]-1; j++)
      for(var i = lo[0]+1; i < hi[0]-1; i++) {
        data.set(k-lo[2], j-lo[1], i-lo[0], fn(i, j, k))
      }

alters ambient occlusion:

screen shot 2014-05-12 at 5 47 06 pm

@deathcap deathcap added the bug label May 13, 2014
deathcap added a commit that referenced this issue May 13, 2014
deathcap added a commit to voxel/voxelmetaverse that referenced this issue Jun 4, 2014
…voxel-bucket, voxel-carry, voxel-chest, voxel-chunkborder, voxel-clientmc, voxel-commands, voxel-console, voxel-daylight, voxel-decorative, voxel-drop, voxel-engine, voxel-fluid, voxel-furnace, voxel-gamemode, voxel-harvest, voxel-health-bar, voxel-health-fall, voxel-inventory-crafting, voxel-inventory-creative, voxel-inventory-hotbar, voxel-land, voxel-mine, voxel-pickaxe, voxel-quarry, voxel-recipes, voxel-sfx, voxel-skyhook, voxel-start, voxel-use, voxel-voila, voxel-webview, voxel-wool, voxel-workbench, voxel-zen

deathcap/kb-bindings-ui@4611bf3 0.3.2
deathcap/kb-bindings-ui@8003e55 Fix mouse bindings, use same filtered_vkey algorithm from game-shell (whitespace to '-')
voxel/voxel-blockdata@1cefa9b Rename main file to blockdata.js
voxel/voxel-bucket@b5f9e75 Add browserify transform, rename main file to bucket.coffee
voxel/voxel-carry@a464d4d Rename main file to carry.js, update keywords and deps
voxel/voxel-carry@4021329 0.1.1
voxel/voxel-chest@02f5d32 Add browserify transform, keywords, rename main file to chest.coffee
voxel/voxel-chunkborder@a083721 0.3.0
voxel/voxel-chunkborder@bd922a0 Add translation for chunk padding 4, voxel-mesher ^0.11.0
voxel/voxel-chunkborder@7e17f51 Size borders from game.chunkSize directly instead of voxel array minus padding
voxel/voxel-clientmc@c020c98 Show chunks directly, now that 16x consistent network->client (but still have to transpose XZY)
voxel/voxel-clientmc@45df38a Move chunk key calculation out of loop, now always the same (16x)
voxel/voxel-clientmc@b4c6e0a Revert "Move onDecompressed to web worker"
voxel/voxel-clientmc@90a4b4f Change chunkSize to 16
voxel/voxel-clientmc@3dda63f Add placeholders for all missing blocks
voxel/voxel-clientmc@bb239b2 Add most opaque solid blocks
voxel/voxel-clientmc@8204375 Update to voxel-texture-shader ^0.3.1, show texture load URL error
voxel/voxel-clientmc@93d7227 Add missing block block
voxel/voxel-clientmc@ad5039b Add some more blocks
voxel/voxel-clientmc@223bc16 Remove voxel-land dependency, move to blocks.js
voxel/voxel-clientmc@f3375bc Move onDecompressed to web worker
voxel/voxel-clientmc@15d081a Rename main file to clientmc.js
voxel/voxel-clientmc@bd1e314 Convert to JavaScript
voxel/voxel-clientmc@55ecdc5 Convert web worker to JavaScript
voxel/voxel-clientmc@b908dbf Remove debugger no-op in worker
voxel/voxel-clientmc@61fae3e voxel-plugins is not optional
voxel/voxel-clientmc@1ee7e22 Use document location hostname for default WebSocket URL
voxel/voxel-clientmc@b5f3424 Show logging in voxel-console
voxel/voxel-clientmc@dd8739a Enable voxel-clientmc by default
voxel/voxel-clientmc@38b8d1c Add voxel engine demo instance
voxel/voxel-clientmc@65b0ab4 Update for new chat message packet name
voxel/voxel-clientmc@cc8fa52 Add ndarray chunk format support
voxel/voxel-clientmc@4026f0b Change to use built-in browserify 4 zlib (browserify-zlib)
voxel/voxel-clientmc@e8c3d97 Update for new packet names in node-minecraft-protocol >0.12.1
voxel/voxel-clientmc@2d967d8 Update for API changes after minecraft-protocol 0.12.1
voxel/voxel-commands@871b903 Add browserify transform, rename main file to commands.coffee
voxel/voxel-commands@9a1cd28 0.2.0
voxel/voxel-commands@ecd9cfc Parse JSON for .item tags
voxel/voxel-console@ff4366d Add browserify transform, keywords, rename main to console.coffee
deathcap/voxel-daylight@03637fc Add browserify transform, rename main file
deathcap/voxel-daylight@c0bd1a3 0.1.1
voxel/voxel-decorative@c947626 Rename main file to decorative.js
voxel/voxel-decorative@0c8c132 0.1.0
voxel/voxel-drop@cf36422 Add browserify transform, rename main file
deathcap/voxel-engine@216be65 Add chunkPad option, update to voxel-mesher ^0.11.0
voxel/voxel-fluid@67e59f5 Rename main file to fluid.js
voxel/voxel-furnace@cfb0b3c Add browserify transform, keywords, rename main file
voxel/voxel-furnace@5aa0f54 0.1.0
voxel/voxel-gamemode@47569ef Add browserify transform, rename main file
voxel/voxel-harvest@b850423 Add browserify transform, rename main file
voxel/voxel-health-bar@c42fa42 Rename main file to health-bar.js
voxel/voxel-health-fall@75f719d Rename main file to health-fall.js
voxel/voxel-health-fall@02868da 0.1.0
voxel/voxel-inventory-crafting@1eb0188 Add browserify transform, rename main file
voxel/voxel-inventory-creative@6e3d02f Add browserify transform, rename main file
voxel/voxel-inventory-creative@5a4d101 0.1.0
voxel/voxel-inventory-hotbar@5c291a7 Add browserify transform, keywords, rename main file to hotbar.coffee
voxel/voxel-inventory-hotbar@0cfd94e 0.4.0
voxel/voxel-inventory-hotbar@06efec8 Add game-shell compatibility
voxel/voxel-land@acf1f4b Add double padding to fix missing faces on borders. Closes voxel/voxel-land#13
voxel/voxel-land@fc2ebb6 Revert "Try padding chunk boundaries with air, ref voxel/voxel-land#13"
voxel/voxel-land@3ce6bb6 Try padding chunk boundaries with air, ref voxel/voxel-land#13
voxel/voxel-land@86bd922 Consistently reference chunkSize from opts, instead of game
voxel/voxel-mine@d62d7c5 Add browserify transform, rename main
voxel/voxel-mine@95f90ee 0.3.0
voxel/voxel-pickaxe@7f8f5b1 Add browserify transform, rename main
voxel/voxel-pickaxe@1a8ed46 0.2.0
voxel/voxel-quarry@da57025 0.2.0
voxel/voxel-recipes@ce2fe11 Rename main to recipes.js, add keywords
voxel/voxel-recipes@b9c7297 0.3.0
voxel/voxel-sfx@922e6df 0.1.0
voxel/voxel-sfx@9211104 Rename main file to sfx.js
voxel/voxel-skyhook@5f9fa20 0.1.0
deathcap/voxel-start@a2ec261 Rename main file to start.js
deathcap/voxel-start@e1f9f92 0.1.0
voxel/voxel-use@28eabea Add browserify coffeeify transform, rename main file to use.coffee
voxel/voxel-voila@793c760 Add browserify transform, keywords, rename main file
voxel/voxel-voila@a9e7dba 0.2.0
voxel/voxel-webview@1f49c28 Add keywords, rename main file to webview.js
voxel/voxel-webview@6fcd42f 0.1.0
voxel/voxel-wool@21638a5 Add browserify transform, update keywords, rename main
voxel/voxel-wool@272ba35 0.1.0
voxel/voxel-workbench@aaa3927 Add browserify transform, rename main file
voxel/voxel-workbench@8821577 0.2.0
voxel/voxel-zen@17fc631 Add browserify transform, and rename main file
voxel/voxel-zen@44f2a3e 0.1.0

Commit message generated by https://github.com/deathcap/lmno-cl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant