Home Technical Talk

Foliage vertex normals editing in Speed Tree ?

gnoop
sublime tool
Offline / Send Message
gnoop sublime tool
I wonder how  big games do it ?

from Horizon Zero Dawn  pdf . for example

I have no problem to do it in any 3d package   but  we need  it inside Speed tree editor  to keep all the animation, lods etc.    

Is it possible there somehow ?   We play with puffiness and it still does it kind of wrong.

Replies

  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    What is your point exactly?

    I think there's quite a bit of control over normals smoothness, pufiness etc in Speed Tree.

    I'm not sure what they do exactly in terms of flipping based on these slides,
    but you may try to experiment with the backside normals (and other backside parameters) in UE4 or whatever engine you're using.


  • gnoop
    Offline / Send Message
    gnoop sublime tool
    My point is  what I see in this Horizon doc  https://ubm-twvideo01.s3.amazonaws.com/o1/vault/gdc2018/presentations/gilbert_sanders_between_tech_and.pdf      for example is  looking like  transferred normals   from a kind of envelope shape.  Easy to do in Blender for example  or any 3d package .

      But in Speed tree I see nothing like normal transfer  or any way to set normals perfectly   same  way radially .    
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    question i've searched for as well. 

    If you are exporting to unreal, then you can export them as an fbx from unreal, make the changes, and reimport. I believe that shouldn't break the vertex ordering. 

    My dumb workaround is that i just amplify the subsurface scattering, just enough to blow out the hard shadowing. 
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Alex_J said:
    export them as an fbx from unreal, make the changes, and reimport. I believe that shouldn't break the vertex ordering. 

    Is it what everybody doing ?      We tried to make normals  radial through "puffiness" .  They  does look  kind of radial in normal vectors  visualization   but the actual shading doesn't look that way at all .   I am lost.

    Oddly enough  couldn't find a single tutorial or you-tube video how to adjust vertex normals in Speed tree.
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    I have no idea what anybody else is doing. :) 

    Have you asked on the speedtree forums? They usually answer questions pretty quick there. 

    I just happened to do a quick test the other day with exporting the speedtree from unreal to maya and then doing the sphere vertex transfer thing and it seemed to work fine on reimport. (actually that's a major loophole, because to get the fbx export of speedtree you need to spend $1000.)

    That's kind of a pain but it does seem to work. I bet the puffiness thing is the proper solution, but I am not sure how it's really working. I only know the basics of speedtree.

  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    gnoop said:
      But in Speed tree I see nothing like normal transfer  or any way to set normals perfectly   same  way radially .    

    I don't think there's a way to transfer the normals from a mesh, but there's definitely radial averaging.

    I haven't used Speed Tree for like a year, but I've used SpeedTree quite a lot in the past and you have enough ways to control normal smoothing in ST, possibly even in a better way than just transfering from a mesh.


    We tried to make normals  radial through "puffiness" .  They  does look  kind of radial in normal vectors  visualization   but the actual shading doesn't look that way at all .   I am lost.
    It's not what puffiness is for.
    Just read the docs ,it's described pretty clearly there.

  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Thanks frmdbl  it's what we tried actually,    I wonder  could this work together with leaves normal map  or it should be either  vertex normals  or normal map and not both? 
  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    I'm not sure what you're trying to achieve exactly, you mentioned that on a preview your normal look 'radial' already. If that's the case, your problem is somewhere else probably.

    The branch/leaf normal shouldn't really break things too much, unless you have a very noisy normal map, but then the shading should also be 'radial' just more noisy.

    The purpose of radial/spherical averaging for tree coronas is to have a more consistent/smooth shading, so that the fact that it's made of branch 'planes' is not that apparent, but it's not always the ultimate solution.

    Can you maybe show some screenshots of what you have and what you'd like to achieve?
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    @gnoop

    I am working in speedtree currently and got decent results making use of the lighting settings tab. Below screenshot is in unreal. Overall the lighting is decently soft looking, without the hard contrasting shadows. 

    My material is albedo/opacity and SSS only. The SSS texture I bumped up brightness just a touch. 


    In speed tree I turned on Normals by pushing N, then I just tweaked the sliders until it looked like normals were mostly pointing outwards... I read the docs but they are kind of vague to me, but these settings below seem to get a pretty soft look. The adjustments (up, right, down) work the same as orientation adjustments for leaf cards. Just rotate along one of the axis. It seems global anchor is the easiest to work with because all the normals behave same way.

    Would be great if speedtree put out a video showing how to get predictable results with these sliders in real world scenario. I saw some forum post from them and answers are just, "use the sliders to adjust the normals." 

  • gnoop
    Offline / Send Message
    gnoop sublime tool
          Thanks frmdbl   and  Alex_J 
       In U4 engine everything looks great , ha-ha :)   It forms  foliage illumination  by self  shadowing.       Unfortunately we can't do it   in our engine.  The lighting impression should  be only normals based.

    So I figured out what makes the mess:  a) leaves normal map    b) backside polygons  having flipped surface normal looking rather inward than outward  and breaking sphere like shading  of  a foliage canopy. 

    Does anyone knows  a way in speed tree modeller  to un-flip them? Doing same shading as the front side ?  Is there such option?

    I think it's what  Horizon doc  calls  "flipped incorectly"




  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    gnoop said:
    Does anyone knows  a way in speed tree modeller  to un-flip them? Doing same shading as the front side ?  Is there such option?
    And then what? You'd have two overlapping vertices/faces in the same place, with the same normals.


    I think you're just very confused and you're expecting SpeedTree to give you some magical solution, for a problem caused somewhere else.

    Unless you've set up your tree in some bad way in ST (you haven't posted any shots so it's impossible to tell), but then also don't expect some magical button to fix it, watch some tutorials instead.

    I exported Speed Tree trees for UE4, Unity and a custom engine, neither of those showed any issues with shading in terms of averaged normals.


  • gnoop
    Offline / Send Message
    gnoop sublime tool
    frmdbl said:


    I think you're just very confused and you're expecting SpeedTree to give you some magical solution, for a problem caused somewhere else.

    I am trying to recreate what they did in Horizon  and what's their mysterious "flipped incorrectly"   is .   It looks obvious to me now  it's not just simply radial normals because  even perfectly radial normals breaks illumination impression by backsides  of foliage polys    

  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    I've seen several examples in unreal of how people edit the shader so that both sides of the card have the same normals. 

    Here's one: 

    Foliage Normals - UE4 Materials 101 - Episode 33 - YouTube
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Thanks Alex_J for an interesting video.     Stiil  what he does with foliage backfaces is  not  perfectly clear.

    Here what I get with a test bush:


    when export fbx from speed tree modeller .    Default  export from Sped tree is unusable imo. ( on the very right)      Just a random  mess no illumination.

    Clearly  "smooth" and " puffiness"  both set  to max  still don't make so perfect result as Blender  native  Radial normals modifier. 

    But the main issue is backfaces.    It looks perfect with only front side visible but will take double more polys for same   density impression    so the key part is  how to do  that  "incorrect flipping"  from Horizon pdf.

    If somebody could  explain what  what they are doing  with backfaces  I would be appreciated.   It doesn't seems like simple flipping


  • jStins
    Offline / Send Message
    jStins interpolator
    Apologies as I'm not familiar with SpeedTree or UE4 these days, but is the first post in this thread what you want to do? Possibly implement the TwoSidedSign bit in your engine somehow? 
  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    Horizon zero dawn doesn't use speedtree. I went to that GDC talk.

    The trees in Horzion Zero Dawn use the crytek tree technique from crysis  - so they're not making their trees in speedtree - they're doing it in another program. I think it's 3dsmax? Horizon Zero Dawn also uses a custom engine (not unreal). 

    This is the Crysis tech document about that technique.
    https://developer.nvidia.com/gpugems/gpugems3/part-iii-rendering/chapter-16-vegetation-procedural-animation-and-shading-crysis

    Speedtree uses a different technique using multiple UV channels to store the information. 

    As for the normals, have you made sure you've got the staticmeshes set to use the imported normals? Instead of regenerating them themselves? 
  • frmdbl
    Offline / Send Message
    frmdbl polycounter

    @gnoop
    If this is your Speed Tree mesh, then as I said just get back to the basics, watch some tutorials, read the docs etc.

    Besides, despite the fact that I posted the shots from the docs about puffiness and told you expressedly that it won't help (in fact it makes the mesh more noisy) in your case you still use it at 1.

    When you fix your problem with vertex normals it's just the start of course, you will still have to handle the backsides.
    I think both I and other people in this thread have hinted at what the problem is, if you look at the slides from Guerilla it's pretty obvious which 
    part of the workflow it is (and you seem to be completely missing it).

    Either way, in terms of SpeedTree let me just post this.

  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Thanks jStins  and sprunghunt  for the useful linlks.    I was under impression that evry game use Speed Tree now.    Unfortunately we don't use Unreal  and this  picture  :
    tells me nothing  of how they sort out backfaces  at first and what vector math operations follow .
    I want to do something like this in Blender shader editor  to test and then  show our coder  and yet have to figure it out.  
    Neghter could I find anything related in GPU gems  doc.


    frmdbl said:


    Besides, despite the fact that I posted the shots from the docs about puffiness and told you expressedly that it won't help (in fact it makes the mesh more noisy) in your case you still use it at 1.
    Either way, in terms of SpeedTree let me just post this.




    Thanks  frmdbl       for trying to help.
      I don't use  their  "legacy"  Leaf generator  you showed me the  help page for .     Since all the library trees doesn't use it too.   
      I use leaf mesh generator and  it doesn't have such thing as  Global Smoothing.
     
    I use  leaf mesh generators which have only this :

    I actually used  "Parent puffiness"   with deep or intermediate anchor  there ,  not     "Puffiness"

    And yet as you see  that bush still has random normals   for some uncertain reason.    Should I switch to legacy one?

    As of backsides  Speed tree just doesn't have any ready made  solution , right?  


    ps. it's sad a pro soft uses silly  cryptic  "puffiness" terms instead of  vertex normal editor /modifier   with "radial" around defined center  terms everybody would instantly understand.

  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    gnoop said:
      I don't use  their  "legacy"  Leaf generator  you showed me the  help page for .     Since all the library trees doesn't use it too.   
      I use leaf mesh generator and  it doesn't have such thing as  Global Smoothing.
     
    I use  leaf mesh generators which have only this :

    I actually used  "Parent puffiness"   with deep or intermediate anchor  there ,  not     "Puffiness"

    And yet as you see  that bush still has random normals   for some uncertain reason.    Should I switch to legacy one?

    As of backsides  Speed tree just doesn't have any ready made  solution , right?  


    ps. it's sad a pro soft uses silly  cryptic  "puffiness" terms instead of  vertex normal editor /modifier   with "radial" around defined center  terms everybody would instantly understand.

    Ok, maybe something changed in terms of naming or the way the tabs are organized, but it looks pretty similar to what it always was.
    There aren't that many variables so you really should be able to get a good result.

    Your normals seem pretty radial, maybe not perfectly radial, but they look ok in my opinion. 
    Maybe you're importing/exporting loses this information somewhere along the way?
    The bush you're showing shouldn't look like this in Blender, unless you're really making some mistake somewhere else than just vertex normals.


    In terms of the backsides, as I said you can't do any magical things with the vertex normals in the mesh, you can adjust the shading of the backsides in the shader/engine, that's the only solution.

    In UE4 you have this node called TwoSidedSign, it let's you select the backsides of the mesh and change parameters for them, so e.g
    you can tweak their normals, change their roughness, color or SSS)

    For example in one project I worked on in UE4 I modeled some bushes and trees and when Distance Field AO was used, in darkened the backsides quite a bit,
    I adjusted the AO a bit, but also adjusted the color and SSS values just for the backsides so it looked more consistent.
    Of course it's a bit hacky and not always a good solution, I'm pretty sure Guerilla uses more sophisticated ways to deal with the backsides' shading, but that's the type of things you need to do.
    If you're using a custom engine then I doubt anyone here can help you, no one knows the specifics of the shader you're using, you'd have more luck asking whoever's responsible for that engine and shaders.

    This seems like more up to date docs.
    Try setting 'Parent Puffiness' to 0, then maybe try increasing it with different anchors.
    But let me repeat my point once again, I really don't think Speed Tree itself is not your problem.

  • gnoop
    Offline / Send Message
    gnoop sublime tool
    frmdbl said:

    This seems like more up to date docs.
    Try setting 'Parent Puffiness' to 0, then maybe try increasing it with different anchors.
    But let me repeat my point once again, I really don't think Speed Tree itself is not your problem.


    Are you sure?    Looks like the parent  puffiness is a main thing to make normals radial  . It's just  at few nodes of library trees  it still has random deviations.  Even  after I specifically set to zero all the red +/-  values in every field.


    Anyway  a few deviations may be ok  and a main thing is backfaces.   Too bad there is nothing to fix them in Speed Tree preview   but at least I managed to solve it in Blender shader network.   Thanks to bakfacing binary  input.



    Not sure it's exactly what  Horizon's  "incorrrect flipping" is  although?

    Next question is how to mix in  the normal maps  they wouldn't make a mess of lighting again
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    speedtree hasn't had a meaningful update in about 15 years - dont hold your breath. 
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    poopipe said:
    speedtree hasn't had a meaningful update in about 15 years - dont hold your breath. 

    Their trees for games  do have  kind of a naive  style . like from  Henri Rousseau  paintings .   Especially at close.   I believe  mostly because of  leaves clusters . They suggest  to model  them  for  a kind of ortho projection  with all the leave be  in  same plane  , rotated frontally to camera,

    I wonder why so  and if  anyone ever tried  to do it otherwise ?   Maybe by taking photo of actual leaves clusters  or model a 3d  cluster with leaves subjected to gravity . etc   and rendered into a plane.     Use a few  alternating  cluster textures etc?    

    I wonder does Speed  Tree modeller provide any tool to switch    leaves cluster  textures  based on plane  normal  or maybe camera vector?
  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    @gnoop
    I downloaded a trial for SpeedTree, 
    I played with the default desktop realtime bush, and there actually might be something off in terms of how these newer versions handle normals :(
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    frmdbl said:
    @gnoop
    I downloaded a trial for SpeedTree, 
    I played with the default desktop realtime bush, and there actually might be something off in terms of how these newer versions handle normals :(
    More time I am spending with Speed Tree  , less I like it .      There is absolutely nothing  that wouldn't be  simpler  to do in Blender  with  Sevrchok or just Geometry nodes .   But I assume it's a matter of personal taste .

  • frmdbl
    Offline / Send Message
    frmdbl polycounter
    gnoop said:
    frmdbl said:
    @gnoop
    I downloaded a trial for SpeedTree, 
    I played with the default desktop realtime bush, and there actually might be something off in terms of how these newer versions handle normals :(
    More time I am spending with Speed Tree  , less I like it .      There is absolutely nothing  that wouldn't be  simpler  to do in Blender  with  Sevrchok or just Geometry nodes .   But I assume it's a matter of personal taste .

    I don't know about Sverchok, but you can't really do anything equivalent in Geometry Nodes. At least not yet, (I really hope it will be possible with the new Curve nodes)
  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    gnoop said:
    frmdbl said:
    @gnoop
    I downloaded a trial for SpeedTree, 
    I played with the default desktop realtime bush, and there actually might be something off in terms of how these newer versions handle normals :(
    More time I am spending with Speed Tree  , less I like it .      There is absolutely nothing  that wouldn't be  simpler  to do in Blender  with  Sevrchok or just Geometry nodes .   But I assume it's a matter of personal taste .

    Unless your engine already has an integration of speedTree I wouldn't bother using it. The advantage of speed tree is that it's already setup in engines like Unreal. 

    On Pillars of Eternity I made all the trees in Maya. I didn't use any kind of automated tree making system. 90% of the time it takes to make a tree was creating the trunk and leaf model and textures. The actual assembly of the tree mesh is pretty easy if these are well made. 

    The animation of the tree was done using a Unity version of Crytek's shader. 

    the artwork I'm talking about:
    https://www.artstation.com/artwork/E3L42
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Unless your engine already has an integration of speedTree I wouldn't bother using it. The advantage of speed tree is that it's already setup in engines like Unreal. 

    On Pillars of Eternity I made all the trees in Maya. I didn't use any kind of automated tree making system. 90% of the time it takes to make a tree was creating the trunk and leaf model and textures. The actual assembly of the tree mesh is pretty easy if these are well made. 

    The animation of the tree was done using a Unity version of Crytek's shader. 

    the artwork I'm talking about:
    https://www.artstation.com/artwork/E3L42
    Great work  for sure .   Cool looking palm trees :) .

    I'v been  trying  a bit more with Speed tree modeller so I could say  I was wrong probably.
    As frmdbl said it does have a few things  that doing in Blender  would be a lot of job to model and rig.  

       It's just pity it doesn't have  same versatile  shader editor  to flip backsides and explicit normals modifier instead of that  weird "parent puffiness" .    So no decent visual feedback  to see what you are doing.

    I am now struggling  to make a decent looking  foliage backlighting effect.   The default one in Speed tree modeler looks ok only when self shadows  are on in the foliage.  i.e. in U4

    Our engine doesn't support self shadowing in the foliage  so I wonder what everybody did for that before U4?   How could I fake a shadow in a center of tree canopy to make a kind of rim backlighiting effect?







     







  • Eric Chadwick
    If I'm understanding this thread, you're using a custom engine with few shading features? 

    I would suggest duplicating the backfaces explicitly, then projecting the normals in a sphere or dome shape. Some examples here.
    http://wiki.polycount.com/wiki/Foliage#Vertex_Normals



    This shows projected normals per the whole canopy (normal thief) vs. per-clump (custom normals), and no self shadowing. Different shading results, depends what tradeoffs you're cool with.
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    I hate speedtree too - don't feel bad.   (I could write an essay about how angry it makes me) 
    The question you have to ask is this..

    Does the fact speedtree handles your LODs, billboarding and markup for wind/collision etc. save you a load of work or not?   if the answer is yes you're in the same boat as a lot of people and might as well just bend over without complaining.

  • Klunk
    Offline / Send Message
    Klunk ngon master
    Was never fan either should have renamed it Mutant trees r us.
  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter
    i think you'll need to work with someone who can write shaders. 

    in the video i linked (or another from same author) he shows how to make shaders to do exactly those things.... in UE4. 

    with the parent puffiness and all that lighting tab stuff you don't have to work entirely blind. Turn normals on and you can see what they are doing as you move sliders. I'd recommend starting from a default template and just move one thing at a time, otherwise shit gets confusing fast. 


    I've tried getting by without speedtree, but they are around such a long time for a reason. Making trees any other way sucks, and if you have to make a volume speedtree pays back. it is especially apparent when you want to make quick non-destructive art-director type changes. That's when it really shines. No other way to do that quickly.

  • gnoop
    Offline / Send Message
    gnoop sublime tool
    poopipe said:

    Does the fact speedtree handles your LODs, billboarding and markup for wind/collision etc. save you a load of work or not?   if the answer is yes you're in the same boat as a lot of people and might as well just bend over without complaining.

    That automatic lods + tree  libraries  is why company decided to use it . I just  puzzled how  much inconvenient and ancient   it actually  feels   in many aspects .

    I managed  to fake  backlight "rim"  in Blenders Evee  without foliage self shadowing :

    Couldn't find  anything helpful in U4  videos  since  they are all use  actual  foliage shadows .   

    Alex_J said:
     it is especially apparent when you want to make quick non-destructive art-director type changes. That's when it really shines. No other way to do that quickly.

    Yeah, it  looks like that.    Weird  nobody tried to make a rival product focused on game market.     I have a "Grove"  addon for Blender and it's great   and super easy  but helps with nothing when you need an in game tree.



  • chena
    Offline / Send Message
    chena polycounter lvl 6

    Flipped ‘Incorrectly’ means that Abs() the Z components of our Viewspace Normal, it's in the shader and realtime, not in the speed export.

  • gnoop
    Offline / Send Message
    gnoop sublime tool

    Thanks chena. Why viewspace? it looks fine if I just multiply normals on -1 for backsides in Blender (all 3 values). Or it's becase it works for camera space normals buffer or something?

  • chena
    Offline / Send Message
    chena polycounter lvl 6

    kown a triangle a backside or not need in viewspace.

    'incorrectly' flipped the z of the viewspace normal, i think the purpose is that make all the leaf face towards camera.

  • chena
    Offline / Send Message
    chena polycounter lvl 6

    @gnoop did you export tree from speedtree, and adjust the normal in blender? I ask the author of <<Between Tech and Art: The Vegetation of Horizon Zero Dawn>>, they generate a smooth mesh from the tree use the maya particles, and transfer the mesh normal to tree vertex. I want use blender to do it. Did you have some tutorial to generate mesh and transfer the normal?

  • gnoop
    Offline / Send Message
    gnoop sublime tool

    We are trying to make it all in Speed Tree. I actually pretty much hate it. So inconvenient . Vertex normals are never right there.

    As of Blender I used data transfer modifier. You make a shape approximation of a tree ( I used Zbrush re-mesher ) but my guess it should be possible to do in Blender too. Not sure why particles is necessary for that. Then data transfer modifier just transfers vertex normals to a tree mesh. Use data transfer modifier + normals at youtube search bar . There was a few tutorials there.

    It's possible to do in Geometry nodes too with atribute transfer node.

  • Hieromagus


    This is one of those rare moments when I search for an obscure technical problem bugging me, and immediately find a thread with others who feel the same way.

    I made an oak tree in Blender for my game enviroment, tested it out in Unity with a basic leaf/wins shader and liked the results. Then I decided to try SpeedTree for a month to see if I can streamline production. I was very sad when there was no easy obvious way to manipulate vertex normals to simulate roundness in the leaf clumps.

    I like ST procedural tools for making the trunk and branches, so now I'm wondering if its worth it just for the main body and LOD's, then modifying the leaf clumps in Blender. I still need to play around with some settings before making a decision.

Sign In or Register to comment.