Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    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

    Leave a comment:


  • replied
    Originally posted by Chosker View Post
    in those cases you'll need to modify the Custom node so that the HLSL code samples the texture with Shared Wrap
    Do you know how to change the code to use shared wrap? The custom node code is :
    float rayheight=1;
    float oldray=1;
    float2 offset=0;
    float oldtex=1;
    float texatray;
    float yintersect;
    int i=0;

    while (i<MaxSteps+2)
    {
    texatray=dot(HeightMapChannel, Tex.SampleGrad(TexSampler,UV+offset,InDDX, InDDY));

    if (rayheight < texatray)
    {
    float xintersect = (oldray-oldtex)+(texatray-rayheight);
    xintersect=(texatray-rayheight)/xintersect;
    yintersect=(oldray*(xintersect))+(rayheight*(1-xintersect));
    offset-=(xintersect*UVDist);
    break;
    }

    oldray=rayheight;
    rayheight-=stepsize;
    offset+=UVDist;
    oldtex=texatray;


    i++;
    }

    float4 output;
    output.xy=offset;
    output.z=yintersect; output.w=1;
    return output;

    Leave a comment:


  • replied
    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.

    Regards!

    Leave a comment:


  • replied
    in those cases you'll need to modify the Custom node so that the HLSL code samples the texture with Shared Wrap

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    "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?

    Leave a comment:


  • replied
    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?:
    https://blueprintue.com/blueprint/be-byrdl/

    (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.


    Thanks!
    Last edited by Miguel1900; 03-26-2018, 05:43 PM.

    Leave a comment:


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

    Leave a comment:


  • replied
    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

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    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.

    Leave a comment:


  • replied
    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.

    Leave a comment:


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

    Greetings,

    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
Working...
X