Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 17 Aug 2010
Offline Last Active Sep 13 2013 05:29 AM

Topics I've Started

How dead is XNA?

12 September 2013 - 08:20 AM

Hi there first I want to tell you about my situation.


Since I have been into game developement I used XNA. I know it is a little late but I recently realized that Microsoft stops further XNA developement. After I read that I decided that the best choice  would be to switch to openGL since it is crossplatform and would give me the opportunity to learn more C++.


Now that I started I had to realize what an overhead this whole new OpenGL thing implicates. Now I am wondering, how dead is XNA? I mean I can still use it in windows 7 (windows 8?). And as far as I know Steam Greenlight still accepts XNA projects. At the end of the day XNA has everything I ever needed.


So is it ok to continue with XNA or is it about time to switch frameworks?




Questions on the "dynamic content loading" example on AppHub.

12 March 2012 - 05:54 AM

Hi folks,

I'm not really new to programming or XNA but I still find it hard to completely understand the "WinForms Series 2: Content Loading".

As I get it, the MainForm.LoadModel(); Unloads the current model and loads the user specified model. So according to this There is always only one model on screen.

1. My first question is, what if I want to draw several models? I guess I simply wouldn't call the Unload-method?

2. The second and most important of my questions is, what to do if I want to load the same Model several times? Let's say, three spaceships at a time? How would I tell the ContentBuilder that every time I pick a Model in the FileDialog he should create a completely new Model?

F.e.: I already tried to Load several models of the same kind by putting them into Lists. But the Problem was I somehow always had only references to my First loaded model. So basically they all were the same. And changing one of them automatically changed the referenced models.

I hope you guys get my problem.

I am pretty certain that is a noob question. Still I would be thankful for any advice.

Thanks in advance.

Why does RayIntersect return wrong values?

09 February 2012 - 05:56 AM

I'm trying to implement Object picking. My BasicModel.cs has a function:

public bool CheckRayIntersection(Ray ray)
	    //Where aabb is the BasicModel's BoundingBox
	    if (ray.Intersects(aabb) != null)
	    { return true; }
[color="#333333"]		    return false;

I create the Ray in my Camera.cs:

public Ray GetMouseRay(Vector2 mousePosition, Viewport viewport)
		Vector3 near = new Vector3(mousePosition, 0);
		Vector3 far = new Vector3(mousePosition, 1);[/color]
[color=#333333]	   near = viewport.Unproject(near, projection, view, Matrix.Identity);
		far = viewport.Unproject(far, projection, view, Matrix.Identity);[/color]
[color=#333333]	 return new Ray(near, Vector3.Normalize(far - near));

And finally in game1.cs I check for Intersection in every BasicModel and write "Intersects" to Console:

foreach(BasicModel model in assetManager._modelsOnscreen)
						winForm.ConsoleWrite = "intersects";

Somehow it always returns true for intersection with offset (to the right) to the actual Boundingbox. I also don't have any clue how I could visualize the problem or step through it. Actually the Boundingbox is drawn correctly as seen here, so I don't think that aabb causes the problem.
Any advice is welcome,

What has to be considered when creating 3D-Content for XNA?

26 January 2012 - 06:49 AM

I am working on a 3D mapeditor right now. Until yet I was working with some primitives (dummies) in order to check the functionality of my Editor. Now I have reached a point where The Editor is ready to be filled with actual content. f.e. Character and environment assets. As I am a one-man-army right now I have to do it by myself. There are some issues I don't have any clue about:
  • I guess assets should be as low-poly as possible. So when is a Mesh/Model considered low-poly? Or do I just have to adjust the Models to the performance of my Editor?
  • What other Information should be saved to the Models while it still is in the modeling software (3Ds-Max, in my case)? Materials, Light...?
  • How to choose the right scale for the Models? What is a reasonable size for models which are later loaded into xna?
Those are the questions I can think of. But if there should be something else that is important please don't hesitate to tell me.
Thanks in advance,

Drawing BoundingBoxes with problems.

24 January 2012 - 08:36 AM

Hi folks,

I've got following problem. I have some .X models loaded via selfwritten assetManager that has Lists with models in it. I also Apply a Diffuse-shader to my models. All the models are "selfdrawing" in a BasicModel-class.

			effect.CurrentTechnique = effect.Techniques["DiffuseLight"];
			// Begin our effect
			// obvious renderstates
			//graphics.GraphicsDevice.RenderState.DepthBufferEnable = true;
			//graphics.GraphicsDevice.RenderState.DepthBufferWriteEnable = true;
			// A shader can have multiple passes, be sure to loop trough each of them.
			foreach (EffectPass pass in effect.CurrentTechnique.Passes)
				// Begin current pass
				foreach (ModelMesh mesh in model.Meshes)
					foreach (ModelMeshPart part in mesh.MeshParts)
						// calculate our worldMatrix..
						world = GetWorld() * mesh.ParentBone.Transform;
						// .. and pass it into our shader.
						// To access a parameter defined in our shader file ( Shader.fx ), use effectObject.Parameters["variableName"]
						Matrix worldInverse = Matrix.Invert(world);
						Vector4 vLightDirection = new Vector4(0.0f, 0.0f, 1.0f, 1.0f);
						effect.Parameters["matWorldViewProj"].SetValue(world * camera.view * camera.projection);
						// Render our meshpart
						graphics.Vertices[0].SetSource(mesh.VertexBuffer, part.StreamOffset, part.VertexStride);
						graphics.Indices = mesh.IndexBuffer;
																	  part.BaseVertex, 0, part.NumVertices,
																	  part.StartIndex, part.PrimitiveCount);

				// Stop current pass
			// Stop using this effect

Now I checked out this tutorial on how to create BoundingBoxes. Of course it doesn't work Posted Image

1. The render method needs a view and a projection-Matrix. Are those the view and projection-matrices I use in my Camera-class or what are they supposed to be? I just guessed that those are Matrices from my camera class. So I had to call the BoundingBoxRenderer.render() function in Game1.Update(). It looks like this:

if (assetManager._modelsOnscreen.Count != 0)
				foreach (BasicModel model in assetManager._modelsOnscreen)
					foreach(ModelMesh mesh in model._model.Meshes){
						sphere = mesh.BoundingSphere;
As you can see I also had to generate my BoundingBox out of the meshes BoundingSphere. No Idea why the Microsoft guys didn't implement mesh.BoundingBox just like they did with mesh.BoundingSphere.

2. If I just leave the code as it is there are no BoundingBoxes drawn at all. But As far as I can see no more Shaders are applied to the models. They are drawn with BasicEffect. I guess it somehow is caused by the Basic Effect that is used for theBoundingBoxRenderer.

Any advice is welcome. Perhaps somebody experienced similar problems? I use XNA 3.1 if it is important.

Thanks in advance!