Page 1 of 1

Multiple World Translations

Posted: Sun May 29, 2011 3:23 pm
by Oblivion165
Hi there, I'm having a problem with translations.

This is how the scene should look:
Image

This is how BEPU renders (world translation anyway) it:
Image

The way this scene is made is by having one quad that gets translated into position for every side of the square it renders.

This is how the tranlation gets filled: (loops through all grids and if there is anything in there, translate the face by the XYZ)

Code: Select all

 
Camera.WorldTranslation = new Vector3(qLayer[k].grid[i].x, qLayer[k].grid[i].y, qLayer[k].grid[i].z);
Camera.UpdateBEPUMatrix();
Actual render code. The functions dont alter the world, view, projection or camera position; it just sends them the the shader.

Code: Select all

                OI.render.UpdateMatrix(Camera.World, Camera.View, Camera.Projection, Camera.BCAM.Position); <- this BCAM is the camera for the Simple character controller
                OI.render.Render(vbuff, Textures.textures[tidx].color, Textures.textures[tidx].norm, 1);
Here is how the normal render code looks:
Image

Here is how im trying to get bepu to do the same:
Image

Any ideas on whats going on here?

Re: Multiple World Translations

Posted: Sun May 29, 2011 4:49 pm
by Norbo
I'm not sure what the problem is or quite what you're trying to do- it appears to be a purely graphical issue. Nothing jumps out as 'wrong,' it just seems like the transformations you're using are not what you expect. Systematically check each component against your expectations.

Re: Multiple World Translations

Posted: Sun May 29, 2011 6:55 pm
by Oblivion165
I did thoroughly go through each step to make sure they are computed the same.

Its very hard to explain but ill try to break down the drawing process:

1. Cycle through 3D grid, lets say 10x10x10
2. If there is a solid object, draw 5 quads, 1 for each face of the cube.

for i = 0 to 1000
{
In basic effect or my custom shader it would go like this:
World * CreateTranslation(Vector3);
Render Quad;
}

and it comes out perfectly;

3. In BEPU, I cant use a matrix before hand so i have to use the one generated by the camera so each translation is off by however much the cameras world matrix is off.

So in each render of the Quad its more like:

for i = 0 to 1000
{
In basic effect or my custom shader it would go like this:
BEPUCamera.WorldMatrix (which includes the rotation of the Cameras Pitch and Yaw) * CreateTranslation(Vector3);
Render Quad;
}

and that throws all the rendering off

Re: Multiple World Translations

Posted: Sun May 29, 2011 7:03 pm
by Norbo
I'm not clear on how BEPUphysics is related. Note that the Camera, along with the rest of the rendering/demos stuff in the BEPUphysicsDemos/BEPUphysicsDrawer project, is just documentation/debugging/testing stuff. It's not actually a part of the engine. You can use the physics engine with any rendering approach, and it is strongly recommended that you use your own choice of graphics over the demos drawing system for a game.

Re: Multiple World Translations

Posted: Sun May 29, 2011 7:36 pm
by Oblivion165
Oh ok I thought that was the only way to use the character controller, like the DLL requires it or something. Looks like I need to get started on my own ;)

Thanks for your help!