Rainbow

Started by bigben, February 26, 2008, 06:50:49 PM

Previous topic - Next topic

bigben

#30
Thanks guys

Here are the renders I had been waiting for.
[attachthumb=#1]
This is a full double rainbow with an intersecting cloud. As the sun is behind the camera you don't really see any efects from the clouds shadow on the rainbow.  The secondary ilustrates the problem I mentioned above. The rainbow has been reduced to just the primary colours. The lightening effect inside the rainbow is getting better.

[attachthumb=#2]
This is a close up of the lower left end of the rainbow showing the gap between the red and green bands in the secondary rainbow.  I'll have to finalise the density settings first before I deal with the noise. Quality settings were set reasonably high for this (hence the long wait). Fixing the minimum density should also make the colour blending much smoother across the primary rainbow.

[attachthumb=#3]
This was more of a positioning test than anything else. The wall'o'rain was restricted to just in front of the camera rather than having the camera in a sphere'o'rain so that the full effect of the sunlight could be seen. There are shadows from the background cloud layer cutting off the rainbow at the top and you can just make out the secondary rainbow.

Having the rainbow attached to the camera makes positioning a breeze. The output of the RGB masks were fed into a Build colour node which was then connected as a child to a surface layer. This gives a quick preview of where the rainbow will appear on the terrain, and it was then just a case of moving the rain to the right distance/position. Just a "quick test" on a Mt St Helens terrain.

Now to figure out the various density settings, especially the minimum density for the cloud masks.

rcallicotte

Excellent work.  Who would have even thought this was possible last year?  I didn't.
So this is Disney World.  Can we live here?

bigben

#32
This is definitely heading in the right direction.  This image uses a greyscale step wedge image to trial a series of numbers for the minimum value of the RGB density masks (faster than rendering an animated sequence) They range from 0.5 at the top to 0 at the bottom in .05 increments. As you can see it gets smoother towards the top although the overall density seems to have dropped a little as well. This can easily be fixed by increasing the cloud colour to compensate.

I had also considered that some of the variation may be due to the fact that the total sum of the three mask values varies from 1-2 (e.g. red =1, green = 1, yellow=2) but this does not match the pattern of gaps so I'm still not really sure what is going on. I will try a render with mask values adjusted so that the sum of the RGB mask values always = 1 but I'm not sure whether it will improve things (although it should make a smoother colour gradation).

bigben

#33
Set the minimum density to 0.5 and used the stepwedge on the cloud fractal this time so see the changes in the rainbow with density.  As you can see in this there is a sudden drop off at 0.4, so the density fractal could use this as it's low colour.

Changing the gradient to provide a sum of densities of 1 was a flawed idea as the gaps return too quickly. Reverted back to the previous gradient, but there may still be the problem of the rainbow degrading to just RGB. A worst case scenario may mean having to add cloud nodes for the secondary colours as well but I want to avoid that if possible.

Running a new test with some cloud tweaks to reduce the noise.

The build up of density outside of the rainbow is due to the combined RGB (minimum) densities. I haven't masked out the edges of the rainbow yet as this is providing me with some useful information for now.

j meyer

Hi-ho Silver,ride on! ;D

bigben

Well I got a little side-tracked when I adjusted 1 or 2 cloud settings too many (at once) and broke things with a weird result. This wasted a bit of time but I've gone back to my last successful test and am moving forward from there.  The next test render is still running, using quality settings more along the lines of what I would use with a nearby tree in the scene. It's looking relatively good.

There's still a bit of noise but I think it adds to the scene and I won't try to remove it entirely. Still tossing around ideas on how to fade the density nicely without the rainbow falling apart. Adding a minimum value helped a lot. I had experimented with tweaking the gamma of the gradients but this is flawed because this involves increasing the slope of each part of the gradient which exacerbates the problem. The latest possibility I'm considering is increasing the range of the gradient by extending each black level beyond its theoretical cutoff. This will mean that the secondary colours will actually have a total density greater than the primary colours. This will only be a small difference but it may be enough to retain the secondary colours long enough to keep them visible as the rainbow fades.

Other than that I think I've just about exhausted the possibilities and it may be a case of putting up with it or adding cloud nodes for the secondary colours as well, but that's a frightening prospect from the point of view of render times. Hopefully another image tomorrow  ;)

Matt

#36
Hi Ben,

I'm not sure I fully understand the density fading problem you're talking about, but maybe it has something to do with the built-in density profiles in TG2's cloud layer. They reduce density in the upper and lower parts of the cloud layer, and there is a variable cutoff threshold which could cause problems. You might need to use a much deeper cloud layer that's centred around the altitude you're most interested.

I think you need a much wider band for each of the channels. I'd expect to see a lot more yellow, and maybe some more cyan. The human eye response to red and green overlaps a great deal.

http://en.wikipedia.org/wiki/Cone_cell

Obviously there are other factors to consider, such as the fact that the RGB components coming from your monitor don't match the eyes cones' responses, but I'd start with an approximation of the eye's RGB response. Unfortunately that won't give you violet because the blue of a computer monitor doesn't look violet, but I think that's the only special case you need to worry about (by adding a touch of red as the blue fades out). Does anyone know how it is that digital cameras are able to reproduce violet in rainbows? Do they perform a similar trick to remap pure blue to something that appears more violet in RGB space?

Matt
Just because milk is white doesn't mean that clouds are made of milk.

bigben

#37
Thanks for the feedback Matt

The density fading problem is related to the hack of using a very low cloud density and high colour values to have the rainbow disappear in shadows.  This also makes it disappear at lower cloud density values, and because the secondary colours are made up of reduced density masks applied to separate cloud layers, these transitions are the first to disappear. It's a trade off then to keep the mask density high enough to keep the rainbow visible while still providing the variation for the colour gradient.  It's not a problem with TG2 as such, more a drawback of the model I'm using to build the rainbow. 

In the previous image you can see how the rainbow is almost straight RGB (density starting point was a bit too low to properly show secondary colours), and as the cloud density decreases further you get gaps appearing between the bands until everything disappears before the density reaches 0.

If you could apply a colour function to a cloud it would simplify things a whole lot  ;)

I'm dealing with violet by adding a reduced red band at the end. Still a bit too bright, but getting there. I had also noticed in pics of rainbows that the bands got wider towards the outer edge. The angles I've used for the gradients provide a uniform increase in width for each colour band.

My laptop crashed halfway through (no GI), but the render I left running at work (with GI) is nearly finished. I've taken a screengrab just in case although it's only using 700Mb  of memory (180 RAM, 530 VM) so I'm not expecting any problems at this late stage.

Detail 1, AA 6, GI 1,3 (0 GI on rainbow nodes)
  [edit] render's finished now [/edit]

bigben

Also following the Cloud Noise at distance thread and learning a bit more about clouds...

Making some headway with cloud scattering colour (was set way too low, probably the main cause of the noise(?))
Lowering edge sharpness also seems to be helping but will have to run a high res render to check...

Moved the rainbow to a new file with a "real" terrain and new cloud to see how portable it is. Mostly works fine. Including the cloud nodes for the rainbow wasn't as easy as duplicating the existing cloud node and then tweaking each colour. It seems to be more successful customising it to suit the original cloud node that it is being added to, but the process is pretty straight forward.

Running a medium res render which will include a terrain shadow across the rainbow demonstrating how the rainbow builds up with distance from the camera.

bigben

#39
Forgot to connect the cloud density shader to the rainbow, so this shows a full density rainbow. The noise is greatly reduced, and the transitions are a lot smoother. The hacks to bump up the minimum density have resulted in a lighter edge to the rainbow which suggests that I can bring the gradients towards their original forms.  So it's another step backwards for now to revise and rebuild based on the latest tests.

I've played around with a few different cloud settings and the latest process goes something like this:

Duplicate cloud node, attach rainbow mask X cloud density shader X distance restriction
Light propagation = 20
Cloud Colour = R,G or B and increased to 100
Scattering colour = 50-100% of Cloud colour (still testing)
Edge sharpness = 1% of original value
[edit] and Enviro light (& tint) = 0 [/edit]

The rest of the cloud settings (including Cloud density) are left at their original value (but this may need to be changed later)

The depth of the rainbow has been increased 10x in this image from previous tests (now 3km)  Some preliminary tests indicate that the darkening of the secondary rainbow is working much better as well. Back later when I have something slick to show.


Mohawk20

It's looking pretty good allready! This is going somewhere.... somewhere nice!  ;D
Howgh!

rcallicotte

This is nice, Ben.  So...educational, beyond my brain energy level.  For now.

Thanks for letting us in on all of this.  I come back to your explanations from time to time, when I get stuck.  It's all been very helpful.
So this is Disney World.  Can we live here?

bigben

Quote from: bigben on March 11, 2008, 04:30:06 PM
... Back later when I have something slick to show.

I lied ;) I has started a render with GI but I accidentally disconnected one of the primary rainbow masks which made the entire rainbow disappear :(  The pre-render took a long time.

Here is an incomplete render of the new, improved double rainbow. Detail 1, AA 2, GI 0,0. The primary rainbow has the original (theoretical) gradients. 

The secondary rainbow has two extra tweaks;
The minimum density of each has been increased by multiplying the gradient by 0.5 and then adding 0.5 to the result
The black levels of the internal gradients (not going to the edges) have been shifted to the next secondary colour (red = 0 at cyan insted of green, blue = 0 at yellow instead of green, green = 0 at violet instead of blue).

The secondary rainbow seem to be holding together much better at lower densities and I may apply the second tweak to the primary rainbow before starting a render with GI.  I may have to extend the red and green black levels beyond the red edge of the rainbow to lighten the yellow as it's gone a little orange. See... I knew there was a reason for posting this... Stopped the render to apply the revised black levels to the primary rainbow and discovered that there were some old tweaks to the gamma of the gradients on the secondary rainbow. These would have been largely responsible for the reduced amount of yellow.

The gap in the primary rainbow looks a little odd although I'll have to reserve my judgement until after seeing a render with GI which will lighten the shadow. It's caused by a shadow, but the thin bit of rainbow in front of the shadow has disappeared. The difference in intensities is probably too great due to the depth of the rainbow (3km). Using a thinner rainbow would fix this... probably around 300-500m, although this would make it a little harder to position the rainbow.

There is no darkening between the two rainbows in this example, although I have a mask that can be used for this. This area will look darker anyway due to the lightening applied inside the primary and outside the secondary rainbow.

bigben

Here's a sneak peek at a larger render with GI.


.... OK so it's the end of the week and it's bloody hot here... must be dehydrating   ::) ;)

rcallicotte

So this is Disney World.  Can we live here?