A number of users have commented that the X-Plane 930 betas looks “shinier” than before. There are actually two separate features going on :

  • Separate specular hilights. Specular hilights are bright areas on the plane that simualte the refelction of the sun on a shiny surface. X-Plane has had specular hilights for a while (available by the “shiny” check-box in Plane-Maker or ATTR_shiny_rat for an OBJ). What’s new is: while previously the hilights were modulated by a texture, they are now independent of the texture. This change means that even a black surface can look shiny now. Before the black surface would “tint” the hilight black, making it invisible. Now we can have a white hilight on a black surface for a glossy look.
  • Per-pixel lighting (when shaders are on). Before the lighting calculations were performed on each vertex on a model, then the color from the lighting was interpolated. The problem with this is that if there is a very local lighting effect (like a specular hilight) that is smaller than one triangle, you can’t see it (since we can only see the lighting at far apart vertices). With 930, the lighting calculations are done per pixel, making the lighting effects look smoother.

Here we have the default 747, as of 922. It’s a little bit tricky to tell what’s going on because the texture has been painted to look like there are lighting effects. But the white “specular hilights” on the engine nacelles are due to the sun position. Lighting is per-vertex and specular hilights are not separate.

Next we have the same plane in 930 without shaders:

Note the increased brightness on the nacelles and fuselage. What’s happening is the hilights are no longer modulated by the texture, so they show up a bit more.

Finally, the plane in 930 with shaders. Now the hilights look smoother and much brighter. This is because the hilights are calculated on a per-pixel basis. Note how the hilights are small – smaller than the triangle size on the engines. We didn’t get the full “glare” effect before because the brightest part of the hilight did not land on a vertex at all, and was thus never seen.

Note that the change in specular hilight handling (moving to separate specular hilights) is a bit of a compatibility break. Previously authors could count on not having specular hilights on dark parts of a plane, even if they set the plane to be shiny.

I am not sure how we will ship the final version of 930. I have received very few (none, to be exact) complaints about dark surfaces appearing “too shiny”, and a lot of users like the new shiny look.

The alternative to the current scheme (specular hilights are separate by default) is to have this be a selectable feature. Older planes would look the same as they always did, but planes would have to be modified to make them look truly shiny.

About Ben Supnik

Ben is a software engineer who works on X-Plane; he spends most of his days drinking coffee and swearing at the computer -- sometimes at the same time.

9 comments on “Separate Specular Hilites and Per-Pixel Lighting

  1. specularmaps 🙂 giving control to the plane builder,…not only about surface-roughness (by intensity) but also about the kind of material (plastics have highlights showing the color of the lightsource (sun), while metals tint highlights with their own base-color. all this could be achieved with a texture. the intensity of the pixel on this texture would give the intensity of the highlight and the color of the pixel could be multiplied with the lightsource to tint the highlight for interesting (metal-like) results.

  2. I need to answer KRZ’s comment first for this to make any sense:

    KRZ – yes, specular maps are coming…I am not sure what the precise format will be — tinting the specular hilight arbitrarily may not be an option. (For example, consider a normal map where the RGB channel is used for normal deflection.) But…at this point this is more like a 940 feature.

    Another map layer for OBJs gets us closer to a more formal “materials” model, which is pretty non-trivial.

    AWC: I would say that both options are not quite equal. (Remember that I am thinking long term here, when we _do_ have per-pixel gloss control via a gloss map.)

    – Separate specular is definitely useful!

    – Non-separate specular I think is only useful for compatibility purposes.

    So I would only want to provide the option _if_ we have a compatibility problem here.

    If there isn’t a compatibility issue (e.g. in general most people can live with having their models be “relit” by the new separate lighting scheme) then avoiding the option and having only separate specular means one less combinatorial option in the material model in the long term.

  3. I can’t tell from this post–in either approach, would an author have the option to turn “shiny” off entirely? I can think of some cases in which matte might be preferable (stealth aircraft come to mind).

  4. DaveDuck – yes, in all approaches, including 922 and 930 as they are now, the author can turn shininess (that is, specular hilights off).

    In plane-maker it is a boolean setting (“plane is shiny”) – in an OBJ it is an ATTRibute, with a ratio from 0 (not shiny) to 1.0 (max shiny, matching plane-maker).

    cheers
    ben

  5. i think the beta spec is much better than the 9.22, although metal material specular takes on the colour of the diffuse colour, so the older system should in theory be better. However most planes are painted with paint that is only slightly metallic and as sun light reflection is extremely bright it usually ends up burning out to white even on dark metal surfaces.

    I know you have mentioned on this blog before to maybe move to high dynamic range lighting system which would improve the tinted specular hugely. Have you ever tried to implement environment maps in X-Plane? I don’t mean a live lookup like the water, but just a static 360 image (i suppose it would have to change through a few different ones based on some presets of weather and time) along with a bit of fresnel effect it would really add more interesting shading, especially when the aircraft isn’t directly lit by sunlight

    The mention in an earlier comment of normal maps i find an exciting prospect too, I can certainly imagine a plane with separate maps for spec and normals being quite amazing looking, add an environment map and we really could be seeing photorealistic aircraft. (assuming there are enough people making aircraft who have the skills to generate a good normal map)

    I know all this is a massive job to implement and i expect its not a trivial impact on frame rate either.

  6. Looks really nice development. Great work Ben!

    Unfortunetely I can’t seem to get it working. I’ve tried beta3 and 4. In rendering setting I have Pixel shaders turned on. Yet no extra shininess and no realistic shadows gained. 🙁

    I have Geforce 8800 GT 512 Mb (2.0 Nvidia-1.5.36) on MacPro 2.8GHz Quad-core, MacOSX 10.5.6. All Apple system updates are applied. Is my GF 8800 already obsolete or am I missing something here?

    Any help is appreciated.

    Cheers
    Ari

Comments are closed.