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

How to tell the engine to load textures underneath blocks with alpha #17

Closed
Nesh108 opened this issue Mar 13, 2017 · 4 comments
Closed

Comments

@Nesh108
Copy link
Contributor

Nesh108 commented Mar 13, 2017

I have been playing around with the testbed and found the leaf.png, which is supposed to represent the leaves for a tree. I tried applying it to the ground and this was the result:

leaf-textures

It looks like the engine loads only 1 level of blocks (probably for optimization) but that fails when the block hasAlpha: true.

@fenomas
Copy link
Owner

fenomas commented Mar 13, 2017

Hi,

I think two separate properties are overlapping here. When you register a material, you specify a hasAlpha to tell whether that material's should have transparency. The engine only uses this for deciding what kind of (babylon) material to create.

Separate from that, when you register a block type you specify whether it's opaque. This is the setting that determines whether stuff underneath the block gets culled at the meshing stage. From looking at the image, I think all you need to do is make the leaf blocks not [edited] opaque, and it'll do what you expected.

(Note that blocks also have a property solid - this one is for physics, and has nothing to do with rendering.)

Let me know if this works!

@Nesh108
Copy link
Contributor Author

Nesh108 commented Mar 13, 2017

I will try now. But yeah, I was a bit confused with the difference between opaque, solid and so forth.

So:

  • Opaque: is whether you can see through it or not
  • Solid: is whether you can go through it or not
  • Fluid: is basically the opposite of solid (but will be extended when we implement the fluid functionality)

Correct?

If so, shouldn't the leaf not be opaque?

@fenomas
Copy link
Owner

fenomas commented Mar 13, 2017

Yes, you have it right, and the leafs should not be opaque (that was a typo 😬 ).

Basically they're all really single-purpose properties. I mean, it probably won't make any sense to have a block that's fluid but solid, or that's opaque but has alpha, but the engine looks as each property in different ways so I have them all separate for now.

@Nesh108
Copy link
Contributor Author

Nesh108 commented Mar 13, 2017

Sweet, I just set opaque: !hasAlpha and that works like a charm!

@Nesh108 Nesh108 closed this as completed Mar 13, 2017
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