Giter VIP home page Giter VIP logo

Comments (25)

vogonistic avatar vogonistic commented on July 25, 2024

Screen Shot 2013-02-04 at 23 44 19

Same issue, there is supposed to be logs inside the gray leaves that aren't rendered.

from voxel-engine.

max-mapper avatar max-mapper commented on July 25, 2024

thanks for the report. transparent textures are brand new as part of https://github.com/shama/voxel-texture so we still have some kinks to work out.

cc @shama

from voxel-engine.

shama avatar shama commented on July 25, 2024

This is actually a voxel mesh problem :) Notice how you can see the grass blocks through the leaves? It's because only the outward faces of the voxel mesh are displayed. We need to detect if a voxel is transparent and render the surrounding voxel faces.

from voxel-engine.

max-mapper avatar max-mapper commented on July 25, 2024

ahha!

from voxel-engine.

vogonistic avatar vogonistic commented on July 25, 2024

Would the solution for this affect other special blocks as well?

Seems to me there are some different types of blocks:

  • Full collision and opaque (dirt, stone)
  • Full collision and transparent (glass, leaves)
  • No collision and transparant (water)

On top of that there are other special cases like:

  • flowers (centered sprite, no bounding box)
  • stairs (special shape, special collision shape)
  • snow (special shape, no collision)

That's off the top of my head, but I'm sure there are more cases.

from voxel-engine.

 avatar commented on July 25, 2024

This bug is why I originally left transparent textures turned off. I think the mesh generator will need to be aware of which blocks have transparent textures so those regions can be split out into separate meshes.

from voxel-engine.

max-mapper avatar max-mapper commented on July 25, 2024

technical details: chunks right now are 32_32_32 but neighboring chunks don't know about each others data so we would need to give the mesh generator a 1 voxel border around each chunk, so 34_34_34. doing this would be a bit more costly in RAM/CPU depending on how its implemented. an alternative solution would be to keep chunks isolated from each other if the chunks are solid and then have special chunks with special rules for other kinds of voxels

from voxel-engine.

vogonistic avatar vogonistic commented on July 25, 2024

If you always draw the outer meshes (edit: of the chunks), is there any problems other than drawing more than strictly needed?

from voxel-engine.

max-mapper avatar max-mapper commented on July 25, 2024

@vogonistic not sure I understand your question. each chunk has exactly 1 mesh, the mesh is just a 3D object that represents the rendered chunk of voxels.

from voxel-engine.

vogonistic avatar vogonistic commented on July 25, 2024

@maxogden I'm just trying to figure out why'd you want to have a 1 voxel border around each chunk.

It seems to be that the only thing you could get out of that is knowing that a particular voxel's outer border doesn't have to be drawn because that face is hidden by another voxel. If the only penalty of drawing that face even though it's hidden is a little wasted time, it sounds like it could work just as well.

I know next to nothing about 3D, so feel free to just tell me that I'm wrong.

from voxel-engine.

max-mapper avatar max-mapper commented on July 25, 2024

@vogonistic for solid blocks it doesnt matter but for transparent/semi opaque blocks its important because if you have 2 block faces next to each other that are supposed to be 30% opaque then they will appear as 60% opaque

from voxel-engine.

vogonistic avatar vogonistic commented on July 25, 2024

@maxogden Ah. That makes sense.

from voxel-engine.

max-mapper avatar max-mapper commented on July 25, 2024

did this get fixed?

from voxel-engine.

vogonistic avatar vogonistic commented on July 25, 2024

I have a solution that is slower than the current greedy mesher. I'll try to work on it tonight and get you a pull request tonight that can be discussed.

from voxel-engine.

max-mapper avatar max-mapper commented on July 25, 2024

Cool! We could probably just have the engine automatically use the slower mesher on chunks that have transparent voxels and the greedy on ones that dont

Sent from my iPhone

On Mar 5, 2013, at 12:17 PM, Kent [email protected] wrote:

I have a solution that is slower than the current greedy mesher. I'll try to work on it tonight and get you a pull request tonight that can be discussed.


Reply to this email directly or view it on GitHub.

from voxel-engine.

vogonistic avatar vogonistic commented on July 25, 2024

