Load a 3d model from an OBJ or STL string.
OBJ and STL files lack a built-in sense of scale, causing models exported from different programs to vary in size. If your model doesn't display correctly, consider using loadModel()
with normalize
set to true
to standardize its size. Further adjustments can be made using the scale()
function.
Also, the support for colored STL files is not present. STL files with color will be rendered without color properties.
- Options can include:
modelString
: Specifies the plain text string of either an stl or obj file to be loaded.fileType
: Defines the file extension of the model.normalize
: Enables standardized size scaling during loading if set to true.successCallback
: Callback for post-loading actions with the 3D model object.failureCallback
: Handles errors if model loading fails, receiving an event error.flipU
: Flips the U texture coordinates of the model.flipV
: Flips the V texture coordinates of the model.
Examples
Syntax
createModel(modelString, [fileType], normalize, [successCallback], [failureCallback])
createModel(modelString, [fileType], [successCallback], [failureCallback])
createModel(modelString, [fileType], [options], [options.successCallback], [options.failureCallback], [options.normalize], [options.flipU], [options.flipV])
Parameters
.stl
, .obj
).Returns
Related References
createModel
Load a 3d model from an OBJ or STL string.
isBinary
This function checks if the file is in ASCII format or in Binary format It is done by searching keyword solid at the start of the file.
loadModel
Loads a 3D model to create a p5.Geometry object.
matchDataViewAt
This function matches the query at the provided offset.