dave.lannan Posted February 26, 2012 Share Posted February 26, 2012 There seems to be some runtime issues with tree materials. There has been a work-around discovered but we would like clarifications on the intended proper use of the materials at runtime. Here is the problem: I have found that editing material parameters does not always work as expected. For example, I wrote some script that essentially, using engine.materials obtained a reference to the “mesh_stem_base” material and traversed the material hierarchy obtaining all children of this material. Directly after the world is loaded, I then set the “animation_stem_radius” and “animation_stem_scale” to 0.0 on all Material objects that are children of “mesh_stem_base”. When I move my Player to where a tree is, the stems are still moving ie the default values for those materials are applied (when the tree is first streamed in). If I then update the “animation_stem_scale” and “animation_stem_radius” to some new value, the stem movement of the tree reflects the new material settings. And if I then reduce the value back to 0.0, the stems stop moving. It appears that any material modifications are only applied when the tree is streamed in and a surface that uses the modified Material is visible? I have subsequently started using engine.render.setAnimationStem and this seems to resolve the problem but I’m concerned that this is a general problem when editing Material parameters on the fly programmatically. Also: Additionally I have found that with certain vegetation, whilst setting engine.render.setAnimationStem and engine.render.setAnimationLeaf to 0, the shadows for the leaves are still moving and the leaves still shimmer like they’re moving, despite the fact that the leaves clearly aren’t moving. I noticed this behaviour on the “vegetation_birch1” tree in particular. Cheers, Dave Link to comment
manguste Posted February 29, 2012 Share Posted February 29, 2012 It appears that any material modifications are only applied when the tree is streamed in and a surface that uses the modified Material is visible? No, there is no such limitation when changing material parameters via the script. You are free to change any material values on the fly, and stem and leaves materials are no exceptions. Can you send us a small sample that reproduces this problem? BTW, why also set the Radius to 0, if setting Stem and Leaf Offsets is enough to render a tree without animation? The only caveat with leaves and stems materials when it comes to changing them in runtime, is that it does not look good when you smoothly increase/decrease Stem or Leaf Scale, because trees are 'twitching' each time. Setting discrete values when increasing/decreasing the scale looks better, global Animation stem and leaf options - is the best variant to change scale dynamically. Additionally I have found that with certain vegetation, whilst setting engine.render.setAnimationStem and engine.render.setAnimationLeaf to 0, the shadows for the leaves are still moving and the leaves still shimmer like they’re moving, despite the fact that the leaves clearly aren’t moving. I noticed this behaviour on the “vegetation_birch1” tree in particular. Sorry, can't reproduce this. Setting it to 0 neither in the editor, nor via the script gives the result you've described. Link to comment
Recommended Posts