Viz Plug-ins User Guide

Version 5.0 | Published December 20, 2022 ©

Average Texture

images/download/thumbnails/85896540/v4_avgtext_ico.png

The Average Texture plug-in takes an image or a media asset as a parameter and populates its average RGB color onto several places.

For example, you can use this plug-in to set the light color based on the average color of your live video signal.

Note: This plug-in is located in: Plugins -> Container plug-ins -> Global

Compatibility Info: This plug-in works in the Viz Engine Render Pipeline only!

Average Texture Properties

  • Target Type: Specifies where the average color gets applied to. This requires, that the same container also holds either a Viz 4 Light object or a Viz 4 Material Definition.

    • Light Color: Forwards the RGB value to the container light.

    • Material Color: The container's Viz 4 material tint receives the new color value.

    • None: Disables any forwarding.

  • Submit: Enables Shared Memory Support. Once this is turned on, every change calculated by this plug-in is submitted to Viz Engine's shared memory interface.

    • Target Type: Defines which shared memory Map to use.

      • Scene: The local scene shared memory map is used.

      • Global: This is needed if several scenes on the same Viz Instances (for example, GFX channels, etc) need to be notified about changes.

      • Distributed: If multiple Engines need to get these RGB changes. Changes are distributed via all connected Viz Engines on the same Graphic Hub.

    • Key: A unique key used to receive the changes.

The following script shows an example on how to use the Shared Memory Interface via Viz Script:

sub updateSHM()
dim c as Container
dim sourceName as String
dim avg as Color
avg =(Color)Scene.Map["average_texture_color"]
c = Scene.findContainer("shm_color_text")
c.Material.Color = avg
println avg
end sub
 
sub OnSharedMemoryVariableChanged(map As SharedMemory, mapKey As String)
if mapkey="average_texture_color" Then
println("SHM change: " & mapKey)
updateSHM()
end If
end sub
 
sub OnInit()
scene.map.RegisterChangedCallback("average_texture_color")
end sub

Information: This plug-in doesn't work with DXT compressed images. It is mainly used for Media Assets like Live Input feeds.