WickedP text logo

Missing model parts fixed

Original project: Hyperion
Previous project post: Sitting in the wings
Next project post: Huge speed-up
History: View complete project post history

I'm wrapped to finally have solved the missing model parts in Hyperion. Let me explain.

Part of making a render engine is finding ways to make things quicker. For example, if your scene has a million polygons, but it only takes up part of the screen, then why waste time testing for those polygons when they're not going to be in certain parts of the rendered image. This is what bounding box and radius tests can help with.

It's much quicker for example, to test if your ray hits a circle (that is, it's inside a radius starting at the centre of the object) than it is to go through all the object's polygons and test each one for a ray hit. A ray circle intersection test can be done in one step. A million polygon hit tests is done in a million steps. Therefore it makes sense to do a one-off test against a circle radius, and if there's no hit, ignore the entire model altogether.

I have this kind of testing implemented in my engine. I can't imagine any render engine not doing this in some way. I actually have a two-stage test, and I'm thinking about expanding that to a third, but I won't go over that here. What I've managed to do however, is find the error that was affecting the draw on some of the model, which lead to some bounding tests failing. An example of this issue, which I first showed in my previous project post, can be found below.

The Hyperion render engine missing parts of the model.

The reason for this turns out to be due to part of my bounding tests being done against locally made coordinates. What this means is, I wasn't moving the bounding box and circle test to fit where the model was sitting in the global space. It was as if the model was always at the centre of the world. To solve this was fairly easy, I needed to add the models global position to the local data for the bounding tests. I also discovered I hadn't included the object's rotation, which I promptly added as well. And hey presto, there's the problem solved:

Hyperion normals render (almost) complete.

This still left a small issue you can spot on the darker blue on the right-hand side of the model. Looking closely you may spot a funny triangle shaped blank spot towards the bottom. It's really hard to tell from the shot above, but on closer examination and further render tests, it still seems to be something to do with the bounding tests.

Digging a little further, I realised there was a pattern in the way I was testing some of the bounding box. I was testing quads, and just splitting them up so as to test two triangles. But the order of points I was sending wasn't right in a couple of the box sides. This led to incorrect results being returned for some of the bounding box tests. Suffice to say, with the point order adjusted, I can now render with no bounding test issues.

Hyperion rendering the windsurf fin powerbox model, with corrected bounding tests.
Hyperion rendering with the additional global position and rotations applied. You can't see it happening because there's no grid to reference it to, but it is there and corrected for.

It's great to finally get these issues resolved. They were causing quite the problem, and I did't want to go onto programming other parts of the engine knowing there were issues with the underlying ray hit tests. But with these now fixed, the next step is to work on the lighting.

And to finish up while we're here, one of the beauty passes:

Hyperion beauty pass in the engine's signature white marble colouring.