• Create Account

necro1895

Member Since 26 Jun 2012
Offline Last Active Oct 11 2012 12:29 AM

In Topic: Skybox & Deferred Rendering how to ?

30 July 2012 - 07:57 AM

Does that work partly? Or do you test just the whole setup?

Try to draw each separate part on the screen.

```pass Pass1
{
CullMode = CCW; //<--- this or CW
}
```

10 July 2012 - 11:59 AM

After playing around with some matrices i didnt find any matrix which fits the bounding frustum cube. The first one is the inverted matrix of view * projection. The second one was computed by xna via boundingFrustum.Matrix.

The screenshot shows the frustum on the start position. I freezed the frustum for strafing rightwards.

Whats wrong with these matrices? There are in no cases a trapezium.

Btw, i got the same matrix without inverting the view*projection matrix like the frustum matrix. There is something really odd with that.

I'm using this
```cubeFrustum.Initialize(Matrix.Invert(camera.matrixView * camera.matrixProjection));
```

and this
```cubeFrustum.Initialize(camera.boundingFrustum.Matrix);
```

and they are calling these function:
```		public static Vector3[] CreateCube()
{
Vector3[] cube = new Vector3[8];
int idx = 0;
cube[idx++] = new Vector3(-1, 1, 1);
cube[idx++] = new Vector3(1, 1, 1);
cube[idx++] = new Vector3(1, -1, 1);
cube[idx++] = new Vector3(-1, -1, 1);
cube[idx++] = new Vector3(-1, 1, -1);
cube[idx++] = new Vector3(1, 1, -1);
cube[idx++] = new Vector3(1, -1, -1);
cube[idx++] = new Vector3(-1, -1, -1);
return cube;
}
public static Vector3[] CreateCube(Matrix _transform)
{
Vector3[] cube = EngineHelper.CreateCube();
for (int idx = 0; idx < cube.Length; idx++)
{
cube[idx] = Vector3.Transform(cube[idx], _transform);
}
return cube;
}
```

It works for
```cubeFrustum.InitializeFromVertices(camera.boundingFrustum.GetCorners());
```
So i just dont understand, why its not the same as the formula above.

09 July 2012 - 11:49 PM

Nice formula, i will try that. I will compare the result of this with the computed frustum of xna -> frustum.getCorners() should deliver the same values.

In Topic: [XNA 4.0] BoundingSphere moves when it should not

09 July 2012 - 08:16 AM

Your problem was, that your world1 and world2 matrices were identically all the time. Have a look at this. The queue of operations decides btw whether the matrices are doing their job correctly. You implemented the rotation with left/right. I guess its not working correctly atm. But first things first: Here is the code (just comment the world assignings out)

```		    if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left))
{
worldKutija = Matrix.CreateFromAxisAngle(Vector3.Up, 0.01f) * worldKutija;
world = Matrix.CreateFromAxisAngle(Vector3.Up, 0.01f) * world;
Window.Title = "Lijevo";
}
else if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right))
{
worldKutija = Matrix.CreateFromAxisAngle(Vector3.Up, -0.01f) * worldKutija;
world = Matrix.CreateFromAxisAngle(Vector3.Up, -0.01f) * world;
Window.Title = "Desno";
}
else if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.A))
{
worldKutija = Matrix.CreateTranslation(Vector3.Left)* worldKutija;
//world = Matrix.CreateTranslation(Vector3.Left) * world;
}
else if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D))
{
worldKutija = Matrix.CreateTranslation(Vector3.Right) * worldKutija;
//world = Matrix.CreateTranslation(Vector3.Right) * world;
}
else if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.W))
{
worldKutija = Matrix.CreateTranslation(Vector3.Forward) * worldKutija;
//world = Matrix.CreateTranslation(Vector3.Forward) * world;
}
else if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.S))
{
worldKutija = Matrix.CreateTranslation(Vector3.Backward) * worldKutija;
//world = Matrix.CreateTranslation(Vector3.Backward) * world;
}
```

In Topic: [XNA 4.0] BoundingSphere moves when it should not

09 July 2012 - 07:55 AM

yah, the problem is, i dont see anything, and i dont have the time to get basic things up. How can i set up the test scene quickly?

PARTNERS