textured_background & coloured_background
Synopsis
The textured_background and coloured_background macros both create a DataObject that can be used as a static background to a Viewer window. The textured_background macro uses a supplied image field while the coloured_background macro generates a interpolated fade based on 4 RGB values.
Input Ports
| Name |
Type |
Description |
|
| texture_in |
Image |
Image to use as Viewer background. |
|
Parameters
| Name |
Type |
Description |
UI Control |
|
| depth |
float |
Distance background is from camera. |
None |
Upper_Left_Red
Upper_Left_Green
Upper_Left_Blue
|
float |
RGB values for upper left corner of image. |
UIslider |
Upper_Right_Red
Upper_Right_Green
Upper_Right_Blue
|
float |
RGB values for upper right corner of image. |
UIslider |
Lower_Left_Red
Lower_Left_Green
Lower_Left_Blue
|
float |
RGB values for lower left corner of image. |
UIslider |
Lower_Right_Red
Lower_Right_Green
Lower_Right_Blue
|
float |
RGB values for lower right corner of image. |
UIslider |
|
Output Ports
| Name |
Type |
Description |
|
| out_fld |
Mesh+Node_Data |
Field containing Quad cell-set that is used as background. |
| out_obj |
GDobject |
Directly renderable output object. |
|
Description
The textured_background and coloured_background macro both create a DataObject that can be used as the background to a Viewer window. The textured_background macro allows an image to be used as the background while the coloured_background macro allows the user to specify a colour fade.
The effect of a static viewer window background is produced by creating a field that contains a single square cell-set. This cell-set is sized so that it covers the viewer window and is slightly in front of the far clipping plane. The far clipping plane specifies the maximum distance that an object can be away from the camera before it is ignored. Therefore by placing the background slightly in front of the far clipping plane it should be behind everything else. The field is then placed into a DataObject and the transformation of the DataObject is locked. This ensures that the background is not transformed with the rest of the scene.
The background image is created by using node data. The coloured_background macro creates a set of node data with a triplet of RGB values at each corner of the square. AVS/Express interpolates between each of these RGB values as normal to create the colour fade effect that can be seen. In a similarly the textured_background macro creates a set of node data. However this node data specifies texture coordinates for each corner of the square. These texture coordinates are then used to texture map the square with the input image. The input image can be any AVS/Express image field. The output of the background_generator macro can be used to generate an alternate form of colour fade.
Inputs
texture_in
2D image field that should be used to texture map the generated mesh data. This input is only present on the textured_background macro.
Parameters
depth
This floating point parameter specifies now far the background should be from the camera. By default this distance is 0.98 and therefore the background is just in front of the far clipping plane. Normally this distance will not need to be changed and hence no user interface component is presented. However if the far clipping plane is altered or you wish to occlude some parts of your model this parameter can be used.
Upper_Left_Red
Upper_Left_Green
Upper_Left_Blue |
Upper_Right_Red
Upper_Right_Green
Upper_Right_Blue |
Lower_Left_Red
Lower_Left_Green
Lower_Left_Blue |
Lower_Right_Red
Lower_Right_Green
Lower_Right_Blue |
The shading of the quad cell-set generated by the coloured_background macro 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 Red-Green-Blue colour model. These parameters are only present on in the coloured_background macro.
Outputs
out_fld
Output field containing the generated background field data. This field contains a Quad cell-set and a single set of node data. In the coloured_background macro this node data contains the RGB colour values for each corner while in the textured_background macro this node data contains the texture coordinates for each corner. Normally this output should not be used as its transformation is not locked and it does not contain the necessary texture image.
out_obj
The GDobject version of the output. If this output is connected to a viewer a background will be placed into that viewer window. The output object contains the generated field data and, if necessary, the texture image data. The transformation for the output object is locked so that the background will always stay at the back of the visualization.
Utility Macros
The user macro coloured_background uses the RGB_BackgroundParams parameter block and the RGB_BackgroundUI user interface macro. The textured_background macro does not use either a parameter block or a user interface.
Example
The TexturedBackgroundEg example application uses the background_generator macro to create a background image and then uses it as the background to the teapot. The ColouredBackgroundEg example application creates a similar colour fade and also uses it as the background to the teapot.
Files
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.
Other Notes
Neither of these user macros rely on low-level code and hence do not need to be compiled. The background_generator user macro does rely on the low-level BackgroundCore module. If this macro is to be used the project should be compiled as normal.
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
|