PDA

View Full Version : Normalizing a scalar layer node ?



Pavlov
05-17-2013, 10:05 AM
hi all
i use this setup (see pic) to get a blur variation across a material. I find this is one of the most important things to get somehow "real".
In my simple setup i plug a scalar layer with a bitmap, into a Gradient and i gfeed gradient's values to Blur variation input.
Problem is that i must find min and max values each time. If a map ranges from RGB 20,20,20 to 150,150,150 this means i must put key correctly into gradient to find these values.
I need a setyup which gets scalar input and outputs a normalized value, which ranges from 0 to 255, so into gradient i can use a key in 0 and a key in 1.
Hope i've been clear, thanks

Paolo

114394

Lightwolf
05-17-2013, 10:08 AM
Well, it's hard to compute the min/max required automatically if all possible values aren't known.

However, the Remap node in the (free) db&w Tools (http://tools.db-w.com) should be able to help you here.

Cheers,
Mike

jrandom
05-17-2013, 04:31 PM
I second the notion for Remap. (I've never used it, but I used to use ReRange from IFVW.) Much handier than trying to use a gradient or curve.

Tobian
05-18-2013, 05:40 AM
+1 remap.. Using it right now! :)

Pavlov
05-18-2013, 09:40 AM
So it seems there's no setup able to check automatically min/max of an image and bring them to 0 and 1.
Trying remap node, seems nice and useful :)

thanks,
Paolo

jrandom
05-18-2013, 10:02 AM
You'd need a node that, at the start of each frame, scans through every pixel in the image and stores a min/max value for that image. Seems possible, but I don't know if anyone has written a plug-in like that.

Sounds kinda useful. I'll add it to my list of "plugins to look into writing" but if even if I decide tackle it, it's not going to be done anytime soon.

Tobian
05-18-2013, 10:11 AM
http://forums.newtek.com/showthread.php?71751-Extra-Buffer-nodes&p=1317199&viewfull=1#post1317199

Not sure if that works for regular images, or just buffers.

Lightwolf
05-18-2013, 12:45 PM
So it seems there's no setup able to check automatically min/max of an image and bring them to 0 and 1.

No - one reason being that no node knows what it's connected to... and it also only "sees" one value at a time. So the source for the scalar could be anything, not only an image map.

The only place to add a function like that would be within the image node itself - and it would only work with images as well.

With (basic) procedurals you already tend to know the min. and max. values anyhow.

Cheers,
Mike

dwburman
05-19-2013, 12:51 PM
The only place to add a function like that would be within the image node itself - and it would only work with images as well.


Could this be done in an Image Filter (similar to auto levels in AE and PS) and applied to the image itself in the image editor?

It's not a nodal option and since it happens before the image hits the node flow, you would have all the limitations that go along with that.

Lightwolf
05-19-2013, 01:52 PM
Could this be done in an Image Filter (similar to auto levels in AE and PS) and applied to the image itself in the image editor?

Yes, but with 8 bit images that's likely to come with a loss of quality as well.

Cheers,
Mike

dpont
05-19-2013, 02:28 PM
Could this be done in an Image Filter (similar to auto levels in AE and PS) and applied to the image itself in the image editor?

It's not a nodal option and since it happens before the image hits the node flow, you would have all the limitations that go along with that.

This can be done in the Image Filter node editor,
as a preprocess the image is output as Color in the Render Buffer node,
the Histogram node can output the low and high Luminance,
not simple but the min and max value could be exported
each one overwriting a copy of the image with this setup in the IFNE,
then two Image nodes with these reference images
can output these min and max values in the Surface node editor.

Denis.

Pavlov
05-19-2013, 04:08 PM
thank you all.
Not simple definitely, anyway, and not storable in a surface preset.. maybe worth a dedicated node in a future update.

Paolo

probiner
05-19-2013, 08:00 PM
You must do it in LW or it could be done in PS?
Adjustments>Levels
On "Options" choose "Find Dark & Light Colors" and set both clip values to 0,00%.
Choose "Save as Default" and now every time you apply Levels and Click Auto it will normalize the image so you can do it in batch :)

Cheers

Pavlov
05-20-2013, 01:40 AM
hi, no i need to do it in LW.
when i want to control reflection blur, i dont wat to get mad with further operations, i'd like to do it in a streamlined way.
Usually i copy a texture i'm using sonmewhere else in the material, and i need a superfast way to normalize it within LW.

Paolo

dpont
05-20-2013, 03:13 AM
I added a Low Luminance output and an High Luminance output
in the Image Map node of DPKit.

Denis.

Pavlov
05-20-2013, 03:32 AM
nice one, Denis.. thank you so much !
gonna try it now.

Paolo

dwburman
05-20-2013, 03:06 PM
Thanks for the answers. I like this community :)