Applying pixel shaders to images - c#

I would like to apply a shader effect to an image in c#/xaml.
I have found this example:
http://msdn.microsoft.com/en-us/library/system.windows.media.effects.shadereffect(v=vs.95).aspx
Which makes applying pixel shaders to an image pretty trivial. Unfortunately I cannot do the same thing with the windows 8 phone SDK.
Can I do anything this simple? I would like to avoid using DirectX if possible.

Check the link below:
Creating a Lens Application that uses HLSL effects for filters
This solution uses SharpDX api (a C# DirectX wrapper).
I've tested recently and it works fine under emulator.
Unfortunally I didn't get the same results when applying outside a Game class. I already published a question here with no responses yet. :-(
Good luck!
Best regards,
Pieter Voloshyn

Unfortunately you cannot make custom ShaderEffects in Windows Phone 7 or 8. See also: WP7 - HLSL effects from WPF/Silverlight
Also it would appear that XNA is a no-go:
Windows Phone custom shaders error?
I don't think XNA has had any feature additions from WP7 to WP8, either.
You might be able to get away with doing what you need in Direct3D: (http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj714072(v=vs.105).aspx)
Good luck!

Related

Is it possible to port a WPF 3D app to UWP / UAP

I wrote an WPF app using all the 3D stuff of WPF which contains several Views displaying 3D data. IMHO WPF is not the platform for further development of the app so I am searching for some ways to port it to a Universal App/Windows Store App/UWP.
The way, Microsoft is promoting, is to use Unity meaning a complete redevelopment and complicated workflows because it should be a 2D-App with some 3D views.
The other way I was looking at way using Helix-Toolkit, because it does not just offer the WPF-way of displaying 3D but also the DirectX way using SharpDX. Unfortunately the progress concerning UWP is pretty low and not currently usable in the extend I need (like displaying custom geometries etc.).
Is anybody out there who got the same problem and found a workaround?
TY!
You may also like to consider Monogame. Like Helix-Toolkit it's based on SharpDX (when it's on Windows anyway). It's not quite as "componentised" as Helix-Toolkit but it's possible to make your app UWP-first and Monogame-second.

SilverSprite runs as White Page

I've been attempting to bring some of my XNA games to the web with Silversprite. However, whenever I run these apps they appear as a white screen.
I am wondering if anyone has any idea on how this might be fixed.
I have followed the tutorials exactly (except replacing the XNA apps they used with my own). Nothing is working.
Has anyone figured a way around this?
Use ExEn instead of Silversprite.
http://exen.codeplex.com
ExEn is a high-performance implementation of a subset of the XNA API that runs on Silverlight, iOS and Android.
It's production ready.
Here are some samples:
My samples (if you want, I can upload you the source code):
Pacman: http://vackup.blogspot.com.ar/2011/09/xna-3-pacman-ported-to-silverlight.html
Pong: http://www.mylittlebets.com/Pong/TestPage.html
From ExEn creator:
http://andrewrussell.net/2011/02/exen-home-stretch-y-arms/
http://andrewrussell.net/lightblocks/

Displaying, overlaying and interpreting live video feed in WinForms

I am starting a new project to show live video in a Windows form from an attached web cam and overlay that video with windows controls (buttons etc). Additionally I would like to do some image correction to remove distortion on the fly and do some edge detection.
I'm confused as to which library might be best suited for this.
OpenCVSharp - Can handle the correction / detection, not sure if overlay / live feed is possible.
DirectShow/DirectShow.Net - Do I need to code filters up for the
overlay, how to handle edge detection?
AForge.net - It's been recommended but I'm not sure it is as capable
Does anyone have experience of these or other libs that might be suitable for access from .Net?
If you only want to work with the vision part then AForge.net is your best bet. I have used it in the past and it was pretty good for video/feed stuff. Don't expect to do something with your audio later on though since AForge.NET only supports Vision related stuff. Personally I wouldn't use DirectShow since that is pretty old and sometimes requires you to do some complex interop tricks to get what you want. If you want to go the DirectShow way at least use DirectShow.NET.
I believe you can accomplish that with OpenCVSharp and the instructions from transparent image overlay.

Metro App with 2D Graphics in C#

I have done some looking and I can't figure out a good way to write a 2D tile/sprite based game in C# for Win8. According to the MSDN documentation:
You can use managed code languages like C# and Visual Basic to develop 2D (and lightweight 3D) games.
The problem is that I can't figure out how to do this. The reason I would like to use C# is because I already have a lot of code written for Windows Phone that I would like to reuse.
Can anyone point me to how I would write a fairly efficient 2D tile/sprite MetroUI game for Win8? The only thing I can find uses C++ and DirectX.
[EDIT]
To clarify I do not care too much what I use (WinRT, DirectX...) so long as I can submit to the app store, and write my code in C#.
If you are familiar with the DirectX API, you can use SharpDX available via http://sharpdx.org. It is basically exposing DirectX APIs into C#. From my understanding, if you are going to upload apps to the store, the SharpDX should be fine and pass compliance, but I would look into it further before going too deep.
Also, as of this time, not all of the features are available (like Direct2d not fully certified for Win8 Metro).
If your game uses simple graphics, you can use Drawing Library for Modern UI, it exposes a GDI+ like interface to be used in XAML/C#/VB.NET Windows 8 Modern UI applications, it works by drawing to a XAML Canvas.
If you're looking for something quick and easy check out the "Physics Helper XAML" project;
http://physicshelperxaml.codeplex.com/
It's based on the farseer engine, and comes with sample apps. There are a few games already released using it.
http://www.andybeaulieu.com/Home/tabid/67/EntryID/223/Default.aspx
Have a look at:
[XAML images sample] (http://code.msdn.microsoft.com/windowsapps/0f5d56ae-5e57-48e1-9cd9-993115b027b9/sourcecode?fileId=102748&pathId=677969581)
The page and samples give some code for NineGrid and WriteableBitmap Image manipulation.
You can now use Win2D (open source, released by Microsoft for metro/WinRT apps) which provides hardware-accelerated 2D graphics rendering.

Control Camera Device From C#

I am now facing one problem which to get the live image from Camera (eg. Sony, Canon) into winform and also control the camera capture button from a button in the form.
have Anyone build something like this, or are there any similar project like this which is done in C#?
This hardly depends on the capabilities of the camera and its driver. Your biggest chance might be the Windows Image Acquisition (WIA) framework.
Take a look at this article or the MSDN reference.
Emgu cv is a project that provides all the bindings for OpenCV. I've used it on both Windows and Linux platforms (Mono) with great success.
http://emgu.com/
http://emgu.com/wiki/index.php/Camera_Capture_in_7_lines_of_code
You can also take a look on Intel OpenCV.
It's C++, but you can use use PInvoke to use it from c#
This project supports even high-end PTZ camera. Code Project - Versatile WebCam C# library.
It uses Touchless.Vision and WebCamLib

Categories

Resources