I was thinking about that. The biggest performance decrease is because I have to check for each material if it is transparent or not. The current algorithm keeps a list that each block must be checked against and then temporarily sets a high bit that is removed at the very end.

I'm going to test setting the high bit for transparency outside of the meshing algorithm. Material 0x0001 is the first loaded, but without transparency. 0x8001 would be that same material but transparent. Feels lika a fulhack though.

Does anyone have a better idea?

from voxel-engine.

max-mapper avatar max-mapper commented on July 25, 2024

I think @chrisdicksinson wanted to hack on bit masks which might work here

On Tuesday, March 5, 2013, Kent wrote:

I was thinking about that. The biggest performance decrease is because I
have to check for each material if it is transparent or not. The current
algorithm keeps a list that each block must be checked against and then
temporarily sets a high bit that is removed at the very end.

I'm going to test setting the high bit for transparency outside of the
meshing algorithm. Material 0x0001 is the first loaded, but without
transparency. 0x8001 would be that same material but transparent. Feels
lika a fulhack http://en.wiktionary.org/wiki/fulhack though.

Does anyone have a better idea?


Reply to this email directly or view it on GitHubhttps://github.com//issues/34#issuecomment-14464181
.

from voxel-engine.

vogonistic avatar vogonistic commented on July 25, 2024

@chrisdickinson Got anything implemented on this?

from voxel-engine.

vogonistic avatar vogonistic commented on July 25, 2024

If anyone wants to test the alternative I've been working on, it's available here: https://github.com/vogonistic/mineflayer-voxel/blob/master/transgreedy.js

from voxel-engine.

max-mapper avatar max-mapper commented on July 25, 2024

@vogonistic @chrisdickinson @shama

IMO this is the last big annoying bug in voxel.js.

@jeromeetienne recently wrote https://github.com/jeromeetienne/threex.transparency/blob/master/threex.transparency.js#L48 which shows how to update the render order within three.js (you update renderDepth on each mesh on each tick, where renderDepth is the distance from the camera to the object). You also have to set material.transparent = true and material.depthWrite = false

but the problem we have is that we might have multiple transparent things per mesh since we chunk a bunch of different voxel types together in a single mesh, so if I'm understanding it correctly the renderDepth stuff doesn't really solve our problem.

in @vogonistic's greedy mesher it draws transparent faces last but I think that won't update when you walk around to the other side of a chunk, right? (I'm a 3D noob, still trying to wrap my head around this stuff)

from voxel-engine.

max-mapper avatar max-mapper commented on July 25, 2024

oh yea and here's a potentially helpful thread from a voxelgamedev subreddit: http://www.reddit.com/r/VoxelGameDev/comments/yn0el/dealing_with_transparency/

also cc other smart 3D people @mikolalysenko @hughsk @substack

from voxel-engine.

max-mapper avatar max-mapper commented on July 25, 2024

also I just found http://halfblock.grumdrig.com/ which is a pretty good minecraft clone in WebGL that is one giant file http://halfblock.grumdrig.com/main.js

it looks like it also uses chunks to render like we do, but I'm having a hard time following the translucent rendering code path to figure out how it works

from voxel-engine.

mikolalysenko avatar mikolalysenko commented on July 25, 2024

Here is a solution, but it isn't three.js compatible. This mesher supports both ambient occulusion and transparency, and it should be straightforward to modify it to include composite shapes like stairs or torches:

https://github.com/mikolalysenko/ao-mesher
https://github.com/mikolalysenko/ao-shader

The downside is that it uses a custom optimized vertex format which won't play nice with three.js.

from voxel-engine.

shama avatar shama commented on July 25, 2024

Awesome! I wonder what it will take to make it three.js compatible so we can use those now. Looking forward to diving into those libs. FWIW, I've got a solution to this almost ready for some PRs but it's not an ideal solution as it currently meshes twice (once for opaque and once for transparent). See voxel/issues#3

from voxel-engine.

deathcap avatar deathcap commented on July 25, 2024

#103 integrates mikolalysenko's solution above, using the custom vertex format with gl-modules, removing the three.js dependency. Fully transparent voxels have their high bit set before meshing. Separately, translucent/semi-transparent voxels are rendered in a second pass (though properly ordering the drawing is trickier: voxel/voxel-mesher#9)

from voxel-engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.