Category: Coding Log

2008-06-16

Testing Log

Permalink 03:59:16 am, Categories: Coding Log, Testing Log  

So - back to work on COLLADA conversion. I'm still reworking the 3d surface triangulation algorithm I originally wrote last summer, but with all the changes to the rendermanager and such, I've mostly been getting caught up with setting up a good testing environment. In order to isolate and identify bugs in the code I wrote, I am attempting to visualize the 3D surface triangulation using a csSimpleRenderMesh. So, once triangulated, the csTriangleMesh is converted to a csSimpleRenderMesh, and then visualized. I am having difficulty right now trying to visualize this. I can't seem to get the csSimpleRenderMesh to appear on the screen. Part of the situation was in getting the render manager set up and working, but now that seems to be finished.

I have the following code setup to perform the rendering of what (I believe) is a simple triangle:


void Tri3DTest::Frame()
{
// we want to draw result
csSimpleRenderMesh rendMesh;
rendMesh.object2world.Identity();

csVector3 verts[2];
verts[0].Set (0, 0, 0);
verts[1].Set (10.0, 0, 0);
verts[2].Set(0, 10.0, 0);

csVector4 cols[2];
cols[0].Set(1.0, 0.0, 0.0, 1.0);
cols[1].Set(1.0, 0.0, 0.0, 1.0);
cols[2].Set(1.0, 0.0, 0.0, 1.0);

rendMesh.vertices = verts;
rendMesh.vertexCount = 3;
rendMesh.colors = cols;

rendMesh.meshtype = CS_MESHTYPE_TRIANGLES;
csAlphaMode alf;
alf.alphaType = alf.alphaSmooth;
alf.autoAlphaMode = false;
rendMesh.alphaType = alf;

g3d->BeginDraw(engine->GetBeginDrawFlags() | CSDRAW_3DGRAPHICS);
view->Draw();
g3d->DrawSimpleMesh(rendMesh, 0);
g3d->FinishDraw();
}

However, all I get is a black screen. I should say that a bit ago, I got a black screen. Now, I added the line view->Draw() and get a segfault. This was due (in part) to the rendermanager not being set correctly. This problem has been corrected, but I am rebuilding the Crystal Space core library at the moment, as I was previously getting a number of weird errors with walktest. Walktest displayed, but not like it did previously, without the new rendermanager code in the trunk. The level seems to be full of errors now. I thought perhaps it could be my platform, along with some weirdness in incremental linking with the msvc compiler, so I am rebuilding things just to be sure. Once this is complete, I will see if the new 3D triangulation test visualization works.

2007-08-16

Coding Log

Permalink 06:14:24 pm, Categories: Coding Log  

Just a brief update on my progress:

