How to filter a specific color?

Started by drongo, August 06, 2013, 07:16:02 AM

Previous topic - Next topic

drongo

Hello,

I am using a lot of image map shaders for all my different populations and colour shaders. But now I am running out of memory (again). Because every high-res image map shader costs me hundreds of megabyte (big area). So I am looking for a possibility to combine all the images to one - because most areas are not overlapping.
Have a look at the attached image, when reading this:
I thought about giving every area a specific colour or grey value and than filtering it in Terragen2. The only option that sounds like it can be used as a filter is the "Colour Adjust Shader". I tried an image with different colours. If I set the black point colour and the white point colour to RGB:150/150/150, it does filter this colour correctly. But, if I take the colour 79/79/79 or 47/47/47, it shows me the complete area which is not black (all three colours). So how does this work exactly? And can I pinpoint a fixed colour? The Clamp-options have no effect and also deactivating the Colour-effects like "convert to linear" in the image map shader does not bring any new results.
Next try: I added a fourth colour: 200/200/200. If I name this colour or 150/150/150, it shows me the combined area of these two colours. I don't understand...
Maybe there is another option? Another shader?

Greetings, Drongo
[attachimg=1]

Dune

You can use the RGB channels of an RGB image, and split them in TG again (with blue nodes: green to scaler etc.) Combine them is another possibility, and make your maps small! Especially for vegetation distribution huge maps are not needed, depending on the scene requirements of course.

Tangled-Universe

The colour adjust shader does not "select" your colours. It "re-maps" the input and outputs it.

Increasing low colour @ 0.1 --> reduce 0.1 to 0 and re-map the entire range accordingly.
Decreasing high colour @ 0.9 -> Increase 0.9 to 1 and re-map the entire range accordingly.
(you can re-map the 0-1 output range only, by keeping the clamps enabled)

Consequently:
Decreasing low colour will increase the brightness of your darker colours.
Increasing high colour will reduce the brightness of your bright colours.

I have to think a little about what you should do best.

Ulco's suggestion is good, especially if you use grayscale masks.

What I always do with grayscale masks is to combine 3 of them into the separate RGB channels in Photoshop.
Then I split them into each channel separately with a "scalar to red/green/blue" node, like Ulco explained.
This gives you 3 masks at the price of 1 image to be loaded into TG3.

However, I'm not even completely sure if this will save you that much memory.
I have never really checked it and I was mostly doing this because of convenience.

drongo

Okay, that sounds good. But I must have done something wrong. I converted the green value of my image (200) to scalar and ask for it in a conditional scalar. My comparison is the scalar of the green part of a constant colour of 200/200/200. But I get the Else result, which is a scalar of 0 in my case.
If I don't take the image as an input, but a constant colour of 200/200/200, it works, it brings me the If result. If I change the green value a bit, I get the Else result again. So, there must be an error in my input image. Does TG somehow change the colours? I deactivated convert to linear as well as smooth interpolation and unpremultiply.

Tangled-Universe

I haven't used conditionals much...heck..I don't use blue nodes that often anyway.

As far as I know your conditional needs the image map as a comparison value.
The "IF" result = white and the "ELSE" result = black.

Don't mistake the input on the far left as the input for the shader's operation.
In many cases this input port is only meant to hook shaders up in the network.
That can be quite confusing sometimes, I reckon.

drongo

but I need two values for a comparison. In http://www.planetside.co.uk/wiki/index.php?title=Conditional_Scalar it says: This node outputs one or two different scalar values based on a comparison between the input value and another value.

Tangled-Universe


drongo

Well... but even if it would work with the image. It would loose the area. I would only get a yes or no, not a here we have a yes and here we have a no. Or? Does it compare pixel by pixel or does it search only for one value (not an image) to compare with the other value?

BTW: here you can see the size of my area and the details I need:

drongo

Okay. Now I tried the function Hard Step Scalar. This gives me everything under a certain value as 0 and everything above as a 1. So I thought I can take all the area with a value a bit under my colour (like 47, 79 or 150) and subtract the area which has a value a bit above the next. And yes, it works. But: again, not with the right values. You can see in the image, I wrote down the colour value at the "constant color" shaders name and I wrote the actual colour of the image in the name of the surface shaders. For example which is 150/150/150 in the image becomes red, because I subtracted the area with the scalar of the colour 218 from the area with the scalar of 160. That means the colour value of 150 now is somewhere at 160. That means, the image is not the image anymore, after import. When I go on with that, I always have to look for the correct scalar of each different color. Which is possible, but annoying...

Matt

#9
Multiplying two Hard Step Scalar nodes (or subtracting one from the other) seems like a good method.

I'm not sure why the colours would be different. Assuming you have a standard 8-bit (or 24bit RGB) image, the Image Map Shader outputs values between 0 and 1, not 0 and 255. If you use Terragen's colour picker to choose values in the 0..255 range, when you click OK it gives you values in the 0..1 range that you can use as constants to select from your image. Terragen's colour picker assumes gamma 2.2 when converting from the values in the colour picker. So, to work with your image, make sure that "convert to linear" is enabled in the Image Map Shader and that the conversion gamma is set to 2.2. It should be set like this by default.

It sounds like you're already doing something like this, so I don't know what's up.

There may some small differences between the conversion done by the colour picker and the conversion done by the Image Map Shader, so I would allow for a difference of 1 or 2 to be sure it will select the right value. For example, if you're selecting 150, select the range 149 to 151.

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