background_generatorSynopsisThe background_generator macro generates a shaded color image field that can be used as a background to another image or model. Input Ports
Parameters
Output Ports
DescriptionThe 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. Inputsin 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. Parameters
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.
X 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. Outputsout_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. Utility MacrosThe 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. ExampleThe BackgroundEg example application creates a background image and shows it in a 2D viewer. Filesiac_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. Other NotesThe low-level BackgroundMods library containing the BackgroundCore module does not specify a process. By default the express process will be used. Authors
Sabreen Vig, Larry Gelberg, Ian Curington Advanced Visual Systems, Inc. Modifications
Andrew Dodd, International AVS Centre Contact
International AVS Centre Manchester Visualization Centre Manchester Computing University of Manchester Oxford Road Manchester United Kingdom M13 9PL See Also
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||