Поделиться через


Announcing Bling 3!

I’d like to announce a newly rewritten release of Bling with many improvements and exciting new features. Bling is a novel experiment in how WPF/UI programming can be enhanced via a lightweight domain-specific language hosted completely within C#. Bling basically changes the meaning of statements and expressions to do more that is otherwise possible with normal values in C#; e.g., a + b no longer means add the value of “a” to the value of “b,” but rather it creates tree that we can then transform into a databinding relationship, HLSL code, and so on. We exploit this to reduce or completely UI boilerplate code; e.g., no more value converters, no more HLSL code, no more C# shader classes, etc…Bling 3 goes farther with this style of programming through the addition of lifted functions (so f(a) also creates a tree!). For more details, see my blog.

New features in Bling 3.0:

  • Improved support for multiple forms in lighting in pixel shaders reusing WPF3D abstractions when possible. Now a lighting effect can be added to a widget by specifying a WPF3D light, a material (similar to but not a WPF3D material), a normal map and/or a height map loaded from a texture (some kinds of lights require an eye position). Lighting effects can be combined via addition. WPF shader examples:

 

clip_image002 clip_image004clip_image006 clip_image008

  1. Normal mapped diffuse material + red specular material point light effect.
  2. Glass material + point light effect (also normal mapped).
  3. Diffraction material + point light effect (again normal mapped).
  4. Diffuse material + point light effect with parametric normals (computed vs. loaded from an image).
  • Pixel-level transition abstractions that support composition. Example:

clip_image009

Intermediate progress of a ripple + sin transition composed via Min (take the min color from each transition’s result, where start and end are the same).

  • Hacked prototype-quality WPF-friendly web browser that supports transformations and pixel shader effects. Browser will refresh every 100 milliseconds, so flash animations will work if a bit choppy. Link clicking is supported, but not keyboard input (need more interop code). Example:

clip_image011

Paper normal mapped browser navigated to Bling’s codeplex page.

  • Simplified physics engine (more examples in the future).
  • Initial experimental support for DirectX 10, focusing right now on parametric surfaces. DirectX compositions look very much like Bling WPF pixel shaders and can refer directly to WPF dependency properties (just like a WPF pixel shader can). Example:

clip_image013 clip_image015 clip_image017 clip_image019

clip_image021

  1. A sphere, no distortion
  2. A sphere + a egg crate distortion
  3. (2) with more magnitude
  4. (3) with more frequency
  5. (4) with less magnitude + the WPF sliders that are controlling it all.

Caveats:

  • Bling 3 is not backwards compatible with the previous version of Bling. Existing code requires porting.

ToDo:

  • Work on DirectX abstractions (right now we just have a start).
  • Would like to support Silverlight 3.