The background_generator macro generates a shaded color image field that can be used as a background to another image or model.
Name | Type | Description | |
in | Image ARGB | Optionally specifies output image dimensions | |
Name | Type | Description | UI Control |
Upper_Left_Hue Upper_Left_Sat Upper_Left_Value |
float | HSV values for upper left corner of image. | UIslider |
Upper_Right_Hue Upper_Right_Sat Upper_Right_Value |
float | HSV values for upper right corner of image. | UIslider |
Lower_Left_Hue Lower_Left_Sat Lower_Left_Value |
float | HSV values for lower left corner of image. | UIslider |
Lower_Right_Hue Lower_Right_Sat Lower_Right_Value |
float | HSV values for lower right corner of image. | UIslider |
X_Resolution Y_Resolution |
int | Dimensions of output image if no input mesh specified. | UIslider |
Dither | boolean | Specifies if noise should be applied to image. | UItoggle |
Name | Type | Description | |
out_fld | Image ARGB | Generated background image. | |
out_obj | GDobject | Directly renderable output object. | |
The background_generator macro generates a linearly-shaded image that can typically be used as a background for other renderings. The macro generates this background image by evenly blending the colour of each corner towards the centre of the image. The user can specify the color of each corner by using the Hue-Saturation-Value colour model. The user can also specify the dimensions of the generated image and whether dithering should be applied to the generated image.
The results of the background_generator macro can be used with the replace_alpha and composite IAC modules to create the effect of a semi-transparent tinted film overlaid upon a regular image. For example, the module could generate a background that vertically blends from grey to white. If this image was composited with an image of a sunny sky an overcast scene could be created. To help with compositing images together the background_generator module has a mesh input port. If an image is input to this port the module uses it to specify the dimensions of the generated background image. Hence the sizes of foreground and background images can be easily matched.
The image generated by the background_generator macro can also be used as the background to a viewer window if the generated image is input into the textured_background macro.
This module is a conversion of the AVS5 "background" module. The module implementation has been converted to C++, and has a new user interface. The low-level code operates on simple byte arrays rather than fields.
in
If a 2D image field is presented on this port it is used to specify the size of the generated output image field. This input is option. If no image field is given the dimensions specified by parameters will be used.
Upper_Left_Hue Upper_Left_Sat Upper_Left_Value |
Upper_Right_Hue Upper_Right_Sat Upper_Right_Value |
Lower_Left_Hue Lower_Left_Sat Lower_Left_Value |
Lower_Right_Hue Lower_Right_Sat Lower_Right_Value |
The shading of the generated background image is calculated by blending the colours at the corners towards the centre of the image. The colours of the 4 corners of the image are specified by the parameters shown in the table above. The colours are specified in the Hue-Saturation-Value colour model.
In the HSV colour model Hue states what is generally known as colour. Example values for Hue are shown below. Saturation states how much white should be added to the Hue. Value states how much black should be subtracted from the Hue. Values for Hue, Saturation and Value should all be in the range 0 to 1.
Hue Value | Colour |
0.0 | red |
0.1667 | yellow |
0.3333 | green |
0.5 | cyan |
0.6667 | blue |
0.8333 | magenta |
1.0 | red |
X Resolution
Y Resolution
If no input is present, these resolution parameters are used to specify the dimensions of the output image in pixels.
Dither
This boolean parameter specifies if dithering should be applied to the image. If the background image was closely examined coloured contour bands would be noticed. These occur when the module interpolates a small range of colors over a large screen distance. If dithering is specified random noise is added to the lower bits of the color to smooth out this contouring effect. The module takes longer to execute if dithering is turned on.
out_fld
Output field containing the generated background image. The image is output as a 2D uniform scalar byte field containing node data with ARGB colour components.
out_obj
The GDobject version of the output, suitable for direct connection to the viewer. A 2D viewer is recommended.
The functional macro BackgroundFunc uses the low-level module BackgroundCore. The user macro background_generator uses this functional macro and the user interface macro BackgroundUI. The BackgroundParams parameter block is used to connect these components together.
The BackgroundEg example application creates a background image and shows it in a 2D viewer.
iac_proj/backgrnd/bg_mods.v contains the V definitions of the BackgroundCore module and the BackgroundParams and RGB_BackgroundParams parameter blocks.
iac_proj/backgrnd/bg_macs.v contains the V definitions of the BackgroundUI and RGB_BackgroundUI UI macro, the BackgroundFunc functional macro and the background, textured_background and coloured_background user macros.
iac_proj/backgrnd/bg_apps.v contains the V definition of the BackgroundEg, TexturedBackgroundEg and ColouredBackgroundEg example applications.
The low-level BackgroundMods library containing the BackgroundCore module does not specify a process. By default the express process will be used.
Sabreen Vig, Larry Gelberg, Ian Curington Advanced Visual Systems, Inc.
Andrew Dodd, International AVS Centre
International AVS Centre Manchester Visualization Centre Manchester Computing University of Manchester Oxford Road Manchester United Kingdom M13 9PL