Category Archives: Windows Blog

Windows Blog

Evolving our Windows approach to AV, thanks to partner feedback

Earlier this summer I shared that we believe in a healthy antivirus ecosystem working with us in protecting our shared customers from security threats. Our top priority is and always will be to protect our customers with security innovations for the Windows platform, increase our customers’ pre- and post-breach security stance, and provide a platform that offers choice.
Part of delivering on that commitment is listening and responding to feedback from our customers and partners. We work closely with AV partners like Kaspersky Lab, and at our Microsoft Virus Initiative forum last month, we made great progress in building upon our shared understanding of how we deliver Windows 10 updates and security experiences that help ensure the ongoing safety of Windows customers.
I’m pleased to share these discussions have helped us clarify our roadmap and implementation plans. As a result, we are making updates to our AV partner requirements today that reflect the interests of the community and our shared customers. We will also implement changes in the Windows 10 Fall Creators Update.
Here are some of the changes we are making to support our partners in delivering security protections to Windows customers.
We will work more closely with AV vendors to help them with compatibility reviews in advance of each feature update becoming available to customers. This means customers can expect we will have worked through compatibility issues with AV providers before offering the update to customers running that AV.
We will give AV partners better visibility and certainty around release schedules for feature updates. This includes increasing the amount of time AV partners will have to review final builds before the next Windows 10 feature update is rolled out to customers.
We will enable AV providers to use their own alerts and notifications to renew antivirus products before and after they have expired.
We have modified how Windows will inform users when their antivirus application has expired and is no longer protecting them. Instead of providing an initial toast notification that users could ignore, the new notification will persist on the screen until the user either elects to renew the existing solution or chooses to rely on Windows Defender or another solution provider.
We appreciate the feedback and continued dialogue with our partners and are pleased to have found common ground with Kaspersky Lab on the complaints raised in Russia and Europe. We look forward to our continued partnership with the industry.
Customers deserve the best and most up-to-date protection possible. Microsoft and our security partners share a commitment to keep them safe.

Announcing Windows 10 Insider Preview Build 15240 for Mobile

Hello Windows Insiders!
We are releasing Windows 10 Mobile Insider Preview Build 15240 to Insiders in the Fast ring. For this flight, it’ll be a bit of a staggered release and it might not show up for you until tomorrow morning. Please be patient while waiting for the build to show up.
What’s New in Build 15240 for Mobile
Emoji 5.0: Just like we did on PC, we have added support for the latest Unicode updates – including new snacks, actions, dinosaurs, and even fantasy characters like genies, fairies and zombies – to Windows 10 Mobile in this build. They’re all accessible via both the touch keyboard and the Emoji Panel. We’ve tweaked some of our original emoji designs based on your feedback and to improve consistency with how the emoji is displayed on other platforms (while maintaining our Windows style).
New emoji include:

Examples of updated emoji – before:

And after:

Chinese Lunar Calendar: We have received questions about supporting the Chinese Lunar calendar on Windows 10 Mobile. The power of a Universal Windows Platform (UWP) app is that it can run on any Windows-based device. The Calendar UWP app supports the Chinese Lunar calendar on both PC and Mobile. Here’s how you  can enable the calendar on Mobile:

Launch the Calendar app
Select Settings >Calendar settings
Enable “Alternative Calendars” and select Chinese and Lunar in the dropdowns.

Et Voila – you have the Chinese Lunar Calendar on your phone!
General changes, improvements, and fixes for Mobile
We fixed the issue where trying to update Windows Store apps saved to your SD card resulted in an 8007000B error. Apps installed on SD cards should update without any issue.
We fixed an issue where there was no icon shown for Windows Update for either new notifications or on the settings page under Settings > System > Notifications & actions.
Known issues for Mobile
Occasionally, Narrator speaks phrases in English rather than the chosen non-English language.
There is a problem with the HP Elite X3 with wired docks where the portrait orientation setting is lost when the external display is disconnected and reconnected. A workaround for this is to reboot the phone after tapping the “OK” button instead of disconnecting and reconnecting. This workaround must be performed every time you connect to an external display you want to use with Continuum in portrait orientation.
When installing or updating a Windows Store app, you may see error 80070057. As a workaround, you can get the latest app by uninstalling the older version of the app from your device and reinstall latest version from Store.
No downtime for Hustle-As-A-Service,
Dona

Windows 10 SDK Preview Build 16257 and Mobile Emulator Build 15235 Released

