Triplanar texturing in UPBGE
Here is the author’s original post on Blender Artist, but since there is no much explanation about this texturing technique here is some explanation, just in case you don’t know this technique.
Tri-Planar Texturing is a method of projecting a texture on a mesh without having texture seams or stretched textures. The texture is projected from each axis (local or world) and then blended together. This is especially useful for (dynamically created) terrain or other procedural generated meshes. There’s no UV mapping needed with this technique.
I’m not goint to write much about technical questions (if you want to read more about it you can do it here) but just about this interesting blender file example provided by our friend BluePrintRandom.
Firts thing and the most obvious, this is blender related and more specific, this is about UPBGE Fork, so you need to use it in order to working properly.
Once you get the file and opened in UPBGE, you will notice a textured cube with some sort of scratched texture. Maybe it looks simple but if you look very close you will notice that texture seams are unnoticeable.
This is because this technique projects a texture on each axis object (X, Y and Z) and then it blends in 45° angles, so any seam will be blended with the other projected textures in the same object.
One thing to take into account is that this technique does not works well with surfaces / objects with 90° angles. It is mandatory to have 45° angles between faces in order to get this working, as shown in the animated gif on the left.
I’m going to apply a material to this texture, because ash you might noticed, there are no materials in the node tree texture, ash shown in the picture below.
Here is how to put a material in this node tree:
And here is an example how tri-planar texturing works while editing geometry.
So, this is the example file from BluePrintRandom and I wanted to make a Multi Texture Tri-Planar material by using this template and the result was this:
And the node tree is a bit more complex, as shown in the picture below.
Well I hope you find this usable in your projects, I’m very unfamiliar with the node editor so you might expect some errors in this file, thanks for stepping by!