troubleshooting invisible nodes

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • troubleshooting invisible nodes

      I can't seem to get my grid node to display, and I am wondering of what steps you guys normally use to determine the root of the problem.

      I have my camera at the origin, pointing down positive z.

      I have a teapot at z=2 and it's visible on the screen.

      I have my grid's position at the (0,-2,0) and it doesn't show up. I have double-checked the vectors with what is in the book and everything looks okay, but I don't see the grid at all.

      I could post the c# code, but I'm more looking for debugging tips with 3d graphics.

      Thanks.
    • I haven't yet put much movement into my camera... it basically moves along +/- Z with the up/down arrow keys.

      I should probably implement a mouse-look camera, but haven't seen a good reference for it as of yet.

      as for the frustum, I'm using pretty basic values..
      fov: pi/2
      aspect: 1.0 (ratio of window)
      znear: 1.0f
      zfar: 100.0f

      also in the frustum class, just to eliminate it as a possibility, I made the Visible function just return true for now. (I'm unsure of the Frustum structure right now... hard to trust it if I didn't calculate it ya know?)

      How small should I make it? i created the node with size 5 (which I'm assuming means 5x5 grid)
    • Maybe your first priority should be to move the camera. Both in translation and rotation. The reason moving the camera is important is because if any triangle in the world gets clipped by the frustrum, then it will simply not be drawn, and that grid is made out of two giant triangles. Most games will tesselate giant planes like that so that you don't get sudden pops when a plane gets cut by the frustum... I think (I could be wrong on this).

      Also, the znear on your frustum could be smaller... like maybe 0.1f instead of 1.0f. This will allow you to see things closer than 1 unit away from the camera. You might also try widening the angle on the frustum to see if that keeps the object inside.

      Of course, all this is assuming your problem is frustrum clipping, but I make that assumption based on the fact that your teapot shows up, but the gridplane doesn't.

      The post was edited 2 times, last by Kain ().

    • Well, what's supposed to happen when culling is that if any part of a triangle intersects with the culling test (the frustrum in this case) it gets drawn. However, if the difference in size between the frustrum and the triangle is very great some implementations may display errors.
      "Your job is not to die for your country. Your job is to make some other poor sod die for his."
    • I'm currently coding a mouse-look camera but I am finding it difficult to do this in a GOOD manner, not just "make it work" by inserting code wherever.

      So I get mouse events if I override a few methods in the Form class, which is good. I could control the camera directly from here, but I don't like that Idea. Mainly because my architecture looks like this:

      Application (FormBase and Concrete Form) -> GameBase and ConcreteGame class ->Scene ->Camera

      If my application directly contacts the camera, it is bypassing the Game completely, which is illogical considering what we are doing.

      so my application gets the mouse events, so I thought of passing all these events to a singleton Mouse class accessible from anywhere. I'm thinking that this will lead to unnecessary overhead due to many thousands of method calls.

      Also, I'm not sure, but I don't think I can Set the mouse cursor from outside the Application layer, which is necessary for my mouse-look algorithm to work.

      Any thoughts on this?
    • All movement in Teapot Wars is a result of messages being sent from the input device. Therefore it stands to reason that you should simply derive an Evt_Mouse_Move event and Evt_Mouse_Evt_Data data struct to carry the movement data, then listen for these events and translate them to movement.

      This keeps it all in line with the GameCode philosophy, and keeps it pretty neat too. If you're feeling really ambitious you could integrate that other guy's event system into your project (can't remember the thread - have to search for it).
      "Your job is not to die for your country. Your job is to make some other poor sod die for his."
    • Originally posted by Nebuchadnezzar
      Well, what's supposed to happen when culling is that if any part of a triangle intersects with the culling test (the frustrum in this case) it gets drawn. However, if the difference in size between the frustrum and the triangle is very great some implementations may display errors.

      Hey, that makes more sense! I retract what I said about frustrum clipping. Nebuchadnezzar has it right.
    • I'm actually sort of just developing a 2D game, so a mouse-look camera is not too important for the game, but it will be for development and debugging, I'm sure.

      I'll probably set it up as a debug camera so I can see objects from a different angle.

      Anyway, back to my problems (since you guys are ALL here to help me figure this crap out, right?)

      I can't seem to get the camera to rotate properly. I read somewhere that rotating around axes is better than moving the Camera's heading vector based on x,y coords.

      So my nodes all have a few vectors:
      -Position
      -Rotation
      -Scaling

      in the case of my camera, scaling is not applicable so I just ignore it.

      In my SetView method (since the update/render is called AFTER this)

      I compute my Transform matrix, right?

      device.Transform.World = Matrix.RotationYPR(_rotation) * Matrix.Translation(_position);

      is this correct? This didn't do a single thing to my scene, so I'm starting to get really confused.
    • Are you making a call to the C# equivalent of 'D3DXMatrixLookAtLH' to update the view matrix? I'm not sure, but that might be the extra step that you must do for the camera.

      Try tracing into 'Scene::OnRender' to see if there is a step being done that you are not doing in your C# version.

      Source Code

      1. m_Camera->SetView(this);
      2. if (m_Root->VPreRender(this)==S_OK)
      3. {
      4. m_Root->VRender(this);
      5. m_Root->VRenderChildren(this);
      6. m_Root->VPostRender(this);
      7. }