Wednesday, August 27, 2008

Trimmed Surfaces are Back and Lookin' Nice

I finished up the majority of the optimizations related to trimmed surface generation.  For those that are interested I was able to remove completely any need to tessellate the projected trim profiles.  I also eliminated a lot of memory reads and writes to/from the GPU.  This was done primarily through the use of a new method I added to both NurbsCurve and NurbsSurface.

This interface is a companion to GenerateClientBuffers and GenerateServerBuffers, it is called GenerateTextureBuffers.  Now you can choose to generate curves and surfaces directly into the most efficient format for how you are going to use them.  Since there are at least four different generation paths for both curves and surfaces, I am sure that there are some holes in places, but the primary paths seem to work well.

The impact on performance is nice.  It is a bit tough to gauge exactly (I need to add better timing ability), but I estimate that the overall trimmed surface generation time was reduced by 25-50%.  Wahoo!

Pictures are coming.  Oh yeah, so is STL support.  Hmm...lots to do.

Cheers,
   Graham

5 comments:

Dan Heeks said...

Graham, I want to make WildCat work with wxWidgets, so that I can build it with Visual Studio Express version.

I have already used wxWidgets, see my blog heekscnc.blogspot.com, there is a picture of my project at the bottom.

I have Visual Studio 2005 Pro now, but I am having problems.

The debug version runs, but, on pressing "New", all the OpenGL 2 functions are NULL.
The release version wont build... ah I've just fixed the compile error.
glDeleteRenderbufferEXT in win_gl.h should have been glDeleteRenderbuffersEXT ( buffers plural ).
But now I get a linker error unresolved external Wildcat::WCTopologyModel::Serialize in part_pad.obj. Help!

Dan Heeks said...

I have done "SVN commit" on the change to win_gl.h. ( Historic occasion, somebody else editing your code? )

Dan Heeks said...

I have found the linker error; topology_model.cpp was exluded from the Release build. I have done "SVN commit" on this change. However, the Release version still crashes on pressing "new file", in the same way as the Debug version did.
I have copied the relevant files to my other Windows XP ( that my work gave me when I left, and is being used as a machine control ), but this crashes in the same way. I had got Wildcat to work OK on that computer, and it's got a pretty good graphics card, so I don't know what the problem is. There is hope, yet.

GrahamH said...

Dan,
This is a great day! Just having one more person on board is most excellent. Thank you for cleaning up some of my messes.

As for the crash...I will run the code on my XP machine tomorrow morning, but I have an idea where it could be. Other users have reported a crash in shader_manager.cpp. I would suggest starting to look there.

WCShaderManager loads the list of all shaders from an external xml file (shader_manifest.xml I think). It uses Xerces to parse the XML and then loads and compiles all of the shaders from file.

Xerces makes you do a lot of string copying and manipulation, and I bet that I am doing that wrong (probably deleting something when I shouldn't). See if you can narrow down on the line of code it is crashing on.

Again, I will take a closer look tomorrow.
Thanks again!

Graham

GrahamH said...

Dan,
Look at this link:

http://code.google.com/p/wildcat-cad/source/browse/trunk/Source/Utility/shader_manager.cpp

Around line 243 I left a comment. This is where I suspect things could be going wrong. Plus I wanted to try out code commenting in googlecode.