Image mask as fractal breakup fix.

Started by bigben, February 20, 2007, 06:41:24 PM

Previous topic - Next topic

bigben

Made a significant breakthrough for my workflow that others should find useful.

I make extensive use of greyscale image maps to replace the fractal breakup for surfaces, and while this works really well there have been a few things that never seemed to work properly. While working on a method to tweak the contrast of the mask image within Terragen, I noticed that my changes also made the mask behave more as expected.  The main problems I had came when combining masks using colour functions, and also trying to restrict objects and fake stones, but having fixed it there also appear to have been other less noticeable 'issues'.

The tweak I came up with was originally designed to just change the gamma of the mask image without having to re-edit the individual image each time. This also allows for a number of different variations of the one image mask without requiring the loading of extra images.  Rather than plugging the image map directly into the fractal breakup/opacity etc... of a surface I added an intermediate surface layer (white colour, coverage 0.5, fractal breakup 1.0 assigned to image map). This surface layer is then used for the fractal breakup of the shader.

As soon as I did this to all of my image maps, the colour functions produced the expected results.

And tweaking the image maps..... I now make my images with a higher gamma than I expect to need (I'll have to do some more tests to be able to assign some numbers to this), which will give an image mask with a broader distribution than desired. increasing the fractal breakup of the intermediate shader effectively lowers the gammma of the image mask, providing some a good range of tweaking. It only works in one direction, hence starting with a 'high gamma' image. 

In the screengrab below I've used a fractal breakup of 2 to increase the sharpness of the edges in the image mask.

Without the intermediate shader ("Adjusted water mask"):


Oshyan

It sounds like this is an issue of the image reader not outputting colors with the full range of values, or simply not being "bright" enough (or not being interpreted as such). Although I say that as pure speculation; Matt would have a better idea of whether this is a bug. I would suggest an experiment however: try using a Colour Adjust Shader after your Image Map shader and feeding that straight into the Fractal Breakup, etc. The Color Adjust allows you to change black/white point and gamma, essentially just as you seem to be wanting to do. I'd be interested in hearing if this could have the same effect and hopefully determining whether this is a range issue with the image reader or interpretation within TG, or something in the image files themselves, etc.

- Oshyan

bigben

I'll run some more tests tonight. If the image adjust shader has the same effect if will probably be more useful in this situation.

I'll also try different image formats to see if there's any difference. I'm using LZW TIFF.  It shouldn't really make any difference but it may help isolate the underlying problem.

Oshyan

Thanks Ben, your efforts and knowledge sharing are greatly appreciated. :)

- Oshyan

Arandil


bigben

#5
OK, here are some basic tests... with some interesting results. 

The mask consists of:

  • A WM flow map image generated from the TER
  • A water mask image subtracted from the above
  • A distribution shader with a minimum altitude set to remove high altitude trees (subtracted from both of the above)

The resulting mask is used for the fractal breakup of the green surface and the tree density shader. Test renders with and without trees (low quality to keep times down).

Image map only
[attachthumb=#1]
[attachthumb=#8]

Intermediate colour adjust shader
[attachthumb=#2]
[attachthumb=#9]

Intermediate surface layer (Fractal breakup = 1.0)
[attachthumb=#11]
[attachthumb=#12]

Intermediate surface layer (Fractal breakup = 1.8 )
[attachthumb=#3]
[attachthumb=#4]

Intermediate colour adjust shader -> intermediate surface layer
[attachthumb=#7]
[attachthumb=#5]
[attachthumb=#6]

The colour adjust shader provides the most accurate representation of the mask image. (and much better control over the image) I used to create 4 flow maps for TG0.9, but now I can replace them with a single image which is going to be a big saving in resources.

Only those examples using an intermediate surface layer have a correct object distribution! While these renders use a fairly distant camera, I suspect that the object distribution problem may be linked to the other surfacing problems mentioned in my original post (although I'd have to check). All other shaders also produced rogue trees on the surface of the lake.
[attachthumb=#10]

Hopefully the difference between these two intermediate shader types may provide the solution.. for now I'll simply use both with each image map. FWIW this also provides a good way to use a single image map in several different node branches from just a single instance.

This may have other implications for some of my other experiments (and hopefully get past some of the limitations I struck)

rcallicotte

BigBen, your devotion to getting this exact is a happy salvo for all of us.  Thanks.
So this is Disney World.  Can we live here?

bigben

I don't mind sharing this stuff because I get plenty back in return (like Oshyan's tip to try the Colour adjust shader which is a huge benefit in this situation). In many cases I simply don't know enough to work all the way through a problem, or it's simply quicker to just ask/share. This usually provides enough info/feedback to move forward. 

I've edited the post above with an additional example because in my early experimentation I forgot to reset the fractal breakup of the intermediate surface layer back to 1. This created an exaggerated difference between using a surface layer and using a colour adjust shader. Even with the correction, there is still a significant difference between the two, so the comments are still accurate. This is probably as far as this experiment goes for now.

Final suggestions...

  • set up you image masks with both a colour adjust shader and a surface layer
  • set the surface layer with Coverage = 0.5, Fractal breakup = 1
  • do all of your tweaking in the colour adjust shader (this rocks!)

I'm reworking this project with an improved TER (and thus improved flow map), and I now have a landsat overlay to generate some additional masks (like finding the rest of those lakes). Adjusting the masks with the colour adjust shader correlates very well with using Phoshop's levels so I use PS to preview the mask adjustment and then transfer the settings to the colour adjust shader. Now all I have to do is update the results of my other masking tests as this is a fairly significant change.

Will

Yes thank you for sharing in your exparments they are really helpful.

Regards,

Will
The world is round... so you have to use spherical projection.

twistednoodle

I wish I knew what you were talking about - I'm sure there are a bunch of us who don't!  :B  Anyway thanks for sharing this, maybe sometime in the future I'll know what a mask is and how to apply it.  Keep up the good work. ;D
I may be crazy but at least I'm not crazy!

bigben

#10
This zip file contains a TGD and image to demo how I use an image map to control the density of a population ( a grass clump in this case). The TGD also contains a disabled surface layer that uses the same mask for its fractal breakup. I normally create a "preview" surface with each population as it's easier to work with. I disable the preview surface before the final render.

[attachthumb=#2]
Render on the left, preview surface on the right

Play around with the settings in "Mask image colour adjuster" and see how it changes the surface and population.

Hope this helps.


garcia


twistednoodle

What a legend!  Hey any relation to Mt Big Ben in Australia?  Thanks for the demo - I'll take a look at it right away!
I may be crazy but at least I'm not crazy!

rcallicotte

Thanks, Ben.  Image masking is becoming clearer and I wouldn't have understood anything about it if not for your adept instruction.  Great!
So this is Disney World.  Can we live here?