TheDuckCow / godot-road-generator

A godot plugin for creating 3D highways and streets.
MIT License
311 stars 15 forks source link

Easier material customization with overlay lane markers #145

Open TheDuckCow opened 7 months ago

TheDuckCow commented 7 months ago

Right now, the material that comes with the Road Generator default texture that is made to work with the exact layout necessary for the road generator. However, because it is a full color image, it means anyone wanting to bring in their own texture (e.g. asphalt) would need to completely design their own custom shader, or pre-create their own custom material. Both are possible, that's why the affinity template is provided, but it could be more convenient.

The proposal here is to default a default setup which would establish road markings with a transparent background, so that it is more of a straight overlay to be applied on top of an existing material. This would let someone use a two-way tiling asphalt (or brick, or dirt) texture that goes in any direction using global coordinates, while still using lane markings with UV layout. We could also provide an additional UV layer which is a simpler left-to-right seamless mapping, regardless of the number of lanes (though, there will be pinching if there are lane changes, or stretching if the texture provided doesn't match the number of lanes it was made for).

Open to other suggestions, but the above two would already open up the door for easier material customization.

TheDuckCow commented 4 months ago

In my more recent project here, I realized that we could use decals for this purpose (potentially). That's how I was able to easily get the finish line onto the road for the race start/end. We could potentially create some rules for adding road decals from a preset folder or built in presets for all things like arrows lines on the road. The main thing would be how to ensure such textures don't bleed onto other objects (Im sure there's some settings on how decals work, would just need to review it).

Also worth calling out: decals are Godot 4 only, it seems.