TokisanGames / Terrain3D

A high performance, editable terrain system for Godot 4.
MIT License
2.01k stars 114 forks source link

Create a lowpoly shader #422

Open CsloudX opened 1 month ago

CsloudX commented 1 month ago

Description

maybe there was a way to create lowpoly style terrain in current state. but i don't know to do it. if it can: can make a toturial in docs how to do this? if not: can implement this feature?

TokisanGames commented 1 month ago

Certainly possible. You have to write a shader to do it.

image

In the picture above, I also enabled the heightmap debug view. The shader code is in our repo. Customize the shader to texture the terrain as you like.

Hacking on the main shader:

image

Here it is with texture UVs at 0.001, though this is sloppy. You see large squares due to nearest texture filtering, and triangle panels due to flat normals. Between vertices you see the shader blending textures and the texture blocks don't line up with the mesh triangles. This isn't the true low poly look, and is more costly than a low poly shader. It should be like the grey image above.

image

If using the main shader, what should be done is:

CsloudX commented 1 month ago

@TokisanGames Oh, Thanks. The terrain look well. and maybe should improve with textures.

CsloudX commented 1 week ago

HTerrain has this feature, wish has some help: https://hterrain-plugin.readthedocs.io/en/latest/#lowpoly image

TokisanGames commented 1 week ago

What is on that documentation page is how to get flat normals. We've already discussed how to show flat normals on our terrain above.

All that is remaining is painting with simple textures if you want the look in the picture.

Also see https://github.com/TokisanGames/Terrain3D/discussions/435

This issue and #435 already show how to do low poly shaders. It will remain open until someone makes a premade one for our extras directory.