Tree color variation

Started by nvseal, January 22, 2008, 12:28:33 PM

Previous topic - Next topic

Mr_Lamppost

Do we actually know how the locations for individual members of a population are calculated?

I have just made a test based on two basic assumptions:


  • 1:- The members of a population are placed at the "Centre" points of Voronoi cells having a scale equal to the Object Spacing and using the same seed value as the population.

    2:- The Voronoi cells are generated using an internal Get Position for the X and Z values are taking the Y value from the placement of the population.

What I have done is started with a Get Position, extracted the X and Z values; Rebuilt a position vector using these plus a constant equal to the Y value of the centre of the population.   I have then taken this modified position and used it as the input to a Voronoi 3D Cell Scalar; Using two constants, one for scale equal to the population Object spacing and another for the seed making this equal to the population seed.  I have used the result of this as the Mix Controller of a Merge Shader, which is being used to vary the colouring of the object.

I have used a duplicate of this mix setup to add colour to the terrain so that I can see the Voronoi cells.

Either my assumptions are wrong or the nodes are not set up right because THIS DOES NOT WORK  ::)

I am not at all sure how clear my explanation is; so here is a screen grab of the nodes, the result and the tgd.

I know this doesn't work but posting may save someone else wasting time trying something similar  :)

Smoke me a kipper I'll be back for breakfast.

moodflow

#16
Mr. Lamppost, this is really nice work.  Even if it doesn't work, this is a good springboard for finding something that does.

EDIT:

I see areas on the trees that ARE being effected.  The colors are different than the voronoi, but you can see it nonetheless!

EDIT 2:

You could replace the voronoi with a perlin noise function for a better color gradient.  I am stuck at work, so I don't have models to test, but I will hopefully give it a shot tonight when I get home.
http://www.moodflow.com
mood-inspiring images and music

Mr_Lamppost

QuoteI see areas on the trees that ARE being effected.  The colors are different than the voronoi, but you can see it nonetheless!

There are two copies of the colour variation nodes, one in the internal network of the trees and one connected to a surface layer in the shaders applied to the terrain.

QuoteYou could replace the voronoi with a perlin noise function for a better color
gradient. 

I have previously used both Perlin and Power Fractal driven blends to give variation to my populations.  However both of these methods give a general rather than tree by tree variation, I was hoping for a way to vary the colours applied to each tree. 

I can disprove one of my assumptions  :(

The positioning of the individual members of a population is not related to the Y value set as the Population Centre.  I tested this by making the instances visible in the preview then changing the Y value of the population and re-populating.  The positions of the individual objects don't change.  Theer goes one assumption.

Quotethis is a good springboard for finding something that does.

I agree that's why I posted a negative result

There is an as yet unsupported Unique Versions parameter in the population settings: Solution?
Smoke me a kipper I'll be back for breakfast.

bigben

#18
Quote from: Mr_Lamppost on January 25, 2008, 08:42:37 PM
... The positioning of the individual members of a population is not related to the Y value set as the Population Centre.  I tested this by making the instances visible in the preview then changing the Y value of the population and re-populating.  The positions of the individual objects don't change.  Theer goes one assumption.


That would be disastrous if it was the case.  For creating animations you need to move the populations with the camera to avoid populating an entire terrain with high quality objects. As it is, the placement is dependent on the density inputs which include a built random variable of some sort plus whatever density masking you use.

I don't think your test is entirely unsuccessful as there is variation of the yellow colouring in the trees which seems to follow a voronoi pattern that is very close to the surface shading. Don't forget that fractals vary in the Y direction as well so you may want to try stretching the result a lot in the Y direction.   You'd need to add some extra variation to avoid those straight lines where the border of a cell bisects a tree.

I have a different test render still running, but I'll have a look at this after it's done (probably tomorrow)

One thing that would be very inforamtive would be to do a closer render of a tree that has a cell border passing through it to see if the cell border also crosses a leaf as well.

Sethren

I wonder if you could not take a snap shot of the population by facing the camera down and render that out and use it as a mask but change the tree masks tonal variations in another program. Here is what i mean. Imagine if these were trees instead with variations to the tonal color placing this map in the shader stack. This noise i used is only an example as the noise should be an orthographic map mask of the trees etc. with the tonal variations.

bigben

Stopped my other test render. It was also tree-related so I can work on both at the same time.  Having a look at the TGD above and redoing some older experiments to see if there are any changes after the last update.

bigben

#21
OK. While the experiment above doesn't specifically colour individual trees it does produce large scale variation across several leaves, so in this respect it was successful... at least a step in the right direction.

I simplified the TGD a little... replacing the bottom half of the leaf shader with a blue surface layer with a red child surface using the voronoi as the child's fractal breakup. The first test render only showed blue and shades of purple/magenta... added a colour adjust shader with a white value of 0.5 as a final adjustment to the voronoi to get this.

[attachthumb=#1]

Compare this to a power fractal as the fractal breakup with a relatively large scale. (60,45,15 in this case). The same fractal was linked to a surface shader to produce a orange surface with an green child layer. Note that in this case there is no red in any of the trees, and no large scale variation that even closely resembles the terrain surface. Tweaked the PF and added a colour adjust shader to get this. This doesn't work  even though it's a pretty common solution that works just fine on surfaces.

[attachthumb=#2]

The attached TGD contains both shader branches... more tinkering.

rcallicotte

The top picture looks hopeful, BigBen.  That is, if I understand what is happening.   :D
So this is Disney World.  Can we live here?

Mr_Lamppost

QuoteThat would be disastrous if it was the case.  For creating animations you need to move the populations with the camera to avoid populating an entire terrain with high quality objects. As it is, the placement is dependent on the density inputs which include a built random variable of some sort plus whatever density masking you use.

There are definitely problems with populations at the moment, I have just made a quick test sliding a small populated area across a flat terrain. I used a power fractal as a distribution mask for the population. 

I had to render the frames one at a time even for this tiny population as TG crashed as soon as it tried to re-populate for the second frame. 

Instances are appearing outside the population area.

This is devastating. The placement of individual instances is not consistent from frame to frame.


The way I had been imagining populations to work was that the world was filled with Voronoi cells with the same scale as the population Object Spacing.  Taking a horizontal slice through this at the population Y position would give a 2D lattice of cells, the centres of which could be used to place the instances of the population prior to them being projected vertically onto the terrain.  If a distribution controller is used this would control the probability that any given cell would contain an instance.  There is a constant associated with each cell ( visible as the Voronoi 3D Cell Scalar), so unless the distribution controller or the seed value for the cess changed the probability of any cell containing an instance should remain constant, allowing any area to be populated without the placing of instances changing. 

This is obviously not happening.
Smoke me a kipper I'll be back for breakfast.

Mr_Lamppost

I am sure that something similar has been posted elsewhere but I couldn't find it so here is another quick test.

Voronoi 3D Diff Scalar making the displacement.

Voronoi 3D Cell Scalar clamped to the Y=0 plane used as a mix controller providing the colour variation.

If as I had hoped population instances had been placed at the centre of each cell this would have provided per object colour variation.  A more complex variation function would have been needed to hide the cell boundaries but this is certainly possible. 

Sorry the node network is a little messy.

I am away to work on something else  ;D
Smoke me a kipper I'll be back for breakfast.

moodflow

Quote from: bigben on January 26, 2008, 08:46:47 AM
Compare this to a power fractal as the fractal breakup with a relatively large scale. (60,45,15 in this case). The same fractal was linked to a surface shader to produce a orange surface with an green child layer. Note that in this case there is no red in any of the trees, and no large scale variation that even closely resembles the terrain surface. Tweaked the PF and added a colour adjust shader to get this. This doesn't work  even though it's a pretty common solution that works just fine on surfaces.

I attempted the same thing with a simple power fractal and no luck.  Apparently, the node network approach has additional mapping information its passing to the object (in this case a tree).  A simple fractal does not do this as it normally does on a surface.  I wonder if Matt could chime in here on how he has objects mapped?

I believe I have the color variation method working, using Mr. Lamppost's node design.  I replaced the voronoi with a perlin 3D scalar so the colors have a continous variance, and it seems to be working.  Since there are 2 colors being mixed by the merge shader (controlled by the perlin 3d scalar), its possible to use the power fractals themselves (which also have 2 colors, high and low) to add even more color detail.  I set the scale to the approximate object (tree) size to roughly keep each tree having its own color.

Definitely more tinkering to do though.

Many thanks Mr. Lamppost and BigBen.  This is some fun stuff!
http://www.moodflow.com
mood-inspiring images and music

moodflow

#26
I've also been noticing some weirdness when trying to mix the two different colors.  With the merge shader, it seems to want to "add" the color values regardless, creating a new color (sometimes above white or black).

If I stack the fractals, it still adds the color values. 

More research to do.

EDIT:  Forget this post, I figured it out.   ;D
http://www.moodflow.com
mood-inspiring images and music

bigben

#27
Quote from: Mr_Lamppost on January 26, 2008, 11:55:55 AM

There are definitely problems with populations at the moment, I have just made a quick test sliding a small populated area across a flat terrain. I used a power fractal as a distribution mask for the population. 

I had to render the frames one at a time even for this tiny population as TG crashed as soon as it tried to re-populate for the second frame. 

http://forums.planetside.co.uk/index.php?topic=954.0

Quote from: Mr_Lamppost on January 26, 2008, 11:55:55 AM

This is devastating. The placement of individual instances is not consistent from frame to frame.


I haven't found this to be the case. I've constructed masks to restrict the objects to a specific distance from the camera, within the camera's FOV, and then animated both the mask and population positions without any problems. As long as you don't animate the distribution shaders the trees should appear in fixed locations.

[edit] I rechecked this as it has been a while since I ran an animation and so far I'm also getting random placement of trees. Trying to find out what was different [/edit]

Quote from: moodflow on January 26, 2008, 02:04:16 PM

I believe I have the color variation method working, using Mr. Lamppost's node design.  I replaced the voronoi with a perlin 3D scalar so the colors have a continous variance, and it seems to be working.  Since there are 2 colors being mixed by the merge shader (controlled by the perlin 3d scalar), its possible to use the power fractals themselves (which also have 2 colors, high and low) to add even more color detail.  I set the scale to the approximate object (tree) size to roughly keep each tree having its own color.

Definitely more tinkering to do though.

... aah the joys of many heads working on the same problem in a forum... the perlin 3D scalar is the obvious connection between the two but I was too focused on either to spot it  ;)  The tonal variation will help to make trees at the border of masked regions look more realistic, so there is definitely plenty of scope here  :) :)

