Sign in to follow this  
  • entries
    235
  • comments
    509
  • views
    172040

Update

Sign in to follow this  
SimmerD

78 views

Well, the portals and anti-portals are finally debugged. Yesterday morning I fixed the last of the few remaining issues.

There was a serious but with the portal traversal code that for some reason only showed up very rarely. I was recomputing a new projection matrix for each portal in view, in order to calculate a smaller frustum, but then I was passing this matrix down during recursion. This created a problem when projecting the portals to NDC space, as the space changed every time there was a portal traversal. Just keeping the main projection matrix fixed this.

I also stopped calling my frustum culling method ignoring the near plane, and instead added a method that uses the view position as the near plane position. This should provide better culling to things behind the viewer.

Additionaly, I found the anti-portals were only culling from one side, so I added code to find the distance of the camera to the plane of the anti-portal. If too small, I skip the anti-portal, as it wouldn't be good for culling and also may create a degenerate frustum. If the distance to the portal is negative, I create the portal planes with opposite winding order triangles, so the anti-portals work front & back.

Yesterday I attempted to portalize the crypt level, and was having a hard time with it, so I made some much simpler user interface methods. Now you can select several triangles to define the bounding box of where you want the cell, portal or anti-portal to go, then hit a button and the appropriate viz item will be created based on the box you specify.

Next I will add a button to shrink cells so they don't overlap when they're not supposed to.

I also changed the water shader to be a bit more realistic with the fresnel term, and fix it when a large part of the water was in shadow.



Today I've made some editor improvements, and am going to mainly work on gameplay-related things, such as adding key support to doors, etc.
Sign in to follow this  


2 Comments


Recommended Comments

How do you define which parts of your map are water? Are you portalling them, or just making a cube around the area?

Share this comment


Link to comment
Good question. The liquids were put in place well before the portals, so they are simply triangles in the map editor flagged with the liquid attribute.

Once a liquid triangle is found during the map building process, it is put into a special list. Once the list is complete, each triangle looks for neighbor tris to simulate with. Groups of triangles at the same height are put into the same liquid object, which is added to the Area object.

The area tracks a bounding box for each liquid object, and only simulates them when they are onscreen.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now