Date: Sun, 2 May 1993 21:36:13 -0700 From: Kenneth Pimentel Subject: SOFTWARE: Cyberspace Developer Kit (Autodesk) vs. WorldToolKit (Sense8) I found this on the Amulet BBS and thought scivw readers might be interested in it: ------------------------------------------------------------------------- Originally written 4-23-93, last draft on 4-28-93 Ok, I know several people have been waiting for my comparison of WTK(WorldToolKit) from Sense8 Corp. and CDK(Cyberspace Developer Kit) from AutoDesk Inc. Since I first dropped a note on my favorite BBS about having both products many people have expressed an interest in hearing about my findings. Because of this enormous interest, I have tried to write a very responsible report, sticking to simply the facts. Although I do share some of my opinions, please keep in mind that's what they are, opinions. Who am I? My name is Jeffrey Donovan. l am forming a new startup company in Sausalito and we are developing standalone VR applications and 3rd party VR software libraries. I have been working with WorldToolKit from Sense8 corp. for awhile now, and prior to that was writing my own pseudo-VR systems using wire-frame rendering only. I have been programming in C for 8 years (my latest book "Building A Better Mouse Trap, A Programmer's Guide To The Mouse", was released this March from Osborne McGraw-Hill) and have been programming in C++ since Borland released C++ V1.0. Because I have very limited time (I really need to get back to work), and because I will try to cover as many issues as possible, there may be some areas I do not cover in enough detail. Please leave me mail about any item you would like a bit more info on. Machine Used : -------------- I am currently using the products on a 486 66-mhz Compaq with 8 megs memory, 240 meg hd, NEC MultiSynch 5FG, SPEA fire board, PharLap 386 DOS extender and compiling with the MetaWare 32-bit C/C++ compiler (a great compiler!). The only input devices I have used or tested to date are the keyboard and a standard 2-d mouse. The worlds I tested with both CDK and WTK ranged from 500 to over 10,000 polygons. Style Of The Libraries: ----------------------- WTK is designed with C and a good OOP design in mind. With WorldToolKit from Sense8, a novice C programmer could probably start building their own exciting worlds in about 2-3 hours and pros will be flying the minute it's installed. CDK embraces C++ to the fullest extent. Fluency in C++ and all it's abstractions is required and it is not a product for inexperienced C++ programmers. If you are fluent in C++ you'll be up and flying quickly. Functionality: --------------- WTK and CDK provide much of the same functionality you would expect in virtual libraries. So, instead of concentrating on every individual issue, I will do a comparison of the most obvious components I have found(or not found) so far. Portals: -------- CDK has no portals. Although it's entirely possible to handle portalling yourself(a portal is a window to a different world), WTK provides a rich set of functions to handle this for you. You also have tremendous flexibility in WTK when moving thru different worlds by way of programmer defined entry and exit functions. Terrain: -------- CDK offers no built in terrain functions. Terrain mapping and following can be extremely important depending on the virtual application, and again, while the programmer can handle this manually, I am disappointed that there are no built in terrain functions in CDK. With WTK it's one line of code and you can make either flat gridded terrain or FANTASTIC random terrain. I mean really great terrain! Then you can apply textures to that terrain and build some wild landscapes in just two function calls. You can also read in your own terrain from an ASCII file and terrain following functions are built in as well. Backface Rejection: ------------------- I have not yet discovered ANY method with CDK to allow flying into an object(individual objects) and viewing the interior. This may be due to the fact that the function to set backface rejection is not working properly, or that I am doing something wrong in CDK. Update 4/27/93: The SPEA calls to set BackFace rejection were not implemented in this version of CDK and I was referred to the SPEA manual to look for their backface functions. Dynamic Objects and Properties: ------------------------------- CDK provides more functions for dynamically creating geometric objects and handling physical properties. For instance, morphing objects with boolean functions, spring damping and friction functions, etc. WTK has several pre-defined geometric objects that are programmer definable, and I have found it very easy to build more complex objects as well. Physical properties are something missing from WorldToolKit and left up to the programmer, although if you know a bit of math implementing physical properties on a WTK object is extremely easy. Lighting: --------- CDK has better lighting qualities. Shininess can be applied to objects very easily, and this makes the worlds seem less cartoonish. I must say that the surface tables and lighting properties allow you to create some very "spooky" effects and some very real looking worlds. Lighting is also more controllable and you can set the color of light as well. VESA: ----- CDK has the ability to run on VESA systems. Look for WTK to be supporting VESA by the next SIGGRAPH conf. Textures: --------- WorldToolKit offers a wealth of functions for textures. The textures are imported from TARGA files, and many commercially available paint programs (I use CorelDraw) have the capability to generate TARGA(*.TGA) files. This makes it EXTREMELY easy to create and use textures. Textures in WTK can also be solid or transparent, and the capability to add textures is something I consider essential for realistic applications, even more important than lighting. With textures, an object that is supposed to be made of wood can have a wood texture applied to it, and it becomes wood! With carefully applied textures, certain applications can also reduce the number of polygons needed for a specific object, because a simpler object can be made and a texture applied instead of using many complex objects(more polygons) for full details. Rendering speed can increase dramatically with this trick. With WTK and the SPEA card texture application and manipulation speed is nothing less than phenomenal. NOTE: The upcoming VESA version of WorldToolKit will be supporting textures as well. CDK has a class for textures(CyTexture), but it is a place-holder for future expansion on CDK. Currently CDK does not support textures on any platform. Attachments: ------------ Both WTK and CDK offer functions to build complex models by attaching one object to another and defining how the objects interact with one another. Separate pivot points, rotational qualities, etc. can all be had thru attachments. WTK provides more functionality than CDK in regards to attachments(or assemblies). Opinion: Sense8 has thought out attachments more thoroughly than Autodesk, making it very, very intuitive, almost second nature. Animation: ---------- Both WTK and CDK both provide animation sequences but I haven't used the auto-animate features of either yet. Paths: ------ WorldToolkit offers you many functions for recording, saving, loading, interpolating, defining, rewinding, and managing paths.(A preset flight path through the world or by an object). I haven't gotten as deep as you can go with the paths but so far it's been easy. These features allows you or and end-user (if set up properly) to fly a preset course in the world for presentation or special sequences. The paths can also be for individual objects and you can have multiple active paths. I haven't found any path functions in CDK. Distance Representation: ------------------------ Both WTK and CDK provide functions for distant objects. What this means is that you can have a less detailed copy of an object and swap it for the detailed object when viewed at a specified distance. The big difference is that WTK gives you a function to create a less detailed object automatically and it will be indistinguishable from the original object when viewed from the specified distance. With CDK you must create the lesser detailed object. CDK provides a distance policy for automatic swapping, while it's up to the programmer to poll the distance and swap the objects in WTK. Supported File Types: --------------------- Both WTK and CDK can read a 3d DXF files with a single function call. CDK can also read 3d Studio files, but not the animation sequences. WorltToolKit also has it's own Neutral File Format. Basically this is an ASCII file that contains the objects' name, vertex list, polygon list, colors and optional polygon id #'s, shading properties, textures file names for individual polygons, portals, etc. Sense8 gives you detailed instructions for setting up the file and it's a snap. As I stated in the opening, I originally started writing my own pseudo-VR systems using wire frame modelling. It took me 1 hour to figure out the WTK NFF format and spew my wire frame world(2400+ polygons) into a file WTK could read. To me, this is a very impressive feature, because your not limited to DXF or 3DS files. Any file type you can read can be converted into a file WTK can read. WorldToolKit also has functions to automatically convert NFF files to DXF files and vice-versa. As previously stated WTK also reads TARGA(.TGA) files for textures. AutoCAD: -------- CDK has the ability to run concurrent with AutoCAD, but I have not tested any of these capabilities. Attached Data: -------------- Both WTK and CDK allow programmer defined data to be attached to objects easily. Networking: ----------- I have not yet written any multi-user virtual environments so I am not qualified to make any type of comparison here. Speed: ------ I have written several identical applications using WTK and CDK. WTK renders faster. With WorldToolkit, you can also improve speed in a multitude of ways including importing stationary geometry at startup and critical shading property functions. For instance, By loading a polygon file as stationary geometry instead of a dynamic object FPS speed increases about 4-5 fold. Additionally, you have a variety of options for enhancing speed of dynamic objects by setting shading, fastmerge and principal axis calculation flags. Speed enhancement can be as much as 3 fold depending on the method. I haven't found any functions of this type with CDK. I will not give any FPS quotes because they are always a bit subjective and besides, there's no way to retrieve the frame rate in CDK (that I have). WTK has a function to retrieve current FPS. CDK objects generate a bad flicker when viewed extremely close up and moving. WTK objects are smooth throughout and you will only experience flicker if you use the 800x600 mode due to the 2MB image copy from DRAM to VRAM(the SPEA board is not fast enough to do it in less than 1/30th of a second, so you end up with a potential flicker mid-screen when moving). In all other modes there is no flicker whatsoever, no matter how close you get to an object. Documentation: -------------- Sense8: The documentation supplied with WTK from Sense8 is organized in a clear, concise manner. When you need to find an object function, look in the objects sections. When you need to find a light function, look in the light section, etc. Every issue is covered and easily retrievable. AutoDsk: The Autodesk manual follows no real format in regards to individual issues. The classes and functions are organized alphabetically only, so plan on jumping back and forth from section to section to find details on classes and associated functions. The index could also be improved dramatically. Technical Support: ------------------ Sense8 : Technical support is nothing less than superb. Fear of embarrassment has never stopped me from asking their staff any question no matter how obvious the answer may seem, and they have had an answer for every question without delay. They know their code! AutoDsk: Autodesk's policy remains that it is the resellers responsibility to provide technical support. While this may work sufficiently for commercial standalone applications, I don't think programmers will be satisfied. Not to degrade my reseller(he's a nice guy) but he couldn't write a line of code to save his life. When I want tech support I want to talk to programmers familiar with the product, not my nearest Computerland dealer who thinks BASIC is the language of choice. Autodesk needs to realize they are dealing with programmers now and act accordingly. Update 4/27/93 - I originally wrote the last paragraph on 4/23/93. Well, after a bit of complaining to AutoDesk, somebody did give me a call and cleared up some confusion. I left this original document fairly unchanged, and have made date stamps of 4/27/93 by paragraphs of information where tech support helped. This does not in any way change my thinking in regards to AutoDesk's tech support. I shouldn't have had to get heated up(after waiting three days for an answer) and make those phone calls to get the help. It should be there ready and waiting. Errors: ------- Sense8: I have been working with WTK Version 2.0(available commercially by the end of May). I started with the alpha version and am now working with beta. I have yet to find a function that doesn't work as documented with 2.0 beta and have used about 90 percent of the functions available on my platform. AutoDsk : 2 of the 3 CDK Display functions I have used so far do not work and if you use the SPEA card, your going to have to write some other mode -reset code, because the AutoDesk function to get out of graphics mode does not work. Wire-framing doesn't seem to work either. These problems exist not only in the code I have written, but in every example AutoDesk included as well. Additionally, some of the supplied examples included with CDK generate up to 50+ warnings. While some are of no consequence, I frown at code(especially commercial) that generates this many warnings. Update 4/27/93 - Wire framing is not supported with CDK on the SPEA card, only VESA systems. Wire framing IS supported with WTK on the SPEA card. The graphics mode problem is also a known bug with CDK. Code Example: ------------- I thought I'd give you a small code example to sample the flavor of WTK and CDK. This code will do the barest of tasks. It simply makes a universe (or deck and space), sets up a mouse sensor, makes a single blue box of 100 units, makes a single light, sets up the viewport and moves it back so the entire box is visible, and then goes into automatic simulation. Both programs respond to the mouse and both will quit when the letter 'q' is pressed. This represents the simplest possible program to create and walkaround a single dynamic object with a dynamic light source. This sample is NOT intended in any way to demonstrate the capacities of either library, it simply demonstrates the "flavor" of each. Assume all headers are in place as well. WorldToolKit Example: --------------------- static void actions(void); main(void) { WTviewpoint *worldview; /* Universe viewpoint */ WTsensor *mousesensor; /* Mouse sensor */ WTobject *box; /* Box object */ WTlight *light; /* Light object */ WTp3 dir,midpt,pos; /* Position direction mid */ WTuniverse_new(0,0); /* Create new universe */ WTlight_setambient(0.15); WTuniverse_setbgcolor(0x000); WTuniverse_setrendering(WTRENDER_TEXTURED); /* Add a box to universe and set colr*/ box=WTobject_newblock(100.0,100.0,100.0,TRUE,FALSE); WTobject_setcolor(box,0x00a); /* Make a light, set it away from box*/ pos[X]=-50.0;pos[Y]=-50.0;pos[Z]=-200.0; dir[X]=0.0;dir[Y]=0.0;dir[Z]=1.0; light=WTlight_new(pos,dir,0.75); /* Get the universe viewpoint, move */ /* move back out and then set view */ worldview=WTviewpoint_copy(WTuniverse_getviewpoint()); WTviewpoint_getdirection(worldview,dir); WTs_multp3(WTuniverse_getradius()*2.0,dir); WTuniverse_getmidpoint(midpt); WTp3_subtract(midpt,dir,pos); WTviewpoint_setposition(worldview,pos); WTuniverse_setviewpoint(worldview); /* Get mouse sensor, attach it to */ /* universe view and set rates */ mousesensor=WTsensor_new(WTmouse_open,WTmouse_close,WTmouse_moveview2, NULL,1,WTSENSOR_DEFAULT); WTviewpoint_addsensor(worldview,mousesensor); WTsensor_setsensitivity(mousesensor,0.04*WTuniverse_getradius()); WTsensor_setangularrate(mousesensor,PI/8.0); WTuniverse_setactions(actions); /* Set action function event-hndler */ WTuniverse_ready(); /* Prep universe and run simulation */ WTuniverse_go(); WTuniverse_delete(); /* Delete it all and exit */ return(0); } static void actions(void) { int ch; /* Scan for 'q' char and stop if so */ if (kbhit()){ch=getch();if (ch=='q') WTuniverse_stop();} } Cyberspace Developer Kit Example: --------------------------------- CySensor6d *choose_sensor(const char *); CyDisplay3d *choose_display(const char *disp, Real range); main(void) { CyDisplay3d *display; // Display object CyDeck *deck; // Deck object CySpace *space; // Space object CySurface *surface; // Surface description CySurfaceTable *stable; // Surface table CyColor specular,diffuse,ambient; // Surface color tables CyComponent *boxobj; // Box component CyCompInst *boxci; // Box component instance CySimObj *box; // Box simulation oject CyLight *light; // Single light CyBbox *boundbox; // Component bounding box CyVertex3 boxcenter; // Center for bounding box Real maxd; // Max diminsion CySensor6d *mousesensor; // Mouse sensor CyMouseView *mouseview; // Mouse viewpoint CyPlatformView *platform; // Viewer platform deck = new CyDeck(); // Make deck and space and get space= new CySpace(); // the mouse sensor. deck->SetSpace( space ); mousesensor=choose_sensor("SENSOR1"); deck->AddSensor(mousesensor); light= new CyLight(); // Make a light, set it away from box light->SetLightType(CY_SPOT); // that is built later light->SetPosition(CyVertex3(50.0,50.0,-200.0)); light->SetAim(CyVector3(0.0,0.0,1.0)); light->SetColorRGB(1.0,1.0,1.0); light->SetMag(1.0); // Set up a surface table so we // can use our own colors. specular.r=0.0;specular.b=1.0;specular.g=0.0; diffuse.r=0.0;diffuse.b=1.0;diffuse.g=0.0; ambient.r=0.0;ambient.b=1.0;ambient.g=0.0; surface=new CySurface(0.5,0.5,1.0,0.1,1.0,&ambient,&diffuse,&specular); stable =new CySurfaceTable(2); stable ->SetSurface(1,surface); // Build the box and add to // simulation. boxobj=new CySolBox(100.0,100.0,100.0,1); boxci =new CyCompInst(boxobj); box =new CySimObj(boxci); space->AddSimBase(box,SP_PHYSOBJ); boundbox = boxobj->GetBbox(); // Get bounding box boxcenter= boundbox->Centroid(); // and properties. maxd = boundbox->MaxDim(); // Auto set display and set // limits, perspective, surface // table and light display =choose_display("DISPLAY", 10 * maxd); display->SetPersp(40.0, 1.333, 0.01, 9 * maxd); display->SetSurfaceTable(stable); display->AddLight(light); deck->AddDisplay(display); // Now make a platform for viewer // and set it away from box, then // set platform/sensor speed platform = new CyPlatformView(boxcenter - (maxd * 4) * CyVector3(0,0,1), boxcenter, CyVector3(0, 1, 0), display, mousesensor); platform->SetSpeed(maxd * 0.04); space->AddSimBase(platform, SP_VIEWERS); mouseview= new CyMouseView(); // Attach mouse to platform view deck->Run(); // Run the simulation, exit on 'q' char delete light; // Delete it all and exit delete mouseview; delete platform; delete box; delete boxci; delete boxobj; delete surface; delete stable; delete display; delete mousesensor; delete space; delete deck; return EXIT_SUCCESS; } Code Notes: ----------- In the above WorldToolKit code listing, the lines - worldview=WTviewpoint_copy(WTuniverse_getviewpoint()); WTviewpoint_getdirection(worldview,dir); WTs_multp3(WTuniverse_getradius()*2.0,dir); WTuniverse_getmidpoint(midpt); WTp3_subtract(midpt,dir,pos); WTviewpoint_setposition(worldview,pos); WTuniverse_setviewpoint(worldview); could have been changed to one line that read- WTviewpoint_zoomall(worldview); I left it the long version so you could better compare the WTK viewpoint method and the CDK platform view method. Although the methods are different, they are also still quite similar, and with WTK the bounding box method could have been used as well. Both have a variety of other methods to accomplish the task. *** A 3d DXF file walkaround program can be done with the same amount of code in WTK and CDK. Overall Opinion: --------------- WorldToolKit lets you program more intuitively to the task, and I find CDK's virtual abstractions somewhat confusing. However, both WTK and CDK do allow a good programmer to get deep enough to do anything. If development time is a big concern, you'll be flying faster with WTK. WorltToolKit from Sense8 leaves me with the impression of being written by people who have a wealth of experience with programming virtual worlds and thinking about virtual implementation(both programmer and end user). Sense8 has incorporated more thought into ease of programmer implementation, and WorldToolKit is VERY coherent. Sense8 has also had more time to listen to programmer feedback and react accordingly. Their libraries are error free and work as specified. CDK from AutoDesk leaves me with the impression of being rushed to market too fast just to be the only VESA version for the time being(although we've all heard about it for quite some time, it doesn't seem to have been tested thouroughly enough, especially on the SPEA card). Autodesk also seems to have devoted more time to designing features for tight integration with AutoCAD than developing standalone virtual worlds. The product has several errors I have found so far, most having to do with the SPEA card. I still have yet to receive a VESA driver that CDK supports(my last one is the V7VESA.COM and it's about a year old), but I should have a new one soon and will leave an update regarding that. Please, if you disagree with any of my statements or have some questions about either product, don't hesitate to leave me mail. I can be reached at The Amulet BBS (310) 453-7705 in The Virtual Forum(forum #1). Jeffrey S. Donovan