Announcement

Collapse
No announcement yet.

Parallax Occlusion Mapping use Shared Sampler

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

    Parallax Occlusion Mapping use Shared Sampler

    Hey everyone,

    I'm trying the new POM node in my game and since I need POM on landscape I need it not to take any texture sampler. So I tried to replace this:

    Code:
    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;
    }
    with this

    Code:
    while (i<MaxSteps+2)
    {
    texatray=dot(HeightMapChannel, Tex.SampleGrad(GetMaterialSharedSampler(TexSampler,Material.Wrap_WorldGroupSettings),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;
    }
    However it does not work since it still consumes a sampler slot. So I can't put too much layers with POM since it won't compile.


    Thanks in advance

    #2
    uppppp pls

    Comment


      #3
      Did someone found a way to set the sampler source of the ParallaxOcclusionMapping node to "shared" ?

      Comment


        #4
        It's still using a sampler even if it's shared. Why not try describing what you're trying to do a bit more?

        Comment


          #5
          Originally posted by vinz243 View Post
          Hey everyone,

          I'm trying the new POM node in my game and since I need POM on landscape I need it not to take any texture sampler. So I tried to replace this:

          Code:
          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;
          }
          with this

          Code:
          while (i<MaxSteps+2)
          {
          texatray=dot(HeightMapChannel, Tex.SampleGrad(GetMaterialSharedSampler(TexSampler,Material.Wrap_WorldGroupSettings),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;
          }
          However it does not work since it still consumes a sampler slot. So I can't put too much layers with POM since it won't compile.


          Thanks in advance
          You can pick shared sampler from view struct. eg. View.MaterialTextureBilinearWrapedSampler

          Comment

          Working...
          X