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

Support for decals/paths? #403

Open
lorddevereux opened this issue Oct 9, 2023 · 1 comment
Open

Support for decals/paths? #403

lorddevereux opened this issue Oct 9, 2023 · 1 comment

Comments

@lorddevereux
Copy link

I'm looking to implement decals and paths on the terrain - essentially simple path/road textures which are blended in place of the strongest texture at that particular point. The road position would (ideally) be defined as a series of x/z positions and then mapped in the shader or projected. I need the texture to rotate along the path of the road, as the texture includes white lines/tyre ruts/etc. I don't need physical shapes for the paths (except the heightmap level). To illustrate the sort of thing I want:

Screenshot from 2023-10-09 15-32-01

I don't want to add meshes for the roads/paths if I can help it because it would add a lot of triangles and be full of Z-fight errors. I'm also happy to get stuck in and experiment. But I wonder if I could ask if you had any advice about how best to implement this sort of behaviour.

My initial thoughts were to add the road texture as one of the TextureArray layers, and then blend it using a splatmap. However, I can't figure out how I would progressively rotate it (in the xz axis) to create curves in the road. I thought I could use a spare layer of a splatmap to hold a rotation in radians for the texture to be rotated at that vertex, but that wouldn't work for multiple roads because of the tiling:

Screenshot from 2023-10-09 15-45-12

I also wondered about the Godot decal plugin, and stamping road tiles like a decal (I could live with that being slightly blocky) but that only seems to work with meshes. Perhaps what I want to do is too advanced, and I shall have to settle for generating meshes in Blender. Or, perhaps there is another way to project the texture on to the terrain to create decal-like behaviour, in a separate shader.

Any ideas are welcome!

@Zylann
Copy link
Owner

Zylann commented Oct 9, 2023

That would be nice to have, but I have no time dedicated to work on this currently.

I wonder if I could ask if you had any advice about how best to implement this sort of behaviour.

I also don't know how it would actually be rendered. Only road systems I know still use meshes or at least some kind of extra drawing, and are a bit complicated, especially when having to cobble it up with GDScript.

My initial thoughts were to add the road texture as one of the TextureArray layers, and then blend it using a splatmap

That wouldn't work at all because that doesn't contain direction information and will lack precision, it would end up the same as yet another paintable ground texture, which is not going to give you the result you want.

I also wondered about the Godot decal plugin

No need for plugins, Godot already has a Decal node built-in. But for roads I'm still not sure how it would work. If your goal is to not create any geometry, you could eventually work out a solution without even touching the terrain plugin, by placing "road tiles" using decal nodes? But if you want full spline support with any number of bends and intersections then that's an order of magnitude more complex to implement.

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