Import 3D model in Visual Studio 2010(WPF) - c#

I work on a project in VS2010(WPF aplication) for 3D game, i use Visual C# with OpenGL and GLControl, and i need help about importing 3D models.
Google search didn't help much, i need more things to know about import 3D models in these technologies.

OpenGl is not a scene graph, and it will not load models for you. You need to load the model separately and then pass the vertex/normal/texture/index information to opengl using either vertex buffers/index buffers, or using the fixed function pipeline if that is the way you are going.
Other than that, we can not help you since this is such a general question, and each model format is loaded differently.

Check out ZAM3D and Microsoft Expression Designer, you can easily import and export models that you can directly use in xaml
Regarding rotate/translate transform, there is support built into WPF and you don't need open gl if you are using WPF, I would highly recommend you to install Expression Blend and use animation/camera-control to achieve the same.

Related

3d Programming with AssimpNet in MonoGame

I use Windows 8 and the Visual C# 2010 IDE and the latest release of MonoGame. Since MonoGame has limited support of 3d models and I want to import 3ds or Obj files, I have decided to try using AssimpNet. While importing the files I need should cause no problems(haven't tried it yet), I am at a loss of how to process the imported Scene object to render my mesh. Is there any XNA or MonoGame related site that will show how to do this and preferably deal with the matter in depth? I have search various terms in Google and failed it find any. AssimpNet's help files and file documentation either doesn't work or only will provide definitions. I am looking for a site that discusses in depth 3d programming info through C#, preferably Monogame or XNA. I cant simply use DrawModel for this. It has to be at the Matrix level.
Thanks in advance.

Models from .x files in OpenGL, difference between DirectX and OpenGL

I have little experience with using 3D models exported to .x files in DirectX.
For example for make watersurface or some objects star, car, grass or whatever.
Can I do it in OpenGl similar way like in DirectX? I mean using .x file to render the 3D model? Or other file, or is that bad way? If it is bad way, what should I do?
Situation: project of simple 3D game OpenGL + C#, I have rendered terrain from Height map and I need to improve it by objects, grass, water, teleports.. so I'm finding easy way to render 3D objects.
Can I do it in OpenGl similar way like in DirectX?
Yes, and no. Let me explain.
The DirectX .x file format came to life with DirectX 3, which was an utter mess. Loading even the most simple geometry was an awfully exhausting task. As of such, support for a loading model geometry from files was added into the Direct3D environment.
However DirectX never enforced a specific file format, and as it matured, somewhere around version 7 Direct3D became usable. As soon as getting geometry into Direct3D became something simple, the .x file format was no longer needed. And frankly, there are only very little serious programs that actully use .x for their assets.
OpenGL never had the need for a builtin format, because setting up and drawing geometry – that has already been read into memory of course – could be managed in as little as 10 lines of C code. So the only difficulty lies in parsing a file format into structures in memory. This is not a task for a API designed for drawing stuff, bur for libraries that are designed to do I/O.
To make a long story short: OpenGL has no built in support for some file format, but you can use any file format you like to, and coax it into OpenGL. The .x file format is well documented and you can find ready to use libraries to load or write your own.
The short answer is no. You cannot do that in OpenGL. First, let me clarify what is going on here.
DirectX, like OpenGL, is a high-power graphics API. While there are differences in individual features you can think of them as nearly identical.
However, DirectX differs from OpenGL in a big way. Specifically, Microsoft has lots of tooling and libraries built on top of DirectX. For example, the XNA library, Visual Studio add-ins, and so on.
When you have a ".x" file, what you are really doing is using part of the additional libraries and machinery built on top of DirectX to do the loading and displaying of the model.
While there are lots of libraries for loading models and displaying them in OpenGL, they aren't "in the box" like they are with DirectX.
For your game, if you are going with OpenGL I would recommend you stick with a different file format for your 3D assets. COLLADA would be a good starting point.

How can I programmatically access the ArcGIS 3D Analyst Toolbar's "Features to 3D" command?

I need to take a 2D shape file in the ".shp" format that ArcGIS accepts, and add 3D information supplied by a raster DEM. I'm looking for how to do this with the ArcObjects API. I'd like to do it in C#, but examples in any .NET language would be welcome. The only thing I've been able to find are descriptions of how to do this manually in one of the ArcGIS desktop apps. Like this helpful HowTo article, or the wonderful full color illustrations on page 22 of this tutorial. That's great and all, but I need to use this feature in the middle of an automated chain of operations. I don't want to have a manual step in the middle.
OK. I figured it out. I'm jotting down an outline of what I did here in case anyone else runs into the same problem.
The key method is ISurface.InterpolateShape. It will copy an existing 2D IGeometry and add 3D information to it from a surface (raster or TIN). I translated this example VB6 code from VB6 to C#, and modified it to call InterpolateShape for each copied IGeometry in the input shape FeatureClass before inserting it into the output FeatureClass.
I won't post any of the code here because I developed it on my company's dime, but this should be enough to figure it out reasonably quickly. Hopefully this will help some other struggling developer get through the problem more quickly.

Javascript (or similar) gaming scripts for C# XNA

Lately I am preparing myself to develop yet another game in XNA C#.
The last time I worked on a game in XNA C#, I ran into this problem of having to add maps and customizable data into the game. Each time I want to add in new content or change some values to the game character or something, I had to rebuild the whole game or what - which can take quite some time.
Is there any way which I can write gaming scripts to load the content that can be interpreted by my XNA C# game without having to compile? I am looking at hopefully Javascript.
I would hope that I can add in functions and other small API which can be called from the external gaming script to manipulate the game or load data so on. I am not concerned about the game being hacked since it's quite early yet - the development is of much priority.
Any help would be greatly appreciated.
You can try Jint which is a open source Javascript interpreter written in C#
The compact framework doesn't include System.Reflection.Emit, which means you can't use IronPython. I recommend LUA, and you can find an XNA interpreter implementation with open source here
Would IronPython be more appropriate? That should work well on "full" framework - but it looks like it might not work (yet) on xbox 360 (which uses compact framework).
For an IronPython / xna example, see here.

Texture onto 3D car mesh

I have a 3D car mesh object. How can I reflect a 3D text onto the 3D mesh surface?
I'm using Visual Studio 2008 C# Express. The 3D car mesh object is ready for use in C# project.
That is, I must use it in my C# project, not in Blender.
All the development processes that I need must be done in C# development environment.
You should use a 3D modeling tool like Blender, AC3D or similar. This will help you create the "model" and placing any textures on it. Then you will also need some kind of drawing engine so you also can load and draw the model in your app.
It's unclear specifically what you're talking about here.
Did you mean Text, or Texture?
Simply texturing the model - If you're using blender to create the model, texture it, and export it in .x or another format and render it using an appropriate library.
Reflecting Text - Look into projective decals.
Or a bit more advanced
Reflection of the environment - To simulate reflective surfaces you're going to need to program a shader. Look into HLSL, GLSL, CG, or you can do the shader in ASM. - Reflection Mapping
EDIT: Added link to reflection mapping.
If you need Direct 3D access at run-time, try using SlimDX.

Categories