Planetside Software Forums

Support => Terragen Support => Topic started by: mogn on May 09, 2007, 03:05:38 am

Title: A colourful error!
Post by: mogn on May 09, 2007, 03:05:38 am
I was trying to emulate a color gradient (as used in many fractal programs).
A colorgradient with 5 control points and about 30 nodes was connected to the colour function of
a surface layer.
The colours overflowed into the atmosphere (also in the prewiev).
After settings altitude limits in the surface layer, it worked ok:
Title: Re: A colourful error!
Post by: mogn on May 09, 2007, 03:10:02 am
Sorry wrong picture!
Title: Re: A colourful error!
Post by: Oshyan on May 09, 2007, 03:21:09 am
Wow, that's rather odd. Can you share the .tgd?

- Oshyan
Title: Re: A colourful error!
Post by: mogn on May 09, 2007, 03:57:57 am
Thanks for the fast response.
Title: Re: A colourful error!
Post by: Oshyan on May 10, 2007, 01:11:20 am
The problem seems to only happen with Global Illumination is enabled. Although I was unable to confirm this theory, I'm thinking either unclamped or luminous surfaces are messing up the GI calculation. It may just be that GI doesn't work well on these pure function-generated colors, or it may have something specific to do with how you've done it in this particular case. I did try a clamp and some other things on your color input but no effect. Maybe this will get you on a track to solving it though, or at least working around it.

- Oshyan
Title: Re: A colourful error!
Post by: bigben on May 10, 2007, 08:50:21 pm
I think GI exaggerates colour effects in order to be visible so it might go "a bit" haywire when given so much saturated colour across a scene.  For a "normal" sample, see the underside of the bridge in http://forums.planetside.co.uk/index.php?topic=1482.msg14646#msg14646 (http://forums.planetside.co.uk/index.php?topic=1482.msg14646#msg14646).  You can tone things down a bit in this image by lowering the Colour in atmosphere in the Enviro Light settings but it'll still be a bit green. I'm guessing that the colour cast was green because it's the colour of the flat valley floors which would reflect more straight up into the atmosphere.

Even if you add fill lights you will still have other problems. The atmospheric lighting effects over distance will screw up the colours in the shadows (see attached). This image was using my fill light setup, but I also got similar results with just a single, neutral light source at the zenith.  I noticed that this is different to your first image that you posted... What fill light did you use there?

Judging from the shadows higher up on the peak, you might get a workable gradient by dropping the saturation of the colours.
Title: Re: A colourful error!
Post by: bigben on May 10, 2007, 09:49:30 pm
Here's a quick hack of a gradient using surface layers. I tried bumping the saturation of the colours right up but the image only got a little green.  I'm not suggesting this as a replacement, as your method is easier to configure, but it may provide some clues to someone as to what is going wrong.
Title: Re: A colourful error!
Post by: mogn on May 11, 2007, 02:55:28 am
I didnt use any light filling (except for the for the default sun).
Your desaturated picture looks good.
I will build a colour-gradient with 6 colours, somewhat simplified.
I love the node network ;D

I have 2 problems with using the colour mixer in my gradient network:

1. mix is linear in luminosity. E.G. A mix of pure red and pure red with a control of 0.5 gives a color of 128,128,0 (luminousity=64)
    pure red and green has a luminousity of 128, so i would expect the luminousity of the mix to be pure yellow instead of unsatureded yellow.

2. The mixer clamps the controller to 0 for negative values, but does clamps the controller to 1 for values > 1

Title: Re: A colourful error!
Post by: bigben on May 11, 2007, 06:41:27 am
Had another look at your tgd. I'm still pretty new to functions like this, but the Build colour node looks promising for reconstructing your RGB values. It may mean reworking your network a bit but the method should be relatively similar.
Title: Re: A colourful error!
Post by: bigben on May 11, 2007, 10:51:04 pm
Had a further play (using this to learn a bit more about functions) and it's looking very promising.

I've setup a gradient in Photoshop using a curves adjustment layer. I then took the RGB values for each key point (in and out) and plugged them into a spreadsheet to convert the values to a range of 0 - 1, with an additional column calculating the slope of the line between the points (you could do this in TG but it gets messy).

In TG I convert the the altitude a range of 0 - 1 clamped to your min/max altitudes and use this with nested conditional shaders comparing the altitude to the IN values to determine the OUT value.  This is done for each RGB channel, with the results fed into a Construct colour node.  It's a bit fiddly (going to take me a while to put it together) but it effectively reproduces the same control over your gradient as the sreengrab in your first post... and it's very smooooth :) 

The only other thing I found was that the render got a bit grainy. I fixed this by bumping up the number of atmosphere samples.
Title: Re: A colourful error!
Post by: mogn on May 12, 2007, 02:51:42 am
Thanks for your interrest in my gradients. 8)
http://cattail.nu/newton/
contains a useful gradient editor.
Title: Re: A colourful error!
Post by: bigben on May 12, 2007, 09:39:42 am
You're welcome.  Like i said... I'm using this as a learning exercise, and at least I know half of what I'm doing so there aren't so many gaps to fill in  ;)

I made a few mistakes in the previous test, and ended up putting the entire calculation into TG. It looks a bit messy and does have an impact on render times but it does give you a lot of control over the gradient. Thanks for the link, but I'm quite comfortable with getting radients out of Potoshop.  The advantage of using this method is that you create 3 completely separate gadients which reduces the risk of banding.  I'll post the tgd when I've finished.
Title: Re: A colourful error!
Post by: bigben on May 14, 2007, 01:09:21 am
[attachimg=#1]

This still has only a basic blue gradient, and the altitudes may be a little different to what you had... but it demonstrates the point...   (that I'm either insane or suffer from OCD to some degree).

One functional gradient restricted within a min/max altitude range that plays nicely with GI.  I'll probably complete the blue gradient tonight anyway (must be OCD ;)) but my head hurts for now. It works... but if you make a single mistake it can be an absolute bugger to track down.. especially toggling between positive and negative gradients.

I'll also have to look at my original approach again and see if it was my mistake or a problem with TG.

I need a big coffee  ;)
Title: Re: A colourful error!
Post by: mogn on May 14, 2007, 01:44:56 am
I finished the red gradient, and it seems to work  8) (40 nodes):
Title: Re: A colourful error!
Post by: bigben on May 14, 2007, 06:40:55 am
I had a quick play with you clip file but haven't done a detailed "walkthrough" of it yet.  I tried a quick modification of it using merged colours rather than a single channel and found that the bands were quite distinct.  I went back to your original and plugged the output into all 3 channels (looking at just a single coloured channel is too difficult) and it looks a little too distinct as well. The second image is the red channel from my gradient for comparison.

[attachimg=#1]  [attachimg=#2]


I also started a render with GI bumped up to 3,3 and got a bit worried when the pre-render had all green dots on the terrain. This may have been on the way to the original problem that started all of this, but the render looks OK.

[attachimg=#3]
Title: Re: A colourful error!
Post by: mogn on May 14, 2007, 09:55:07 am
Ok, here is my version:

The border line is too sharp some places. Perhaps this could be remidiated by adding some noise to some of the altitudes.
The next project is to make soft interpolation between the colours. ::)