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

Using channels and accessing data #86

Closed
LuFlo opened this issue Nov 15, 2019 · 3 comments
Closed

Using channels and accessing data #86

LuFlo opened this issue Nov 15, 2019 · 3 comments

Comments

@LuFlo
Copy link

LuFlo commented Nov 15, 2019

Hi,

I've read in the documentation that one can save data in up to 8 channels in each voxel, which is great! I assume the channel is specified in the last argument in VoxelBuffer.set_voxel which also used for the the voxel type (smooth or blocky).

So my first question is: Do I have to do a second (or multiple) call on the same coordinates for populating the channel data?

My second question is: How do I access the data when the mesh is generated, especially in shaders? I mean, in gd-script I could theoretically ask the voxel-stream again for the channel data, but I didn't find a way for accessing the data in a shader.

I'm using the VoxelLodTerrain with a custom Stream written in GD-Script.

Also thanks a lot for this awesome tool :-)

@Zylann
Copy link
Owner

Zylann commented Nov 18, 2019

Do I have to do a second (or multiple) call on the same coordinates for populating the channel data?

Currently yes. If you use C++ you can get away the mild performance hit by caching the channel buffer. In GDScript the language is pretty slow to begin with so the overall impact is probably less relevant.
I'm aware that 8 bytes per channel is quite small so in the future I may add a channel size setting (so 16-bit values could be used in a single channel).

How do I access the data when the mesh is generated, especially in shaders? I mean, in gd-script I could theoretically ask the voxel-stream again for the channel data, but I didn't find a way for accessing the data in a shader.

Voxel data doesn't end up in vertices yet. It may be added at some point in some of the meshers as one or two IDs in the COLOR attribute maybe, so that you can tell which textures to mix from a texture array for example.

@LuFlo
Copy link
Author

LuFlo commented Nov 18, 2019

Thanks for the answer, 8 bits is plenty for now, i just want to define 3-4 different materials for the voxel, I also stumbled upon the issue about getting terrain data #83 .

I'll try to adapt the mesher to my needs. I assume voxel_mesher_dmc is the default mesher for the LOD-terrain?

@Zylann
Copy link
Owner

Zylann commented Nov 18, 2019

Yes DMC is.

@Zylann Zylann closed this as completed Jan 11, 2020
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