texture_wave
Synopsis
The texture_wave macro generates a moving wave-pulse function in the alpha channel of an existing ARGB image field.
Input Ports
| Name |
Type |
Description |
|
| in_image |
Image_ARGB |
Original image to add a texture pulse to. |
|
Parameters
| Name |
Type |
Description |
UI Control |
|
| freq_value |
float |
Frequency of pulse function |
Slider |
| phase_value |
float |
Phase of pulse function |
Slider |
| wave_mode |
int |
Type of pulse function to be generated |
Radiobox |
| min_amp |
float |
Minimum amplitude of pulse function |
Slider |
| max_amp |
float |
Maximum amplitude of pulse function |
Slider |
| contrast |
float |
Colour contrast control |
Slider |
| animate |
int |
Trigger start of phase animation |
Toggle |
| numsteps |
int |
Number of step to be used in phase animation |
Slider |
| cycle |
int |
Specifies if phase animation should cycle |
Toggle |
|
Output Ports
| Name |
Type |
Description |
|
| out_image |
Image_ARGB |
Image with generated pulse function |
| out_obj |
GDobject |
Directly renderable output object |
|
Description
The texture_wave macro generates a pulse-wave function in the alpha channel of an existing ARGB image field. Any image source that outputs ARGB data (such as read_image can be used. The macro replaces any existing alpha channel data with a 1 dimensional wave function that varies vertically across the image. The macro allows the frequency, phase and amplitude of the wave function to be controlled. It is also able to generate a variety of wave functions. Currently these are:
Finally the macro allows the contrast of the RGB components in the generated image to be controlled. As well as allowing manual control of phase the macro also provides an animation facility. This automatically increments the phase of the wave function hence moving the pulse-wave through the alpha channel of the image.
Although the generated images could be used for other purpose they are intended to be used to texture complex geometric objects. If the generated image is applied to an object that has alpha blending enabled, then the pulse-wave function will control the visibility of the UV texture space. The animation facility can also be used. This technique can lead to some very interesting visualizations that cannot be easily achieved by other means. The texture_wave_field macro uses the Scalar2Texture macro to texture fields with generated pulse-wave images. It should be noted that animating textures on complex fields is a graphically intensive task and for decent results good hardware texture-mapping support is essential.
A conference paper fully describing this technique can be obtained by contacting Ian Curington; the original author of this project.
Inputs
in_image : Image_ARGB
Original image data that is to be used as the basis of the pulse-wave image. The field data should contain a 2D structured mesh with a 4 byte vector of node data containing the Alpha, Red, Green and Blue components of the image. This is the field format output by modules such as read_image. Any data present in the alpha channel is completely replaced by the generated wave function.
Parameters
freq_value
Floating point parameter that specifies the frequency of the wave function. This is defined as the number of complete cycles generated in the output image.
phase_value
Floating point parameter that specifies the phase of the wave function. This parameter should be in the range 0 to 1, and is automatically altered when animation is enabled.
min_amp max_amp
Floating point parameters that specify the minimum and maximum amplitudes of the wave function. These parameters should be in the range 0 to 1. If they are outside of this range the integer portion of the parameter is ignored.
wave_mode
Integer parameter that specifies which type of wave function should be used to generate the output. Currently 5 functions are supported. The numbers for each of these functions are:
- Full Sine Wave
- Cosine Squared
- Cosine Medium Pulse
- Cosine Short Pulse
- 50% Square Wave
contrast
Floating point parameter that specifies how the contrast of the RGB components of the original image should be altered in the output image. A contrast of 1 indicates that no change should be made to the colour of the original image.
animate cycle
Integer parameters that control the phase animation facility of the macro. When the animate parameter is set to 1 the macro repeatedly increments the phase of the wave function. This continues until one entire cycle has been completed. If the cycle parameter is set to 0 then the animate parameter is reset to 0 and the animate stops. If the cycle parameter is set to 1 then the phase is reset to 0 and the animate continues indefinitely.
numsteps
Integer parameter that specifies the number of steps that are to be used whilst animating the phase of the wave function. For each entire cycle the phase will be incremented numsteps times. Therefore if the number of steps is increased the animation will become smoother but will require more powerful graphical support.
Outputs
out_image : Image_ARGB
Output image containing the texture image with the generated pulse-wave stored in the alpha channel. The image is output as a field with a 2D structured mesh and a 4 byte vector of node data containing the ARGB components of the image.
out_obj
The GDobject version of the output, suitable for direct connection
to the viewer. A 2D viewer is recommended. Since the alpha channel is
normally invisible, only variations in image contrast should be visible after processing. To see the wave function directly, the extract_scalar module can be used to extract the alpha channel from the image data.
Utility Macros
The TextureWaveFunc functional macro uses the low-level TextureWaveCore module. This functional macro and the TextureWaveUI user interface macro are used by the texture_wave user macro. All of these macros use the TextureWaveParams parameter block to communicate data.
Example
The project includes two example applications that demonstrates the use of the texture_wave macro. The TextureWaveEg1 application uses the texture_wave macro to generate a wave and then extract the alpha channel so that it can be displayed directly. The TextureWaveEg2 application extends this by using a graphing module to visualization the wave function. This allows the actual form of the wave to be seen much more easily.
Files
iac_proj/twave/tw_mods.v contains the V definitions of the TextureWaveCore module and the TextureWaveParams parameter block.
iac_proj/twave/tw_macs.v contains the V definitions of the TextureWaveUI UI macro, the TextureWaveFunc functional macro and the texture_wave and texture_wave_field user macros.
iac_proj/twave/tw_apps.v contains the V definitions of the TextureWaveEg1, TextureWaveEg2, TextureWaveEg3 and TextureWaveEg4 example applications.
Other Notes
The low-level TextureWaveMods library containing the low-level TextureWaveCore module does not specify a process. By default the express process will be used.
Author
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
|