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

Question: Enclosing and texturing underneath isosurface when using transvoxels #647

Open
Ladvien opened this issue Jun 7, 2024 · 3 comments
Labels

Comments

@Ladvien
Copy link

Ladvien commented Jun 7, 2024

When applicable, please describe your setup:

  • Terrain type: VoxelTerrain
  • Mesher: VoxelMeshTransvoxel
  • Generator: VoxelGeneratorGraph
  • Stream: None
  • Plugin version: 1.2.0
  • Godot version: 4.2.2-stable
  • OS: Linux, Manjaro

To kick it off, thanks to Zylann and all contributors for such a well put together voxel toolset. I'm a data engineer by trade, so I don't know the game dev world, but I do know good OSS when I set it. Great work! And much gratitude.

With that, I hope I've a simple question. Do you have a recommended way to texture the area below the isosurface when using transvoxels?

Specifically, the area highlighted red in the screenshot. The goal is make the under side of the isosurface look like an enclosed volume, textured to look like a cross-section of undug earth.
diggin_skelly

I don't need fine details, but was curious if someone had a recommended route?

@Ladvien Ladvien changed the title Enclosing and texturing underneath isosurface when using transvoxels Question: Enclosing and texturing underneath isosurface when using transvoxels Jun 7, 2024
@Zylann
Copy link
Owner

Zylann commented Jun 7, 2024

The module doesn't have that feature, and there is no plan to have it. If your camera is looking through meshes, they will be cutoff, and there is no quick way to fill that section the same way the rest of the mesh is generated.

I'm not sure if there is an easy way to do this. It seems that you'd have to implement a custom meshing algorithm (which requires modifying the module or write your own mesher in your own module), where the side would have to use marching squares to be filled in. But that's a lot of work.
I wonder if exploiting the background with a shader could work rather than trying to make a mesh that fits exactly, but you'd have to differenciate that from the sky...
You could change the generator to actually produce air such that there would be no mesh crossing near the camera, instead there would really be an infinite "gap" through the world that exists just to see through the side. That would probably not be perfect since Transvoxel cannot render sharp corners so the ledge would not be a sharp cut. This would exploit the fact your game has apparently 2D gameplay. But if not, you're stuck with the complex problem.

@Zylann Zylann added the question label Jun 7, 2024
@Ladvien
Copy link
Author

Ladvien commented Jun 7, 2024

Hey Zylann,

Wow, thanks for the wicked fast reply.

Ah, understood. Yeah, I'm pursuing destructable terrain in fairly controlled viewport for more casual gaming.

I'm not sure if there is an easy way to do this. It seems that you'd have to implement a custom meshing algorithm (which requires modifying the module or write your own mesher in your own module), where the side would have to use marching squares to be filled in. But that's a lot of work.

Meh. I've been looking for an excuse to march some squares. We'll see if I've the time.

Think this would be of interest to anyone else? Or think I'm alone out here?

I wonder if exploiting the background with a shader could work rather than trying to make a mesh that fits exactly, but you'd have to differenciate that from the sky...

That was my first kludge thought, but couldn't think of a good way to execute that'd looked polished. I'll explore it a bit.

You could change the generator to actually produce air such that there would be no mesh crossing near the camera, instead there would really be an infinite "gap" through the world that exists just to see through the side. That would probably not be perfect since Transvoxel cannot render sharp corners so the ledge would not be a sharp cut. This would exploit the fact your game has apparently 2D gameplay. But if not, you're stuck with the complex problem.

Clever. Going to play with this idea a bit.

Ultimately, I'd like to find something that isn't too fragile, looks good, and keeps the brilliant fast nature of the transvoxel implementation you already have. I don't know etiquette for this repo--feel free to close this, but if ok, I'll report back in the thread if I find a solution.

And once again, thanks for the brilliant module!

@Anyeos
Copy link

Anyeos commented Jul 27, 2024

Hello, If I understood you well, what I would do is making another VoxelTerrain with the generator negated, I mean, when the generator makes a solid voxel on the other one it will be an air gap. So I could use another material for that parts. The same approach for water, sand, and things that are normally part of a terrain but I need to handle that independently. As you mentioned digging sand I dont expect the player to dig the limits or the "solid" parts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants