Posts Tagged ‘Misc’

Oh So Close…

Monday, May 26th, 2008

Hey, my latest idea shows promise! At the very least, it’s screwing up far less than anything else I’ve tried. Below is a picture to better illustrate what I’m doing. The mesh on the left is what you’d see in ToeTag. It’s a concave mesh created in Cheetah3D and imported into ToeTag from an OBJ file. Quake won’t compile that shape as it is. However, once my deconstruction routine runs you’ll get what you see on the right – each convex chunk has been successfully split off from the original mesh and any holes created during the process are covered with new polygons. So in this case we get 3 convex brushes from 1 concave mesh.

This deconstruction magic will happen when you save your level and will be completely hidden from your view. All you will know is that you have complicated concave meshes in your level and somehow Quake is compiling and using them. It’s magic!

Now, the post title is correct. It’s close. It doesn’t work 100% yet as there are meshes that will screw it up and it doesn’t do well if the mesh is complicated. However, it’s coming along. I expect another couple of swings at the ball here and I’ll have it working well enough to call it a real feature!

When it’s working 100% I will give a full technical break down of what I’m doing in terms of code and algorithm (for those who might be interested).

For now, here’s another mesh being broken down properly. This one is a little more complex and has an embedded light source:

A Journey Of Triangles

Sunday, May 25th, 2008

I’ve been to the brink of hell and back and it doesn’t work yet. YET! I am determined, however.

Just to recap what’s been happening here – I’ve been trying to work out the code necessary to allow me to import triangle meshes into ToeTag and then have them successfully compiled into the map. What do I mean by a triangle mesh? For example:

Now, here is that mesh in ToeTag:

So, as you can see, ToeTag can import triangle meshes and use them just like regular brushes.

Now comes the hard part : now what?

Direct Insertion

What I tried first was to modify QBSP to read those triangle meshes from the MAP file and insert them into the BSP file directly. This proved very challenging due to QBSPs reliance on brush data being convex and sealed (meaning, no missing faces). I could get this sort of working but it was never 100% and there were huge problems with collision.

Decomposition

Then I thought that what I would do is figure out a way to break the mesh down into several convex brushes and write those brushes out to the MAP file to simulate the user actually creating them. This seemed nice because it was entirely within ToeTag and QBSP wouldn’t have to change at all.

I built a bunch of code including a routine that created secondary arrays showing me which triangles shared edges with other ones (my main idea was based around walking these edge connections to create convex chunks). This proved to be even more challenging because every time I thought of something I could almost immediately think of a mesh shape that would break it. No, this wouldn’t do either.

SKIP Faces

My latest idea was to extend the idea of SKIP brushes to individual faces. What this would entail would be having ToeTag take every triangle on the mesh and create an entire brush from it (like some of the OBJ utils have done in the past for Quake engines). It would then give the extra faces it created a texture name of SKIP and then QBSP could compile the BSP as normal but then throw away the SKIP faces before actually writing out the BSP.

While it’s somewhat easy to handle SKIP brushes, SKIP faces seems more challenging. I eventually got it to the point of being able to compile and remove the faces but the collision was never right as it was still relying on getting convex data fed to it. It was REALLY close though and was the best shot I had taken so far.

The trouble was the that resulting BSP, even though it had the SKIP faces removed, was so sliced up that it was killing VIS. I had a single room with 2 triangle arches in it and I was looking at a 60 second VIS. Not good. I rebuilt that same room using manually created brushes and VIS took less than a second. So this wasn’t going to fly.

So now what?

Well, now I’m back at the my Decomposition idea but with an entirely different algorithm in mind. It’s deceptively simple in my head so hopefully it will be equally simple to implement. It might work. But I won’t know until I try!

At the very least, I can say that this has been a real challenge for me and I hope that I’ve grown a little as a coder by going through it. The end is in sight. Whether than end entails me throwing in the towel or this idea working remains to be seen. Let’s hope for the latter!

Triangulation Of My Heart

Monday, May 19th, 2008

