Jump to content

VIS Tutorial


moonsense715

Recommended Posts

Author: YSLMuffins

Skill level: 6

 

 

This tutorial shows you how to add VIS to your map (objects that the players can't see from certain angles will not be rendered for them, increasing the Frames Per Second for the players).

 

 

Content:

1.1 Introduction

 

1.2 Getting Started

 

2.1 Getting the VIS sectors done

 

2.2 Important VIS sector notesTHE PLAYER in THIRD PERSON

 

2.3 Important VIS sector notesTHE PLAYER in a VEHICLE

 

2.4 VIS Sectors on a map with FLYING UNITS ENABLED

 

2.5 My personal VIS set up recommendations/known VIS issues

 

3.1 Getting VIS set up in the Commando Level Editor

 

3.2 Detailed Manual VIS point placement

 

3.3 VIS troubleshooting

 

3.4 Retouching VIS after the fact

 

4.1 Additional hints and tips

 

5.1 Credits

 

 

 

 

1.1 Introduction

 

So youre creating a map and you want your map to be played by as many people as possible? Whats the best way to do this? Make sure that the map gives the best performance as possible! Whats one way to do this? Get VIS set up on your map!

 

VIS is short for VISibility, as far as I know. Its Renegades way of speeding up performance on their huge single player levels and on their online multiplayer maps. By way of invisible meshes called VIS sectors located all over the map, each sector has its own data on what can and cannot be seen from that particular pointso for example, if youre inside the Hand of Nod your computer wont waste time rendering the inside of the GDI Barracks (with proper VIS data), or the barracks period if you cant even see it. The end result saves your video card and CPU from processing useless data and can leave it to focus on whats importantwhats right around you.

 

Now, setting up VIS properly can be time consuming, and most smaller maps should do fine without it, says Greg Hjelstrom, lead programmer for Renegade. On bigger, higher poly maps, though, VIS is a mustand if there are parts of your map where the FPS drops dramatically, youll want to seriously consider setting up VIS for your map. Besides, all of WWs maps have a VIS system in place!

 

 

1.2 Getting started

 

I assume youve downloaded the Renegade Public Tools. Navigate to your Program Files > Renegade Public Tools > HowTo > Multiplayer Maps > mp_hourglass folder. Open the mp_hourglass.gmax scene in RenX. Hit the Select by Name button and select everything in this diagram. Hide them after theyre selected. Everything thats left is the VIS group. Ungroup it.

image-25-O_VIS001.JPG

 

Here are the VIS sectors for the map Hourglass. Notice the important characteristics that these VIS sectors share:

  • Most every POLYGON on the map has been cloned into separate individual VIS sectors. A VIS sector is basically a hidden mesh with the VIS option checked in the W3D options. See diagram.
  • Each VIS sector is hidden.
  • Each VIS sector is located a meter or two below the actual terrain.
  • The VIS sectors are located in every place the player, whether on foot or in a vehicle, can move (actually, every place where the players CAMERA can movemore on this later).
  • The VIS sectors are not one huge mesh.
Study this setupyoull have to mimic this type of setup on your own map.

image-25-O_VIS002.JPG

 

 

2.1 Getting the VIS sectors done

 

This is probably the most tedious part of the processif you do it right. I personally recommend getting your VIS sectors done before you texture your terrain, as hundreds of tiny meshes with a material texture assigned to them take longer to load than hundreds of tiny meshes with NO textured assigned to them.

 

The lazy way to do it would be to clone your terrain ground and Explode it. Select your terrain, clone it, select all of the faces of your mesh by hitting the ELEMENT selection button, click your terrain, scroll down to the Explode box in the Editable Mesh tab, set the number by the button to 0.0, and hit explode. Pick a name for your exploded meshes, and hit OK. See Diagram.

image-25-O_VIS003.JPG

 

Now, I no longer recommend this method because (1) you can end up with thousands of VIS sectorsmeaning thousands of unnecessary VIS sample points, and (2) WW doesnt do this. The Explode function separates a mesh, when set to 0, into individual triangle FACES, which are not only awkward VIS sectors, but unnecessary.

 

Detaching your VIS sectors manually may take a lot more time, but it could save your VIS system from crumbling entirely when you try to Auto-Generate the VIS for your entire map (i.e., LevelEdit crashing when trying to Build the VIS sample points). If you notice on the Hourglass gmax scene, youll notice that WW did not explode their VIS sectorsthey selected a polygon or two, hit the DETACH button, and gave it a name. You could end up with hundreds of sectors, but not thousands upon thousands compared with using the explode method.

 

Give your VIS sectors a unique name followed by a number, so when it comes time to Select them all you can easily assign the VIS sector W3d propertiesHIDE and VIS. Group all of your VIS Sectors, and lower them all by two meters along the Z-axis.

 

 

2.2 Important VIS sector notes - THE PLAYER in THIRD PERSON

 

Its not where the player currently is thats important in the VIS culling systemits where the CAMERA is located. See diagram. When the Player is in first person mode, the camera is located exactly where the player is standing. When the Player is in third person or inside a Vehicle, that is no longer the case.

image-25-O_VIS004.JPG

 

By looking at the crude diagram Ive supplied, consider this: the camera is always BEHIND the player depending on the direction the player is looking and the camera swings around the player as the player moves the mouse. This may be obvious, but you may not have consciously realized this.

 

Also consider these situations:

image-25-O_VIS005.JPG

 

First diagram: the player has backed up against a wall that has the PHYSICAL and CAMERA w3d characteristics checked. The players camera cannot move beyond the wall, so when the player is perfectly against the wall the player is also smashed against the camera so the players view is probably obstructed by the players character model. The VIS sector in green, in this case, is fine. This case also applies if the wall slants at an ACUTE angle against the ground.

image-25-O_VIS006.JPG

 

Second diagram: the player has backed against a wall that has the Physical and Camera w3d characteristics checked. The wall slants backwards against the ground at a degree greater than 90 degrees (pretend its a mountain or something). The VIS sector ends at the base of the wall, but since the wall slants backwards so that the players camera can move beyond the VIS sector, the VIS sector MUST be extended PAST the wall. As you can see by the Red camera circle in the diagram, the players camera has moved out of the VIS sector. Whenever the players camera stumbles outside of any VIS sector, nothing could happenor everything could turn invisible for the player (a VIS glitch).

image-25-O_VIS007.JPG

 

Third diagram: the player has backed against an INVISIBLE barrier that blocks the player from falling off the cliff, but the invisible barrier does (and should not) have the CAMERA w3d property selected. The players camera has moved past the invisible barrier and the cliff itself! However, because the VIS sectors extend past the cliff, the player should experience no VIS glitches when this situation is encountered in game.

image-25-O_VIS008.JPG

Now, in the gmax scene, we can put these situations to the test. Study this diagram. Get the picture now?

 

 

2.3 Important VIS sector notesTHE PLAYER inside a VEHICLE

 

Fire up Level Edit, load the map UNDER, and click the SHOW VIS SECTORS button. See diagram. Enter walkthrough mode, change the camera to third person, and escape walkthrough mode. Click the Camera menu, and click on GDI_Mammoth_Tank. Enter the walkthrough mode againsee something different? This is how you can walk around the map in your own virtual mammoth tank, minus the model and the speed.

image-25-O_VIS009.JPG

 

When you make your VIS sectors, you must not only consider the FIRST and THIRD person camerasyou must also consider the VEHICLE cameras.

 

If you remember from the crude Camera diagram, the vehicle camera travels around a much larger radius than the Third Person camera. Walk around the map Under with the mammoth tank Camera. You may also want to consider using the camera Nod_Apache if you have flying units on the map. It swings on the widest radius possible--so it is even larger than GDI_Mammoth camera. Youll notice the green highlighted VIS Sectors as you walk around. If you ever have a landmark ramp like on under, youll have to make sure your VIS sectors extend beyond the physical ramp beyond a much larger area, but ONLY if a vehicle can get up there. Youll probably only have to test using the Mammoth Tank camera, because I believe that is the camera that circles the largest radiusso if you have the Mammoth tank camera covered, you have the rest of the vehicles covered. (The Nod_Mobile_artillery camera appears to be larger, but it seems pretty obsolete since if you look up the Havoc model gets in your waythis was patched with the flying path.) Youll want to consider making sure the player cant get too close to the edge, or rely on the player not getting so close to the edge that they fall off!

 

 

2.4 VIS Sectors on a map with FLYING UNITS ENABLED

 

When you have flying units enabled, you must have additional layers of VIS sectors in addition to the VIS sectors you have on the ground. Each VIS layer should be separated 10 meters on the Z axis. See diagram. Hopefully you wont have this many VIS layers, but you should get the idea. You should continue to have VIS layers until you hit the flight roof.

image-25-O_VIS010.JPG

 

The 10 meters number is directly dependant on the VIS Sample height that you can increase/decrease in Level Edit. 10 meters is the default, but increasing this number, while it can cut down on VIS layers, it will vastly increase the auto-generate VIS processing time. I recommend leaving the VIS sample height at the default. More on this later.

image-25-O_VIS011.JPG

 

Consider what WW did apparently on C&C_City_Flying. It was mostly likely because the team was short on time, but WW basically added square VIS sectors 30x30 each all over the map, even in areas where there were already VIS sectors. Since WW seems to have gotten this to work, perhaps you can too. According to the diagram, there are four layers of VIS sectors, each layer covering the entire map. The first layer seems to have been made from scratch, and each additional layer was cloned from the first.

 

This could get complicated, but Ill leave it up to you to get things doneI dont have anymore specific advice on making VIS sectors for flying maps.

 

 

2.5 My personal VIS set up recommendations/known VIS issues

 

The GDI/Nod Power plants need to have additional VIS set up on themthe default VIS sectors arefaulty. Even if you arent going to include flying units on your map, locate the FLYING_BUILDINGS_SETUP.gmax available on the WW FTP and merge the GDI and Nod Power plants onto your own map. They include the necessary VIS that youll need if you do not have terrain under your buildings (you have holes cut out of your terrain to specially fit each building, like WW does).

 

I recommend adding VIS sectors outside of the windows of the Hand of Nod. They are common places for VIS glitches. See diagram, except do this for all the windows.

image-25-O_VIS012.JPG

 

 

3.1 Getting VIS set up in the Commando Level Editor

 

So youve finally gotten your VIS sectors done in gmaxnow youre ready for the work in Level Edit!

 

Make sure youve generated your Pathfind sectors and whatnot, so the Human Pathfind Generator is already on the map. See diagram.

image-25-O_VIS013.JPG

 

First, go to the VIS menu and DISCARD VIS DATA.

 

Next, go to the Edit Menu and REPARTITION THE CULLING SYSTEMS.

 

Third, go back to the VIS menu and BUILD THE DYNAMIC CULLING SYSTEM. This step will take a little while.

 

Fourth, go take a nap or something while this is chugging away. Go to the VIS menu, and hit Auto Generate VIS. In the dialog that pops up, set the Granularity to 5 (my personal recommendation). I recommend 5 because this could save you a vast amount of time while checking for VIS glitches

 

Fifth, walk around the map, look for VIS glitches, and take MANUAL VIS point samples.

 

 

3.2 Detailed Manual VIS Point placement

 

The auto-generate VIS function is not going to be perfectyoull have to walk around the map and check for VIS glitches. Over my experience here are common places where VIS glitches occur:

  • The doorways at every building
  • The Hand of Nod interior looking out through the windows
  • The GDI Advanced Guard tower just as you enter through the doorway
  • Tunnel entrances
  • The roofs and ramps of the buildings on Flying maps
When dealing with this places, hit CTRL + SHIFT + T to hide the doors of the base buildings so you can enter/exit freely and check for VIS glitches.

 

When you find a VIS glitch, hit CTRL + ~ to take a manual VIS point sample. The invisible object that should be visible should become visible. See diagram.

 

Here is before; notice the obvious VIS glitch?

image-25-O_VIS014.JPG

 

After hitting CTRL + ~, pay attention to the status window at the bottomhere is the after result:

image-25-O_VIS015.JPG

 

I think you should get the idea now. Run around the map, around the areas I suggested, and check for VIS glitches.

 

 

3.3 VIS troubleshooting

 

Q: Im trying to fix this VIS glitch, but I keep getting a BACKFACE LEAK OVERFLOW ERROR!

This means there is a BACKFACE at that particular point. Backfaces prevent the VIS sampling system from generating a VIS sample, because the VIS system thinks the player is in an invalid location (i.e., under a mountain) and wont generate a sample. See diagram.

image-25-O_VIS016.JPG

 

To show backfaces, hit the SHOW backface button. Everything that appears in BRIGHT GREEN is a backface. According to Greg Hjelstrom, the VIS system needs there for not to be any backfaces, or a very tiny amount, because this saves the VIS system from performing needless processing.

 

To fix the backface problem, go to the VIS menu and hit VIEW VIS window. Try the manual VIS point sample againthis is when something should appear in the VIS window. Move the mouse around the window until you see BACKFACE! Go to the instances tab and locate the particular mesh that has the backface exposed. Clear the checkmark by it and try to do the VIS sample again. This should fix the VIS glitch.

image-25-O_VIS017.JPG

 

However, if this method cannot solve the VIS glitch, or if hiding that mesh with the backface makes something turn invisible that you dont want to turn invisible, you will have to go back to gmax and fix the problem manuallythis means youll have to start the VIS process in Level Edit ALL OVER AGAIN, so as you work, use the Toggle backfaces button often and be mindful of backfaces on the battlefield!

 

 

Q: I keep getting a Vis Sample Rejected - No Vis Sector or Vis Sector ID not assigned! error!

 

If the VIS glitch is severe, you will have to go back to gmax and add a new VIS sector to that location. You will have to start the VIS process in Level edit all over again. Study section 2 again, as this is probably most likely the culprit behind your VIS glitch problem.

 

 

3.4 Retouching VIS after the fact

 

After exporting your map, and after youve closed Level Edit, should you find more VIS glitches in game, reopen your map in Level Edit and fix the VIS glitch. Before you save your level again, make sure you go to the EDIT menu and REPARTITION the CULLING systemsthis is very important, if you dont do this, the VIS data could be COUNTER-PRODUCTIVE and actually SLOW down the players FPS. Do this every time before you export your level again, and your arduous VIS work will pay off.

 

 

4.1 Additional hints and tips

 

Use the wireframe mode as you move around, then hit F9 and toggle it back and forth before adding a VIS sample. You can totally customize the way VIS samples are taken this way, by making sure that only a needed sample is taken that doesn`t show more polygons than are actually visible to the player. Use wireframe because it can tell you when something is disappearing and lets you see how the VIS is working in the specific level. You can see things way off in the distance just become totally obscured by the VIS engine as you run around, and you can see the interiors of the bases start coming into view as you move towards each base.

 

 

Use the other camera views, like varying tank views, so you can fix issues the same way with vehicles, too.

 

 

Other points about hills. Say you`ve got a lot of hilly terrain on your map. It`s my theory that the VIS auto-generate sample seems to be based on the first person camera.

image-25-O_VIS018.JPG

 

If you open up Hourglass I think you`ll notice all of the manual VIS points high in the air over the hill. If you switch to the first, or even third, person camera while on the hill, you`ll notice you won`t see a lot from the hill. But change to a vehicle camera you`ll see a lot more--but apparently the auto-generate VIS sample doesn`t consider the vehicle cameras. It appears that VIS glitches are common with a land form like the hill on Hourglass, or even on a smaller scale, if you have a sharp, sudden rise in elevation several meshes over the hill might be accidentally turned invisible by the VIS sample.

 

 

So, if you`ve got a lot of hilly terrain, like Hourglass, on a smaller scale, be sure to walk around with the vehicle camera and check for VIS glitches.

 

 

If you move your view below the map, and "unhide" all the VIS layers, it seems to go MUCH faster with high settings on the granularity and flight ceiling.

 

 

5.1 Credits

 

Written by YSLMuffins

 

Additional notes by Dante and Aircraftkiller

 

HTML Formatting by General Havoc

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...