No announcement yet.

Control SpeedTree AO from within Unity (on material, or script API)

  • Filter
  • Time
  • Show
Clear All
new posts

  • Control SpeedTree AO from within Unity (on material, or script API)

    Hey, it would be great if there was a way to control the baked Ambient Occlusion on SpeedTrees from within Unity. I'm not a big fan of baking immutable AO onto trees. I'd like to be able to adjust this AO at runtime. It would be nice to bake the AO onto the tree in the modeler, and then control how much of the AO is being applied at runtime through the material or a script somehow.

    For example, if I am using Screen Space Ambient Occlusion, I may want to tone down (or completely disable) the ambient occlusion that is baked onto SpeedTrees. If I'm not using SSAO, then obviously I would want to use the baked ambient occlusion saved directly on the speedtree.

    Is this currently possible? (it doesn't seem like it, or it's undocumented). If not, then consider this a feature request

    I assume the speedtree shaders are reading the AO data from vertex colors or something; so hopefully it's not too far fetched to expose a parameter on the shaders to modulate the amount of AO that is being applied?
    Last edited by philwinkel; 11-11-2014, 04:41 PM.

  • #2
    They both have their uses. SpeedTree's AO gives you the nice darkening of the interior of the tree that SSAO can't do, and has options for being sensitive to the sky when computing it. And SSAO gives you the interaction of trees and the surrounding environment. SSAO does have artifacts when used with intersecting geometry (like leaves on a tree mesh), though.

    Currently the SpeedTree shaders just use the AO value, but I could see it being an option. Or, you can always clear the AO in the Modeler to work around it without needing to edit the shader.


    • #3
      yea, it would be nice if it was a slider or something you could change on the material. So for example if the SSAO is turned on in the game, or if you're on low gfx settings with less dynamic light, then you could crank up the AO on the speedtrees. And vice versa, if you have a lot of dynamic lights and SSAO then the AO that's baked onto the speedtree might be a little heavy and you could tone it down.

      I guess it'd just be nice if you had the ability to adjust the amount of AO in the engine, so you could bake AO onto the speedtree and not have to worry about it being too dark, or worry about having two separate trees, one with AO, one without.

      I imagine its not too hard to pop the shader open and add a float input parameter and use that to control how much AO is being used. I could probably figure it out, but i think it'd probably be a useful feature for other people as well.

      Just a thought, i'll plan on baking the AO into my trees and I'll have to take a look at the shader.