I have to create library that render static, simple shapes with some 3d effects such as rotation and bevels. Shapes can contains text or image on it.
Something similar to this:
I think that with GDI+ it will be hard to implement so is there any CLS compliant library that will help me with rendering?
P.S. I can not use WPF.
Try to read the following stackoverflow page to choose the engine:
What to use? Tao, SharpGL, OpenTK, DirectX P/Invoke, XNA, MDX, SlimDX, Windows API Codec Pack
One example for the Tao framework with C# can be found in codeproject:
OpenGL 3D Navigation with Tao and C#
You could try SFML: main page - features (includes bindings).
It's got a Shape primitive, is based on OpenGL rendering and includes support for shaders.
Related
I'm creating a music player in C# / WPF.
With the BASS audio engine, I can create simple spectrums like this:
But I'm looking to create nicer looking ones like those seen in YouTube videos created in After Effects.
Are there any DirectX, OpenGL or other engines that can produce similar effects that I can use in my application?
Well, first, your question isn't the best (fit wise) to SO, since it's not about a problem you have with code.
Having said that, WPF supports OpenGL, as you can see
Using OpenGL in a WPF Application
Creating OpenGL Windows in WPF
And also DirectX (although 9 it seems)
Walkthrough: Hosting Direct3D9 Content in WPF
So, yes, you can choose your engine :)
I need to visualize constructive geometry in 3d using C#. And for that I want choose a library. Ideally, that library should be able to provide the following:
Rendering arbitrary polygons in 3d. Wireframe representation.
Orhtographic projection
Camera control. I need to be able to zoom-in/out, set center of rotation to turn camera around it.
Pick my polygons, edges, vertices with a mouse.
Draw text on top of vertices, edges and polygons.
Efficency isn't the priority, so it can be resonably slow if it can do these things right out of the box or provide a good high level service for it.
I tried to look at XNA. But as far as I understood it doesn't support visualization of polygons directly.
XNA does support visualization of polygons directly by providing access to the underlying Direct3D 9 GraphicsDevice object. You can also dynamically create a mesh and draw it in a managed way, however that will be slower.
See:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.xna.framework.graphics.graphicsdevice.drawprimitives.aspx
and related methods.
There's several DirectX wrappers in c#. I would avoid Managed DirectX since it's deprecated, and you have only access to direct3d9.
The two most common libraries for DirectX are:
SlimDX
SharpDX
Both work pretty well, and support latest DirectX feature set (SlimDX up to 11, SharpDX supports windows 8 and 11.1).
They both support what you need to do, it of course implies a bit of coding on your side.
I have an Image object in my application which the user can drag around. The object displays an image which is partly transparent, so the window background (which is itself a bitmap) can be seen through it.
I want to add a graphics effect to this object. Assume that I already have an algorithm for this effect — that’s not the issue. The issue is how to get this algorithm into WPF.
So I tried to look at how DropShadowEffect works, but the implementation displayed in Reflector is empty. I also tried to look at what methods from the abstract classes Effect and ShaderEffect I should override and there doesn’t seem to be anything related to actually rendering an effect.
So how do I create my own effect?
The best and fastest way is to use pixel shaders (supported starting with WPF 3.5 SP1 I think) . It will require some shader language (HLSL) knowledge, though :-)
Here is a tutorial: How Do I: Create Custom Pixel Shader Effects for WPF
a library on codeplex: Windows Presentation Foundation Pixel Shader Effects Library
an article with .NET 4 information (including Sliverlight support which has it too): SilverShader – Introduction to Silverlight and WPF Pixel Shaders
A very cool tool (and resource) is Shazzam it will help you to create the effects and it contains a nice tutorial.
Is it WPF? WFA? A custom template?
I currently use WFA, and it just doesn't seem anywhere near optimal. And no, I'm not asking for a referral to DirectX, or another language.
Thanks.
Do you want it to be really 2D, or you you want a "2.5D" game where 3D objects move in 2D?
For most basic 2D, like turn-based games or simple animation where very fine human input control is not necessary, the System.Drawing tools used in a WFA will probably be fine. You have access to a lot of the tricks, like using small images as sprites, rendering vector graphics, as well as the must-have elementary shape-drawing functions. You can use Image objects like Bitmaps to simulate page-flipping (create a Bitmap, draw the shapes on it, then call Graphics.DrawImage()), or simply use SetRedraw(false) on the control you're using as the Graphics pane to freeze what's there while you're drawing the next window.
WPF has some tools that are a major leap forward. Look at the System.Windows.Media.Media3D namespace; it has tools for 3D vector algebra and geometric primitives, allowing you to create 2.5D games with vertex shading and all the tricks. The basic structs can be referenced and used for their mathematical power, or you can build a WPF application that will integrate them into a graphics pane. You'll have to research this yourself; I'm a lightwight with WPF.
If you want your game to really get some FPS, you're going to have to use an accelerated platform like DirectX. XNA Game Studio is a free .NET-compatible API that wraps a lot of the DirectX functionality, allowing you to create .NET apps with accelerated graphics without requiring messy native code hookups. Creating and running apps on just about any .NET-compatible platform (including Windows) is free; you have to pay a fee and join the "XBox Creator Network" to publish even free games for XBox 360.
XNA, and the Box2D.XNA physics engine if your game requires 2D collision detection and physics. XNA takes care of hiding all that crazy DirectX stuff from you. It has a great content pipeline, which lets you add content to your game very easily. My favorite framework for small games.
Are there any good C# Silverlight Graphics or Game engines currently? I am planning to create a game with it (either 2d or 3d) but are there already usable frameworks or should I expect to have to build everything myself?
At the moment, probably the most well known graphics engine is:
Balder
Managed GameEngine with both 2D and 3D
support targetting Silverlight 2/3,
Xna and OpenGL.
There is also:
Kit3D
Kit3D is a 3D graphics engine for
Microsoft Silverlight.
As far as Game Engines go, there is:
PlayBits Engine
Although PlayBits is not yet available, and will not be free.
If you're targeting both XNA and Silverlight for 2D games you can use the SilverSprite library at http://silversprite.codeplex.com and it may also be useful if you're used to a traditional game loop and draw calls.
For simple games it is fairly easy to make you own game Silverlight game engine. This tutorial here shows you how to get started.
Probably the most enhanced 3D engine for Silverlight so far is Silvermotion
It has some quite impressive demos and looks more like a high tech DirectX engine than the usual stuff and runs quite well.