petrbroz / svf-utils

Utilities for working with the SVF file format used by Autodesk Platform Services.
https://petrbroz.github.io/svf-utils/
MIT License
129 stars 55 forks source link

File shows up all black, no lighting. #23

Open amichaelcody opened 4 years ago

amichaelcody commented 4 years ago

IMG_9978 IMG_9977 IMG_9976

wallabyway commented 4 years ago

Do you have a screenshot of the model from Fusion Team/A360 Web view (ala Forge Viewer) ?

amichaelcody commented 4 years ago

Annotation 2020-05-01 095816

petrbroz commented 4 years ago

@amichaelcody would you be able to share the original file with us? I'm guessing it could be some issue with mapping the original material's roughness to the glTF PBR material.

petrbroz commented 4 years ago

Ok, so here's what's happening: the material in the original design seems to be completely black (RGB: 0,0,0), with a relatively high roughness. Because of that, the model needs a very bright environment to be lit properly:

Screen Shot 2020-05-04 at 12 21 55 PM

Try modifying the material in the glTF file, for example, changing the RGB to 0.2,0.2,0.2 and roughness to 0.01:

Screen Shot 2020-05-04 at 12 24 31 PM
wallabyway commented 2 years ago

Looks like the prism metal value, is mapped outside the 0..1 roughness range. It needs normalizing?

Screen Shot 2022-02-17 at 11 53 51 AM

Screen Shot 2022-02-17 at 11 55 28 AM

wallabyway commented 2 years ago

The fix:

divide glossiness by 20 and by 60, depending on isMetal, like so...

at line 126 in reader.ts

            roughness: _mat?.glossiness ? ( 20.0/ _mat.glossiness ) : 1.0, // TODO: how to map glossiness to roughness properly?
            scale: {x: _mat?.maps?.diffuse?.scale.texture_UScale ?? 1.0 , y: _mat?.maps?.diffuse?.scale.texture_VScale ?? 1.0}
        };
        if (_mat?.diffuse) {
            mat.diffuse.x = _mat.diffuse[0];
            mat.diffuse.y = _mat.diffuse[1];
            mat.diffuse.z = _mat.diffuse[2];
        }
        if (_mat?.metal && _mat.specular && _mat.glossiness) {
            mat.diffuse.x = _mat.specular[0];
            mat.diffuse.y = _mat.specular[1];
            mat.diffuse.z = _mat.specular[2];
            mat.roughness = 60/_mat.glossiness;
        }        

Reference (LMV)

Screen Shot 2022-02-17 at 7 22 16 PM

Results ( Three.js, Babylon.js, LGLTracer ):

Screen Shot 2022-02-17 at 7 20 02 PM