Material Manager [2020-01-21]
Introduction: The goal of this wiki is to help bring a better understanding of how the material manager works. A ‘material’ is a 3D file type .mtl where a 3D object’s visual properties such as specular, glossiness, how reflective it is etc. The material’s properties will dictate how the object will visually react in a 3D environment. One factor to consider is different .HDR (high dynamic range) images are used to help light the scene will have different lighting effects on the objects based off their materials. See https://vpinball.com/wiki/visual-pinball-knowledge-base/table-and-environment-lighting/
Visual Pinball’s Material manager:
To open VPX’s material manager, select ‘Table’ menu from top menu bar then select “material manager” or press ‘F4’.
The material manager is essentially divided into two sections, the table’s list of materials on the left, and material properties on the right. In between is the ‘in-use’ check list, this let’s you know if the material is currently in use on the table, however you should note that it will not register as ‘in-use’ if there is some function in the table script that calls upon the material to be used only in specific instances such as a material swap. On the far right side there are the options to ‘Add’ new material, ‘clone’ existing material, ‘import’ a previously made material from another table ‘export’ material to be used on another table, ‘rename’ the material and ‘delete’ material.
A quick overview:
The material manager itself has some brief explanations of each variable, let’s take a look at them (see image above).
Base color: “Steers the basic color of an object. Wrap allows for light even if object is only lit from behind. 0 value = natural” I’m not entirely certain what exactly the ‘wrap’ value does but from what I can gather it tunes how the color (or image/texture map) is lit even if it is only lit from behind. The Base color option can be useful for adjusting color variation on the table from something as subtle as minor tint to full bright color change. Many 3d objects can be rendered as grey and then colored using the material manager in this fashion provided the entire object can share the same color as there can only be 1 color per material.
Glossy Layer: “Add subtle reflections on the non-metal materials (leave at non black for most natural behavior) See “Glossy color range” further down this page. Essentially the color range controls the intensity of the glossy effect.
Shininess: “Sets from very dull (Shininess low) to perfect/mirror-like (shininess high) reflections for glossy layer or metal only) This controls how bright and how concentrated highlights/reflections will be. So it should be noted that how the object reflects the environment image is actually effected by both glossy layer and shininess (I think this can be a bit counter intuitive for many people). (values Lowest 0.1 – 1.0 Highest)
(Personally I’d prefer the amount of reflection were a separate variable like it is in 3d software but in VP it has been bundled into the glossy/shine effect – it works but would allow more tuning if it were a separate variable).
Clearcoat layer: Adds an additional thin clearcoat layer on top of the material. This is controlled by color range as well. Primarily used for really shinny/high gloss plastic toys (0,0,0 black = no clear coat, 255,255,255 white = strongest clearcoat). Any highlights produced by clearcoat can also be tinted what ever color you wish but generally is kept to a shade of grey.
Edge Brightness: Dim’s the silhouette “glow” when using Glossy or clearcoat layers (1= natural, 0 = Dark).
Opacity (will be modulated by image/alpha channel on object. This is for the fine tuning of transparent objects, typically plastic ramps.
Adjusting Materials in a comprehensive way requires some understanding of real world ‘materials’ as well as how VPX material properties work. At first the VPX material manager can seem rather counter intuitive as it can be hard to tell what impact each of the values have on the 3d object(s). An easy way to fine tune and adjust materials on the fly while seeing real time results is to use the ‘material debugger’.
See Material debugger page: https://vpinball.com/wiki/visual-pinball-knowledge-base/material-debugger/
Note that in order to ‘debug’ a material it must have already been created in the material manager and applied to the appropriate (dynamic / non-static rendered) primitive/3D mesh.
Lighting variables in a 3D material:
Let’s briefly discuss how lighting and materials work in 3D. In 3dsmax as well as other 3d software the main two material values are ‘specular’ and ‘glossy’ or ‘glossiness’. Specular controls how bright highlights will be on the surface of a 3D mesh while glossiness controls how concentrated those high lights will be. To illustrate this see the image below, there are 4x 3d sphere’s rendered with the same grey colored material as well as the same ‘specular’ level however the sphere furthest to the left has very low glossy while the one furthest to the right has a high glossy value.
Note how as the glossiness increases the highlights on the sphere become more concentrated. (Image rendered in 3dsmax)
Low gloss <——————————————————————–>High gloss
How does this translate to VP’s material manager? Well VP kind of combines both specular and glossy together a bit so this is part of what initially confused me when I first started with the material manager. Essentially Specular = shininess in VP and glossy is still glossy in VP however there’s more to it. Shininess will control how bright highlights are on 3d objects however it can also control how concentrated the highlights are. At a low value shininess will create less concentrated highlights (0-3 value) and at high values will cause the highlight to be more concentrated (8-10 value). I personally don’t like this all that much since it doesn’t give as much control over how the material looks as 3d software can but for all intents and purposes it does work fairly well.
To demonstrate this lets observe in VPX:
In order to achieve a similar effect in VP, one base plastic material was made then cloned four times, the materials all have the same base color and the same ‘shininess’ level of 0.75 but the glossy layer is increased for each iteration of the sphere. However it should be noted that in the case of the glossy layer it is not the number value that has the most effect on the material but rather the color selected.* The value for “Use Image (0.1)” actually has little effect on the materials appearance, I believe it controls how much the environment map is supposed to effect the material (need citation) but from my observations it only has subtle effects.
*Color range values to control Glossiness and shininess values.
As mentioned above the material’s glossiness is not primarily controlled by the ‘use image value’ but rather by color range. To demonstrate this see the image below:
Which ever color you select will make any ‘glossy’ highlights that color on your mesh, so typically the color is set to a shade of grey. 0,0,0 black will mean no glossiness on the object where as a value of R: 255 G: 255: B: 255 will be maximum glossiness. As glossy is increased the object will reflect more of the table’s environment image. Where ever there are white highlights from the glossy layer, if you change the glossy color, those white highlights will be replaced by which ever color you choose.
Shininess: Is not controlled by color range but rather by number value (0.01 – 1.0), this further controls how intense highlights are as well as how intense env reflections will be. To demonstrate see image below:
To make this aspect clearer, I made a 2nd set of spheres with a similar plastic material except I changed the base color to black. These materials all use a max glossy value (255,255,255) but use a range of shininess from 0-1. We can observe from this that glossiness requires shine to help steer it’s effect and vise versa. Note how the spheres on the right have smaller, more concentrated highlight and are reflecting the environment image more clearly. The environment image can have a dramatic effect on 3d object’s reflections/highlights and general lighting, to demonstrate this see the image below:
These (above) are the same spheres with the same materials, however the env image has been changed to ‘overheadvpx2’ from the standard env image that comes with vpx. Note the dramatic difference in highlights/reflections.
Clearcoat Layer: This is fairly self explanatory and evident once applied to an object in vpx. This adds a thin clear coat layer on top of the material. Works very much like how you would expect, adds additional shine you would get from adding a clear coat to an object the same as in real life. The clearcoat is controlled by color range, so black 0,0,0 will turn the effect off while white 255,255,255 will give it it’s maximum intensity. You can also change the clearcoat color so that any highlights that would be produced by the clear coat will be the color you set instead of white.
Edge brightness: (values 0.01 – 1.0) “Dims the silhouette or “glow” when using glossy or clearcoat layers (1 = natural, 0= dark). Basically when you use clear coat or glossy, as you know it creates highlights, often those highlights take place along edges of objects which some times will create an unnatural or unwanted look. The edge brightness option is simply to fine tune edge highlights. Although it says 1= natural and 0= dark, there are instances where the opposite maybe true, where the glowing out lines of a mesh look unnatural and need to be toned down.
Opacity: (will be modulated by image/alpha channel on object). <–What this means is transparency will be controlled by the transparency of your image (texture map) and or alpha channel transparency of the image. With these options it’s possible to fine tune transparent objects, you can take an object with no transparency in it’s image/texture map and give it transparency or take an object with too much transparency and make it more opaque. Basically this section is for fine tuning transparent objects, most typically plastic ramps. Generally it is recommended you apply the majority of your transparency in the texture map image and only use these variables to fine tune.
Amount: Values 0.00 – 1.0: 0 = almost invisible*, 1 = 100% opaque [enable ‘active’ checkbox]
*Almost invisible except for what ever reflections are still picked up on the object based off glossy/clearcoat/shine/ but also the edges will still be visible unless ‘Edge opacity’ is also reduced to 0. (see image below)
Edge opacity: controls the opacity of the edges of the object.
Thickness: For tuning of transparent objects with varied thickness, typically used for the fine tuning of plastic ramps.
Enable ‘metal’ material checkbox. This will disable glossy and increase metallic reflections, which are more distinct and clear than plastic/glossy reflections. In the case of metal materials you are typically only adjusting ‘shinniness’ and perhaps color tint. Metal generally doesn’t have a clearcoat and in the real world is never transparent so we can generally ignore those unless trying to create some kind of special effect. See image below for some examples of the metal material in use. From left to right the shininess is increased, you’ll note the highlight becomes stronger. The furthest to the right on top has its base color changed to red and the one below it is a magical invisible metal ball. Also note how the metal ball with no shine looks dull while the one’s on the right progressively take on a chrome look.
Note: You must ‘enable’ metal material from material manager, it cannot be done from material debugger.
How to approach materials, a real world vs virtual discussion:
When ever going about setting up new materials for your 3D objects it’s important to consider how they look and react in real life. Some material basic concepts are specular/glossy/reflection/dullness, it’s important to keep these in mind when considering how to best emulate your virtual objects in a 3D environment to achieve the most realistic results. Please note that while I discuss these terms I’m referring to specular and glossiness as I would in 3D software to describe how highlights/reflections etc are effected (see first image on the top of this page).
Metal objects are generally either dull with low specular(shine)/reflection and little to no glossy. Metal can be polished to reach almost a mirror-like finish but even in this case metal has little to no glossy. This is why when you enable the ‘metal material’ option in your material it will “ignore/disable glossy” because this is how metal works in the real world.
Plastics like metal can range from being dull with little to no reflection or glossy highlights, however they can also be polished or made with a smooth finish so they are highly reflective and glossy (lots of smaller concentrated highlights as opposed to dull spread out highlights).
Wood: Wood generally has low glossy, but can be polished to a shine, so it can have high shine, have fairly high reflection but generally has low to medium glossiness (only high gloss when lacquered or a smooth clear coat has been applied)
Stone: Stone generally isn’t used in VP but it’s worth mentioning, it generally has little to no glossiness, no reflection (unless wet or clear coated) and has very low specular/shine.
Glass: Glass has low glossy, medium to high shine (based on how reflective) and obviously can have a maximum of ‘mirror’ reflection.
Complex organic-like objects/table toys such as X-Files Flukeman, Jurassic Park’s T-Rex etc, in my experience you generally want to keep the glossiness and shine values fairly low to keep the objects looking natural. The reason for this is because a complex object with lots of detail may pick up excessive amounts of highlights when compared to more basic objects. If you have a ‘center piece’ toy like the ones I mentioned above, I recommend waiting on fine tuning lighting/environment until you have them in place. Personally I try to make sure the models will look good on the table while trying a variety of env maps before fine tuning the materials of the complex objects then kind of make everything else around it look good from there.
The amount of details and how sharp your environment image (HDR) will have dramatic effects on highlights, especially on complex models. I found that the frequently used ‘overheadvpx2’ HDR map has lots of details, high contrast and produces good highlights for plastic ramps, however it’s too much for most complex models. On the Jurassic Park table for example when I tried this env map it caused lots of jaggy looking highlights on the Trex, the solution to this was simply to add a slight blur to the env image. I recommend taking some time to try a variety of HDR images for env maps and playing with the variables to see what you can get out of them, also you can edit the images to try and get specific results however this can be a bit tedious. Flupper used a method of coloring an env map to determine which parts of the env map were effecting which parts of the table. I also used this method on Jurassic Park, and although it’s not entirely accurate or precise it does give a pretty close idea of what highlights land where. I’ve spent hours and hours just experimenting with env maps trying to get various results.
After you’ve spent hours and hours playing with env maps you can also spend hours and hours experimenting with the material debugger. I recommend every table author spend a few hours playing around with the material debugger to become more comfortable and familiar with how VPX materials work.
As I mentioned previously, VPX kind of bundles a few material variables together and because of this it’s typically not possible to import a .mtl directly from a 3d software into vpx. What I mean is, you can in-fact import .mtl but it won’t work how you’d expect, it will not properly translate all the 3D material variables into VPX, it will just do it’s best. So generally you want to make a new material in VPX or clone an existing one then customize it from there. Of course once you have a vpx material collection they can be exported/imported for future re-use.