Home Adobe Substance

How can I get a mask from tile sampler?

polycounter lvl 16
Offline / Send Message
dimwalker polycounter lvl 16
Using few tile samplers for leaves.

First of all. is there a way to get a mask from sampler? I can crank up levels on sampler result to get a mask, but it will "grow" and have nasty rough edges. Solution I'm sticking with at the moment is leveling each leaf and then using copied sampler with those leveled leaves plugged in to have exact same pattern/distribution in mask.
Though, this approach has its drawbacks - each time I change something in original sampler, I have to copy it and replug all those leveled leaves again. Which is already inconvenient and will get even more annoying since I want to use 3 different samplers mixed together with height_blend. So I would have to juggle 6 samplers in total(3 for main pattern and 3 for corresponding masks).

What would be a best way to go around this? Is there any "native" solution to get a mask from sampler? Or maybe I can wire 2 samplers together with some scripting/function voodoo magic?


Replies

  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Usually people use shape splatter nowdays  . It has a companion data extract node for this.

    If  for some reason  you don't want to use  shape splatter.   It has very limited scale range on narrow textures  256x2048  for example  .   So sometimes sampler is a better choice.   

    In such case you can use a trick  of  giving  your inputs some  hidden gradient  and  ID  through sort of frequency separation  and use two of such gradients to get  UV   that you can use to remap  color info or masks .

    here is an example of such gradient:


    You have to "fix" the tile sampler node first to make it working in 32 bit math although.  For some uncertain reason it doesn't  in default one.  And the trick is working only in 32 bit mode.

    You would have to do it  2 times for UV and one extra time for  input objects  ID indexes.   So 4  tile samplers working in sync.     Shape splatter  would work quicker probably.






  • dimwalker
    Offline / Send Message
    dimwalker polycounter lvl 16
    gnoop said:
    Usually people use shape splatter nowdays  . It has a companion data extract node for this.


    Splatter's shape height affected by its size confuses me, but I guess it's kinda like tile sampler's size-amount dependency I will have to get used to.
    Anyways, shape splatter looks promising. Thank you.
  • dimwalker
    Offline / Send Message
    dimwalker polycounter lvl 16
    ...
    You have to "fix" the tile sampler node first
    ...
    Wow... that was quite an edit, mate =) 
    I'm afraid your wisdom is lost on me. Fixing node's math, multiplying by extra white - this graph looks like it's written in alien language.
    Could you share fixed sampler please? I guess there is no harm in using better one even if I don't understand all the benefits. Though, if possible, would prefer it as additional node instead of replacing old one.
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Actually you could just  make a clone of  your tile sampler  and make  it work with inputs alphas  in 8 bit mode. No need to remap anything.    Sorry for over -complicating.

    Also you can use FXAA node to "fix"   " nasty edges".

    That "hiden  gradient" UV  idea still might be  useful if you  want to use  the leaves color  counterparts   instated of recoloring  scattered result. 

    The idea is basically making  your thing(hemisphere)  super high  like skyscraper  and add a  subtle  roof gradient  on the top , so subtle it's make no essential difference .  Like a carrier wave and a signal.    Then  after you scatter the thing  you subtract  your skyscraper ( without gradient) and get only  the gradient  itself , now  rotated  and height {Max} blended  properly.    Do so with another gradient, rotated 90deg   and you get UVcoordinates  you can use  to map color counterpart of same sphere/input picture on.  


    As of fixing tile sampler  to work in 32bit mode  set fx-map inside  to absolute/ 32 mode and add any node after pattern input  that also set to absolute/ 32 bit output .
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    Use the colour version of tile sampler . Alpha is passed through from input to output




  • gnoop
    Offline / Send Message
    gnoop sublime tool
    yeah.  poopipe is right . those  UV gradients  or even splatter node are necessary only if you want to use Max (lighter)  blending  in  between  scattered things  to get kind of proper height blend .   ( like in the initial screen)   


    But for leaves it could be just  regular  alpha blend  since they are mostly flat  things  and laying one  over another  naturally .  

    if you want to pass the  height  through  "alpha blend " kind of scattering it's  more complex thing to make it look real.    I usually  just do it in layers . Kind of series  of tile samplers each  doing sparsely scattered, non-overlaying  things  in certain height range and use the first one  as a mask input for a next sampler and so on.  And it doesnt grant you always right appearance anyway.

    Would be nice to have a scatterer  that would prevent things intersecting each other like in some 3d soft.     Usually a human eye  instantly and subconsciously catch such intersections  and get an unreal impression.    Something working like UV packers maybe .   

    I never managed to do it ..    Our programmer wrote  a script that can but I  couldn't even figure out how it works.
     




  • dimwalker
    Offline / Send Message
    dimwalker polycounter lvl 16
    @gnoop
    Small intersections are alright. I'm trying to do my work as well as I can within reasonable time. In this case perfection is not needed since it is a racing game and tree won't be on player's screen for too long.
    Afaik speedtree is used for serous foliage and can distribute leaves respecting collision, but I never used it.
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    speedtree either makes leaves - in which case they aren't going to intersect - or uses the textures you give it - in which case it's your problem. 


    if you want to make decent foliage you have to grow it  - there's pretty much nothing you can do in a 2d context that will prevent the occasional weird intersection short of modelling the tree in 3d and baking a texture out of it.  This isn't that nobody's written a tool yet - you simply can't. 


    As Gnoop says we usually get around it for things like hedges etc. by layering sparsely distributed color tile samplers / shape splatters (whatever it's called)  it's generally "good enough" but under close inspection it falls down . 

    Within the substance designer ecosystem it would be very complicated to build a scatter system that fully respected 3d intersections etc.  I don't think fx-map based distribution would work unless the system were extended but I think it's theoretically possible within a pixel processor -I'm doubtful about how practical it would be at resolutions you'd actually want to work with though. 

    Now i've written that down somewhere public we just have  to wait a couple of months,NicholasW will implement it and we'll see it in designer shortly after ;) 





Sign In or Register to comment.