|
|
Browse by Tags
All Tags » Effects » WPF (RSS)
Sorry, but there are no more tags available to filter with.
-
In a number of places in this series on Effects , I've alluded to a VisualStudio BuildTask and project templates that ease the authoring of shader-based Effects. We now have one up and available for you to download, install, and use. This was written by Gerhard Schneider and me. (Gerhard is the development lead who's team is responsible for implementing the new GPU-based Effects, among other things.) We're distributing it as a CodePlex project under the Microsoft Public License. You can find it at the WPF Futures site, which is under the umbrella www.codeplex.com/wpf . At that site, you'll find both a .zip file to install from, and the source code that you can peruse/modify yourself if you need to. Once you have this installed, you can edit .fx files and the the corresponding C# ShaderEffect subclasses all in VisualStudio, and just hit F5 or rebuild from VS to compile the whole project, including compiling the .fx file and inserting the bytecode Read More...
|
-
Alright! .NET 3.5 SP1 and VS 2008 SP1 are live and available on the web today. There are lots of places to read about all the great stuff there, but from the perspective of this blog, the two big additions over the Beta of .NET 3.5 SP1 are: Support for multiple texture inputs to shaders used in ShaderEffects. The makes ShaderEffects quite a bit more expressive and powerful. The addition of D3DImage, allowing composition-level interop between DirectX surfaces and WPF. This feature opens up many, many possibilities of meaningful integration between code that already uses DirectX, or code that is more appropriately written in DirectX than in WPF. That's just a teaser... I'll describe these in more detail (or link to other resources that do) in upcoming posts. Read More...
|
-
The previous post in this series began to talk about writing custom Effects for WPF. We looked specifically at ColorComplementEffect, an effect with no parameters. In upcoming posts, we'll get into the details of multi-parameter effects and other specifics. But in the meantime, I thought it would be useful to post a sample VS project and a ClickOnce application from that project for folks just itching to get going. The app looks like this: It's nothing fancy, mostly XAML and, in fact, the way the code and structure and UI are constructed are not conducive to hosting all effects now and forever (a more sophisticated hoster of effects would make a lot more use of metadata and reflection to allow arbitrary effects to be applied and parameters to be tweaked). However, this definitely does the job in terms of showing how Effects are used and written. There are two projects in the solution -- one is a MyEffects library, and the other just an EffectTest application that uses Effects from MyEffects. Read More...
|
-
The last few posts in this series on Effects have focused on the perspective of those using Effects. These Effects have to come into being somehow, and that's where we turn to now. In this post we showed how to apply a ColorComplementEffect to go from this to this: ColorComplementEffect, which very much looks like a photographic negative, is just about the simplest Effect one can imagine. Conceptually, all it does is take the RGB color components and create a new color with each component subtracted from 1.0. Let's first show what it takes to write it and add it to your app, then we'll expand and generalize from there in the next post. Creating the HLSL for color complement Here's some simple HLSL for doing the color complement. Note that this series is not in the least intended to be an HLSL tutorial. There are a bunch out on the Net, and there is also a Programmer's Guide and Reference Guide on MSDN that can be a good place to start. Also starting from existing examples (like those included Read More...
|
-
The last couple posts in this series have dug into features and example usage of Effects in WPF. Let’s go into some other aspects of the feature that are important to understand. Software Rendering When we discuss Effects, we typically talk about them being GPU-accelerated. This is typically the case. However, there are three important situations where the Effects cannot be GPU-accelerated: When the graphics card being run on does not support PixelShader 2.0 or above. This is becoming more and more rare, but is definitely still out there. When the WPF application is being remoted over Remote Desktop or Terminal Server or some other kind of mirror driver. When the WPF application is in a mode where software rendering is required – such as rendering to a RenderTargetBitmap, or printing. In all of these cases, WPF will render Effects via software. What does that mean? As mentioned in an earlier post, Effects are written using HLSL for programming the GPU. WPF incorporates a “ JIT ter” (Just-in-Time Read More...
|
-
My previous post on Effects (part of this series ) gives a simple example of instantiating an parameterless Effect (it just takes the complement of a color) through XAML. Here we discuss more about the use of Effects. First, lest you think that Effects are somehow a XAML-only feature, let’s write some code to use Effects. Recall that the invocation of the Effect through XAML looked like this: < Grid > < Grid.Effect > < eff : ColorComplementEffect /> </ Grid.Effect > < Image ... /> < Button ... / > < TextBox ... / > </ Grid > In code, presuming I already have the Grid and it’s called “myGrid”, we’d just do the following: myGrid.Effect = new MyEffects. ColorComplementEffect(); Like everything else in WPF, Effects are readily creatable and manipulable through code. Given that, most of the below will focus on usage through XAML just because it’s the most succinct way of expressing the usage. The ColorComplementEffect is very limited in what it Read More...
|
-
With WPF 3.5 SP1 on the horizon (and the Beta available now ), I plan to discuss some of the new graphics features that are coming into WPF in this release. There are a number of great new additions as well as improvements on existing features, but I will say that the one that I’m the most excited about is GPU-accelerated custom effects. I’m going to go into a good amount of depth in a series of upcoming blog posts, so I’ll dedicate this one to talking about the basics of what we’re offering and the motivation behind the feature. One of the hallmarks of WPF is the ability to mix and match media types, to compose visual elements, and to give the developer a substantial amount of freedom in the way they construct the interfaces for their applications. However, they are typically restricted to using the building blocks that WPF provides, such as rectangles, text, video, paths, gradients, images, etc. As rich as that set of primitives is, it is still a fixed set of primitives that only has Read More...
|
-
GPU-based Effects are a hot new feature in WPF for .NET 3.5 SP1. I'm going to be blogging a series of articles with progressively more detailed information in them, and am using this post as a place to store a table of contents of these posts. Here's what's out there so far: GPU-accelerated custom Effects for WPF Using Effects in WPF (Part 2) More details on how Effects work Writing custom GPU-based Effects for WPF Read More...
|
|
|
|