I’ve spent the last week or so trying to convince QBSP to accept raw triangles. This has been challenging to say the least and what’s funny is that it -almost- works. Almost. The problem is that the triangles are not being added into the clipping hulls correctly so they don’t block players, weapon fire or monsters. They do, however, appear in the drawing hull and Quake happily draws them for me.

There are other problems as well like – if the triangle mesh I’m feeding isn’t convex, it doesn’t carve into the existing BSP correctly (convex meshes work fine).

It’s all very shaky and almost-working-y but I think I’m going to take a step back and take another crack at dissecting the mesh myself before saving out the MAP file. What I mean is that I’ll take the imported mesh and break it down into convex shapes and write those out individually to the MAP file.

To that end, I’ve spent the weekend solidifying my CSG and math routines to the point where I’d be tempted to call them “rock solid”. I can’t find any maps now that display artifacts when loaded so that’s a good sign. I would sometimes get stray polygons shooting off into infinity and stuff like that but that all seems to be fixed now and happily working.

I’ll post another update once I’ve had a chance to throw these new math routines at some mesh dissection concepts I have bumping around in my head.

New ToeTag Feature

Saturday, May 10th, 2008

Soon. Heh, sorry! No, it should be done within the next few days assuming that things go as planned. It’s forced me to clean up my 3D code somewhat though and I’m kind of getting happy with how it works/looks now. I used to have a bunch of functions where I could ask a plane which side of it a vertex was sitting on. I’ve condensed that down to one now:


-(ESide) getVertexSide:(TVec3D*)InVector
{
float distance = [self getDistanceFrom:InVector];
float delta = fabs( distance - dist );

if( delta < = ON_PLANE_EPSILON )
{
return S_OnPlane;
}

if( (dist - ON_PLANE_EPSILON) < distance )
{
return S_Front;
}

return S_Behind;
}

Not very exciting, I know, but I haven't posted anything in a few days and was feeling bad. :) I hope to be back soon with cool shots of a kick ass new feature!

I don't know why WordPress sucks SO MUCH at posting source code but if anyone knows how to make that look nicer, I'm all ears. Unbelievable that it's 2008 and it doesn't "just work" yet.

Remix Progress

Sunday, May 4th, 2008

Remix Progress

This is the starting area. It’s not complete but this is the direction that it’s headed.

Grill Club For Men

Sunday, April 20th, 2008

So I’ve never owned a grill before. I know that calls my manliness into question but it’s true. My wife and I went out today and bought one because we figured it was time.

As we’re loading it into her truck, a guy comes up and offers to help out. I gladly accept and once we’re done he compliments me on the grill.

As we’re pulling out, another guy walks by and upon seeing the grill, gives me a big thumbs up and a smile and jokingly calls out, “When’s the barbeque!?”

We get home and I ask my neighbor to give me a hand lugging it into the backyard. He does and then we have a conversation about the grill, it’s specs, and we left off with my being tasked to report back to him later as to how this grill performs.

I feel like I’ve gained membership into some sort of club that I had no idea existed.

Work Is Getting Crazy

Tuesday, April 8th, 2008

Real life is impeding on my Quaking so I’ll be back in a bit. We’ve got a few weeks of crazy hours coming up. Be back when I can!

Email Stupidness

Wednesday, March 26th, 2008

My email is acting up at the moment so if you’re getting errors sending me anything, that’s why! I’ll post again when it’s sorted out. I don’t have a lot of time to work on this so it might be a day or two. Hooray!

Mulling, Working, Etc.

Friday, March 21st, 2008

Work is pretty hectic at the moment which is why I haven’t done much in the last week or so. I’m also not sure what to work on next. I have a few options but none of them are lighting my fire. I’ll have to think about it some more.

In other news, today is my birthday! I’m 38. Ye gods.

Portals Via Ogre3D

Wednesday, February 13th, 2008

Very cool portal engine someone is doing using Ogre3D as a base. The videos are killer!

http://freegamer.blogspot.com/2008/02/stop-press-portalized-open-source.html

So many possibilities!