Shader Mixer: type conversions in/between bricks, parameter ranges, brick ‘preview’ renders
With no real documentation, I’m having problems trying to get a simple maths network to work (combining two normal maps). The following things are all involved:
- Types: the triplets with range limitations, i.e. normals (N) and colors (C).
- ‘Between-brick’ type conversions: when you plug an output triplet (N, C, point P, or vector V) into an input triplet of a different type.
- ‘In-brick’ type conversions: Color Component (C to 3*F), Color Transform (3*F to C), XYZ Component (P to 3*F), and Point (3*F to P).
- Brick ‘preview’ renders: when the output is a float (F)
I’m not sure whether the problems I’m having are with my maths, or with my implementation using the bricks (in truth it’s probably a bit of both). I’d like to clear up a few points just to check:
Q1) If you plug a NORMAL into the input of a Color Component or XYZ Component, will the 3*F outputs each be in the -1.0 to +1.0 range?
Q2) If you plug a COLOR into the input of a Color Component or XYZ Component, will the 3*F outputs each be in the 0.0 to +1.0 range?
Q3) If a brick has a single FLOAT output and you do a preview render, are negative values rendered as black (i.e. same as 0.0) and are values greater than +1.0 rendered as white (i.e. same as +1.0)?
I think I’ve found some more clues:
- If you select the same normals map image from a ‘Normal Map’ brick and an ‘Image Map’ brick and do a brick preview render on each, the ‘Normal Map’ brick preview render is much darker.
- Taking the ‘X Component’ output from an ‘XYZ Component’ brick (input from a ‘Normal Map’), plugging it into one input of a ‘Binary Operation (Add)’ brick, setting the other input to -2, -1, 0, +1 and +2 in turn and doing a preview render seems to confirm that the outputs are in the -N to +N range (with N being the value that the brick preview render displays as white (and that may or may not be +1).
- Doing the same, but using a ‘Color Component’ brick instead has the same results.
- Doing the above two experiments again, but with an ‘Image Map’ brick providing the input confirms that the outputs are in the 0 to +N range.
Let’s face it, looking at a manual wouldn’t be half as much fun!
Conclusion (so far):
-Outputs from an ‘Image Map’ brick, when split into three components, have values in the 0 to +N range.
-Outputs from a ‘Normals Map’ brick, when split into three components, have values in the -N to +N range.
-The brick preview render, when used on a brick with a F output, displays values of 0 and below as black, values of +N and above as white, and intermediate (0 to +N) values as shades of grey.
- the value +N is very probably +1.
-the ‘XYZ Component’ and ‘Color Component’ bricks don’t appear to do any range-checking, and the outputs’ ranges appear to depend on the input.