I’m using some Material Functions in my scene which require Texture Objects instead of the usual Texture Samples. With a Texture Object there only appears to be one output, which means I can’t re-use the same Texture Object in another part of the shader were I to hide away another map in the alpha channel (for example). This means my material has lots of Texture Objects which I wouldn’t normally need.
Is this just a fundamental limitation of Texture Objects? And why do Material Functions need Texture Objects anyway? Also, am I really making my shader more expensive (as well as more visually complicated in the Material Editor!) by having all these Texture Objects?
Hello Moroboshi!
Texture objects are pure textures and you have to sample them(“Convert” to Texture sample) to work with them as with Texture samples.
Simply plug-in object into sampler and you will get your common Texture Sample node.
The only input into a Texture Sample is for UVs? There doesn’t seem to be a way for me to input a Texture Sample into a Texture Object?
Not sure that would really give me what I want anyway, as at the moment I have all these Material Functions (albedo, normal, roughness, height, AO) each being fed by separate Texture Objects, as that’s the only input they seem to accept. The rest of my shader (the parts which aren’t feeding Material Functions) is much simpler, as I have half the number of Texture Samples due to me hiding the height and roughness maps in the alpha channels of the albedo and normal maps.
Essentially I’m wondering if there is any way to feed a Material Function with a texture sample, or something which gives me the same functionality.
Texture sample is processed texture object. Basically it converted into vector with 3 or 4 channels, so if you want to use texture sample as input in Material Function then just make constant 4 vector and plug in texture sample.
I don’t quite understand what exactly you trying to accomplish, but big pile of texture objects is the worst thing you can imagine doing in Material/Shader. It’s ever worse than hundreds of instructions.
I suspected they would be expensive, but I couldn’t find any other way to get my shader to work. Sadly I can’t attach a screen shot as the forum is coming up with a database error, so I’ll try to explain my set-up.
My landscape uses several LandscapeCoord planar map nodes and they’re cheap as they use Texture Samples, and I can set Texture Samples to use both Shared:Wrap mode and I can pack other maps into the Alpha channels.
However the LandscapeCoords don’t work for more vertical surfaces, as they texture stretching looks awful. Instead I’m using WorldCoordinate3Way Material Functions, as they project textures in all 3 axis. This solves my texture stretching, but Material Functions need to be fed with Texture Objects.
Basically I was looking for a way to swap out those Teture Objects for something cheaper, and something which I can use twice (so a single Texture Object could supply RGB for my albedo, and Alpha for my height or roughness). Texture Objects also lack the Shared:Wrap setting, which I gather speeds things up.
Oh, you can simply double click on node and change behavior. This node sample your objects anyway, you could cut out everything you need from WorldCoordinate3Way and paste into your material and then use Texture samples instead of objects