3d model tool: autoflip
Posted: Fri Aug 27, 2004 12:24 pm
As I've mentioned sometime before, I have been trying to write a program to make it easier to deal with the problem Popo and I have run into with certain 3D models that uses 2-sided surfaces. With such models, since Wonderland always treats surfaces as 1-sided, you get a lot of triangular "holes" in those models from surfaces that aren't facing the right direction.
Well, I'm proud to annouce that my program is near completion at this point! I guess this isn't of much interest to most people here, but I think Popo at least will find this to be good news.
I do want to say right now that it's not going to be completely automatic, unfortunately. A completely automatic solution is probably a bit too tricky for me to program. But I do have something that works nearly automatically.
The attached screenshots illustrates what I could do now with my program, which has been named "autoflip". We start off with a model of a castle, which I think Popo has seen before. In its original version, there are major problems when displayed in Wonderland.
At one point some months ago, I suggest that maybe we can fix this kind of problem by taking the model, making a duplicate copy, flip the surfaces' facing direction on the duplicate, and then place the duplicate at the exact same position as the original. The idea being that now for each position where there was one surface in the original, in this new model, you'll have two surfaces, and one of them is guaranteed to face in the correct direction.
The result of that suggestion can be seen in the middle screenshot. You no longer have those ugly holes. Unfortunately, the triangles don't blend together very well, and so you can still see the individual triangles, especially on very flat surfaces. Not good.
Finally, in the last screenshot, we see now how my program can help fix the model in mere seconds. We first take the original model, and run it through my program "autoflip". Then we do the "duplicate and flip" as we did before. But whereas doing "duplicate and flip" on the raw model didn't work too well (screenshot 2), doing "duplicate and flip" on the autoflip-ed model works much better (screenshot 3)!
===============
The only thing that really remains for me to do before releasing the program here is to add the file open/save dialog boxes (right now I just hardcoded the filenames the program uses into the program), and also to create some sort of help file.
The concept behind autoflip is actually very simple. The key idea is that adjacent triangles, that is, two triangles sharing an edge, should have the same facing direction. So the program basically starts off with a triangle, assume that it has the right facing direction, and then propagate this facing direction from adjacent triangles to adjacent triangles. So whereas before you might have one big connected surface made of numerous triangles in random facing directions, after autoflip, they are all made to face the same facing direction.
This by itself would've fixed the problem, except notice that I have to start off picking some triangle and assume that it is facing in the right direction. So if the triangle I picked to start off is actually not facing the right direction, then you'll end up with a group of adjacent triangles all facing the wrong direction instead of all facing the right direction. This is why I couldn't get the program to be completely automatic. However, because the triangles' facing directions are now more consistent across a continuous surface, you can now use the "duplicate-and-flip" strategy and it'll work much better than before you did autoflip, as you can see in the screenshots.
=======
Anyway, I'm expecting to get the program ready for public release by this Sunday or so, if not earlier.
Oh yeah, if anyone thinks of a better name then "autoflip" for this program, feel free to suggest other names.
Well, I'm proud to annouce that my program is near completion at this point! I guess this isn't of much interest to most people here, but I think Popo at least will find this to be good news.
I do want to say right now that it's not going to be completely automatic, unfortunately. A completely automatic solution is probably a bit too tricky for me to program. But I do have something that works nearly automatically.
The attached screenshots illustrates what I could do now with my program, which has been named "autoflip". We start off with a model of a castle, which I think Popo has seen before. In its original version, there are major problems when displayed in Wonderland.
At one point some months ago, I suggest that maybe we can fix this kind of problem by taking the model, making a duplicate copy, flip the surfaces' facing direction on the duplicate, and then place the duplicate at the exact same position as the original. The idea being that now for each position where there was one surface in the original, in this new model, you'll have two surfaces, and one of them is guaranteed to face in the correct direction.
The result of that suggestion can be seen in the middle screenshot. You no longer have those ugly holes. Unfortunately, the triangles don't blend together very well, and so you can still see the individual triangles, especially on very flat surfaces. Not good.
Finally, in the last screenshot, we see now how my program can help fix the model in mere seconds. We first take the original model, and run it through my program "autoflip". Then we do the "duplicate and flip" as we did before. But whereas doing "duplicate and flip" on the raw model didn't work too well (screenshot 2), doing "duplicate and flip" on the autoflip-ed model works much better (screenshot 3)!
===============
The only thing that really remains for me to do before releasing the program here is to add the file open/save dialog boxes (right now I just hardcoded the filenames the program uses into the program), and also to create some sort of help file.
The concept behind autoflip is actually very simple. The key idea is that adjacent triangles, that is, two triangles sharing an edge, should have the same facing direction. So the program basically starts off with a triangle, assume that it has the right facing direction, and then propagate this facing direction from adjacent triangles to adjacent triangles. So whereas before you might have one big connected surface made of numerous triangles in random facing directions, after autoflip, they are all made to face the same facing direction.
This by itself would've fixed the problem, except notice that I have to start off picking some triangle and assume that it is facing in the right direction. So if the triangle I picked to start off is actually not facing the right direction, then you'll end up with a group of adjacent triangles all facing the wrong direction instead of all facing the right direction. This is why I couldn't get the program to be completely automatic. However, because the triangles' facing directions are now more consistent across a continuous surface, you can now use the "duplicate-and-flip" strategy and it'll work much better than before you did autoflip, as you can see in the screenshots.
=======
Anyway, I'm expecting to get the program ready for public release by this Sunday or so, if not earlier.
Oh yeah, if anyone thinks of a better name then "autoflip" for this program, feel free to suggest other names.