lovr.graphics.newModel

Edit

Loads a 3D model from a file. Currently, OBJ, glTF, and binary STL files are supported.




Arguments

NameTypeDefaultDescription
filenamestring The path to model file.
optionstable Model options.
.mipmapsbooleantrue Whether the textures created for the Model should have mipmaps generated.
.materialsbooleantrue Whether the textures and materials in the Model should be loaded. When false, the model will use the material set with Pass:setMaterial, although it will apply to all nodes.

Returns

NameTypeDescription
modelModel The new Model.

Arguments

NameTypeDefaultDescription
blobBlob A Blob containing 3D model data.
optionstable Model options.
.mipmapsbooleantrue Whether the textures created for the Model should have mipmaps generated.
.materialsbooleantrue Whether the textures and materials in the Model should be loaded. When false, the model will use the material set with Pass:setMaterial, although it will apply to all nodes.

Returns

NameTypeDescription
modelModel The new Model.

Arguments

NameTypeDefaultDescription
modelDataModelData An existing ModelData object to use for the Model.
optionstable Model options.
.mipmapsbooleantrue Whether the textures created for the Model should have mipmaps generated.
.materialsbooleantrue Whether the textures and materials in the Model should be loaded. When false, the model will use the material set with Pass:setMaterial, although it will apply to all nodes.

Returns

NameTypeDescription
modelModel The new Model.

Notes

Currently, the following features are not supported by the model importer:

Diffuse and emissive textures will be loaded using sRGB encoding, all other textures will be loaded as linear.

Loading a model file will fail if the asset references textures or other files using absolute paths. Relative paths should be used instead, and will be relative to the model file within the virtual filesystem.

See also