PDA

View Full Version : Calling the Geniuses on this one


robot_builder
10-30-2009, 08:58 AM
Always flatter a techies smarts for help right ;)

We have put in 30+ hours of research on this one and are still trying to figure out what the correct development path should be. It's time to ask for some experienced help.

What we need is to create a control that renders predefined 3D models of robots which we can drop onto C# and VB.net forms. The control would expose basic robot control to the form and programmers. For example:
- robotcontrol.arm.joint(2).position = 45
- a form button that toggles wireframe view
- clicking on the control can output 3D coordinates of where the users mouse is for us to incorporate feedback control etc.

We aren't game developers so building a 3D world inside a control from scratch is a rather daunting approach. I have scoured the internet for 3rd party tools that can help build this control and leadworks is the only thing I've found that's close. I've also found one program that is made for adding 3D CAD viewers to .net applications. It works well, but lacks the ability to create any kind of parent/child relationship between the parts. For every degree of movement on any appendage you have to redraw the entire scene. That is a math and CPU nightmare for complex robots.

I have been learning Blender and we can import our CAD file parts into the program and I'm learning constraints to connect them together. It seems we can model a robot this way, but here's where we get lost. What is the way to bridge having a Blender model and creating a .NET control for it? There doesn't seem to be any examples, tutorials, etc out there for bridging these two worlds.

So I wanted to ask the game dev community how they think this could be best developed. Any sage wisdom on this?

Thanks!

robot_builder

vrnunes
10-30-2009, 10:37 AM
Well although I'm definitely not one of the genius you refer to, I'll give you my try on the topic:

First, I'm not sure what you're calling "control" here. You may be talking about a C# control that appears on the Toolbox, and you drag into a form in design time, or you may be talking about a runtime control that you drag into the screen, within your application GUI. Could you clarify, please?

Both are not really too complex. For the first case, the control gives you independence of one instance to the other (like, robots dragged to the form will be independent and won't interfere with the others). They will be on entirely different scenes, though, like totally different windows, even living in the same form.

The second case, you won't be able to drag the robot in design time, but only when the application is running. The robots will be all in the same scene, and could interact with each other.

Interested to know which case you need.

robot_builder
10-30-2009, 12:02 PM
Hi vrnunes, thanks for the reply. Yes, we are talking about a C# control that appears on the Toolbox. The control would have an instance of our predefined robot loaded in at start up. (all invisible to user)

Projects would not need more than one control on a form at a time.

fireside
10-30-2009, 12:50 PM
If you are using c#, you might want to look into XNA. I think it blends with that whole deal a little better. I don't know if you can use it in forms, though. I don't think Blender is going to help you out much there unless it's conversion to a different model format or possibly adding some preset animations and then exporting into a model format such as directx that can be read by whatever you are using to render. The Blender engine is pretty cool and might be helpful but wouldn't work with controls like that. You could probably write something like a control in it, but it wouldn't work in c# or vb. I think the control is just adding some code to the run time so it's a matter of following some rules to make it do what you want. No one here will be able to do that for you. Re-drawing the scene every loop is pretty standard. The parent child thing is just some code that informs the children to do what the parent did. For instance, if the parent is rotated, the children are rotated the same amount around the parent's axis or center point. At least I think so, I don't do engines. XNA might have some code for that.

JarkkoL
10-30-2009, 12:57 PM
Well, you can do this with Spin-X Engine by using C++ at least ;) You first model the robot with your favourite modelling program where you define the geometry, skeleton hierarchy and associate geometry to the skeleton (skinning). Then you export the model to Collada (.dae) format and import that model as skinned mesh to your application using the engine. Then you create an instance of that mesh and you got access to the skeleton bones, which you can animate as you like.

The engine can render the result to the window you pass to it, so you can create a simple custom window control, which renders to that window by using the engine. This is done repeatedly in Spin-X Editor, so there is plenty of reference code how to do it by using wxWidgets (GUI library for C++). There is also support for switching rendering mode to e.g. wireframe rendering. If you got questions, don't hesitate to email me (jarkko@spinxengine.com) (: