Unity Shader Graph - Vertex Colour - Texture Control

Поділитися
Вставка
  • Опубліковано 4 жов 2024
  • This is a continuation from the previous video and also a bit more advanced, not the most complicated of shaders but quite powerful!
    Previous video: • Unity Shader Graph - V...

КОМЕНТАРІ • 9

  • @stefkeegan4391
    @stefkeegan4391 Рік тому +1

    Hi Rob! I was like hmmm this voice sounds familiar! Using your tutorials to learn some bits and bobs. Thank you!

  • @arch454
    @arch454 3 роки тому +1

    thanks, Robert, just the part been trying to do, now know my mistake, thanks saved me a lot of time

  • @britishwatermelon680
    @britishwatermelon680 4 роки тому

    Dude you been making videos for 6 years, it’s time you get attention for your hard work!

    • @Polytricity
      @Polytricity  4 роки тому

      Thanks Hyper , I'm humble, what can I say heheh

    • @britishwatermelon680
      @britishwatermelon680 4 роки тому +1

      Robert Ramsay I know how it feels, you work on an video and try your best, takes me hours to edit and upload and don’t get attention at all!

  • @Dehakuzo
    @Dehakuzo 3 роки тому

    Edit: Solved it, I remap the split R from 0 to 1, to 0 to 255, then I use the comparison and branch nodes to check the specific R value and pass that to the T of the Lerp, It takes some copy and pasting, but you can have 256 textures per channel!
    Thanks for the vid, You lead me to solve a problem I've been tackling over a year repeatedly.
    :End Edit
    Can you squeeze in more than 3-5 textures into this? I've tried using comparisons for the T's lerps for specific R values, but things get... weird.
    Ideally, I'd like to get around 10 textures out of this. So far, this is the only vertex color to texture system I've found that works, I'd love to expand it.
    I think I've figured out the logic, currently working on it.

    • @Dehakuzo
      @Dehakuzo 3 роки тому

      Current theory is that I might be able to read Red as 0-0.5 as one texture, and 0.6 to 1 as another, but I'm not have any luck with it. Not entirely sure what the relation between lerp's T and the vertex color's split output is.

    • @Polytricity
      @Polytricity  3 роки тому

      @@Dehakuzo I see you are compressing the channels down to 0-127 ranges so want to get functionality from that. That won't be easy. A shader can handle up to 16 texture samplers so you can have multiple RGB masks and lerp /switch between each. Not sure about changing the ranges of the Vcols 0-0.5 and 0.51-1.0 etc I always thought about it but makes it tricky to create a good workflow.

    • @Dehakuzo
      @Dehakuzo 3 роки тому

      @@Polytricity Edit: Yeah it seems I can't include any links to images, bah.
      Attempting to explain it without images
      With the vertex color node being split, I take the R value and remap it, In(0,1) Out(0,255)
      Feeding that into a Comparison Node, we can compare 0 to 255 and return 0 or 1 in a Branch node, I feed that into the T of a Lerp. I then have my vertex's red channel painted to 1 for a texture, 2 for another texture, 3, etc. Theoretically you could do up to 255, excluding the sampler limit. I'm using it at the moment in my game, but haven't tried adding a ton of textures yet, so haven't hit any issues.
      I'm a little concerned now since I have 3 samplers per texture to prevent z-stretching, which would limit me to 5 textures again, gonna go do a stress test on that now.
      Double Edit:
      Yeah, 16 Samplers in current graph is the limit, everything turns pink if you go above, Amusingly, subgraphs aren't included!
      I have 3 samplers in my subgraphs that help with z stretching and it only counts as one on the output into the main graph.
      So theoretically, with some subgraph tweaking, you could have the full 255 textures by feeding in the texture data from the main graph into subgraphs and having them do the comparisons, I think.
      Either way, 16 triplanar'd textures is more than enough for me. All is good.
      I'd upload the shadergraph, but I don't know how to do so in a youtube safe way, it keeps deleting links.
      :Double Edit
      :Edit
      ...I made a long winded comment detailing how I handled it, and it looks
      like it was automatically deleted, ugh. Either way, I didn't know about
      the hard 16 sampler limit, does that include used subgraphs too? I
      haven't hit that limit yet thankfully.
      I wanted to thank you again though, Your video helped solve a year long
      stress for texturing procedural voxel terrain.