Site hosted by Angelfire.com: Build your free website today!
 


22.1 VRML Export and VRML Applet
 
Previous   Table of Contents   Home   Next




As with all things in any 3D Sculpture Program, there are many ways to achieve a desired result. Both LightWave and 3D Studio Max have another method of exporting 3D information.


WHAT IS VRML?

  • VRML stands for "Virtual Reality Modeling Language"
  • VRML is a scene description language for creating 3D objects and evironments
  • VRML was primarily designed for delivering virtual environments over the Internet
  • VRML is an ISO standard
VRML is a 3D text-based language like Encapsulated Postscript (.EPS) is. It has oftentimes been used for what are called 'Walkthroughs' in architecture. A walk-through allows a person to set up a house interior, and allows people to 'walk through' the house to show a prospective client what the room will look like when it is finished but it had originally been invented with the hopes that it would do much more than that.

Because VRML creates such small files, it being completely text-based, it was designed so that people could place 3D Sculpture on the internet.


WHAT IS X3D?

  • X3D stands for "Extensible 3D"
  • X3D is the 'Next generation of VRML 97'
  • X3D is backwards compatible with VRML 97
  • X3D integrates with XML (XML can be used as a file format for X3D)
    • ( Similar concept to XHTML for VRML )
  • X3D is componenent-based (consists of a small core that can be extended with new functionality
  • Not yet finished:
    • A number of proposals have been submitted and are being consolidated by the X3D Task Group (at the Web3D Consortium -- a member of the W3C Consortium)
    • The X3D specification and two sample implementations will be produced by the end of 1999
    • A Java3D implementation of XML-ised VRML 97 exists (Xj3D)

Many different versions of X3D are popping up every day. Which will win? Who knows. Another version which is currently gaining popularity is called GL View v4.4, which is a standalone VRML 1.0/2.0 Browser and 3D File Viewer for Windows NT 4.0 and Windows 95/98. GLView is free and unsupported and is available as either a Direct 3D or OpenGL Version. The latest Version is v4.4 which as of 12/2002.


PLUG-INS

The second type, a 'Plug-In' is really just a cleverly disguised way of saying 'Client Application'. Remember that 'Client Application' really just means 'done from the user's side, not the server's side'. Oftentimes websites and manufacturer's call their plug-in a 'Client Plug-in'

Realize that a plug-in is also sometimes called a 'Client Application'.

The difference between a 'Client Application' and a 'Plug-in' is that a 'Client Application' generally is an .EXE executable program where you run a Windows installer to install a computer program on your computer once you've downloaded that installer. Afterwards it can generally be found in your Windows Start Menu and you run it before doing what you wish to accomplish.

A 'Plug-In' is a program which 'adds a feature to' another program, such as Internet Explorer. Generally, when talking about the internet, the program that a plug-in plugs into is Internet Explorer.

When a person browses the internet and finds a file format that is unknown, such as .WRL, Internet Explorer looks to see if it has a plug-in to handle that type of extension.

If it finds no plug-in for that extension, it looks to see if there is a plug-in available, and if so, asks the person if they'd like to download a plug-in which can handle that type of file.

Oftentimes the next thing that happens is the person goes somewhere else. People are too afraid of installing a virus on their computer. If it's 'Flash', something they've heard of before, or something from Microsoft they might continue, but if they've never heard of it? Down the drain it goes.


THE 'CORTONA' VRML CLIENT PLUG-IN

The most popular VRML viewer Plug-In called the 'Cortona VRML Client' by 'ParallelGraphics'. "Cortona is a fast and highly interactive Web3D viewer that is ideal for viewing both simple 3D models and complex interactive solutions on the Web. A set of optimized 3D renderers in Cortona guaranties the best quality for viewing 3D on the Web on both PCs with the latest video-cards and those with more basic video card capabilities.

Cortona works as a VRML plug-in for popular Internet browsers (Internet Explorer and Netscape® Navigator) and office applications (Microsoft® PowerPoint®, Microsoft® Word, etc).

But Cortona is more than just a plug-in! The powerful Automation Interface makes Cortona a general purpose 3D engine that can be integrated into applications with the Cortona SDK
"


THE 'BLAXXUN CONTACT' VRML CLIENT PLUG-IN

The 'other' popular VRML viewer is called Blaxxun Contact. "Blaxxun Contact is a multimedia communications client, already used by many internet users as a 3D viewer and communications client. blaxxun Contact, satisfying the standard VRML97, is the most universal VRML client on the market and even fulfills many of the new MPEG-4 standard features. Download the plug-in, free!" at Blaxxun Downloads


JAVA / JAVA 3D APPLETS

The third method is called a 'Java Applet'. A Java Applet is like a mini-application that is invisibly downloaded from the website every time it is needed. After the little program is downloaded, it runs.

However, with VRML, the ISO definition is just too wide. It encompasses way too many definitions for a tiny applet to be able to handle.

The disadvantage of an applet is, it has to be small. So, in the case of VRML, there is NO WAY that the full ISO definitions can be packed into an applet. An applet, by definition, will only handle a very small part of the ISO standard, thus the VRML code will oftentimes have to be fiddled with in order to make the VRML display properly in the applet.

The advantage of an applet is, it is small, it takes little time to download, and the user needs do nothing but turn on Java in their browser.


THE VRML WAR

Those in favor of VRML will oftentimes say, 'If people want to see my work, they'll install it'. But, that isn't at all the case. Since people are lazy, if they have to install a new plug-in when they come to your website, it's far more likely that they'll go somewhere else.

The reason they say that is probably because they have never found a successful applet that properly handles VRML. The reason for this is they included too many functions in the ISO VRML97 definitions for an applet to be 'all purpose'.

This Tutorial will aim at java applets, as that is the hardest to implement. It will show how to export a VRML97 file from LightWave, and import it into a Java Applet so that it may be observed, rotating, on the internet.

VRML Woman in Applet


THE 'Blaxxun3D' JAVA APPLET

The Blaxxun3D Java Applet can be downloaded from Blaxxun Downloads

The Blaxxun3D Java Applet is good because it tend to WORK. It is bad because there are no canned controls to allow the programmer to instantly have an interface. 'Straight out of the box', it displays a .WRL file as a 3D image. It doesn't rotate it, it doesn't let the user rotate it, it just shows it.

However, it WORKS.

Rotations can be done in three ways with the Blaxxun3D applet. You can either create your own Java Applet, you can use Javascript to control things, or you can do the animating inside the VRML file. I will use the third method to animate the applet... I will modify the VRML file which is exported from LightWave.


PREPARING A COMPLEX LIGHTWAVE OBJECT FOR VRML EXPORT

As with the last tutorial where we were exporting simple shapes for Applet use, when dealing with more complex shapes one still has to worry about the number of polygons in the object. Also, the object must only contain triangles.

So, lets say I start with an enormously complex Subsurfaced Nurbs object with many layers and show how that enormous object can be dropped down and exported for VRML use. You should use an object file that you have made that you would wish to import into an applet. I am figuring that you have followed along with the tutorials and you now know how to create an organic object in LightWave.

Realize that it will be an enormous strain on your computer's speed and power so you will need gobs of RAM (at least 256k) and Gigahertz (preferably at least 1 GHz) to do this. And, with any graphics project, it helps if you have a video card which is OpenGL compliant.

First, realize that the simpler that you make your object, the more possible it is that the applet will be able to handle it.

If possible, you should end up with one object on one layer with one surface name and no texture maps. The number of polygons should be less than 10,000 and they must be all triangular polygons.

If you do have more than one surface name, no procedurals should be done on that surface. Just choose a color for that surface name. The surface name can have specularity settings, etc.

Throw away all layers that aren't necessary.

Drop down the number of polgons in each layer one layer at a time, pasting all layers into one layer.


LOADING THE OBJECT

Load in your object, and immediately save it as a new name. We will be drastically chopping up the old object and you certainly don't want to destroy the good subsurfaced version of your object (you DO have it on CD-ROM, right?)

In my particular case, I have 8 layers to my object but layer number 1 could be used all by itself, it being the entire body and head. The other layers are things like the eyeballs, the cornea and irises, the hair...

So, I delete all layers by clicking on the layer and pressing the 'Delete' key until I have just layer 1.

Save it, closing the LightWave Modeler. Restart Modeler and load it back in. The reason I closed down Modeler is closing down and restarting it will rethink the Surface Names and will remove any Surface Names which are no longer applicable, only keeping the ones which still point to existing polygons.





REMOVE ANY SKELEGONS

Enter 'Polygon Mode' by pressing CTRL-H. Make sure that the 'Back' viewport is set to 'Wireframe' view type.

Magnify the 'Back' viewport by pressing the '.' key until you can see any skelegons you may have in the object. Select one of the skelegons by dragging across the edge of it.




Press the ']' key to select connected skelegons and press the 'Delete' key to remove them. Continue until all skelegons have been deleted.


CONVERTING NURBS SUBSURFACING TO POLYGONS

Reduce the size of the object in the 'Back' viewport until you can see all edges of the object. Point your mouse and click 'g' key to make that point go to the center of the viewport if necessary, right-click in the 'Back' viewport, dragging a cyan circle around the polygons with your mouse.




Select the button from the Convert' section of the 'Construct' tab.

Your object will probably turn a solid yellow. The reason for that is, subsurfacing, when turned into polygons, turns into a MASSIVE number of polygons when 'Frozen'. Here is what the belly button area looks like after a 'Freeze' of the Subsurfaces.





REDUCING THE NUMBER OF POLYGONS & CONVERTING TO ALL TRIANGLES

You should save the object which has the massive number of polygons as 'woman-massive.lwo' (or equivalent) as it takes some experimenting before you succeed in getting just the right number of reduced polygons in your new object.

Select the button from the 'Construct' tab 'Reduce' section (if it doesn't appear there, check the 'More' button at the bottom of that area). Enter an appropriate scaling factor in the 'Goal (# of polys or .5 for 50%) box.

If in the area to the right of where it says 'Sel:' it has five asterisks? That means that you have over 99,999 polygons. In that case, you might try putting .02 or .01 as the value and seeing how well it does.

However, if it is telling you the number of polygons you have, use math to come up with a total that is between 3000 - 7000 polygons when it is done. The more polygons, of course, the better the quality will be.





Press 'OK' to have it do it.


AFTER IT HAS REDUCED THE POLYGONS

It will take quite a while for LightWave to figure the polygon reduction (on a fast computer or a simple object it might take minutes, on a slow computer or a complex object it might take up to an hour.

When it completes, IT WILL NOT HAVE DELETED THE ORIGINAL POLYGONS. Instead, it will have created a new layer at the 'end' of all your layers that contains the reduced polygon object and the original polygons will be in the layer they originally had been in before you had done the 'qemLOSS2'. In my case, I started with only one layer, with the original polygons in Layer 1. After it finished doing the 'qemLOSS2' function, the layer indicator is yellow on Layer 2, and the new polygons are there.




It is at this time, if you are running Windows XP and don't have 27 Gigabytes of RAM, that it might say...




It is best to tiptoe around for a while when it shows that indicator. Don't switch windows, or try clicking on anything. It means that it is trying to keep your computer from crashing, basically. If you don't have enough RAM, doing a 'qemLOSS2' on an object with too many polygons will either lockup your computer, or it will make your computer move SUPER SLOWLY. Under Windows XP, LightWave Modeler might just disappear if it crashes. So, even if you have a lot of memory, it is best to shut down any unnecessary programs before you try doing a 'qemLOSS2' operation.


DELETE THE ORIGINAL POLYGON LAYER AND KEEP THE NEW ONE

But, lets say that it succeeded. Once it has completed, you can select the original polygon layer, press 'Delete' to delete the original layer, selecting the new layer that it just created.

Press the 'x' key to cut the new polygons to the clipboard, switch to Layer 1 and press the 'v' key to paste it into layer 1. The polygons should appear there.

Do a 'File->Save As...' to save it as a new object name. I first look at the total number of polygons by selecting all polygons and looking to the right of where it says 'Sel:'. I add the total number of polygons in the object to the end of the name. When reducing polygons, the thing that is important is the total number of polygons that are in the file (quality always is secondary at this point).


In my case my original guess is a 'qemLOSS2' value of .02 (2%) of the original polygons. After the 'qemLOSS2' operation, this is now the number of navel polygons in the figure. Quite a difference from the before picture.





BEFORE AND AFTER THE TUMMY TUCK

Obviously this stomach is no longer good for doing closeup flybys of her navel, but it will hold together well as a 2" tall figure that will rotate in an applet. However, even when you look closely at the difference, you will find that it still holds up pretty well.




Experiment with different values. Do a 'u' to undo it, and redo it with a different value if it either gives you too many polygons, or the quality gets too poor.


CHOOSING AREAS TO HAVE FEW POLYGONS AND AREAS TO HAVE MORE

Sometimes it's best to do parts of an object with a lower number of polygons (the ass, the stomach...) and other parts with more polygons (the face, the hands...)

Only increase the number of polygons if you absolutely have to.

In my case, the head grew too puckered and lost way too much detail when I choose the proper number of polygons for the body.

My plan is this. I want to take the original 'woman-massive.lwo' polygons, do one lower quality version to steal the body from and put those polygons into Layer 1 of an object file. I create a higher quality verison to steal the head from and put it into Layer 2 of that same object file. To do that, I first create two object files, one called body.lwo and another called face.lwo' which contain those polygons, I will merge those two files into one file which contains both of them. That way, if I make a mistake it will be easier to correct it without having to do everything over again. Sometimes it is good to write a sentence that says in detail what it is you are wanting to achieve before you actually do it.


CREATING CRUDE LAYER 1 AS ONE OBJECT AND DETAIL LAYER 2 AS ANOTHER

So, starting with the subsurfaced object I first do a 'Freeze' (CTRL-d) and saved the file as 'woman-massive.lwo'. I reload the 'woman-massive.lwo' file for each of the two versions, doing a qemLOSS2 on each of them.

I make sure that 'woman-massive.lwo' is the only loaded object, save and close all other objects. I select all the polygons in Layer 1 and do the 'qemLOSS2' operation on the polygons of the 'woman-massive.lwo' file, setting a value of .02 (2% of the original polygons) and select 'Preserve Mesh Quality'. Once it creates Layer 2, I will be using those polygons for the body. After doing the 'qemLOSS2' operation the entire body has 3752 polygons. I delete the old polygons from Layer 1, copying and pasting the polygons from layer 2 into Layer 1. I do a 'File->Save Object As...' and save the object as 'body.lwo'.

I do a 'File->Close Object' on the 'body.low' object. I do a 'File->Load Object' and again load the 'woman-massive.lwo' object. I select all the polygons and do the 'qemLOSS2' operation on the polygons of the 'woman-massive.lwo' file, setting a value of .05 (5% of the original polygons) and select 'Preserve Mesh Quality'. Once it creates Layer 2, I will be using those polygons for the body. After doing the 'qemLOSS2' operation the entire body has 9383 polygons. I delete the old polygons from Layer 1, but this time I keep the polygons that are in layer 2 in Layer 2. I do a 'File->Save Object As...' and save the object as 'face.lwo'.


COMBINING CRUDE LAYER 1 AND DETAIL LAYER 2 INTO ONE OBJECT

Again, I make sure all object files are closed and saved. I do a 'File->Load Object' and load 'face.lwo', and a 'File->Load Object' and load 'body.lwo' into Modeler.

You'll notice that when you load two objects into modeler, both are in memory, they just have a drop-down menu to choose one of the objects, or the other object. The drop-down menu can be found to the left of the layer gadgets at the top-right of your window.


MAKING SURE THE LOWER-QUALITY BODY POLYGONS ARE IN LAYER 1

I switch, using the drop-down menu, to the object called 'body.lwo' and I ensure that there is only one Layer in that object, and that it is Layer 1.

Next, I select 'face.lwo' from the drop-down menu and I highlight Layer 2 by clicking on the top part of the second Layer button. The more detailed polygons should be in that layer. Make sure that polygon mode is selected by pressing 'CTRL-h', make sure all polygons are unselected, and press the 'c' key to copy them to the clipboard.





PLACING THE HIGHER-QUALITY FACE POLYGONS IN LAYER 2

Once more select 'body.lwo' object from the drop-down menu. Click on the upper part of Layer 2 to select it and ensure that it is blank, with no polygons in it. Press the 'v' key to paste the more detailed polygons into Layer 2 of the 'body.lwo' object.




Do 'File->Save Object As...' and save it as 'BodyAndFace.lwo'

Select Layer 2 by clicking the top half of Layer 2 and it will turn all yellow. Click the bottom part of Layer 1 and that will make that the 'Background Layer'.




Black polygon lines will appear to indicate the Layer 1 polygons. The black polygons can't be worked on, erased or deleted but can be used to judge which polygons to remove from the white Layer 1 polygons.




Using the black polygons as an indicator, I select and delete all polygons which aren't the head in layer #2. To do this, back off by pressing the ',' key until you can see the whole body. Make sure you are in polygon mode by pressing CTRL-h. Right click in the 'Back' viewport with the right mousebutton and draw a cyan line around the body, except for the head.




Press 'Delete' to delete the body polygons.




The 'Background Layer' is not affected, but all that are left of Layer 2 is the head.

I click on the top part of the Layer 1 indicator, and the bottom part of the layer 2 indicator making Layer 1 the front layer (white) and Layer 2 the second layer (black).




I zoom the 'Back' viewport by pressing the '.' key and center the face in the viewport by pointing with the mouse, pressing 'g' (go to) and that area will move to the center of the viewport. Keep doing it until the nose is in the center of the viewport.




Again click with the right mouse button and draw a cyan circle around the head, being very careful that you draw the line INSIDE the area where the black polygons are. You will more carefully remove the proper polygons more carefully later.




Press the 'Delete' key and the head will disappear from the low-quality polygons.




If you now click on the top part of Layer 1, hold the shift key down while you are clicking on the top part of Layer 2, both layers will now turn completely yellow and both layers will be white in the wireframe views. But, in the perspective window you will be able to see what the figure looks like with a detailed head and a less detailed body.




I still need to carefully remove annoying polygons that overlap by either deleting the offending polygons, or move their points until they're all not overlapping. I do all of this by magnifying the Perspective view, rotating it under high magnification, selecting points or polygons, and using the drag tool (CTRL-d) to drag particular points to new places. Or, I select polygons and press 'Delete' to remove them. For example, in this image I have turned the head so I can work on it, I have selected Layer 1 as the foreground layer (white, working layer) and Layer 2 as the background layer (black, can't affect it). I have highlit the chin polygons and am just ready to press 'Delete' to remove them.




I rotate the head by pressing ALT key and using the mouse until I can see more polygons, I select them, and press the 'Delete' key again.




Because you can't see through the solid part of the body, you will sometimes have to go into wireframe view type, particularly as you start to get down to the place where the polygons meet each other. Here, I have selected all polygons I think I can safely delete.




... I press 'Delete' again.

Once I get enough of the Layer 1 polygons deleted, I have to swap foreground with background layer so I can trim the black polygons. Here, before swapping layers, I show the need for at least two black polygons (background layer) to be removed. I have rotated the head so you're inside the body, looking up through the neck at the inside of the head. You oftentimes have to rotate an object to the inside to see better.




Here, I have swapped foreground layer with background layer, highlit those offending polygons, and am ready again to press the 'Delete' key.





HIDING POLYGONS

You can also hide certain polygons at any time by selecting them, pressing the '-' key next to the zero on the top keyboard. To bring back all hidden polygons, press the '\' key. To hide more polygons, press '-' while more polygons are selected.


WELDING HEAD TO BODY

Finally, I weld multiple points from the head's neck polygons to appropriate points on the body's corresponding points. To weld points, though, the two points MUST BE ON THE SAME LAYER. Thus, once you think you've arranged the black and white points to be away from each other but close to each other, you can cut the head from Layer 2 pasting it into Layer 1.




You may, at this point, find that you may have to add a polygon that you may have deleted (previous tutorial).

Since there will be less points on the body than on the head, you will have to weld three or four of the head's neck points to one point on the body's neck. Arrange them first, a few at a time, by pressing CTRL-t, dragging each point. Enter point mode by pressing CTRL-g and highlight the ones you don't mind if they move when they're welded first, finishing with the one you want them all to bind to last and press CTRL-w to weld those points.

Here, you can see a severe closeup of the neck. I have arranged the lines of many polygons from the head's neck pulled down close to the body's neck point. Combining two polygon lines to the same point on the body will create some wierd polygons afterward, but we will remove those. I selected the two top points first, then the bottom point. This will make the two top points jump down and weld to the bottom point.




It will tell you how many points have been welded.




Here is the resulting weld.




Be careful that you don't include points which are really on the other side of the model as those points will bond with the points you wish to bond. To make sure this doesn't happen, count the points you are welding and make sure it equals the number of points that actually weld.

Otherwise, do an 'u' to undo it, unhighlight all points and try again.

Do this carefully, and slowly, moving points towards the point you wish to weld in the Perspective window, turning the object slowly by pressing the ALT key and rotating, selecting points and deselecting points as you need to. (Shift to add a point if points have already been selected, click on any selected point with the mouse button up to remove a point).

I have covered these techniques in other tutorials.

Make sure you remember to do a 'File->Save Object As...' and give it a new name like 'woman-welded-head.lwo'


MOVING PARTS OF YOUR OBJECT INTO FINAL POSITIONS

Once each part of the object is as detailed as you need it to be to look well at a 2" - 3" tall size on your monitor, start to arrange the arms and legs until they feel naturally placed. I move the arms by selecting all polygons in each arm and using the 'y' key to rotate the arm. I point the cursor to the place where I want the arm to rotate, I click with the left mouse button and move the mouse.

The arm will pivot around the cursor so you must do this in the 'Back' view. I move the arms from an outstretched position to hang by her sides.




The arm can be bent at the elbow by selecting polygons from the tips of the fingers to the elbow, rotate, pointing to the elbow. You can rotate in the perspective window as well, so if you wish strange angles, do it there.

The legs need to be brought closer together. I go to the front view and draw a cyan circle of selection with the left mouse button while in polygon mode around her foot, selecting the foot polygons.




I now make the selection crawl up her leg by pressing SHIFT-] to make it crawl upward and SHIFT-[ if I want to have them crawl back. In this way I could select her leg up to the knee, or up to her thigh, or even higher.




I keep pressing SHIFT-] until the entire leg is selected. I press 'y' to get the rotation tool, point to where the upper hipbone might hinge in the 'Back' viewport, and rotate the leg clockwise.




The foot is now tilted too much, so I select just the foot, press 'y' for the rotate tool, point to the top of the ankle and rotate the foot in the 'Back' viewport counterclockwise until it looks flat.




You are now ready to bring your model into the Layout program so you can set up a camera and light. In my case I save my object as 'woman-final.lwo'

Previous   Table of Contents   Home   Next