Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds glTF plugin #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Adds glTF plugin #1

wants to merge 1 commit into from

Conversation

AurL
Copy link
Owner

@AurL AurL commented Apr 5, 2018

Summary

Allows to read and convert a .gltf file with it's .bin file and images to an OSG scene. You will need to install or reference JPG and PNG libraries to OSG when building in order to get the textures paths included in output file.
(Note: it also supports .osgb files but embedded textures are not supported at the moment)

Convert from glTF to OSG

The osgconv binary can be used for convert from glTF to OSG.
Example: osgconv file.gltf output.osgt

Features supported

Supports all common glTF features including PBR materials (metallic/specular), animation, skin and morph. Spare accessors and more specific features are not supported.

PBR Materials

PBR materials are not supported in OSG, so their parameters are added as metadata in the corresponding osg::StateSet.

Example of generated metadata:

Texture metadata

  osg::StringValueObject {
    UniqueID 28
    Name "sDiffuse"
    Value "1"
  }

  osg::StringValueObject {
    UniqueID 30
    Name "sMetallic"
    Value "7"
  }

Factor metadata VEC3 glTF factors are split into two different metadata Color and Factor. For diffuseFactor, it's split into DiffuseFactor which is the R of diffuseColor, DiffuseColor which is RGB and OpacityFactor

  osg::StringValueObject {
    UniqueID 16
    Name "DiffuseColor"
    Value "[1, 1, 1]"
  }

  osg::StringValueObject {
    UniqueID 19
    Name "EmissiveFactor"
    Value "0.7"
  }
  osg::StringValueObject {
    UniqueID 17
    Name "DiffuseFactor"
    Value "1"
  }
  osg::StringValueObject {
    UniqueID 20
    Name "MetallicFactor"
    Value "0.9"
  }

Other values correspond to the remaining values defined in glTF materials (alphaMode, doubleSided etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant