Wow, Shazam was mentioned during the MIX10 keynote. Much to my dismay however it wasn’t our beloved Shazzam pixel shader tool. No, there is another application lurking out there with a very similar name (note the subtle difference in the spelling) . Back when Shazzam (the pixel shader utility) was released I didn’t know there was a product with a comparable name. This other software product, Shazam (the music recognition software) is actually an amazing tool in its niche. Play a few seconds of music into Shazam and it tells you the song title.
Who’s wearing the Shazzam shirt?
Here’s a few pictures of people wearing our Shazzam T-shirts during the MIX10 conference in March 2010.
Figure 1: Jaime Rodriguez, Adam Kinney, Brennon Williams
Figure 2: Laurent Bugnion and Cory Plotts
Videos too
Cory was wearing his Shazzam colors during this video.
Feeling left out?
Want your own Shazzam shirt? If you didn’t get a chance to go to MIX you can still get one. Just go to the Shazzam store and pick our your own shirt. Proceeds help support development of Shazzam.
The testing UI in Shazzam is a popular feature. I get a lot of email commenting on how nice it is to see the shader effects applied in real time.
The top half of the Shazzam screen is where you find all the sample test items. This includes six sample images.
Figure 1: Sample image tabs.
You can add your own image in the Custom Image tab via the File menu.
Figure 2: File menu.
Figure 3: Your custom image.
Trying out the effect
Once you have your HLSL code ready you apply the affect by pressing the F7 key. The shader is applied to all eight samples. Here you can see the WaveWarper effect applied to the custom image.
Figure 4: WaveWarper effect applied.
What’s new in version 1.2?
There are two new tabs added to the tab section in v1.2. The first is a sample UI consisted of a few buttons and a listbox. The second is a media tab, which plays a sample video. You can add your own video via the File menu. Yes, that’s right. You can play an video and apply a shader while it is running.
Figure 5: UI sample tab.
Figure 6: Sample video tab.
Figure 7: Sample video with WaveWarper effect applied.
I get a lot of email regarding Shazzam. One constant request from the community is to add multi-input shaders. I’m happy to announce that you can now use up to three additional input samples in your shader definition.
First Look
I’ll start by looking at a simple example. I’m using the MultiInput_MergeImages.fx sample included in Shazzam 1.2.
First, a little review. All shaders in Shazzam have a least one input sample. This is typically written like this.
// this is the main input texture for the shader sampler2D input : register(s0);
To add another input to your shader (in HLSL) you have to create a variable and load it into one of the four GPU ‘S’ registers. Since there are only four registers, that is the limit for the number of samples you can use in your shader.
In the following code snippet I am loading the second sample into register s1.
// this is the main input texture for the shader
sampler2D input : register(s0);
// this is an additional texture
// note that textures use the S registers
sampler2D Texture1 : register(s1);
Here are the two inputs that I will use for this example.
Figure 1 – Primary sample.
Figure 2 – 2nd sample.
Once we have second sample we can do any of the normal HLSL tricks. On top of the usual tricks you can also combine the pixels, from both samples, in interesting ways. This first example will merge the two images.
float Ratio : register(C0);
float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 inputTex = tex2D(input, uv);
float4 otherTex = tex2D(Texture1, uv); return ((inputTex * Ratio) + (otherTex * (1 - Ratio))); // mix the two images
}
Here are the results.
Figure 3 – Merged images.
Changes in UI
Now that Shazzam supports multiple inputs the testing interface had to be changed to accommodate selecting other images. When Shazzam detects additional sample input, like this sample HLSL,
sampler2D Texture3 :register(s2);
it automatically adds the ‘OpenImage control’ to the ‘Change shader settings ‘ tab.
Figure 4 – the new change Image controls
Getting fancier
I’ve recorded a video to show the new interface. This video uses a ripple effect to morph between the two sources.
The Catalyst
I had help with this feature from Nikola Mihaylov, better known as Nokola at nokola.com. His site is a terrific Silverlight resource. I suggest you take a look at his work over there.
Figure 5 – Nokola Shock Game
Nikola and I started corresponding a few months ago while he was working on his new Silverlight application (EasyPainter). He had a number of questions about Shazzam and many helpful suggestions regarding improvements in the Shazzam interface. As a result, Nikola contributed some code to the project that enables multi-input shaders. I am grateful for his contribution, he is the catalyst that caused multi-input to be added to Shazzam.
As a side note, be sure and check out his easy painter application. It’s an excellent representation of what can be done in Silverlight 3.
I’ve added a few sample multi-input shaders to Shazzam. I have more samples available from Microsoft. Those will be added to a future release as soon as they are Shazzam-alized*.
* Shazzam-alized: Cleaned up, commented and provided with useful default values.
Contribute your shaders
Do you have ultra hip shader you are proud to show off? There are many shaders in Shazzam that were contributed by the community. Now that you can create multi-input shaders I’d like to see what you come up with.
Submit your HLSL and see if it ends up in the next release of Shazzam.
I’ve added more shaders to the sample folder bringing the total count to nearly forty Here is a quick overview.
ParametricEdgeDetection
We’ve got more contributions from the community. Rene Schulte (http://kodierer.blogspot.com) sent over a few of his latest creations.
Figure 1 – Original Image.
Figure 2 – ParametricEdgeDetection
Rene has posted a nice post regarding his ParametricEdgeDetection shader.
For Silverlight 3 I’ve implemented an edge detection post processing effect. It’s a parametric pixel shader, which performs a common image processing technique called convolution.
TransparentAlternatingPixels
This is another shader contributed by Rene. Read his blog post for information.
Figure 3- TransparentAlternatingPixels
OldMovie
This is the last contribution from Rene. This shader makes it easy to simulate an old film, complete with scratches, noise and flickering projector light. Once again Rene has a post explaining more.
Figure 4 – OldMovie shader applied to wmv file
Tiler
The Tiler effect duplicates your sample across rows and columns. You get a result similar to the TileBrush in WPF.
This is one of my sample effects. The idea for it came to me earler this week while testing the latest version of Shazzam.
Multi Input Shaders
We’ve finally added multi-input support to Shazaam. Multi-input support has been in the top 5 feature requests for a long time and it finally is here. Look for another post soon about this popular item. Props to nokola for providing the code that got this feature launched.
Oh, and if you have a pixel shader you want to share with the community just drop me a line and I’ll get it added to the project.
I’ve uploaded the newest version of Shazzam to the Shazzam-Tool.com servers. The version number for this release is a minor change (1.2.0.21). but are many interesting updates in the product. Look for more blog posts on this site for details regarding the new features.
If you have Shazzam installed on your computer it will attempt an update the next time you run the application. If you don’t have the Shazzam installed you can install it from this location.
Silverlight and WPF are different beasts. The similarities between the two is high, but there are enough differences to foul you up now and then.
Choose your platform preference
There is a new addition to the Settings pane. The code generation engine will consider your desired platform when generating the .NET classes.
Figure 1: Target Framework setting.
As you can see from the following code examples Shazzam creates slightly different versions of the DependencyProperty registration code depending on your framework choice. Shazzam also ignores Point3D, Vector3D, or Point4D property types when creating Silverlight classes as Silverlight 3 doesn’t support these types yet.
// Use UIPropertyMetaData for WPF
public static readonly DependencyProperty AspectRatioProperty
typeof(BandedSwirlEffect), new PropertyMetadata(((double)(1.5)),
PixelShaderConstantCallback(3)));
Constructor
Shazzam now generates a parameterless constructor that automatically loads the compiled pixel shader from an assembly resource. If the name of your assembly is different from the name of your namespace, you’ll need to hand-edit the URI in the constructor."
The resource URI can be relative, taking the form "/AssemblyName;component/ShaderName.ps" – this new syntax works in both WPF and Silverlight.
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.
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
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.
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.
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.
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).
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.
Walt Ritscher created a great tool that lets you easily work with WPF shader effects, called Shazzam. This tool makes it very easy to grab some shader code, perhaps off the internet, try out various input values, see what effect they have on images, and then grab some generated source code (C# or VB) and paste it into your app. Very cool!
-Josh Smith
A must have for [the] HLSL dev. - Jon Galloway
I just got a chance to test this tool out. Took me 30 seconds to notice how f-ing awesome it is! I was looking for a VS shader template to save some time, but this blows it out of the water! Great job! Thank you!
-Jer
Thanks alot for this awesome tool. I tested it. It is realy cool. WPF Pixel Shader enable us to create better UX and now with comming new version of Silverlight (3.0) we can use it in Silverlight, too. It helped me a lot on creating FaceMaker. - Daneshmandi
I love shazzam for single input (image) shaders. - Rick Barraza
Shazzam is a great visualization tool for writing the HLSL and adjusting the properties to preview your effects. - Eric Rodewald
Shazzam is delivered as a ClickOnce application and provides a nice interface for editing and testing HSLS shaders. - Silverlight 3 Programmer’s Reference
Fortunately there is Shazzam, a wonderful click once WPF application you can download and that helps in developing the Pixel Shaders. - Andrea Boschin
I used Shazzam a lot for my SL shaders: http://blog.rene-schulte.info It's a great tool! The new SL support looks promising. - rene-schulte
Yaay - Shazzam has Silverlight support! Must have tool for shader effects in WPF/SL! - András Velvárt
Awesome! - Brian Henderson
Thanks for making me a hero on this project. Their UI developers had never seen anything like the effects. [from shazzam] - isitdanny
I've tested your Shazzam software and I love it, being an avid fan of pixel shaders. -Loïc Dansart
Thanks for putting the time in to write Shazzam, I love it. It really helped me understand and play around with shaders! - Jim Housekeeper
I'm a great fan of your great Shazzam tool. - Leonardo Salvatore
Btw, you have created a great tool! It saved me an incredible amount of time and allowed me to understand so many things about shaders. - Ivor Sargoytchev
Shazzam is pretty cool! It has been my favourite WPF/Silverlight pixel shader tool for some time now! Great job! - nokola
I love the added functionality for multi input shaders! Now I can preview my transition effects even more effectively.
- F. Faizal
Congratulations on an impressive release - Laurent Bugnion
First of all thanks for the great tool. I am using it to try out various pixel shading effects on Silverlight 3.0. Your tool is truly indispensible. - ksleung
Wow, your Shazzam program has saved me so much time getting Pixel Shaders in our application.
Thanks for taking the time to write such a cool application. You really are an expert in this field.
- Joey Fox
I tryed out your great Shazzam tool, really cool!!! - Roman Hille
It's a great tool -- it really helps me try out lots of ideas before incorporating a shader into a project. - Eric - Microsoft Research
Just trying out your latest version of Shazzam ... much improved! I love it. - Cory Plotts
Awesome job. You know I have been waiting for this for a while, so I cant wait to give it a good workout. - Brennon Williams
I want to say what a awesome and useful tool is Shazzam - Andres
Great update... Shazzam is a real life saver.
- F. Faizal
First of all: thanks for creating Shazzam; it's a great tool that makes creating shader effects for Silverlight and WPF so much easier.
- Derek
I’ve just begun using Shazzam
Its freaking brilliant !! - to be able to write pixel shaders and test them on-the-fly !
- Martin
I am the coordinator of the online image editor called Thumba (thumba.net/). Since its creation, we use a lot Shazzam tool. Very few effects that can not be created with this amazing tool.
- Pieter Voloshyn
Thanks for getting me up to speed on Pixel Shaders so quickly. Great tool, and 1.3 update = WIN!