Mitovo Posted January 4, 2017 Share Posted January 4, 2017 Hi all,I've tried googling, and I saw the question was asked back on the GG site, but the link wouldn't load... Thought I'd ask here.Has anyone ever put together a shader for multi-texture, using either vertex blending, or perhaps a splat-map type setup?I was thinking of working on some assets using something like that, but am not sure if T3D would support such a thing. Quote Link to comment Share on other sites More sharing options...
Azaezel Posted January 4, 2017 Share Posted January 4, 2017 Haven't had time to do more than a bit of basic research on the subject at present, but if somebodys interested, to save em a bit of hunting:https://github.com/GarageGames/Torque3D/blob/274bfb2b5012a73fe862c5a5fb1c4aa99bac0128/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp#L1215-L1267Would be the vertex coloration end, so a variant on that would be with different textures presumably being lerp(basetexture,chaneltexture,colorchanel); Quote Link to comment Share on other sites More sharing options...
Duion Posted January 4, 2017 Share Posted January 4, 2017 What is the purpose of multi texture blending? Quote Link to comment Share on other sites More sharing options...
JeffR Posted January 4, 2017 Share Posted January 4, 2017 It's similar to how the terrain texture blending works. In fact, that's one of the most common ways to control which textures are where on the terrain - by changing the vertex color values - and is similar to what we do with our terrain.For more specific examples, it allows you to do stuff like having, say, a brick floor material, and then additional texture maps/materials that blend in as needed like, say, water and snow.So you'd have your brick floor on your ground, and then by painting vertex color values, can dictate spots to have water and snow accumulation, letting you pick specific parts of the ground to have water puddles, or snow piles.This can be extrapolated to practically anything. Stone wall with greenry growth or grime, cracks in concrete, etc. Because you select what parts of the surface have the various blends, it allows you to take a common material, and apply minor changes via the blends, adding lots of detail as needed and also helps combat the 'repeating texture' effect. All in all, a very powerful tool for artists to work with to make their scenes unique and interesting. Quote Link to comment Share on other sites More sharing options...
Duion Posted January 5, 2017 Share Posted January 5, 2017 I don't see the much use yet, since if you model objects you can have individual textures with everything you can imagine. Quote Link to comment Share on other sites More sharing options...
Johxz Posted January 5, 2017 Share Posted January 5, 2017 So @JeffR this is something like texture overlay? but with better control of blend? Quote Link to comment Share on other sites More sharing options...
JeffR Posted January 6, 2017 Share Posted January 6, 2017 Kinda.This part of a video from UDK shows it off a bit:iAvupgMlvKE One of the advantages this method offers is a single material, but nearly infinite variations in surface. This is especially useful in cases where you have a bunch of prefab parts to make buildings. Obviously if you just used the same peices with the same textures, it becomes really repetitive, but having a bunch of different textures uses more memory and adds draw calls. So you could go in there and using one material, paint grime in various spots, breaking up the repetition without tons of additional memory use and draw calls.The thing that separates it from a simple texture overlay is you can use the normal maps as a contributor, so as the video shows, is when he paints the sand/water, it accumulates in between and at the edges of the tiles first, which is more realistic, and then the flat surface areas. You can also mix and match a few different materials, or have it offset the verts in the very shader to have sand accumulation actually raise off the surface for more depth, etc.It's a pretty flexible technique. Quote Link to comment Share on other sites More sharing options...
Azaezel Posted January 6, 2017 Share Posted January 6, 2017 Should note the vertx painting approach specifically (as oposed to a splatmap, which would be a 5th texture where you reference rgba for your blend ops) does require a higher than normal polycount for lookup, pretty much by definition. Quote Link to comment Share on other sites More sharing options...
JeffR Posted January 6, 2017 Share Posted January 6, 2017 Yeah, how detailed you can get with the painting is 1:1 with how dense your verts are, even on flat surfaces, you'd need to have them modeled as a grid. Quote Link to comment Share on other sites More sharing options...
Duion Posted January 6, 2017 Share Posted January 6, 2017 So you need to add more vertexes for it to work smoothly? Lets assume you have a wall that is juts 4 vertexes, how you gonna blend that?I wonder how it works that you have one material? I mean you have multiple ones like with the terrain.It looks a bit like the megatexture approach where you can paint it like you want and in the end it gets baked to one megatexture. Quote Link to comment Share on other sites More sharing options...
JeffR Posted January 6, 2017 Share Posted January 6, 2017 Lets assume you have a wall that is juts 4 vertexes, how you gonna blend that? It'd be like if you had a terrain block with only 4 verts. Each corner could have the blend effect applied on it, but it would influence the entire quadrant of the mesh in that corner. I wonder how it works that you have one material? I mean you have multiple ones like with the terrain.It looks a bit like the megatexture approach where you can paint it like you want and in the end it gets baked to one megatexture. Sort of. You're still only using one actual material. As with the video, they weren't swapping back and forth between brick, water and sand. It was one material with multiple diffuse, normal and spec textures, each set associated with a vertex color value. You paint blue on the vertex and it blends the default texture with the sand texture for example. So you're only using one actual material, and you don't actually bake anything into a final texture, it's handled runtime in the code. Quote Link to comment Share on other sites More sharing options...
Duion Posted January 6, 2017 Share Posted January 6, 2017 So how many textures can you blend with that method? One for each color? Red, blue, green? Quote Link to comment Share on other sites More sharing options...
JeffR Posted January 6, 2017 Share Posted January 6, 2017 Yep. You basically get your base textures, then can do a sub material per color channel. Quote Link to comment Share on other sites More sharing options...
Duion Posted January 6, 2017 Share Posted January 6, 2017 So you can only do 3 materials with that? Does not sound that good to me. Currently I use the vertex paint for adding diffuse color to the textures, this gives you an individual diffuse color tint for every polygon in the level without adding materials or textures etc. This seems to be a better use of the vertex paint to me. Quote Link to comment Share on other sites More sharing options...
Mitovo Posted January 7, 2017 Author Share Posted January 7, 2017 Should note the vertx painting approach specifically (as oposed to a splatmap, which would be a 5th texture where you reference rgba for your blend ops) does require a higher than normal polycount for lookup, pretty much by definition. I actually prefer the splatmap approach, as it gives far more direct control, but vertex blending works as well, though it can really look like vertex blending if you're blending across a large polygon. Not that anyone but someone who knows what vertex blending is would look at it that way lol.I'd worked out a node setup in Blender that uses a splat map approach and it's awesome. Thing is, I don't know how to translate that into a format T3D would understand, and sadly baking to a single texture tends to result in really low resolution texturemaps, unless you make them all huge; especially on large objects. Quote Link to comment Share on other sites More sharing options...
Mitovo Posted January 7, 2017 Author Share Posted January 7, 2017 So you can only do 3 materials with that? Does not sound that good to me. Currently I use the vertex paint for adding diffuse color to the textures, this gives you an individual diffuse color tint for every polygon in the level without adding materials or textures etc. This seems to be a better use of the vertex paint to me. I've seen up to 4. Base texture, then R, B and G channels. Also, it's not a binary, mutually exclusive matter of "which is better". Horses for courses.If you're looking for the ability to change the coloration of the same texture across a surface, and that's all you need, vertex color is ideal.If you're looking for having up to 3 or 4 different textures on a single object, multi-texturing is ideal. If you want the best of both worlds, you could probably mix both together - use a splat map for the multi-texture part, and then vertex color to change the tinge. I've mixed these two in Blender, but again, not sure how that would apply to a material in T3DA single project can use both for different things. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.