Models
Should be merged into other articles (e.g. LOD), and split into separate pages.
Contents |
LODs
Visual
These are LODs which are rendered by the GPU and are visible to the player, sometimes called resolution LODs, but it would be better to say that visual LODs can have a number of resolutions, each becoming progressively more simplistic. Unlike in VBS1, the VBS2 engine does not consider the index number of the visual LODs, instead it simply expects that each visual LOD will be half as detailed as the previous, and it will switch these LODs in the scene as necessary to preserve an acceptable framerate.
The engine will make LOD changes to based on the assumption that each resolution LOD is 50% lower in face count than the previous one. The number of LODs needed varies based on object complexity but usually 4 to 6 visual LODs is enough and the last and lowest detail LOD should be around 200 faces.
There are also special visual LODs used only in first person view inside vehicles. If you are creating a vehicle model which is missing all of these LODs, your vehicle will cause VBS2 to crash to desktop when you try to sit in the driver's seat. There are three types of special view LODs:
View - Cargo
This is used when a special level of detail is needed to present crew members with a high detail interior of a vehicle which isn't needed in the normal visual LODs. Any parts that can't be seen by any passengers can be removed to reduce file size. All vehicles at least need a View - Cargo LOD, but the following two view LODs are optional.
View - Pilot
This is used when a special level of detail is needed to present a vehicle driver with high detail cockpit instrumentation which isn't needed to be seen by other crew members or external players. This is only used when vCargo isn't good enough, for example, the cockpit of a C130 should be done in View - Pilot and the cargo area is done in View - Cargo since they are distinctly separated areas. When View - Pilot is missing the engine will use View - Cargo instead.
View - Gunner
This is used when a special level of detail is needed to present the gunner with a high detail turret area or gun position which isn't needed by the rest of the vehicle crew. Usually the gunner proxy in View - Gunner will be included in the elevation animation of the gun instead of just the traverse animation, so that his hands stay locked on the gun's handles. When View - Gunner is missing from the model, the engine will use vCargo instead. A turned out gunner currently always uses the 1st visual LOD instead of View - Gunner.
Common errors: There are a few errors that occur in resolution LODs that must be fixed. It's a really good idea to clean the 1st LOD before making the others, so that you don't clone the errors into more LODs. To get the error report in O2, use Automation > Check All. This script will check the whole model and output the results to the script console.
- Non-planar faces: Twisted faces don't have a uniform normal, and can disappear unexpectedly. Simple fix is to load this selection and hit "/" or "\" to triangulate.
- Non-linear mapping: Sometimes if one corner of a face quad was moved, it stretches the uv coordinates in an irregular way, and can be fixed with "/" or "\" to triangulate.
- Cannot Generate ST Coords: This error comes from a face that was planar-mapped perpendicular to the normal, also known as "stretching". It should be avoided as much as possible, learn how to UV map correctly to avoid this, but isn't a critical problem to fix.
- Keyframes in LOD: If you use keyframes for unwrapping the model, they must be removed before the final model is submitted.
Geometry
Collision detection has a much higher fidelity in VBS2 than it had in VBS1, so we can use smaller shapes without getting strange results. However, the number of components used must be kept as low as possible. Especially the collision geometry, should be kept as simple as possible. The Geometry LOD has a special representation of vertices, it shows grey boxes that represent the vertex weighting. Vertex weighting in a Geometry LOD is used to distribute mass. The mass toolbar only works in the Geometry LOD.
Fire Geometry is only added when the normal Geometry isn't detailed enough to act for hit detection. If you have a crate, and collision is just a box, then it's also enough for hit detection and you don't need a Fire Geometry. Fire Geometry is where penetrable materials are applied, to control how easily bullets will penetrate a surface, or if thrown objects will pass through (grenades) such as a tent wall. There has been some development of penetrable materials, these are RVMATs which are applied to geometry components, they contain info on material type and density, and this should be applied to the Fire Geometry only.
View Geometry is used to block the view of AI, so if enemy are hiding behind View Geometry they might not be detected. It's also used in some form for occlusion, so objects behind this might not be drawn. If units are disappearing through windows or behind ladders, this is usually the case. This LOD only added when Geometry isn't good enough to do the job. This is used to block the AI's view of targets.
Common errors:
- non-convex component: Find errors with Structure > Convexity > Find non-convexities. Each component in geometry must be solid (closed) and be convex. There is an automatic process available: Structure > Convexity > Convex Hull which will use the currently selected points to create a convex shape, but beware that it doesn't handle much complexity and results are not always perfect.
- incorrectly created component names: Use Structure > Topology > Find Components to automate the naming of each geometry component. It's a good idea to first delete any old component names. Proxies are automatically ignored. Man models use a common special geometry LOD with hardcoded names for each vertex, and should be left alone.
- components with no mass: If you have a mix of components and some have no mass, the cleanest way to fix this is to select all, apply a mass of 0 to wipe everything, then apply the correct mass to the whole vehicle. Check the center of gravity (blue x) and adjust as necessary by changing the mass of individual or groups of vertices.
ShadowVolume
This set of LODs is used only to produce stencil shadows, and we can have resolutions here too. Normally we only use two shadow volume LODs, the first around 2000 triangles and the second around 500 triangles. Since this shape will be used to block light, it must be just slightly smaller than the resolution LODs, and can sometimes work well when faces are inverted, but always inspect results in buldozer to make sure it's working as expected. Double-sided faces are allowed (like untextured polyplane) and these are very important to making realistic shadows while keeping face count low. All components in shadowVol must be:
- closed, but concave surfaces are fine
- untextured
- triangulated, no quads allowed.
- all edges sharp.
General Guidelines
Some general guidelines followed by specific usage for different model types:
(Note: The following guidelines refer to some named properties that should be added to the geometry LOD)
- Every model must have a shadow buffer fallback specified. After a certain distance only these shadow maps are used instead of stencil shadows.
- sbsource only controls what model source the engine uses to draw a shadow map.
- sbsource=visual is default behaviour anyway, so we don't really need to add it.
- when sbsource=visual then we also need to use lodnoshadow=1 in all visual lods that we don't want to use as a source for the shadowbuffer (all high detail ones > 500 triangles).
People:
- all visual lods but the last will have named property "lodnoshadow=1"
- there should be at least two sv lods, 0.000 for normal high detail and 10.000 for medium detail which should be around 500 triangles.
Vehicles:
- all visual lods but the last will have named property "lodnoshadow=1"
- there should be at least two sv lods, 0.000 for normal high detail and 10.000 for medium detail which should be around 500 triangles.
Buildings:
- no properties needed in visual lods
- geometry lod has named property "sbsource=shadowvolume"
- geometry lod has named property "prefershadowvolume=0"
- there should be at least two sv lods, 0.000 for normal high detail and 10.000 for medium detail which should be around 500 triangles.
Plants:
- all visual lods but the last will have "lodnoshadow=1"
- geometry lod has named property "sbsource=explicit"
- geometry lod has named property "shadow=hybrid"
- geometry lod has named property "prefershadowvolume=0"
- there must be one 0.000 SV LOD, with simple closed shapes, following the usual shadow volume rules.
- there must be one 1000.000 SV LOD, with specially made discreet alpha textures that will cast "leafy" shadows (this is what is meant by explicit sb source).
Common errors:
- non-closed components: Use Structure > Topology > Find Non-closed to detect any openings in your components.
- quads or smooth edges still present: When you finish making the model, Select All and hit "/" then "U" to triangulate then sharpen all edges.
- textured surfaces: If you import parts from other LODs make sure you remove any textures or materials that might be present. This doesn't apply to the 1000.000 SV LOD since it is a special exception and is used to draw a shadow map.
Hit-Points
Hit points are used to specify weak points of a vehicle which have a different armor rating than the general hull armor value given in the config. These can be configured per vehicle, but some standard values which will already work in VBS2 are:
- engine
- main_elev
- main_trav
- glass_1
- glass_2
- light_1_1 (headlights)
- light_1_2
- track_1
- track_2
- wheel_x_y_damper
- fueltank
- avionics
- missiles
LandContact
Land contact points should be placed under wheels of wheel type vehicles (4 points), or averaged in the case of tanks (6 points). The points must be connected to the wheel dampers so that the vehicle maintains proper traction over rough ground.
Paths
Paths are essential for the AI to find ways through difficult terrain like a village or the interior of a building. Paths can be useful to any structure that has a walkway or a complicated layout. Besides the movements there is a further tactical aspect, the positions. Positions can be assigned via editor (waypoints) or in-game from leaders directly to any AI agent. The AI agent will stay on this position and will act from here until there is a new order given. Now some more points, especially for developers:
- AI will always travel along the edges of a path shape, they travel between vertices.
- When an edge of any path is going through walls the AI also will go through the wall or get stuck, so take care to plan paths properly.
- A leader commanding subordinate AI will see all positions available along the path, and can command his troops to move to these points.
- Take care when making position points (named selections "pos#). Not too few or we lose tactical potential and not too many or the leader gets overloaded with too many options.
- Paths are best to be 10cm above the roadway/walkway/ground surface.
- Entry points (named selections "in#") are simply entry points onto the path network, and don't necessarily have to be positioned outside the doorways of models.
Roadways
Roadways provide a surface upon which people and vehicles can travel. Typical use of roadways is in road models, bridge decks, and the floors, stairs, and rooftops of buildings. For a working roadway, all that is needed is a single-sided plane with normals pointing upwards. When a roadway has no texture assigned, it will have default friction and default sound effects, but special registered textures (CfgSurfaces) can be applied to roadways so that they have additional dust, friction, and sound effects. If you have created a bridge or other type of model for vehicles to drive on, and it seems to slow you down more than it should, check that there are no textures assigned in the roadway LOD.
Edit
These are lods for storing WIP meshes, or reference models etc. They are discarded during binarization so it's a way to keep development materials in the raw P3D model without having unnecessary data in game. There is currently a bug in the pipeline so that that Edit LODs are included in the calculation of the bounding box so they should not have geometry which exceeds the bounds of the actual object in other LODs.
Memory Points
Memory points are single points in a the Memory LOD which have named selections. They are used for positions of effects like smoke, lights, and weapon firing vectors, etc. They are also used as pivot points for animated named selections. The most useful reference will be looking at sample models for the object class you are making.
Named Properties
Named properties are simple parameters which can be included directly into LODs. Some properties have specific effects on the LOD where they are found, others are general named properties which affect the whole model. The general properties should be located in the Geometry LOD which makes it easier to find them.
Geometry LOD
- class - for all models that get placed in Visitor:
- vehicle
- house
- church // clock
- streetLamp //light
- road
- treeHard
- treeSoft
- bushHard
- bushSoft
- forest
- man
- damage
- building // disappears bellow ground
- tree //rotates around X Axis
- treeZ //rotates around Z Axis
- no
- bunker
- tent
- engine // explosive
- fence
- map
- building
- fence
- house
- tree
- small tree
- bush
- forest square
- forest border
- forest triangle
- fortress
- hide
- fuelstation
- view-tower
- hospital
- church
- cross
- fountain
- chapel
- lighthouse
- rock
- busstop
- quay
- style - visual style for choosing LODs Artist chooses which style of modeling complexity the model has. A complex shape of helicopter might be very organic, so it will be more like character than a vehicle. Gas station or factory is complex more like vehicle than reguar building.
- character
- plant
- vehicle
- structure
- placement - assigns specific deformation according to the terrain shape map surface
- slope // the model is SKEWed according to the terrain shape, vertical lines remain vertical. Better than vertex property “Keep height “ in many cases
- SlopeLandContact
- slopeZ
- slopeX // variants where the transformation counts with landcontact defined points (1-3)
- forcenotalpha = 1. Some models with much alpha textures on their surfaces were considered as alpha objects and therefore were rendered in a speciall pass where it was not possible to cast shadows on them. There is aa new named property (in geometry LOD) using which you can force the whole model not to be considered as alpha model and shadows will be casted on it therefore. Negative impacts of such solution: various alpha sorting artifact may appear on alpha blended parts of such models. It will depend on particular situations if the effects will be bearable or not.
- armor=10 //used by tents
- autocenter=0 //some model classes are placed according to automatic object center (cars). This property sets that position to 0.0.0 from P3D will be used. It is often used for proxies.
- frequent=1 //marks objects that are placed in big amount using instancing.
Notes
Placement
"slope" "slopez" // change slope just in z-dir "slopex" // change slope just in x-dir "slopelandcontact" // take first two or three land-contacts and change slope according to them...
As far as I can read out of the code if one od these is set in shape the code using Keep Height is skiped and the skew is done differently. So both "placement" and "Keep Height" methods work but "placement" overrides use of "Keep Height".
Flyman says that "Keep Height" along with the matrix skewing also does a shape cutting for better slope alignment and obviously this is quite consuming process.
Frequent
From news:isl9cu$ima$2@new-server.localdomain
To clarify, the main purpose of property "frequent" is that it extends size limit of allocated vertex buffer from 8000 vertices to 32000 vertices. Apart of that we cannot have more than 45 items in the instancing chain. This particular model of building (let's consider the worst LOD) has got 32 vertices, which means that even 45 instances have just 1440 vertices and it makes no sense to use property "frequent" in their case. It would start to be interesting if the LOD would have 200 vertices - we could afford only 40 instances then and with bigger numbers the difference would be bigger. Hard to say how big improvement the "frequent" propery brings in our real scenes. Our rough LODs are usually modeled much under 200 vertices and maybe our scenes are dense enough, so that we don't see too many models in finer LODs to take advantage of the improved instancing with "frequent" property. In any case, please keep using the "frequent" property as it was up to now as an advice to engine for possible optimalizations. From what I understand, we don't see the original problem (performance decrease with "frequent" property) anymore (which would be very strange).
Resolution LOD
- LODNoShadow=1 //There will be no SW shadow cast from this LOD. Usually used on LODs with more than 1000 faces
- LODNeeded= //number will set which LOD should be displayed in case player gets near to object
- keyframe=1 //marked models that are animated by keyframes stored in .p3d, used only in x:\data3d\racekT.p3d
Named Selections
IMPORTANT! Selection should no longer be nested as they were in VBS1. Now the heirarchy is done through the model.cfg and will use proper forward kinematics from parent bone to child bones.
General vehicles
- wheel_X_Y, where x = wheel position starting at the front, y = lateral location of the wheel. 1 for left, 2 for right.
- wheel_X_Y_damper, formerly tlumič, this is the suspension part of the wheel assembly, that will move up and down with the wheel
- wheel_X_Y_steering (this is the steering parts of the wheel assembly which turn with the wheel but do not spin. only needed for steering parts)
- TyreTrack_X_Y, TyreTrack_X_Y
- main_elev
- main_trav, for main weapon turret
- <turretname>_elev
- <turrentname>_trav, for any additional turrents like commander (cmdr_) or a remote camera (camera_)
- door_X_Y
- hatch_gunner
- hatch_commander
- hatch_driver
- hatch_X_Y, for cargo hatches on APCs
- hood
- trunk
- drivewheel, steering wheel
- drivewheel_axis
- light_tail, normal tail lights.
- light_brake, tail brake lights.
(indicator/reverse lights go here)
- light_1_1 (for single headlights, including landing lights)
- light_1_2 (for second headlights, etc)
- light_x_y (for more as needed)
- light_<colour>_<blink/still>, for blinking or steady lights, relevant to land, air, and water vehicles.
- exhaust_pos
- exhaust_dir, for first or only exhaust source
- exhaust_2_pos
- exhaust_2_dir, for 2nd exhaust
- exhaust_?_pos
- exhaust_?_dir, for more...
Helicopters
- mainRotor
- mainRotorStatic
- mainRotorBlurred
- tailRotor
- tailRotorStatic
- tailRotorBlurred
Planes
- flap_x
- flap_x_axis
- elevator_x
- elevator_x_axis
- rudder_x
- rudder_x_axis
- wheel_x_y
- wheel_x_y_axis
- gear_x_y
- gear_x_y_axis
- gear_x_y_hatch_z
- gear_x_y_hatch_z_axis
- gear_x_y_damper
- gear_x_y_stabil
- gear_x_y_stabil2
- prop_x
- prop_x_axis
- propBlurred
- propStatic
Instruments
- alt, altimeter
- alt_axis, the axis goes in viewPilot with instrument parts
- clockHour
- clockMinute
- clock_axis
- fuel
- fuel_axis
- compass
- compass_axis
- horizont, artificial horizon sphere
- horizont_axis
- horizont_dive, don't know what this is
- vert_speed
- vert_speed_axis
- mph
- mph_axis
- oilpressure
- oilpressure_axis
- rpm
- rpm_axis
- rpm2, for multiple instruments add a number beside the part name
- rpm2_axis
Buildings
- door_x_axis (2 points of axis selected, if door opens outside reverse the axis points. Doors should open inside a building)
- door_x_ap (1 point selected, place where the doorknob is)
- door_x (all 3 points has to be selected)
- start1, start2, start3, ... (ladder, lower action point)
- end1, end2, end3, ... (ladder, upper action point)