Sampler Source -> Shared: Wrap and Shared: Clamp for Texture Objects too


I would want to ask you for adding the Sampler Source field to Texture Objects too, not only for Texture Sample nodes, as for a lot of functions we must use Texture Objects, it’s also easy to reach the limit of only 16 textures in a complex material.

Yexterday I read that the default texture sample is not Wrap only for keeping compatibility with old materials, so it wouldn’t seem to be a problem to have the option of being able of selecting the Texture Source for Texture Objects, right? Or they could be Wrap by default…

Thank you very much and best regards

You can double-click a material function to open it, copy the nodes into your graph, and change the texturesample nodes to shared.

Or you can create your own material function, or edit the material function itself. Material functions are intended to be pliable.

He wants the ability to directly set texture object to “Shared: Wrap” etc. and texture objects don’t allow that. Would be useful if they do.

While that would be nice, Im with Dementiurge.
Then again, being able to update the samplers inside a mat function trough a texture object would be a nice faster workaround.

You are always meant to use a TextureObject in conjunction with a TextureSample.
The TextureObject is the raw texture, it isn’t sampled yet. It wouldn’t make sense to specify a Sampler Source in the TextureObject.
It doesn’t matter how many TextureObject Nodes you have in your material. What matters is the amount of TextureSample Nodes with different Sampler Sources

the issue lies in the function that samples the Texture Object, not in the object itself

Hi all,

Some functions doesn’t allow to enter texture samples directly, even if you get the code and port it to your main graph.

A Texture Object is lways intended to be used with a Texture Sample, tha’s right, but a Texture Sample can be used without a Texture Object, so if we are forced to use a Texture Object in a certain function, we will consume one Texture Sample slot, as we can’t set it as Wrap.

So, I think the solution would be to be able to replace Texture Objects with Texture Sample, which we can’t do it for the moment, or to directly change the sampler in the Texture Object.

For a very fast example, but it’s similar to my problem: How could you use more than 16 texures in this material, in which you need to use certain functions to achieve what you want?:

(Yes, in fact, I have 7 layers on my material, every layer with a Macro lerp, so every one have two textures, and I want both of them with POM, so can’t we use a 7 Macro layered material with POM? or a simple 14 layered material with POM on every layer?)

In my opinion, there is only one unique and logical solution.


“so if we are forced to use a Texture Object in a certain function, we will consume one Texture Sample slot, as we can’t set it as Wrap.”
this still doesn’t make sense. the function will sample the object with a sampler, and the sampler will determine the sampler source.
do you have an example of a function where you’re forced to do it?

The Amount of TextureSample (with unique Sampler Sources) Nodes is important, not the Amount of TextureObject nodes.

You can easily go into the POM Material Function and change every SampleNode to use a Shared Source.

Oh, I begin to catch you, sorry for the misunderstanding!

Well, I started this because I realised the problem with the POM function. In fact I could use the same: set the Texture Samples inside the function as Shared Wrap, but the problem is that, in that certain function, there are no Texture Samples nodes. The Texture Object enter directly into a Custom code node, so I can’t find a way to get this function working on 7 Macro layered materials. Not sure if there are other functions like this, but I have tried some as you mentioned and trully they have the Texture Samples inside, and yes, the Texture Objects which enter inside a Texture Sample (wrap) doesn’t consume one slot! But the Texture Object which doesn’t enter inside a Texture Sample, does it, like in POM.

Thank you.

in those cases you’ll need to modify the Custom node so that the HLSL code samples the texture with Shared Wrap :slight_smile:

Thank you Chosker. I see… that’s far away from my knowledge. So, re-writting the feature request (if not keeping the same), it could be allowing in all the functions (including POM, for example), to be able to configure the Sampler Sources of the Texture Samples (so they would be visible or simply, exist), or, in the Texture Objects, have an option to say it that wherever it enters, it will be Wrap, Clamp, or whatever you want. I think it could be interesting.


Do you know how to change the code to use shared wrap? The custom node code is :

I don’t know how to do it myself. usually to find out how any node translates into custom node code I make the node and check the HLSL output

If you’re still looking for a solution, just edit the code and replace all TexSampler with **View.MaterialTextureBilinearWrapedSampler **and you’ll get rid of all the extra samplers.