Modeling and Texturing Guide

Modeling and Texturing Guide

From BeamNG

Revision as of 00:47, 4 November 2019 by Toron Beldevar (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

There's a specific way vehicles are modeled and textured for BeamNG which we feel produces the best result the most efficiently. Intermediate knowledge of a 3D modeling program is recommended.

Polygon Count and Density

There's a balance here not just between graphical quality and performance, but also computational performance. Every vertex that has to be mapped to the JBeam skeleton takes computing power. Thus, it's good to save polygons whenever possible and use normal maps instead for things like panel gap bevels and underbody details like cutouts, structural members, and bolts. For large panels, though, a minimal amount is necessary; a flat plate like a large old hood or trunk can be made with only a few polygons; one has to have some control loops around areas that could bend when the JBeam is deformed.

Body Shell

Model the basic shell of the vehicle (roughly) first. When that's complete and accurate, add more edgeloops to smooth out the model. Try to be efficient, maintaining a somewhat grid-like flow of polygons across the model. For hard edges, add control edgeloops on either side. These are edgeloops that don't change the shape or silhouette, but make the lighting/smoothing look correct. No "hard" edge is actually hard in real life (or you'd cut yourself on it). This is where control loops result in nice shading without needing to bevel the edge, again saving polygons. Be careful using 'subdivision surface' as a smoothing tool, as it might influence the way a flexbody deforms.

Another important thing that is often overlooked is the flow of triangulation. Every quad is two triangles, and all of the quads in a surface should be facing the same way for the lighting to look smooth.

Once the shell is complete and smoothed and at its final polygon count, it's time to detach the panels. At this point there should be edges where the panel gaps would be - if not, cut them in. Then, detach each panel, and space the vertices a bit (~6.35mm or 0.25") to represent the distance between the panels on the real car.

Underbody

Use a shell modifier or something similar to give panels like the hood and trunk the basic thickness necessary. Real hoods and trunks have an understructure bolted on that has some thickness to it, so it'd be wise to roughly represent that (the details will be done in the normal map). Optimize this area by terminating control edgeloops (since the bottom of the hood doesn't need to look as smooth as the top). Also flatten out/remove features like minor hood creases that shouldn't be part of the understructure. Doors are a bit more complicated. Look at photos of a real car door and door jamb to get an idea of how to do it. There are usually rubber seals running around the perimeter of the door and/or the door jamb.

Depending on the construction of the car, it will be either a unibody (monocoque) or body-on-frame. In the case of the former, continue the geometry of the now panel-less main body to form the various understructures, like the front inner fender, radiator support, trunk interior, floor, etc. Always closely consult photo references. These can be found by searching for things like "<car name> build" or just browsing auto enthusiast websites.

If it's body-on-frame, model the frame. Again, this will depend on what the real vehicle's frame looks like. Generally, a frame will be two C-rails or box rails with several crossmembers.

Once the frame and/or underbody in the general vicinity of the suspension is modeled, the suspension is next. Consult photo references and place ball joints, hinges, and whatever else is necessary in the place they should be. Then model the other components like control arms, tie rods, spindles, and brakes. Always pay close attention to clearance (both with the wheels and the rest of the car).

These underbody components (and the general underside of the vehicle) should have much fewer polygons than the exterior, since they're seen less and more difficult to model accurately.

Unwrapping

The next stage, once everything is modeled, is to unwrap the vehicle. Automatic unwrapping won't do much good here except create a bad, messy UV layout. It's good to unwrap it part by part and work through the vehicle slowly, as the number of parts can be very overwhelming. Sometimes it's good to unwrap things as they're modeled.

Symmetry seams are good for saving space, but bad for clearly visible parts like a hood or trunk. Use discretion. Underbody parts are great to map only half of to save space, but don't do that with the hood or grille. Also, in the case of a symmetry seam, it's necessary to "fold" symmetrical UV islands in half. Which is to say, select half of the UV, detach the selection from the main UV, mirror it by scaling it by -1 along an axis, and line it up with the other half. Otherwise, the normal map won't display correctly.

Any underbody part, like a suspension component, the underside of a body panel, or the frame, should be scaled to about half of the texel density of the outer body shell. Again, these parts are seen less often, and it's better to use the UV space to make the panel bevels, eventual dirt, and lettering higher-resolution.

UV map with seams wherever there are hard edges - this is where normal map bevels will be used to smooth out those edges.

Very important: Map the lights to a separate map! They need their own glow maps and damage maps, and shouldn't be on the same map as the rest of the vehicle. The same goes for glass.

Pack everything in a way that's efficient. The official BeamNG vehicles use different texture sizes depending on the size and complexity of the vehicle. For example, the Ibishu Covet uses a 1024x1024, the Gavril Grand Marshal a 2048x1024, and the Gavril D15 a 2048x2048. It's also good to texture at double resolution. Fine details will show a lot better on a texture that's been downsized versus one that's just had the details painted on as-is. Thereby, BeamNG only supports GPU compressed textures formats (like .DDS), with a power-of-two resolution larger than 16 pixels.

Normal Mapping

The next step, before baking AO or anything like that, is to finish the normal map completely. Start by baking a white diffuse map with no padding. This is basically a perfect outline of every UV island. Open this bake in an image editor and use it as the mask for a white layer. Duplicate this layer so there are 3 copies: one with the selection expanded by 1 pixel, and one with the selection contracted by 1 pixel. Run each of these through a height-to-normal filter and overlay them on each other. This makes for a nice, strong, 3-pixel bevel. Erase it where it's not needed, like on symmetry seams, or seams in the middle of smooth surfaces that were created out of necessity.

After the bevel pass, create the various underbody details - cutouts, bolt holes, structural members, etc. There is a lot one can do in an image editor without ever baking any normals from a mesh. Simply by running a normal map filter and then blurring, overlaying, or otherwise manipulating, one can effectively "model" in the image editing program. All of the underbody details on the official BeamNG vehicles were created this way.

Ambient Occlusion Baking

Once the normal map is completely finished, with all of the various details added, AO can be baked with the normal map applied. In the case of 3ds Max it's a matter of adding it to a "Normal Bump" map in the Bump slot of a material. It's good to increase the intensity to 2 or 3 so the details show more strongly. Space all of the separate panels apart, so it doesn't create a huge black hole when they separate, then bake the AO. It might need some adjustment afterwards when blended into the texture in order to not overdarken things.

Final Texturing

When the normal map is finished and the AO is baked, the diffuse and specular maps can be created. It can be nice to add a subtle layer of grime (invert the AO and use it as a mask for a brown layer). Don't overdo it, as there will be a dynamic dirt system added to BeamNG eventually. Any part of the car that can be coloured should be black in the diffuse map. There will be a separate color map used to mask such areas, which will be colored by the game engine. These areas should also be black on the diffuse map's alpha channel (since the color map fills them in). Any AO or grime that's covering the colorable areas should be lighter on the diffuse alpha, so that it actually shows up.

The color map should be all black except for the areas that should receive body color, which should be some specific shade of gray. Tune it for a nice balance between reflectivity and color strength.

The lights should be done in a similar way, though there's generally little normal map detail needed beyond basic bevels (and bulbs in some cases). A glow map should be made, as well as a set of damaged textures. Take a look at the official ones to see how they're done.

The way materials in Torque3D work can seem counter-intuitive. Chrome (or any kind of reflective material) effectively works by covering up a base reflective material with non-reflective pixels. So the alpha channel of the diffuse map should be something like an inverted specular map. The darker the color, the more reflective it is. It would be best to use an official BeamNG vehicle's materials as a template.

Glass is tricky to get looking right because of the way T3D materials work. We've found it necessary to have an extra "_da" map in order to achieve the desired transparency and reflectivity. It's difficult to explain how or why it works, so it's best to just look at the official BeamNG glass textures.

Vehicle Creation
Get started: Introduction to Vehicle Creation
JBeam
Overview
Physics
Dynamics
Visuals
Extras
Upkeep
Deprecated
See also: JBeam ExamplesJBeam Physics Theory