I hate finding out about these kinds of bugs late in the beta. But this one was pretty big.
X-Plane uses a “metalness” material model. Metalness is a fairly standard material model that recycles the albedo of your material to implement both dialectrics (non-metals) and metals. It works like this:
- Non-metal: diffuse light is tinted by the albedo texture. Specular light is not tinted.
- Metal: there is never diffuse light. Specular light is tinted by the albedo texture.
In other words, since metals don’t have a diffuse component, we recycle the albedo to save texture space.
The bug in 11.05 is that for a pure metal, the albedo was tinting ambient light but not the sun itself. A third party developer sent me a test model that showed the problem – here’s the before and after.
That weird set of colors on the top of the helicopter body is due to the white sunlight being added to the red body. The red aircraft body is lit by ambient light reflected directly off of the environment. The runway stripes are not visible because the metal is about 30% rough, diffusing the reflection.
(One of the confusing things about PBR models if you are not used to them is that the environment itself can cast both diffuse light and specular reflections off of a material, and if the material is rough, it can be hard to tell them apart. Diffuse light is always widely diffused, no matter how glossy the surface.)
Alex and I took a look at some of our legacy aircraft and found that fixing the lighting didn’t make too much of a difference for metals that are not tinted.
Since our aircraft don’t have any “tinted” metal there isn’t much change. Note that in real life heavily tinted metals aren’t common. The cases you might have are:
- Approximations of metals with complex spectrum-dependent fresnel like gold.
- Composite paint, e.g. like for your car, with fleks of metal and translucent dielectric polymer mixed together – that’s the case where this really helps.
As I wrote this up I realized that the spot lights are still wrong in beta 8 – they’ll be fixed for RC1 unless people really need the old model, in which case we’ll have to put some versioning in. My guess though is that anyone doing composite paint realized it was impossible in 11.05 and hasn’t shipped anything like that yet.
In these comparisons we are under an airport light viewing various materials. In the multi-color case the bottom row of materials are various “metals” with light tinting to simulate copper, iron, gold, etc.
In the second set of cases (all red) we have a 2-d grid: metal on the bottom, dialectric on top and rough on the left and glossy on the irght. Note that the reflection of the overhead light is reddish for the metals and white for the plastics in 11.10 (correct) but all white in 11.05 (incorrect).
30 comments on “Heavy Metal”
did something change in 11.10b8 with VRAM management ? For some reason since b8 I’m starting to hit my VRAM limits 8GB really easily. Sitting at my home airport with default 737 I used to get about ~5GB usage now I’m at 7.3. Throwing more demanding model and some weather/traffic into the mix pushes it over the limit and FPS goes to drain. I do have some orthos around my home airport but I’ve had the same ones for 8 months, never noticing any issues but since b8 I’m hitting the VRAM limit very often. When installing b8 a couple days ago I also installed newest nvidia drivers 388.31, those are the only 2 things that changed but since then it seems to me that I’m getting 20% more VRAM usage than before for some reason.
Nothing changed in b8 with VRAM managemement.
I’m seeing this as well…but it’s not showing up in a fresh install of 11.05 vs 11.10b8 on linux. As far as I can tell, that must mean it’s 3rd party related (ortho, airports, etc.). I went from comfortably handling my regular airports to nailing 16 gig and beyond (e.g. reboot button because swap space is lame). I’ve scaled back graphics settings for now until I find something that can be documented in a bug report…
Does this mean that not all lights (sun vs. spill in this case) are handled with the same energy conservation rules in the PBR model? If the material albedo is working for one source, why not for all?
There’s no energy conservation bug – the PBR energy conserving model is used eveywhere, and was used in 11.05.
We do have a bug in that the reflection off metals was wrong:
– 11.05: right for ambient world light, wrong for sun, wrong for artificial lights.
– 11.10b8: right for ambient world light, right for sun, wrong for artificial lights.
– 11.10r1: right for ambient world light, right for sun, right for artificial lights (coming soon).
The reason for the difference is that the shader code has separate cases for separate light sources…this is an artifact of the implementation of the rendering engine.
This is a tinting bug but not an energy conserving bug because the splitting of energy to conserve the budget (between the specular and diffuse bin, and conservation of specularity across roughness) are both correct. It’s only a question of whether the metal is modeled to emit a full spectrum or partial spectrum.
A side note on metals: apparently the REAL physics of metals is that they absorb ALL of the incoming photons, surface electrons do some stuff that is well beyond my pay-grade, and _new_ photons are emitted. One of the funny properties of this is that the energy in a given frequency band might be _higher_ for outgoing photons than the energy in the _same_ frequency band for incoming light. In other words, the frequencies are “mapped” and can be concentrated. TOTAL energy is conserved, but not energy in a given frequency band, where we can have positive gain.
IF we wanted to model this in X-Plane, we would do so by having an albedo with one channel > 1.0 (and the others < 1.0); in practice, I haven't seen any cases where this is a really good idea, so we never provided access to it. The real reflection model of metals is angle and frequency dependent, and thus creates much more complex reflections under movement. LACKING that shader, cranking up one of the channels would, in practice, just look silly.
This funny “mapping” which you describe is actually nothing but what is called fluorescence (and there may be a much more well-known example sitting on your desk in the form of a highlighter). In many cases the preferred outgoing frequencies are in the visible gamut but out of the sRGB gamut (that’s why they look so much better in real), so not having them in X-Plane, or in anything that needs to go through a screen, is surely not a bug 🙂
The more I work on graphics, the more I feel that the @#$@ LCD screen itself is the bug. 😉
Wha…?? you mean the PBR engine doesn’t actually keep tabs on all the red, green, and blue photons in the universe?? 🙂 I am now connecting the dots on your initial reference to gold. It is a unique situation as metals go but I imagine only those who own oil fields will need to worry about that aspect of aircraft exterior decor. And if the reports from Groom lake are anything reliable, you’ll need to write a new shader if plasma-wrapped surfaces become a thing.
On the red helicopter example: Somehow I feel the truth is in between both, beause the brighter a color is, the less saturation the eye can perceive (the same is true for very dark colors) (that’s what the L*a*b* color model suggest to me). Maybe it’s foto-realism in its true sense: If you make a photo of your (let’s say blue) car with metallic painting, the brightest spots always look like white, rarely like blue. OK, maybe the left example with the helicopter has too much “white light”, but the right one lacks some (IMHO).
So while the computation may be physically correct, the visual result does not seem to be (as long as monitors display bright red as saturated red).
The effect of ‘blowing out’ bright colors to white is something we’d model in post-processing, e.g. when mapping the high dynamic range render to an LCD monitor – it’s not part of the material model itself.
Does this mean we’d be able to use something like a HDR TV as a monitor, and use the whole range?
Not right now. We don’t support rendering to a _final_ HDR surface. Some GPU vendors have done some experiments with this…if it ever became standardized we’d look at it. (E.g. for example, we’d look at having our tone mapping use less ‘squashing’ for a direct-to-HDR surface.)
Is there / is there going to be documentation on how to achieve the various PBR and metalness effects in textures, Ben?
I just checked //developer.x-plane.com/docs/aircraft/ and this topic seems to be absent. I’m looking for something that really drives to the basics, starting with a plain old texture for an aircraft object and moves on from there. Windows and Mac tools. Step by step. All the gory details, for the complete noob, so steps are not assumed to be understood. 😉
Probably not in that much detail because the texturing technique is _not_ unique to x-plane. So I expect to document the x-plane properties and options, but we’re not going to teach you “how to make your metal prop look real” any more than we teach “how to make your leather seat texture look plush and oily”. Note that you can use a tool like Substance Painter 2 and it’s fairly WYSIWYG.
I understand if LR doesn’t want to teach. However, if the technique is not unique, then there should be links to online learning resources provided. People shouldn’t have to figure out how or where to learn if they are willing. Tools like Substance Painter are not cheap if one is not a student or a teacher.
I see LR going out of their way to support Blender, a freeware application (with BIG headlines, too 😉 ). Similar support for Gimp would be appreciated, or perhaps Photoshop, when it comes time to do the supporting artwork. More common tools, in other words.
Not dingin’ on you, Ben, but adding nifty features like you’re adding is pointless if only the more experienced texture artists have a clue what the heck you’re talking about. I enjoy extending X-Plane with plugins. I’d also like to up my game in aircraft creation, too. Thanks!
Wait – let’s be clear about the difference between “supporting photoshop” and “supporting Blender.”
In the case of Blender, we have to go and create a thing (the export plugin) to connect Blender to X-plane. So we do that and we provide a _lot_ of support for how that component works – it’s ours and no one else is going to explain it.
We don’t tell you how to use NURBs in Blender. Once we give you Blender, regular tutorials on modeling from the Blender community are what you’d use.
Similarly, Substance Painter 2 – we have an export preset, and I’d like to publish it so everyone can use it. Then using SP2 is your problem (and there are great tutorials) but we provide the link from their world to ours that only we can do.
That’s fair, and a perfect parallel. I’ll look forward to that, then. Thanks!
I just started learning SP2 and getting Ok results.
Looking forward to an export preset to use for x plane
An export preset for SP2 would be amazing !
So, Steve, you basically wanted everything for free?…
There’s a reason it’s called “artwork”… Proper texturing is an art. I have dwelled into it but quickly realized it would require a significant amount of effort from my part to do it properly.
Maybe that’s why some people make a living out of this?
If you’re not willing to put the time, effort (and money?) into it, maybe you should leave it to the professionals?
Wait what??! Bruno, Steve’s entire request is for documentation/instruction so he can make stuff…I think you totally misunderstood his post.
Indeed. It would be nice to use freeware tools, but Ben is correct. And I am willing to put in the time, money and effort to learn, if need be. I own a number of pricey payware tools already, and have attained the pro level in terms of plugin development.
X-Plane has never been better when it comes to producing the sorts of things sim enthusiasts want and need – either in the sim or to help develop products for it.
Documentation has never been X-Plane’s strongest suit, but as a developer myself, I know that after the gee-whiz fun of getting something to work as intended, writing the docs is rather anti-climatic.
I can see projects on my near horizon where it will be good to be able to develop realistic metal surfaces. So I’m being pro-active and want to find the best sources to learn the nuances of X-Plane development. The old school approach of bang-your-head-into-the-wall and trial-and-error might be fine for amateurs, but aren’t exactly cost efficient for someone with a livelihood to maintain. 😉
Not sure how I missed the point.
Documentation/instruction is generally “payware”… There are “payware” classes on texturing/using Photoshop or what have you.
I read Steve’s post again and my opinion holds. Steve asks for links to documentation or tutorials for these tools, etc. We live in the age of the internet, where there’s a lot of knowledge available for free, but this is a privilege, not a right. There used to be a time when people had to pay for classes for whatever it was they wanted to learn… Be it playing a musical instrument, painting, or even… texturing and making 3D objects.
I wouldn’t even be surprised if LR provided its API’s and documentation for a fee. Expecting to have LR’s support on how to do bump/specular mapping, etc, is beyond me, unless if it’s different from “standard procedure”, as you mentioned…
Maybe there was a language barrier here somewhere…
“I wouldn’t even be surprised if LR provided its API’s and documentation for a fee.”
We have ABSOLUTELY NO INTENTION of making access to X-Plane, both getting the SDKs and accessing the docs to them, pay-ware.
We _want_ people to make stuff for X-Plane – it would be very short-sighted of us to put a pay-wall in front of this.
This is where that line between general technique and platform docs comes in. There are indeed both payware and freeware educational materials on very general tools like photoshop.
But for platform specifics, whether it’s using the Mac API, MSDN, coding for SteamVR, or writing the x-plane plugin, the norm in the industry is clearly that platform access is free when the platform provider’s goal is wide adoption.
My post was couched in the well known X-Plane paradigm of wide reaching, free support for freeware/payware development.
LR provides Planemaker for just that purpose, along with everything else, all the free (open source) tools, support for plugins, the SDK… the list goes on and on. To use these tools and to take advantage of all of the goodness X-Plane provides, one needs docs. And I did pay for it, sortakinda, when I bought X-Plane. 😉 I continue to pay for it by providing assistance to others in the community, and I support it by developing products that expand the appeal of the sim.
I would doubt we have a language barrier thing, but perhaps a misperception of the world of X-Plane or perhaps even cultural bias applies. Hard to tell, when we all come from all points of the compass to this happy little spot on the web. No harm, no foul. I know where I stand. 🙂
Steve, keep in mind that I wrote my reply before I read your reply that was still waiting for moderation, where you said:
“That’s fair, and a perfect parallel.”
And my reply was in line with this, because it wouldn’t make any sense for LR to hold everyone by the hand and teach everyone to do texturing in common tools that are used for artwork in any platform.
Maybe I couldn’t express myself properly but basically I was echoing what Ben said next. It’s perfectly fine to expect support for X-Plane specific processes to get stuff in the sim. For everything else, “we” have to do “our” homework.
I have this point of view on the lack of documentation:
People probably will just copy the settings of any existing plane or part with the desired properties; so they don’t have to understand how it works (at least not in detail)… So far, so good, but it keeps the variations low, and possibly bugs may not be found early using this approach (If everybody does the same thing, only that has to work)
So: Documentation inspires creative power!
(And from my personal point of view: Sometimes developers find their own bugs once they start to document how things (should) work ;-))
This is now Off Topic but I have a question about VR integration. Will there be a possibility that the plugins in VR are visible. It is especially about online flying. That one sees the chat window with the ATC in the glasses.
Legacy plugins definitely will not be.
I’ll look into plugins that can adopt the new 3.0 APIs for windows.
Comments are closed.