-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathmesh3d_model.Rd
97 lines (79 loc) · 3.69 KB
/
mesh3d_model.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/objects.R
\name{mesh3d_model}
\alias{mesh3d_model}
\title{`mesh3d` model}
\usage{
mesh3d_model(
mesh,
x = 0,
y = 0,
z = 0,
swap_yz = FALSE,
reverse = FALSE,
subdivision_levels = 1,
verbose = FALSE,
displacement_texture = "",
displacement_intensity = 1,
displacement_vector = FALSE,
recalculate_normals = FALSE,
override_material = FALSE,
material = diffuse(),
angle = c(0, 0, 0),
order_rotation = c(1, 2, 3),
flipped = FALSE,
scale = c(1, 1, 1)
)
}
\arguments{
\item{mesh}{A `mesh3d` or `shapelist3d` object. Pulls the vertex, index, texture coordinates,
normals, and material information. If the material references an image texture, the
`mesh$material$texture` argument should be set to the image filename. The `mesh3d` format
only supports one image texture per mesh. All quads will be triangulated.}
\item{x}{Default `0`. x-coordinate to offset the model.}
\item{y}{Default `0`. y-coordinate to offset the model.}
\item{z}{Default `0`. z-coordinate to offset the model.}
\item{swap_yz}{Default `FALSE`. Swap the Y and Z coordinates.}
\item{reverse}{Default `FALSE`. Reverse the orientation of the indices, flipping their normals.}
\item{subdivision_levels}{Default `1`. Number of Loop subdivisions to be applied to the mesh.}
\item{verbose}{Default `FALSE`. If `TRUE`, prints information about the mesh to the console.}
\item{displacement_texture}{Default `""`. File path to the displacement texture.
This texture is used to displace the vertices of the mesh based on the texture's pixel values.}
\item{displacement_intensity}{Default `1`. Intensity of the displacement effect.
Higher values result in greater displacement.}
\item{displacement_vector}{Default `FALSE`. Whether to use vector displacement.
If `TRUE`, the displacement texture is interpreted as providing a 3D displacement vector.
Otherwise, the texture is interpreted as providing a scalar displacement.}
\item{recalculate_normals}{Default `FALSE`. Whether to recalculate vertex normals based on the
connecting face orientations. This can be used to compute normals for meshes lacking them or
to calculate new normals after a displacement map has been applied to the mesh.}
\item{override_material}{Default `FALSE`. If `TRUE`, overrides the material specified in the
`mesh3d` object with the one specified in `material`.}
\item{material}{Default \code{\link{diffuse}}.The material, called from one of the material
functions \code{\link{diffuse}}, \code{\link{metal}}, or \code{\link{dielectric}}.}
\item{angle}{Default `c(0, 0, 0)`. Angle of rotation around the x, y, and z axes, applied in the order specified in `order_rotation`.}
\item{order_rotation}{Default `c(1, 2, 3)`. The order to apply the rotations, referring to "x", "y", and "z".}
\item{flipped}{Default `FALSE`. Whether to flip the normals.}
\item{scale}{Default `c(1, 1, 1)`. Scale transformation in the x, y, and z directions. If this is a single value,
number, the object will be scaled uniformly.
Note: emissive objects may not currently function correctly when scaled.}
}
\value{
Single row of a tibble describing the mesh3d model in the scene.
}
\description{
Load an `mesh3d` (or `shapelist3d`) object, as specified in the `rgl` package.
}
\examples{
#Load a mesh3d object (from the Rvcg) and render it:
if(run_documentation()) {
library(Rvcg)
data(humface)
generate_studio() \%>\%
add_object(mesh3d_model(humface,y=-0.3,x=0,z=0,
material=glossy(color="dodgerblue4"), scale = 1/70)) \%>\%
add_object(sphere(y=5,x=5,z=5,material=light(intensity=50))) \%>\%
render_scene(samples=16,width=800,height=800,
lookat = c(0,0.5,1), aperture=0.0)
}
}