Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applying pixel shaders to images

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.

like image 922
Toadums Avatar asked Nov 01 '12 02:11

Toadums


People also ask

What is the use of pixel shader?

A Pixel Shader is a graphics function that calculates effects on a per-pixel basis. Depending on resolution, in excess of 2 million pixels may need to be rendered, lit, shaded, and colored for each frame, at 60 frames per second. That in turn creates a tremendous computational load.

What is shader in image processing?

In computer graphics, a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the rendering of a 3D scene - a process known as shading.

Is fragment shader same as pixel shader?

A fragment shader is the same as pixel shader. One main difference is that a vertex shader can manipulate the attributes of vertices. which are the corner points of your polygons. The fragment shader on the other hand takes care of how the pixels between the vertices look.

How do you increase pixel shader?

As in most optimisations efforts, the performance of a pixel shader can be improved in two ways: by not running it at all if possible and, if not, by making it cheaper to run. So a first good step would to be to avoid rendering occluded triangles at all, using a CPU or GPU based solution.


1 Answers

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

like image 148
Pieter Voloshyn Avatar answered Sep 23 '22 17:09

Pieter Voloshyn