- Procedural Tree
In order to color a full set of leaves with different color variations we can take advantage of a simple shader in created in RSL to create a slim template that will allow us to create quick variations of multiple geometry a only using one main shader.
- TECHNICAL BREAKDOWN
- How are the Branches Created?
In this case i used a simple idea of translating the leaves on the normal of the face. So basically I create a leaf and then I move along the face normal where it was created by a spread amount. There I create the next one.
How do the branches curve?
One of the main flaws of moving along the normal is that we get these straight un-natural looking branches. To chance that I used a simple concept of usint the negative parabola of x^2 (x square). We can control the arching of this function dividing x^2 by a factor (or multiplying it by the inverse factor).
Here is a visual example of what happens with this function:
- So what we need to do is each time we move along the face normal, we change the y component for:
y = -archingFactor*x^2.
- USING RIB ARCHIVES
In order to speed the interaction with the tree mesh in the viewpor we've used the ability to load pre-baked rib files as our leaves to be rendered dring rendertime. But as this approach is valid for rendering one image, if we are rendering a sequence, or once we are happy with the distribution of our leaves, we want the posibility to not have to compute the creation of the leaves any more. So in essence what we've done is implemented the function to bake our rib files of the ditributions that we've created and then the ability to reuse these bakes rib files so we only have to compute the distribution of the foliage once. This is where the menu that we saw on the UI shines. I set to compute the rib file with the distribution is baked and then read to render. If it's set to reuse, we read this baked rib file and we render it and if it's set to off then we do nothing.