Integrating WPF, Unity3D (and Kinect) - c#

I created a WPF project in Visual studio. The XAML markup is managed by C# code-behind. What i want to do is create a component on the user interface, which will show a 3D scene. I would like this 3D scene to be managed by Unity, because i need to take advantage of Unity's physics engine. The user must be able to interact with this 3D scene via gestures, recognized by Kinect (for example toss a ball).
Is there any way I can connect WPF, Unity3D and Kinect, so that the user will be able to manipulate 3D scene in such manner? If so, could you provide me with some examples/tutorials? If not, what is the best approach for letting user manipulate 3D scene with Kinect gestures?

I would see How get the Unity3D View In wpf winform as for using Unity3d with wpf. The tricky part will be the Kinect interaction.
You can interface with Kinect through WPF, and use Zigfu for unity. The downside to using WPF for the Kinect interaction is that you won't be able to send data to unity unless you use the new Kinect Client Server System and send all of your information to a webserver, then retrieve it in unity. That is a very bad idea, and will probably not be fast enough and experience serious lag.
The second option, using ZigFu in unity for the Kinect support, is to be considered. The issue with it is if you want to use the Kinect in WPF, then you would have to disconnect from unity. This is the only possible way I see being able to implement
Overall, this is achievable, but will be very difficult. I suggest you use ZigFu, but there are drawbacks to both methods.

This is quite a big and generic question. But I will suggest you to use a web deployment of your unity project and, on your project/References/COM there is a UnityWebPlayerAXLib Control that will help you a lot.

Related

Unity WebcamTexture advanced settings (exposure, focus, zoom)

I have my camera feed working in Unity that uses WebcamTexture. According to https://docs.unity3d.com/ScriptReference/WebCamTexture.html, there are no features for changing the exposure or focus settings.
Just to be clear:
Is there any way to change the exposure of WebcamTexture?
If not, is there any other way to adjust the exposure without using WebcamTexture?
If not, what are some widely used API/tools that I can use in Unity for getting camera feed with these adjustable settings?
Is there any way to change the exposure of WebcamTexture?
No. You can on Android with AndroidJavaObject but that's a hack and can stop working each time there is Unity update. Also, it will only work on Android but not on iOS, Windows, Mac and other platforms.
If not, is there any other way to adjust the exposure without using
WebcamTexture?
Again, no. You can't modify the camera settings while using WebcamTexture.
If not, what are some widely used API/tools that I can use in Unity
for getting camera feed with these adjustable settings?
The only way to be able to modify the camera settings you mentioned is to create a camera API plugin for each platform. This is not easy to do since you have to know many programming languages to get it working such as Java for Android, Objective-C for iOS and Mac, C++ for Windows and Linux and Javascript for WebGL then use C# to put them together. It's really time-consuming to make this and therefore better to use an existing plugin.
The best one out there is the NatCam plugin. This plugin can control the exposure, focus and zoom of the camera but it's not free. It's worth it.
You can set the exposure and the exposure bias as:
DeviceCamera.RearCamera.ExposureMode = ExposureMode.Locked;
NatCam.Camera.ExposureBias = NatCam.Camera.MinExposureBias;
To set the Focus Mode:
NatCam.Camera.FocusMode = FocusMode.TapToFocus | FocusMode.AutoFocus;
To zoom the camera:
NatCam.Camera.ZoomRatio = 2.0f;
You can find the complete tutorial for NatCam here.

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.

Real time 3d rendering navigation