Normal and texture coordinate conversion (if they are given in the COLLADA file) are now complete, and working in viewmesh. I am currently working on getting blender to export the texture filename (it doesn't seem to want to do this), but once that is complete, I will be able to check my conversion of textures in general.

For the rest of the day, I plan to accomplish the following:

  • Basic scene conversion (translate/rotate/scale objects)
  • Camera/start positioning
  • Basic light conversion (if time permits this evening)

2007-08-09

Coding Log

Permalink 08:02:50 pm, Categories: Coding Log  

I was able to finish coding basic materials. The collada convertor now converts a color to a material, corresponding to the diffuse color of the <phong> or <blinn> shader in the COLLADA file, and then adds a <material> tag to mesh objects which utilize it.

Additionally, with help from thebolt and res2k, I was able to get the object to show up inside viewmesh. Both the material and geometry conversions seem to work quite well.

I have begun work on translating texture coordinates, as well as textures themselves. I anticipate this will be completed by either tomorrow afternoon, or possibly Saturday, depending on how many problems I encounter. I will then work on the world/scene conversions.

2007-08-08

Coding Log

Permalink 02:31:50 am, Categories: Coding Log  

I have nearly completed the basic materials conversion process. What remains, at the moment, is to convert from a csColladaMaterial object, which holds specular, diffuse, and ambient colors (COLLADA treats materials as shaders, which poses a slight problem when shaders aren't being used to their full extent), as well as some supporting information, which will be useful when we move from basic materials to shaders in the future, to the XML needed for the Crystal Space document. I expect this conversion should be finished tomorrow, at which time I will begin debugging the materials conversion process, and adding what needs to be added to make it sound.

Following this, I intend to work on the scene conversion, which will only be applicable for Crystal Space map files. I expect this will be fully finished and ready for use by August 20. Unfortunately, I think that the COLLADA Physics, advanced effects, and rigging/animation conversions will not be completed by the GSoC deadline of August 20. I believe that I will be able to get most of the rigging/animation, as well as possibly, the FX conversion, completed by the time school starts again. Of course, progress will slow once school starts, but I fully intend to continue working on this project even after I return to classes.

Some good news, on the other hand, is that I have almost finished the algorithm for 3D polygon surface triangulation, with some help from Dr. Martin Held. I am going to put this up in UML activity diagrams, and then post it, so folks have a chance to look it over, and give me their feedback, before implementing it. I will also be modifying the 2D triangulation conversion slightly, so that it works will polygons with holes. This won't happen until after the initial 3D triangulation algorithm is in place, however, so my initial COLLADA conversion code will not support polygons with holes - that is the <ph> tags.

2007-07-15

Coding Log

Permalink 04:08:08 am, Categories: Coding Log  

After some arduous coding this afternoon and evening, I was able to get started on the materials section of the code. I was also able to finish writing the implementation of the general polygon conversion case (the triangulate method doesn't work still, but the code is in place for when it does work correctly).

I added a method to csTriangleMesh called AddTriangleMesh(const csTriangleMesh&), which merges an existing triangle mesh with the current one. Essentially, what it does is add all of the vertices of the parameter mesh, as well as all of the triangles to the current csTriangleMesh. This was necessary for the polygon implementation, as I had a bunch of csTriangleMeshes floating around, and I wanted exactly one of them. I figured this fit best inside the csTriangleMesh class itself, although this is open for debate. Also open for debate is whether the name of the function should be something more descriptive, such as "MergeInto()" or the like.

I haven't made a commit today, because there are still things that I want to test before committing it to the branch. (e.g. I haven't fully tested the AddTriangleMesh() function yet, and I don't want to commit without knowing it works 100%).

Finally, I want to state that I have been placing warning messages into the code for items in the collada convertor which aren't implemented yet. (e.g. the general polygon case, as well as polygons with holes, triangle strips, and triangle fans). It will now warn a user if a case is encountered that isn't fully implemented yet. Also, I'm not sure how to handle the <lines> element, because as we have moved fully to triangles, how are lines displayed in CS?

2007-07-13

Coding Log

Permalink 08:14:37 pm, Categories: Coding Log  

After finishing the triangle geometry conversion, I have restarted looking at the Triangulate3D function. For some crazy reason, I still can't figure out why IsConvex() doesn't work quite right. Or rather, I know why it doesn't work right, but I am unsure how to fix it. The problem lies in the situation where when I am inserting consecutive points into a csPlane3 object, sometimes the resulting plane is defined counter clockwise, and sometimes it is defined clockwise. e.g. if one considers the polygon defined by the points:

(0, 10, 10)
(0, -10, 10)
(0, -10, -10)
(20, 5, -10)
(10, 0, -10)
(0, 10, -10)

Point number 4 (that is (10, 0, -10)) should be convex. However, what happens is that since the polygon loops back around, the plane defined by points 4, 5, and 3 is defined counter-clockwise, resulting in an incorrect result for the IsConvex() test. I am not quite sure how to fix this. Anyone who thinks they can provide some insight, feel free to look at my code. It's available in the libcrystalspace project (in MSVC) under the files triangulate3d.h and triangulate3d.cpp. It's been placed in the csgeom file, if you are not using msvc.

As a result of this problem, I am going to continue with the collada conversion by next moving to materials conversion. The fact that the collada conversion system doesn't currently support any polygons other than triangles isn't immediately a problem, since COLLADA exporting from Blender allows the user to export only triangles, which can then be used to test the collada system. I will look into the materials conversion today, and hopefully have it coded in the next few days, at which time I will re-investigate the triangulation function.

2007-07-10

Coding Log Supplemental

Permalink 11:19:12 pm, Categories: Coding Log  

I edited the code to make sure that xml tag parameters were all lowercase (e.g. 'meshfact' instead of 'meshFact'). Also, I added a plugin tag so that it could be viewable in a scene once exported. It appears that the viewability still isn't there, though, as exported XML files can be imported into viewmesh using 'Import Lib', but the triangles don't show up. There aren't any errors, just no triangles. I wonder if there are other things that I need in the XML file (e.g. materials) before it will display.

Coding Log

Permalink 09:22:28 pm, Categories: Coding Log  

I was able to get the triangle conversion working completely today. It doesn't yet convert vertex normals from COLLADA format to CS. What it *does* do, however, is read in all of the vertices from the COLLADA file, add them to a triangle mesh, then construct triangles from the given vertices, and index the vertices accordingly. Once completed, the triangles are retrieved from the csTriangleMesh object, and written to the CS XML document in the correct format.

For the remainder of the day, I am going to be working on Triangulate3D(), as this is still not completed. Tomorrow, I hope to be finishing general polygon conversion.

2007-07-07

Coding Log

Permalink 09:00:55 am, Categories: Coding Log  

I've redesigned the triangulation routine, at the recommendation of thebolt, to utilize an ear clipping algorithm. As of right now, I have got the function working, but there are a few bugs still left in the code. Namely, the triangulation routine is returning a triangle for each vertex in the polygon, which of course is not correct. I'm fairly certain I know where in the code the bug lies.

I intend to have this bug fixed tomorrow, at which time I will extend the code to work with polygons that have holes.

I am going to postpone testing of the triangulation function until after I have the rest of the geometry code finished. I feel like I am slipping further and further behind, and I need to make sure I get the XML conversion completed, as the convertor will be near useless without it. ;)

2007-06-26

Coding/Design Log

Permalink 08:49:57 pm, Categories: Design Log, Coding Log  

I have managed to get the code working for the new design. The following is the new activity diagram for ConvertGeometry().


This includes two of the new objects, csColladaMesh and csColladaAccessor. Both of these objects have, at their core, a Process() function. The Process() function essentially parses the XML document and retrieves the necessary information. The activity diagram of csColladaMesh::Process() follows:



And the activity diagram for csColladaAccessor::Process():



The next stage will be to integrate a listing of polygons into the mesh object. This should be fairly straightforward, as before, and will be composed of yet another class, csColladaPolygon, which will have as sub-classes: csColladaSimplePolygon, csColladaTriangle, csColladaTriangleFan, csColladaTriangleStrip, csColladaLine, and csColladaLineStrip. I hope to have all of these converted and ready by this afternoon.

:: Next Page >>

November 2014
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Search

Categories

Misc

XML Feeds

What is this?

powered by
b2evolution