The main limitation to this method is that it is possible for two trees to be placed so close together that they overlap. The only way we could create masks for individual trees is with a unique variable for each tree. The simplest I can think of is if it was possible to extract the coordinates used to position the tree and then use functions to convert this to a scalar between 0 - 1.   Something for the developers?

Mr_Lamppost

I agree that Voronoi Cells are less than ideal for gradual blends, I was hoping for an object by object variation similar to that which can be applied to fake stones.  Seeing as my assumptions about the way population instances look like being wrong Perlin or Power Fractal looks like the way to go until we figure out population placement or someone (Hint Matt), tells us.  I am sure I had Power Fractal variation working a while ago, just playing around so didn't  save the setup.  

I am knee deep in procedural hurricane nodes at the moment, posting this while a test is rendering, but will have another look if I get the chance.

Smoke me a kipper I'll be back for breakfast.

Mr_Lamppost

Ah the joys of parallel posting   ;D

Quote
Quotehis is devastating. The placement of individual instances is not consistent from frame to frame.

I haven't found this to be the case. I've constructed masks to restrict the objects to a specific distance from the camera, within the camera's FOV, and then animated both the mask and population positions without any problems. As long as you don't animate the distribution shaders the trees should appear in fixed locations.

Constant instance placement is what I would expect and I am sure I had it working in one of the previous versions. Other than move the centre of the population I am changing nothing in that test; your guess is as good as mine why it is not working.

Smoke me a kipper I'll be back for breakfast.