This is the first time I’ve reached the Texture Sampler limit…then again I’ve never put all that much effort into making high quality landscapes before.
So i’m trying to wrap my head around optimizing my materials. I already append AO and Rough materials into one texture. I also including the height in the Diffuse Alpha. I also read that using the same Texture won’t count as another sampler…but in practice, it still counts as another Sampler.
This is getting frustrating. I’m trying to get the best out of this without resorting the Texture Atlasing. Its way to time consuming and really doesn’t seem like the most dynamic option.
So here is my Material Function. Right now it says it has 6 samplers. I have two samplers taking in a texture object…one texture object. The Texture object isn’t counted as a sampler, but when I remove one of the samplers, it says there are 5 samplers used. So whatever that person meant by “Using the same texture doesn’t increasing the count” is complete ********.
I even tried not using a texture object and it still reads out as 6. What the hell am I missing? I’m already frustrated with the fact there is a Sampler Limit (No thanks to you Mr SM3).
Quick note on the sampler count: A default material actually does have some texture samplers even though you can’t see them in the material editor. One is for Vertex Fog I think, and I believe between 2-4 are actually for deferred lighting and reflections. If you switch to an unlit model and turn ‘vertex fog’ off (I think you can only do the latter on Translucent materials), you’ll start with zero texture samplers.
There are two fixes for this really, the first (and up until recently, only) option is to use less textures. But obviously that’s not what most folks want to do so here’s number 2:
Use Shared Texture Samplers! They’re a new feature that was added in 4.7 I believe that basically allows you to bump the 16-sampler limit all the way up to 128. Definitely an overdue feature but a welcome one all the same. I don’t think there’s actually any documentation on these (gonna do a wiki tomorrow now I think about it), but basically click the texture sampler, and where it says ‘Sampler Source’, changed it to use a shared sampler type. You’ll get a much higher limit that way.
Obviously 128 texture samples per-pixel might actually crush you, but you probably won’t ever reach that.
Thanks for that Jamsh! I’m surprised I’ve never stumbled upon that feature in 4.7. I’ll give it a look.
During the time I posted this to now, I made a base Atlas Pack. Dirt 1, Dirt 2, Grass and Cliff. It works flawlessly aside from the MipMap problem. But with the option you mentioned, I can use the Atlas as a base and work in some variations. Should keep the sampler low and still create a visually appealing affect.
What exactly do you mean here? Do you mean that duplicating a Texture that is already inside of a Material will increase your Texture sampler count? This should not be happening and if it is, it is almost certainly a bug. I am not at my PC so I can not check for myself but can you post a picture of your entire shader setup so we can better see what you are doing maybe there is something that was missed. Also I would strongly suggest that stay away from using Material Functions in Landscape Materials as they can over complicate your Material making debugging issues harder to find. Note that you do not have this, this is just my opinion on the matter.