I have no idea at all about the 3D Visualization ,and i want to create an application ,the application idea depends totally on the 3D structure .
I'll do my best to clarify my question to avoid considering it vague .
The main goal of my application is the (navigation) part in 3D environment .I want to upload maps of a specific area and the application allow to guide the user to its destination.(real time 3d rendering).
The application should work on kiosk ,smart phones and on web.(multiple platforms).
The following video clarify what i want to do exactly :
3D wayfinder
Now I want to know a start point to begin without reinventing the wheel,if there are some frameworks should i learn about first?
I'm a.net developer(asp.net) and i begin to learn CMS (Joomla),so it 'll be great to find APIs or frameworks near to this area to achieve my goal as soon as possible.
From requirements you specified, I would like to advice to look at Unity3D.
Unity3D will help to develop application which will work on almost all major platforms including kiosk, smart phones and on web.
You can develop using C# language which should be familiar to you.
There are number of projects which aims similar goal as rendering 3D map. There are "Google Maps for Unity" plugin and I can advise to look at Displaying Maps in Unity3D post.
Unity can be integrated to Joomla if necessary
Another option would be to build the front-end of the app using HTML5 and do the 3D using Three.js http://threejs.org/
Your back-end could serve up the map and navigation data to the front-end and you render everything in the browser or in your HTML5 smartphone app. If you need to update information in your visualization or load a new location dynamically, this can be done with a simple AJAX call and your callback would add the new info into your Three.js scene.
Forget about what others suggest you in regards to looking at 3D frameworks. Mapping and navigation is a complexity of it's own - 3D frameworks like unity will give you 3D. But they won't give you GIS. Depending on your requirements, you could check Micello for 2D mapping and Deep Map for mobile 3D mapping (http://www.deep-map.com/en). They also help you with creating the maps - which is something you should consider for beforementioned reasons.
You can use OpenCV library in C# for image processing and get help from HTML5 and AJAX .
Try X3DOM. Its a programming language that can be used in applications, web browsers, and much more. And the language is ALOT like HTML and JavaScript. In fact, you can use JavaScript and HTML to access the 3D space in X3DOM.
The website for this language is: x3dom.org

Graphics and Animation in C#

I created a Game in C# (Multi-player Tanks Game) using Windows Forms Tools (Panels, shapes, buttons, etc...) but the Animation and Graphics are just so poor, so is there any Type of simple Graphics or Animation to use in C# to make this game a little better, can I use flash in C#, anything?!!!
XNA is great, its a completely different technology to Windows Forms as its based on DirectX.
Another idea is to check out silverlight or WPF depending on how complex your game is. For simple 2D games with not too busy screens it might be a lot easier than XNA.
I found a great example of building a multiplayer game in WPF.
I would recommend having a look at Microsoft XNA.
I'm pretty sure if you want to improve the graphics of your game you're going to have to use design software or hire someone to do it for you. A simple look up on Google will direct you to model development software.
A good place to start is the microsoft XNA framework.
I also recommend using Blender: http://www.blender.org/
It's a completely free open source 3D model creation program.
There are many librarys and ways for game development in C#.
I prefer to use XNA, which is based on DirectX and developed by Microsoft itself.
But there are also many other wrapper like OpenGL wrapper SharpGL, a custom DirectX wrapper SlimDX or using the plain DirectX SDK.
Some time ago I was looking for libraries or frameworks to improve winforms experience with nice animations. My best options were XNA or OpenTK (OpenGL) and SDL.Net.

Buidling an XNA tile editor

I'm writing a tile editor for a game and would like to be able to select which level file to open. Once open I would load the level into an XNA window and click to add/remove tiles to the level. When the editing is finished I would save the file layout back to the original file.
Currently I don't see a way to integrate windows forms and XNA. Is this even possible?
When I was working on a small, "2.5D" isometric game in XNA, I found it worth while to also have a separate WinForms version that would just render a 2D top-down view using GDI. This was due to my inexperience with XNA and my (relative) comfort using WinForms.
This approach also had the useful side-effect of enforcing separation between logic and rendering code. It made it easier (for me, at least) to test changes without having to worry about how to deal with the XNA rendering aspects.
It may not be exactly what you had in mind, but it might be something to consider.
WinForms and Xna can cooperate, but it's not recommended to use Xna's built in Game class with WinFroms. There are two samples demonstrating it:
http://xbox.create.msdn.com/en-US/education/catalog/sample/winforms_series_1
http://xbox.create.msdn.com/en-US/education/catalog/sample/winforms_series_2

Categories

Resources