minetest / minetest

Luanti (formerly Minetest) is an open source voxel game-creation platform with easy modding and game creation
https://www.minetest.net/
Other
10.87k stars 2.04k forks source link

World aligned textures on .obj files #14912

Open Githubismalware opened 4 months ago

Githubismalware commented 4 months ago

Problem

World aligned textures are a good solution to stairs not aligning to blocks. However, when the stair is a mesh representing e.g. a slope, it will still look ugly because it's not possible to world align its texture.

Solutions

Make it possible to world align mesh textures.

Alternatives

Make it possible to rotate its texture 180 degrees when it is upside down without needing to define another node?

Additional context

I was talking with a programmer on git about world aligning slopes in their mod, but he said that it's not possible to do that with .obj nodes (he didn't mention other mesh formats).

hecktest commented 3 months ago

There's two ways this request can be interpreted; one is just scaling and shifting the UVs depending on the node's position, the other is autogenerating the entire UV map in a way consistent with nodeboxes. Both could be useful. Most people would want both flags enabled, but some advanced use of the "scale+shift only" case is possible, or even just "shift only".

Non cardinal plane triangles should be assigned to and projected from the closest plane by angle, similar to how it works in Radiant and related map editors: qer

For practical reasons it might be prudent to bias the angle snap in the 45 degree case to favor the floor and ceiling, in order for 45 degree ramps to maintain texture alignment with the surrounding floor. Better yet, give this a flag too.