I’ve recently been toying around with ideas that really have no immediate purpose (As you do) and I felt the need to be able to paint upon meshes with really no limit to the number of textures I can use to paint and blend with, and not have to rely on aged Texture Atlas’s.
There has been for some time now a technology in both OpenGL and DirectX called Texture Arrays. Some quick research and I couldn’t find much of anything relating to how to get Texture Arrays working in Unity (Please, correct me below! ).
Then I stumbled upon Unity’s Texture3D. It sounds like Texture Arrays. But there it little to no documentation on it. The best I could find was a quick example from what appears to be the Unity Developer Aras himself, on a thread here. However the example is around rendering volumes from texture slices using Texture3D. I wonder if the shader could be modified to paint and blend the textures in the Texture3D using something like vertex colors on the mesh?
I don´t know about texture arrays, but you can can do a pretty good texture blending with a limited amount of texture using shaders. I remember creating a simple shader that let me simulate the terrain engine´s texturing system, however I only tried using 2 textures there.
The 3D-textures have the big disadvantage that they can only be created procedurally, but not be stored as a normal picture format that you could easily modify using image processing software. So either you create them from scratch and write your one save files via script or you write a code that automatically detects which depth is needed at which location. Also, this depth seems to be limited to 3D vfx, since all shown examples only show this one use. I´m not entirely shure as to how to use them for blending multiple textures on one object/shader.
I guess you could really do most of the stuff you´re looking for with shaders. Just create an array of textures (don´t know if that´s possible with shaders) and assign them to their respective UVs by looking up their alpha channel. This can be done by either creating a control texture from script that sorts the textures by alpha value or by letting the shader somehow do that using a mathmatic formula (Yeah, I´m rather new to shader scripting). Doing stuff this way would kill your transparency (if you need it), but you could compensate this using a seperate alpha texture showing the overall transparency/specularity/glossiness level of the object.
Thanks for the reply mate. Yes Texture3D would be used in conjunction with a shader to perform the painting and blending on to the mesh. However the problem with normal material shaders and Texture2D is that there is a very short limit on the number of textures you can push into a shader for blending.
My understanding is that you can write ant number of Texture2D’s into a Texture3D at runtime, procedurally. So there shouldn’t be a problem utilizing traditional images.
My guess is that one should be able to blend textures with a Texture3D almsot exactly the same way you would with normal terrain blending shaders. The key difference is that you reference data in the Texture3D instead of from a group of Texture2D’s.
I guess my key problem here is that there is just no information on Texture3D, nor am I very good at shader programming just yet. So its hard for me to run some tests. Was hoping someone with more skill in shader programming could provide some advice before I embark on putting effort into learning it all myself.