lovr.graphics.newModel

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


model = lovr.graphics.newModel(filename, options)

Arguments

NameTypeDefaultDescription
filenamestring The path to model file.
optionstable Model options.
.mipmapsbooleantrue Whether the textures created for the Model should have mipmaps generated.

Returns

NameTypeDescription
modelModel The new Model.

model = lovr.graphics.newModel(blob, options)

Arguments

NameTypeDefaultDescription
blobBlob A Blob containing 3D model data.
optionstable Model options.
.mipmapsbooleantrue Whether the textures created for the Model should have mipmaps generated.

Returns

NameTypeDescription
modelModel The new Model.

model = lovr.graphics.newModel(modelData, options)

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.

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.

See also