Menu

#2738 Material::setShininess() warning not naming the model

2020.4
Done
AC3D (1)
Low
2024-06-08
2022-05-12
No

The OSG warning about shininess value being clipped has no mention of the model file where it encounters that problem, making it impossible to trace it:

    4.96 [WARN]:OSG        Warning: Material::setShininess() of 254 is above permitted maximum, clamping to 128.

Discussion

  • Mariusz Matuszek

    Just tried a quick workaround.

    1st step (using fgdata as an example):

    $ cd /path/to/fgdata
    $ grep -R MATERIAL . > /tmp/materials.txt

    2nd step (quick and dirty Python script):

    with open("materials.txt", "r") as f:
        for line in f:
            try:
                if float(line.strip().split()[19]) > 128.0:
                    print(line.strip())
            except:
                print("PARSE ERROR:", line.strip())
    

    This script will print an error on some unusual material definitions, like e.g. material name having spaces in it, but should otherwise be useful.

     

    Last edit: Mariusz Matuszek 2022-08-03
  • Mariusz Matuszek

    Additional modification, replacing the test with
    if int(line.strip().split()[19]) > 128:
    will catch (as parse errors) shininess specified as non integer values

     
  • James Turner

    James Turner - 2022-08-04

    We can add this script to fgmeta (we have some similar scripts already), but we could also make a patch to OSG (as we have some already) to actuall show the filename.

     
  • James Turner

    James Turner - 2022-08-04

    .. looking at osg/src/osgPlugings/ac3d.cpp, there is this code:
    """
    stream >> shininess;
    mMaterial->setShininess(osg::Material::FRONT_AND_BACK, shininess);
    ""
    ... so we can easily add an OSG WARN there, we know the filename, and we capture the OSG warning stream into the Simgear logs.

    I think it's good when we have both a better runtime error but also the offline script, since different people approach fixing this in different ways.

     
  • Mariusz Matuszek

    One more modification, as spaces in directory names also resulted in false positives.

    if int((line.strip()[line.index("MATERIAL"):]).split()[19]) > 128:
    

    I think it may come handy for bulk inspection of whole directories, be it fgdata or Aircraft.
    Maybe even some sort of automated check?
    James, if you want to add it to fgmeta I am more than happy.

     
  • James Turner

    James Turner - 2022-08-04

    yeah we actual had the idea to automate such checks in the aircraft-hanagr script which creates the zips automatically. It already reports some issues, but only to a local log, so not easily visible: so far we did not find an easy way to get the errors generated bye ach aircraft in front of the correct person/team.

    Anyway, I can add the script, it's a good start.

     
  • Mariusz Matuszek

    Great.
    There is a similar issue (not printing the offending file name) with detected incorrect RGB profiles. Not sure if it merits a separate ticket, as it seems very similar to this one, so I'll just mention it here.

    [WARN]:OSG       /fg_next/install/simgear/include/simgear/debug/OsgIoCapture.hxx:37: PNG lib warning : iCCP: known incorrect sRGB profile
    
     
  • xDraconian

    xDraconian - 2024-06-08
    • labels: --> AC3D
    • status: New --> Started
    • assigned_to: xDraconian
    • Milestone: 2020.3 --> 2020.4
     
  • xDraconian

    xDraconian - 2024-06-08
    • status: Started --> Done
     

Log in to post a comment.

MongoDB Logo MongoDB