Feed on
Posts
Comments

Creating shaders is fun.  But it’s more thrilling to see what your new shader can do.   Shazzam has a testing screen for just that purpose, giving you a place to experiment with your effect, just choose the ‘Change Shader Settings’ tab.

image

Figure1 : Change Shader Settings tab.

The Edit Shader Property control

What happens when you compile your HLSL code? Each input parameter in your HLSL code is converted to a DependencyProperty in the generated C#/VB code.

/// The HLSL
/// <summary>The aspect ratio (width / height) of the input.</summary>
/// <minValue>0.5</minValue>
/// <maxValue>2</maxValue>
/// <defaultValue>1.5</defaultValue>
float AspectRatio : register(C3);
/// The C# Dependency Property
public static readonly DependencyProperty AspectRatioProperty 
   = DependencyProperty.Register("AspectRatio", typeof(double), 
   typeof(BandedSwirlEffect), new UIPropertyMetadata(((double)(1.5)), 
   PixelShaderConstantCallback(3)));
    

In turn, each DependencyProperty in your generated class is assigned an editor on the test page.  See Figure 2 for an example.

image

Figure 2:  AspectRatio editor.

The Min and Max textboxes on the editor set the range for the value slider.  Move the slider to set the current value for the property (AspectRatio in this example).

Animating the Property

Manually changing the slider value is useful to see what happens to the image when a particular test value is applied.  When you find a interesting version of your effect you can jot down the detail  and use it in your Silverlight/WPF application.  But sometimes you just want to play with the settings and see what happens.  That’s why there is an animation section on the edit control.  There are several buttons (exact number depends on the property type) available for controlling the animation.

image

Figure 3: Animation controls.

When the animation is running the value slider is replaced with a status textbox.  This way you can see the current values as the animation runs and not be distracted by the slider racing dizzily back and forth on the screen.

image

Figure 4:  Current animation value as text.

Multi-value Animations

Some properties like Point and 3DPoint have multiple values in each property. The editor provides more controls for editing and adds another animation button (Circular animation).

image

Figure 5: Multiple editors and circular animation button.

Set Default Animation Duration

The Settings pane has a number of improvements in versions 1.1.  The one you are interested in for today is the Default Animation Duration setting. This specifies the default duration for all animations.  Your default is loaded in to the test page the next time you compile the shader. You can always modify the animation duration on the test screen, the default value is only used as the initial setting.

image

Figure 6:  Setting pane – Default Animation Length.

Summary

[Shazzam 1.1 was released on October 11, 2009]

See a list of additional help pages here.

Install your own copy of the free Shazzam Pixel Shader Utility here.

One Response to “What’s New in Shazzam 1.1 – Animation”

  1. [...] « What’s New in Shazzam 1.1 – Animation What’s New in Shazzam 1.1 – Better Silverlight Support [...]