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

Multiple materials for smooth terrain (multiple surfaces) #104

Open
blockspacer opened this issue Jan 13, 2020 · 2 comments
Open

Multiple materials for smooth terrain (multiple surfaces) #104

blockspacer opened this issue Jan 13, 2020 · 2 comments
Labels
enhancement Needs research Not trivial / needs prototyping / translating paper into code

Comments

@blockspacer
Copy link

blockspacer commented Jan 13, 2020

Separate meshes may be useful if game needs to support large number of textures

May require transition meshes for seams between materials like in https://github.com/bw2012/UE4VoxelTerrain/wiki/Draft

Any ideas will be helpful (where to start with implementation?).

related to
#69
#93

@TokisanGames
Copy link
Contributor

This MIT UE4 plugin supports 255 textures. You might also look at this implementation.
https://github.com/Phyronnaz/VoxelPlugin

@Zylann
Copy link
Owner

Zylann commented Jan 13, 2020

I thought Phyronnaz's plugin had 255 textures because 1) it uses texture arrays, and 2) because Unreal can make use of a deferred pipeline (so it can do things Godot can't).
Texture arrays will definitely be the way to go, and it's also part of the Transvoxel approach. At least, that's what I was planning to do with this mesher.

It is possible to use a large amount of textures with a single material, but if a mesher needs to produce a mesh to be rendered with multiple materials, then it needs to output multiple surfaces. It then becomes obvious those won't blend.
VoxelMesherBlocky does that, which allows opaque and transparent surfaces to exist within the same mesh. The only thing the mesher needs to do is to work with two sets of vertex arrays, or more depending on needs. The output struct has room for this.

The transvoxel mesher still has a bit of pending work though (and haven't finalized the depth branch yet). Also, I'm slowing down a bit now, I've been full steam on voxels for weeks but it's on my free time. Knowing myself it's going to stop for a while before the next sprint :p

Edit:
another issue I have currently with the transvoxel mesher is that to handle seams between blocks of different LOD I had to use the COLOR attribute completely, which leaves very little room for any texturing information, because Godot's renderer hardcodes available attributes. It is possible that the first attempt at texturing from voxel data will be relatively limited, and won't be the only one (just see how many shaders I had to develop for the heightmap plugin xD) so this is a lot less trivial than it was for blocky meshers.

@Zylann Zylann changed the title smooth terrain: separate meshes + transition meshes for seams Multiple materials for smooth terrain (multiple surfaces) Jan 14, 2020
@Zylann Zylann added Needs research Not trivial / needs prototyping / translating paper into code enhancement labels Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Needs research Not trivial / needs prototyping / translating paper into code
Projects
None yet
Development

No branches or pull requests

3 participants