Today, we released a new Windows 10 Preview Build of the SDK and the Mobile Emulator to be used in conjunction with Windows 10 Insider Preview (Build 16257 or greater). The Preview SDK Build 16257 contains bug fixes and under development changes to the API surface area.
The Preview SDK and Mobile Emulator can be downloaded from developer section on Windows Insider.
For feedback and updates to the known issues, please see the developer forum.  For new feature requests, head over to our Windows Platform UserVoice.
Things to note:
This build works in conjunction with previously released SDKs and Visual Studio 2017.  You can install this SDK and still also continue to submit your apps that target Windows 10 Creators build or earlier to the store.
The Windows SDK will now formally only be supported by Visual Studio 2017 and greater. You can download the Visual Studio 2017 here.
Known Issues
Designer fails to render: When viewing the XAML in the Designer Window in Visual Studio, the controls fail to render.  This can be resolved by using Visual Studio 2017.3 Preview.
Compilation fails on non-Windows 10 platforms  (need to see if fixed)When building apps on previous platforms, you may get a build error:
C:program files (x86)Windows Kits10bin10.0.16232.0x86genxbf.dll:C:program files (x860Windows Kits10bin10.0.16232.0x86genxbf.dll(0,0): Error WMC0621: Cannot resolve ‘GenXbf.dll’ under path ‘C:program files (x860Windows Kits10bin10.0.16232.0x86genxbf.dll’. Please install the latest version of the Windows 10 Software Development Kit.
Process ‘msbuild.exe’ exited with code ‘1’.
This will occur if the minimum target platform version is set to 10.0.16225.0.  To work around this, right click on your project file and choose properties or open your project file in your favorite editor, and change the version to a previous released SDK.  For example:

<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>

WRL projects fail to compile with MIDLRT error: When building my WRL project that contains a WinRT Component, the project no longer compiles.  I get the following errors:
midlrt : command line error MIDL1012: [msg]argument illegal for switch / [context]ns_prefix
midlrt : command line error MIDL1000: [msg]missing source-file name
To work around this temporarily you will need to use the previous version of the MidlRT.exe tool.  You can do this by changing your changing your Target Platform Version to a currently installed previous SDK.

<WindowsTargetPlatformVersion>10.0.15063</WindowsTargetPlatofrmVersion>

Breaking Changes
ecmangen.exe removal from the SDK: ecmangen.exe will no longer ship with the Windows SDK. Developers who rely on ecmangen for event manifest creation are advised to install the Windows Creator Edition of the SDK to obtain the file. Developers may also use notepad or other XML editor of choice for manifest creation. A schema file is available on MSDN to aid in manifest creation, for tools that support it.
API Updates and Additions
When targeting new APIs, consider writing your app to be adaptive in order to run correctly on the widest number of Windows 10 devices. Please see Dynamically detecting features with API contracts (10 by 10) for more information.
The following are the API changes since the 16232 Preview SDK, please reference that list. The TreeView control has been removed, but will be back soon in the next release of Windows and the Preview SDK.
Addition from Preview SDK 16232

namespace Windows.Storage {
public sealed class AppDataPaths
public sealed class SystemDataPaths
public sealed class UserDataPaths
}

Removals from Preview SDK 16232

namespace Windows.UI.Xaml.Automation.Peers {
public class TreeViewItemAutomationPeer : ListViewItemAutomationPeer
public class TreeViewListAutomationPeer : SelectorAutomationPeer
}
namespace Windows.UI.Xaml.Controls {
public class TreeView : Control
public sealed class TreeViewExpandingEventArgs
public class TreeViewItem : ListViewItem
public sealed class TreeViewItemClickEventArgs
public class TreeViewList : ListView
public class TreeViewNode : DependencyObject, IBindableIterable, IBindableObservableVector, IBindableVector
public enum TreeViewSelectionMode
public sealed class XamlBooleanToVisibilityConverter : IValueConverter
public sealed class XamlIntegerToIndentationConverter : IValueConverter
}

Announcing Windows Server Insider Preview Build 16257

Hello Windows Insiders!
Today we are very excited to be releasing Windows Server Insider Preview Build 16257 to Windows Insiders. To access, register at the Windows Insiders for Business program or the Windows Insider program and then navigate to the Windows Server Insider Preview download page.
This release also includes the Remote Server Administration Tools (RSAT) packages. When installed on a Windows 10 client, RSAT allows a user to remotely manage and administer Insider builds of Windows Server via GUI tools. Valid on Windows 10 client builds greater than 16250.
General Scenario Highlights
Developers and Containers:
New base container images (available on Windows Insider Docker Hub repo)
Optimized Nano Server base image (over 70% smaller)
The .NET team is providing a preview image based on Nano Server with .NET Core 2.0
The PowerShell team is providing a preview image based on PowerShell 6.0

Optimized Server Core base image (over 20% smaller)

Support for SMB volume mounting
Infrastructure for Orchestrators
Networking enhancements for ongoing Kubernetes work
Named pipe mapping support

Bug fixes, performance enhancements
Cloud Guest:
IIS
TLS info: administrators can make specific recommendations to default to HTTPS

Disaster Recovery
Storage Replica Test Failover

Guest + Host better together
vPMEM in Guest: Tenants can use and manage PMEM/SCM
Tenant-Aware VM Start Ordering: App Ready / OS Heartbeat for better load balancing
Guest RDMA

Improvement in time accuracy
Azure enlightened clusters – optimized to run on Azure IaaS
Cloud Host:
Software Defined Data Center (SDDC) host
Security
Shielded Linux VM
SDN: Encrypted virtual networks
Secure clusters
SMB 1 disabled by default

Resiliency and Availability
SDN: Reduced downtime for tenant connections through gateways
Spaces Direct: Scoped Spaces to mitigate impact of multi-node loss
Spaces Direct: Marginal drive handling for predictive detection of drive failures

Efficiency
Data Deduplication available for ReFS
New Data Deduplication DataPort API for optimized ingress/egress
Space efficiency with ReFS Compaction
Performant Spaces Direct Multi Resilient Volumes (MRV)

Hyper-converged Scale
Cluster Sets: Significantly increases hyper-converged SDDC cloud scale by grouping multiple clusters into a larger fabric

Hardware support
Support for Storage Class Memory (SCM) in Spaces Direct

What’s New in Build 16257 for Windows Server
Windows Subsystem for Linux (WSL) is available on Windows Server
Windows Subsystem for Linux (WSL) is now available on Windows Server along with a compliment of Linux distributions.
Test WSL on Windows Server.  WSL runs unmodified Linux (ELF64) binaries natively.  With the additions of WSL you can run node.js, Ruby, Python, Perl, Bash scripts or other tools that expect Linux behaviors, environment, or filesystem-layout, the ability to install and run Linux with WSL expands the tools at your disposal on Windows Server.
At this time, WSL does not support persistent Linux services (such as daemons and jobs) as background tasks. To enable WSL and install a Linux distribution, see Enable the Windows Subsystem for Linux and Install a Linux distribution in the Windows Server 2016 Installation Guide on GitHub.
Read more in this blog or follow the installation guide to try it out.
 
How to Download
The latest Windows Server build and matching symbols are available for download here. Matching Windows Server container images will be available via the Docker Hub. For more information about Windows Server containers and Insider builds, please visit http://aka.ms/containers/insiders.
The following keys are available for unlimited activations of Windows Server. These keys may be used throughout the pre-release cycle.
Server Datacenter Core: B69WH-PRNHK-BXVK3-P9XF7-XD84W
Server Standard Core: V6N4W-86M3X-J77X3-JF6XW-D9PRV
NOTE: If you signed up for Windows Insiders for Business using an AAD account, there is a temporary issue with access to the Windows Server Download page using AAD accounts. If you registered using an MSA account at the Windows Insider program, your MSA account may be used to access the page and to download builds until this is resolved.
It’s all about your feedback! 
Use the Feedback Hub app to provide feedback on Windows Server builds. Feedback Hub comes pre-installed on Windows 10. Register a Windows 10 device with the Windows Insider or Windows Insider for Business programs. Open the Feedback Hub application. Choose the Server category and then the appropriate subcategory for your feedback. Please indicate what edition and build number you are providing feedback on. The Feedback Hub app cannot scan a server for diagnostic information, however you may manually attach screenshots or other files to your feedback entry.
We encourage you to visit the Windows Server Insiders space on the Microsoft Tech Communities forum to collaborate, share and learn from experts.
The expiration date for this server preview build is 12/4/2017.
Known issues 
The background tasks infrastructure service (Bisrv.dll) may cause a system crash because of a null class pointer read error (0xC0000005) or a failfast corrupt list entry (0xC0000409) during a Distributed Component Object Model (DCOM) launch, or because of a critical process bug check (error code 0xC0000409, bug check 0xEF) in the host process for Windows services (Svchost.exe).
Calling into the firewall service may hang: Apps that call into the firewall, such apps that use networking, may become unresponsive until the user reboots because of an application hang end-task error (0xCFFFFFFF) in the Windows firewall API library (FirewallAPI.dll), which occurs when the library is blocked on an advanced local procedure call (ALPC) port while attempting to diagnose a connection failure and retrieve information.
Cluster Sets: A couple of key functionalities to enable end-to-end testing of Cluster Sets scenarios are not present in this build, so defer all evaluation of this scenario to a future build.
Bugcheck during volume creation: A stop error may occur during volume creation in a cluster. The recommended workaround is, after restarting the computer, to delete the volume and try creation again.
Bugcheck during volume repair: A stop error may occur during volume repair in a cluster. The recommended workaround is to restart the computer. No corruption or data loss is expected.
No downtime for Hustle-As-A-Service,
Dona

Windows Subsystem for Linux on Windows Server

The Windows Subsystem for Linux (WSL) is available in Windows Insider builds of Windows Server. Now developers and application administrators can run tools they use in Linux environments alongside Cmd and PowerShell.
If you want to jump straight in, the installation guide is available here.
Why include WSL on Windows Server?
We want Windows, including Windows Server, to be a great place for developers. We know developers, system administrators, people managing services and people building services all occasionally need tools available on Linux.  Many more would like to run Linux tools as part of their workflow as a matter of convenience.
Previously, there were a few options:
Run something like Cygwin and rely on Win32 ports of common GNU tools.
Cygwin is a great toolset but it runs into issues when using tools that haven’t been ported to Windows. Many tools simply aren’t available. This is especially common when trying to build and run Ruby & Java solutions, which utilize some Linux-only Gems, libraries and components.
The tools available through Cigwin and other Win32 ports are also notorious for being out of date – which is understandable since updating them requires recompiling them for Windows. For Windows users, however, this is both inconvenient and often leads to troublesome compatibility issues when running, building or deploying software.
Use Linux in a virtual machine.
Virtual machines are designed for production workloads on Windows Server. They aren’t ideal for things closely tied to the Windows Server host. If you need basic Linux command-line tools integrated with their Windows system, a virtual machine will be cumbersome.
This is where running Linux on WSL provides value: WSL runs unmodified Linux (ELF64) binaries natively. It can install and run almost any Linux command-line tool integrated in Windows.
With the additions of WSL and Linux containers with Hyper-V isolation, Windows Server offers a wide variety of Linux options that make it a great place and platform for modern developers.
If you’re a server engineer that needs to run node.js, Ruby, Python, Perl, Bash scripts or other tools that expect Linux behaviors, environment or filesystem-layout, the ability to install and run Linux with WSL expands the tools at your disposal on Windows Server.
What this isn’t — WSL is not a Linux server
Just as with WSL on Windows Client, you can run daemons and jobs like MySQL, PostgreSQL, sshd, etc., via an interactive shell, but you cannot currently use WSL to run persistent Linux services, daemons, jobs, etc. as background tasks.
For these sorts or tools, read more about Linux containers with Hyper-V isolation from the Build 2017 announcement.
How do I get started using WSL on Server?
Windows Subsystem for Linux arrived in Windows Server Insider Build 16237. Follow our new Windows Server WSL Installation Instructions to get started running Linux alongside Cmd and PowerShell on your Servers.
Feel free to comment below or reach out to Sarah and Rich via Twitter.

Announcing exciting changes coming to MINECON!

MINECON is a worldwide celebration of the community, the game, and the joy that Minecraft continues to bring people around the world. In the past, it’s been a single massive convention – but today, the Minecraft team announced how they’re shaking up MINECON this year with two new elements! Here’s what you can expect:
MINECON Earth
MINECON Earth is a global interactive livestream event broadcast from two continents on November 18 and viewed by players around the world from their living rooms or at local viewing parties, retailers, theatres and community events. The 90-minute livestream will take place on November 18 at 12 p.m. EST / 5 p.m. GMT on mixer.com/minecraft. If you’re new to Mixer, head over here for tips on getting started viewing and streaming!
Official Minecraft Community Events
We’ve teamed up with Minefaire, MineVention and BLOCKFEST to create authentic Minecraft events, a little closer to home. Players will get to meet their favorite YouTubers and streamers, compete in tournaments and costume contests, see unique content and much more. We’re excited to share more details really soon, but check out the Minefaire and MineVention websites for more info in the meantime!
With the combination of our livestream and the official Minecraft community events, we’re excited to make it easier for EVERYONE to participate from all around the world.  Anyone with a broadband internet connection can watch the livestream from wherever they are. We’ll have more details to share soon on exciting ways for you to get involved from wherever you are.
Save the date for MINECON on November 18, and head over to Minecraft.net for even more details about this exciting news!

Windows 10 Tip: See your 3D creations take life in Remix 3D

Last week, we announced new capabilities in Remix 3D – Parts and Remixes – an all-new way to experience the relationship between 3D content and see how it can transform and take new life when shared with a creative community.
Here’s how to get started with Parts and Remixes:
On any model page on Remix3D.com, you’ll see two new tabs: Parts and Remixes. Simply click on Parts and scroll down to see the individual parts that make up the model. A dog with a party hat and party favor may have three parts: the dog model, the hat model and the party favor model.

But what if someone remixes that dog and adds a birthday cake? That would appear under Remixes. The Remixes tab is a way to show how creators are building off other amazing creations. If someone remixed a model you created, their new design would point back to your original model in the Remixes tab.

If you’re working in the Paint 3D app, you can click on the Remix 3D tab, find a model and then click “Place in project” to start creating your own Remix!

Parts and Remixes will be available everywhere Paint 3D and Remix 3D are available. Head over here for tips on getting started with Paint 3D, and, in case you missed it, here’s last week’s Windows 10 Tip:

Have a great week!

Your feedback is helping shape Windows privacy

Those enhancements included improving in-product information, updates to the Microsoft privacy statement, and publishing more information about the diagnostic data we collect.
Since then, feedback we’ve received about the Creators Update has been positive. This is great news to us because what we hear from you directly impacts the improvements we make.
For example, 71 percent of customers are selecting Full diagnostics data to help us fix things and improve Microsoft products.  While your direct feedback like, “The privacy settings added to clean installs are a boon for the privacy minded,” and “Very well done,” is great to hear, we know there is still work to do to meet and anticipate the expectations across our diverse customer base and provide you with the best privacy experience possible.
We’ve also seen a positive reception to the web-based privacy dashboard which allows you to see and control your activity data across multiple Microsoft services. Announced back in January, the privacy dashboard has been visited by more than 23 million people on accounts.microsoft.com.
With more than 500 million devices running Windows 10, the opportunity to refine our approach to privacy and implement your feedback is exciting.  We are also ensuring Windows 10 is compliant with the European Union’s General Data Protection Regulation (GDPR) that goes into effect in 2018. Fundamentally, the GDPR is about protecting and respecting an individual’s privacy rights and Microsoft’s enduring commitment to trust is well aligned through the privacy principles that shape the way we build our products and services.
For those of you who participate in the Windows Insiders Program, you can expect to see some of the privacy changes showing up in Insider builds in the coming weeks, and we welcome your feedback in helping us make create the best Windows ever.
I look forward to a continued dialogue and thank you for your feedback – please keep it coming!
-Marisa

Creating Materials and Lights in the Visual Layer

In today’s post, we’re going wrap up this series by combining everything we’ve learned so far and take you through the steps in creating a custom material. We also have an amazing new tool to show you that empowers anyone to design a custom material. To see how you can use these custom materials in your XAML app, be sure to check out the last two posts in this series; XAML and Visual Layer Interop, part one and part two.

The Fluent Design Language is an evolving concept, rather than a one-time design language release like MDL and MDL2. It was designed to expand and grow as Microsoft and the community of creators (developers and designers), adds to what it could be. We’ll show you that anything is possible, as designers, developers and the Windows community have common ground to share their creations and create amazing materials.
Let’s get started by first showing you how a material is created by chaining effects, then we’ll explore using the new Material Creator to easily and quickly create materials.
Creating Material with the Visual Layer
CompositionEffectBrush
Whether we’ll be using the effect in a XamlCompositionBrushBase or painting a SpriteVisual, the construction of the effect graph is the core of the approach. In order to create the material we want, we’ll need the following components:
Effect sources: A SurfaceBrush for the NormalMap and a BackdropBrush for access to the pixels underneath the material
The effect graph: A composite of different effects to control the Material’s reflectance properties and filter effects (such as blur and tint) to customize for UI usage
Lighting: The Visual is in a scene that has a CompositionLight applied
Let’s start with the first source, a SurfaceBrush. This will be provided by using LoadedImageSurface to load a NormalMap.
NormalMap and LoadedImageSurface

If you’ve had any experience with 3D computer graphics, maybe as a game developer, you may already know what a normal map is and the image above looks familiar. If you’ve never worked with one before, Normal mapping is a technique that determines the reflectance of light at every pixel (read more about Normal mapping here). The Visual Layer in Windows 10 gives you a choice of industry standard reflectance models; Blinn-Phong and Physically Based Blinn-Phong. Go here to read more about the math behind how this is done.
For today’s demo, we used a 2D picture of a textured surface and transformed it into a Normal map image using an image editor. There are many image editing tools that let you do this. You can use any one you prefer to create your image.
To get started, we can load the image using the new LoadedImageSurface API. Let’s add a private field for the LoadedImageSurface, load the image and create a CompositionSurfaceBrush with it.

// Load NormalMap onto an ICompositionSurface using LoadedImageSurface
LoadedImageSurface _surface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///Images/NormalMap.jpg"), new Size(512,384));

// Load Surface onto SurfaceBrush
CompositionSurfaceBrush normalMap = compositor.CreateSurfaceBrush(_surface);
normalMap.Stretch = CompositionStretch.Uniform;

Now we’re ready to move on to creating and chaining effects.
Chaining Effects to create the effect graph
For our material, we are going to create a chain of effects that leverages the Win2D’s ArithmeticCompositeEffect (note: be sure to add the Win2D NuGet package to your project). All effects can be used as input sources for other effects, thus enabling you to allow a chain of effects to one or more inputs.
ArithmeticCompositeEffect lets you assign two sources for the composite, giving each one a weight toward the final effect. For example, Source1 at 0.75 (75%) and Source2 at 0.25 (25%). You can also use an additional ArithmeticCompositeEffect as one of the sources to add more effects in the composite chain.
Let’s step back for a minute and think about how we want create the composite:
Parent ArithmeticCompositeEffect to be used for Brush
Source 1: Child ArithmeticCompositeEffect
Source 1: ColorSourceEffect for tint coloring
Source 2: GaussianBlurEffect using the BackDropBrush for its source

Source2: SceneLightingEffect using the Normal map for its source

For source 1, we’ll combine a ColorSourceEffect and GaussianBlurEffect (from Win2D) with a nested ArithmeticSourceEffect. For Source 2, we’ll use a SceneLightingEffect (from Windows.UI.Composition.Effects). This will manipulate the reflective properties of the effect’s source when a CompositionLight, from a XamlLight for example, is applied.
Note that the SceneLightingEffect is used to modify the default lighting applied to the contents of a SpriteVisual targeted by a CompositionLight. In today’s example, we are going to create SurfaceBrush using a NormalMap (loaded by LoadedImageSurface) to define dents and bumps that the light reflects off of.
Furthermore, in order to use the SceneLightingEffect, the content being modified must be defined as one of the sources into a multi-input effect graph, with the other input being the SceneLightingEffect. For example, above, the content whose lighting properties are being modified is defined by Source1 of the parent ArithmeticCompositeEffect.
Here’s what the code looks like for the effect graph:

// Define Effect graph
const float glassLightAmount = 0.5f;
const float glassBlurAmount = 0.95f;
Color tintColor = Color.FromArgb(255, 128, 128, 128);

var graphicsEffect = new ArithmeticCompositeEffect
{
Name = "LightComposite",
Source1Amount = 1,
Source2Amount = glassLightAmount,
MultiplyAmount = 0,
// Nested Composite to combine the Blur and Color tint effects
Source1 = new ArithmeticCompositeEffect
{
Name = "BlurComposite",
Source1Amount = 1 – glassBlurAmount,
Source2Amount = glassBlurAmount,
MultiplyAmount = 0,
Source1 = new ColorSourceEffect
{
Name = "Tint",
Color = tintColor,
},
Source2 = new GaussianBlurEffect
{
BlurAmount = 20,
Source = new CompositionEffectSourceParameter("Backdrop"),
Optimization = EffectOptimization.Balanced,
BorderMode = EffectBorderMode.Hard,
},
},
// The SceneLighting effect, which will use a NormalMap
Source2 = new SceneLightingEffect
{
AmbientAmount = 0.15f,
DiffuseAmount = 1,
SpecularAmount = 0.1f,
NormalMapSource = new CompositionEffectSourceParameter("NormalMap")
}
};

Notice the SceneLightingEffect’s NormalMapSource property and the GaussianBlurEffect’s Source; these are parameter provided sources. We will set what these parameters are as we pull everything together to create the CompositionEffectBrush:

// Create EffectFactory and the CompositionEffectBrush
CompositionEffectFactory effectFactory = Window.Current.Compositor.CreateEffectFactory(graphicsEffect);
CompositionEffectBrush effectBrush = effectFactory.CreateBrush();

// Create BackdropBrush, this is used by the GaussianBlurEffect
CompositionBackdropBrush backdrop = Window.Current.Compositor.CreateBackdropBrush();

// Set Sources to Effect
effectBrush.SetSourceParameter("NormalMap", _normalMap);
effectBrush.SetSourceParameter("Backdrop", backdrop);

With the CompositionEffect completed, we can now use it to paint a SpriteVisual, like this:

SpriteVisual spriteVisual = Window.Current.Compositor.CreateSpriteVisual();
spriteVisual.Brush = effectBrush;

If you’re primarily a XAML dev, you can use this effect in a XamlCompositionBrushBase. Let’s take a look.
Using the CompositionEffectBrush in a XamlCompositionBrushBase
As I mentioned earlier, we can also create this effect graph in XamlCompositionBrushBase and set the XamlCompositionBrushBase’s CompsositionBrush property. If you haven’t read the post in this series on how to create a XamlCompositionBrushBase, go here to catch up.
As with the other XamlCompositionBrushBase implementations, we build the effect graph in the OnConnected method and make sure that the user’s device supports effects. This can be done using the AreEffectsSupported method of the CompositionCapabilities API.
Here’s the full class:

public sealed class MaterialBrush : XamlCompositionBrushBase
{
private LoadedImageSurface _surface;

protected override void OnConnected()
{
if (DesignMode.DesignModeEnabled) return;

Compositor compositor = Window.Current.Compositor;

// CompositionCapabilities: Are Effects supported?
bool usingFallback = !CompositionCapabilities.GetForCurrentView().AreEffectsSupported();
FallbackColor = Color.FromArgb(100, 60, 60, 60);

if (usingFallback)
{
// If Effects are not supported, use Fallback Solid Color
CompositionBrush = compositor.CreateColorBrush(FallbackColor);
return;
}

// Load NormalMap onto an ICompositionSurface using LoadedImageSurface
_surface = LoadedImageSurface.StartLoadFromUri(new Uri("ms-appx:///Images/NormalMap.jpg"), new Size(512, 384));

// Load Surface onto SurfaceBrush
CompositionSurfaceBrush normalMap = compositor.CreateSurfaceBrush(_surface);
normalMap.Stretch = CompositionStretch.Uniform;

// Define Effect graph
const float glassLightAmount = 0.5f;
const float glassBlurAmount = 0.95f;
Color tintColor = Color.FromArgb(255, 128, 128, 128);

var graphicsEffect = new ArithmeticCompositeEffect()
{
Name = "LightComposite",
Source1Amount = 1,
Source2Amount = glassLightAmount,
MultiplyAmount = 0,
Source1 = new ArithmeticCompositeEffect()
{
Name = "BlurComposite",
Source1Amount = 1 – glassBlurAmount,
Source2Amount = glassBlurAmount,
MultiplyAmount = 0,
Source1 = new ColorSourceEffect()
{
Name = "Tint",
Color = tintColor,
},
Source2 = new GaussianBlurEffect()
{
BlurAmount = 20,
Source = new CompositionEffectSourceParameter("Backdrop"),
Optimization = EffectOptimization.Balanced,
BorderMode = EffectBorderMode.Hard,
},
},
Source2 = new SceneLightingEffect()
{
AmbientAmount = 0.15f,
DiffuseAmount = 1,
SpecularAmount = 0.1f,
NormalMapSource = new CompositionEffectSourceParameter("NormalMap")
},
};

// Create EffectFactory and EffectBrush
CompositionEffectFactory effectFactory = compositor.CreateEffectFactory(graphicsEffect);
CompositionEffectBrush effectBrush = effectFactory.CreateBrush();

// Create BackdropBrush
CompositionBackdropBrush backdrop = compositor.CreateBackdropBrush();

// Set Sources to Effect
effectBrush.SetSourceParameter("NormalMap", normalMap);
effectBrush.SetSourceParameter("Backdrop", backdrop);

// Set EffectBrush as the brush that XamlCompBrushBase paints onto Xaml UIElement
CompositionBrush = effectBrush;
}

protected override void OnDisconnected()
{
// Clean up resources
_surface?.Dispose();
_surface = null;

CompositionBrush?.Dispose();
CompositionBrush = null;
}
}

To see this in action, let’s create a Grid to put in the middle of our page’s root Grid and set an instance of our MaterialBrush to that Grid’s Background brush:

<Grid Background="Gray">
<Grid Width="580"
Height="387"
HorizontalAlignment="Center"
VerticalAlignment="Center">

<!– Our new MaterialBrush –>
<Grid.Background>
<brushes:MaterialBrush />
</Grid.Background>
</Grid>
</Grid>

Here’s what it would look like if you ran the app now:

This is because you’re missing the second part of the approach, the lighting!
Illuminating the Material with Lights
In the last post, we created two lights (an AmbientLight “AmbLight” and the SpotLight “HoverLight”). We’ll use them today to apply lighting to the UIElement that is using our custom material.
Since our MaterialBrush uses the new SceneLightingEffect with a Normal map, any lights applied will enhance the material per the SceneLightingEffect’s configuration. Note that this isn’t necessary, but can greatly enhance your material. For example, if you’re using an Acrylic material in your app, adding Reveal will enhance the Acrylic.
Let’s now add the two XamlLights to the Grid:

<Grid Background="Gray">
<Grid Width="580"
Height="387"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Grid.Background>
<brushes:MaterialBrush />
</Grid.Background>

<!– Added lights –>
<Grid.Lights>
<lights:HoverLight />
<lights:AmbLight />
</Grid.Lights>
</Grid>
</Grid>

Now, this is what you’ll see at runtime:

What if it were easier to create and experiment with new materials? What if there were a tool that anyone can use? Let’s take a look at what’s coming to the WindowsUIDevLabs GitHub repo, the Material Creator tool.
Using the new Material Creator
Introducing availability of the new Material Creator tool!

Creating custom materials may sometimes requires a bit of experimentation and tweaking to get the effect’s property configuration just right. This would take time if you had to constantly tweak and redeploy your app. What if there were a way that you could change effect properties and material layers in real time?
The Material Creator can be found on the WindowsUIDevLabs GitHub repo in the demos folder here. (Note: you need to be running Windows 10, build 16225 or higher to use the Material Creator).
Generating the SceneLightingEffect code

One of the great features of the tool is being able to see the effect graph after you’re done creating the material. Click the ellipsis next to the save button and select “view effect graph” to see the C# code for the SceneLightingEffect. You can then copy and use this code directly in your custom material class.
If you go back up to the part of this article where we created the ArithemticCompositeEffect that contains a SceneLightingEffect, that’s where you can use this code!
Saving and Loading Materials
The Material Editor can also save and load materials! If you want to save your current progress on a material, or share a completed material with another developer, just click the Save button and it will create a json file containing all the layers and effect configurations. To load an existing material or edit a material shared with you, just click Load and select the json file.
The key takeaway is that you don’t need to be a developer to create materials. A designer can create a material and then share the saved json file with a developer for implementation in a XamlCompositionBrushBase. Even Windows enthusiasts, like the Windows Insiders, can start building out a universe of materials to drive the evolution of Fluent Design.
Blog Series Wrap up: The future of Fluent Design materials
Acrylic and Reveal are stunning examples of how using Material with Lights can alter the Windows experience, but they’re just the beginning of what is possible. The vision for the Fluent Design Language going forward is that developers and designers can easily build custom materials, innovate and share as well.
The message we want you to walk away with is that you can build new Materials, for a couple primary reasons:
Because you’re a Creator
Because it embodies your brand
We look forward to seeing what kinds of materials you create for your Windows apps! If you’ve already built your own material, feel free to share in the comments below.
Resources
Demo Code:
Material Creator
Brush Interop
Light Interop

Blog posts: XAML and Visual Layer Interop series
Part One
Part Two

Lighting Overview
CompositionCapabilities API
Light Types
Mathematics of lighting
SceneLightingEffect
WindowsUIDevLabs GitHub repo (contains Samples Gallery app)
Win2D Effects API Documentation

Powered by WPeMatico

This Week on Windows: Remix 3D, Minecraft and more

We hope you enjoyed today’s episode of This Week on Windows! Head over here to catch up on our latest programs and deals for back to school, read our Windows 10 Tip on how to use Surface Dial with Paint 3D – or, keep reading for what’s new in the Windows Store.

In case you missed it:

<!–
!function(a,b){“use strict”;function c(){if(!e){e=!0;var a,c,d,f,g=-1!==navigator.appVersion.indexOf(“MSIE 10”),h=!!navigator.userAgent.match(/Trident.*rv:11./),i=b.querySelectorAll(“iframe.wp-embedded-content”);for(c=0;c<i.length;c++){if(d=i[c],!d.getAttribute(“data-secret”))f=Math.random().toString(36).substr(2,10),d.src+=”#?secret=”+f,d.setAttribute(“data-secret”,f);if(g||h)a=d.cloneNode(!0),a.removeAttribute(“security”),d.parentNode.replaceChild(a,d)}}}var d=!1,e=!1;if(b.querySelector)if(a.addEventListener)d=!0;if(a.wp=a.wp||{},!a.wp.receiveEmbedMessage)if(a.wp.receiveEmbedMessage=function(c){var d=c.data;if(d.secret||d.message||d.value)if(!/[^a-zA-Z0-9]/.test(d.secret)){var e,f,g,h,i,j=b.querySelectorAll(‘iframe[data-secret=”‘+d.secret+'”]’),k=b.querySelectorAll(‘blockquote[data-secret=”‘+d.secret+'”]’);for(e=0;e<k.length;e++)k[e].style.display=”none”;for(e=0;e1e3)g=1e3;else if(~~g<!]]>

<!–
!function(a,b){“use strict”;function c(){if(!e){e=!0;var a,c,d,f,g=-1!==navigator.appVersion.indexOf(“MSIE 10”),h=!!navigator.userAgent.match(/Trident.*rv:11./),i=b.querySelectorAll(“iframe.wp-embedded-content”);for(c=0;c<i.length;c++){if(d=i[c],!d.getAttribute(“data-secret”))f=Math.random().toString(36).substr(2,10),d.src+=”#?secret=”+f,d.setAttribute(“data-secret”,f);if(g||h)a=d.cloneNode(!0),a.removeAttribute(“security”),d.parentNode.replaceChild(a,d)}}}var d=!1,e=!1;if(b.querySelector)if(a.addEventListener)d=!0;if(a.wp=a.wp||{},!a.wp.receiveEmbedMessage)if(a.wp.receiveEmbedMessage=function(c){var d=c.data;if(d.secret||d.message||d.value)if(!/[^a-zA-Z0-9]/.test(d.secret)){var e,f,g,h,i,j=b.querySelectorAll(‘iframe[data-secret=”‘+d.secret+'”]’),k=b.querySelectorAll(‘blockquote[data-secret=”‘+d.secret+'”]’);for(e=0;e<k.length;e++)k[e].style.display=”none”;for(e=0;e1e3)g=1e3;else if(~~g<!]]>

See your 3D creations take life with the newest update to Remix 3D

Here’s what’s new in the Windows Store this week:

The Better Together Beta for Minecraft is here!

The Better Together Beta for Minecraft is here!

If you’re on a Windows 10 PC, your world expands to being able to play with friends across devices. The Better Together Update we announced at E3 2017 is designed to unify the console, mobile and Windows 10 PC versions of the game under one single Minecraft edition, which will include infinite worlds, the community Marketplace and community servers (which are coming to the beta later on!). It’ll introduce cross-platform support, allowing console, Windows 10 PC and mobile Minecrafters to play together for the first time! Who can participate? Players on Windows 10 PC, Android and soon Xbox One are welcome to jump into cross-platform play with other beta testers across all three devices. For the full announcement, head over to Minecraft.net!

Build the Car of Your Dreams in the Forza Motorsport 7 Garage

Forza

Welcome to week three of the Forza Motorsport 7 Garage, our weekly look at the 700+ cars coming to the game at launch. This week, in addition to announcing a massive collection of Japanese vehicles – 77 in total – we’re also turning the spotlight on the body customization options available to players in Forza Motorsport 7. For the first time in the Forza Motorsport series, we’re bringing wide-body kits to a number of cars in Forza Motorsport 7. In addition, numerous body-kit options from Forza Horizon 3 will also be available in Forza Motorsport 7, including Upgrade Heroes like the Nissan S14 and the 240SX SE announced today. Wheel options will be abundant in Forza Motorsport 7. In addition to bringing over a number of the new-entry wheels from Forza Horizon 3, we’re adding a selection of new race-inspired. Read more over at Xbox Wire!

Alien: Covenant

Alien

While on a colonizing mission in a distant corner of the galaxy, the ship Covenant stumbles upon a planet that appears to be an undiscovered paradise…but is actually home to something more terrifying than they ever could have imagined. Watch Alien: Covenant ($19.99 HD, $17.99 SD), now available in the Movies & TV section of the Windows Store two weeks before it comes to Blu-ray. For a limited time, win fun swag courtesy of #AlienCovenant! Learn more here.

New Minecraft Marketplace Content!

Minecraft marketplace

Today, we’re releasing even more new content created by our Marketplace partners Noxcrew, Eneija, Razzleberry Fox and Jigarbov: Infinity Dungeon EX map, Summer Festival Skin Pack, Survivors Skin Pack, Kings and Paupers Skin Pack, and the Sports Skin Pack! Anyone on Bedrock Engine platforms can download the new content for now (Windows 10 & mobile devices), but we’re bringing Xbox One and Nintendo Switch into the Bedrock ecosystem soon. To learn more, head over to Minecraft.net!

Have a great weekend!