Comments (5)
Hey, really good question. The short version is that I think I have this implemented, but I'm not personally using any alpha textures in my project right now so I'm not sure if it works.
The relevant code is, to pass in a texHasAlpha
flag when registering the material via noa.registry.registerMaterial. The mesher should then see that property here when building the terrain mesh, and set the hasAlpha
property for the Babylon texture.
Can you try that and let me know if it works? It's a while since I looked at this, so BJS may have changed. Also the above is assuming that there's just one texture with alpha - if you wanted to apply a separate texture for the opacity then I don't have any code for that yet, though I don't think it would be very hard to support.
from noa.
Setting hasAlpha
enables alpha testing but not alpha blending. I was able to "fix" it by setting mat.opacityTexture
to the same texture, and I found it works the same if I use ambientTexture
instead of diffuseTexture
. But then I hit a rendering bug. Some blocks get clipped when viewed from specific angles:
from noa.
Okay, the texture parameters get into an area I'm not very familiar with. My recollection is that setting hasAlpha
used to be sufficient, but only if something else was true, or somesuch. Babylon has a couple of different settings related to opacity and I'm not sure what the "correct" combination is. It's easy to change, if only we know what the working combination of settings is.
For the clipping thing, do both the grass and the brown bricks in that screenshot have some kind of alpha enabled? Clipping like that is expected if multiple parts of the terrain need alpha blending (since terrain voxels are merged into large per-chunk meshes), but I don't know why it would happen for opaque meshes. Can you describe more about what's going on?
from noa.
I finally got some time to look into this issue one more time. If I set opacityTexture
for images without alpha, then it may get clipped. I don't understand why, possibly a bug in babylon.
from noa.
Closing this for now, but if it resurfaces please do file it. (Maybe as a new issue, since I think Babylon has versioned up since this was filed, so the behavior's probably changed..)
from noa.
Related Issues (20)
- Is there any way to use this as an es6 module? HOT 10
- Support gamepad input
- Outdated comment + note on blockMesh registration HOT 2
- Alpha blended mesh ordering issue HOT 2
- Terrain remeshing bug when block is neither solid nor opaque HOT 3
- Custom voxel occasionally leaves one side after removal. HOT 4
- UV offsets wrapping at edges of blocks HOT 2
- object meshing bug HOT 6
- Meshing with non-opaque blocks is incredibly slow + block textures with alpha dont work HOT 4
- custom renderMaterial performance (for animated textures) HOT 2
- Supporting noa HOT 2
- Does NOA support child meshes? HOT 3
- webgpu? HOT 2
- How to define new objects in NOA engine. HOT 5
- Optimal octreeBlockSize
- What is the best way to manually build worlds? HOT 2
- render all blocks even if covered HOT 1
- How to import an obj model?
- refresh the registry on the go HOT 2
- Making a set world.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from noa.