1

Is it possible to implement per-pixel-lighting in WPF 3d application (C#) by using their shader effects?

I have a basic 3d application running in WPF but it only shows Gouraud Shading, by interpolating shaded colour values between vertices to the inner of the polygons. I tried to implement a per-pixel lighting approach, like Phong, but I realize that I do not seem to have access to interpolated normals in the WPF pixel shader effects. Is this the limitation of WPF, where one should better go with C++ and OpenGL/DirectX directly?

Michbeckable
  • 1,851
  • 1
  • 28
  • 41
  • you can still go with xna to avoid native programming. I always use this demo as an example: https://www.youtube.com/watch?v=RDIeijJkV14. its made in xna&silverlight – Liero Feb 25 '15 at 12:33

1 Answers1

0

as far as I know, yes it is a WPF limitation...contrary to the OpenGL where you can do per-pixel shading, the WPF only allows you to work on a meshGeometry.

I think a way to go with it, would be to create textures that contains your shader effect, and then apply it per triangle. This would take a longer amount of computation time, but should work.

Regards

L Chougrani
  • 588
  • 4
  • 7
  • Pixelshaders are also available in DirectX. It is a WPF limitation. Putting the shading in the texture is a hack, it does not take light and movement into consideration and will look very wrong when moving objects, lights or the viewpoint. – Emond Feb 25 '15 at 12:50