A concave mirror #1232
-
Dear All, Is there an easy way to add a concave mirror to a scene? If there is no easy way, what would be the optimal way to construct an OBJ file? Thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I've also tried to follow the recipe for the "wavy disk", except coding a rectangular coordinate grid and calculating a spherical surface truncated on the sides. For some reason, the mesh doesn't come out right, although there are no errors. The Python code seems simple enough: N = 100
x_ = dr.linspace(mi.Float, -0.5, 0.5, N)
y_ = dr.linspace(mi.Float, -0.9, 0.9, N)
x=[]
y=[]
z=[]
for n in range(N):
for m in range(N):
z_ = 0.
v = x_[n]**2+y_[m]**2
if (v)<1.0:
z_ = dr.sqrt(1-v)
x.append(x_[n])
y.append(y_[m])
z.append(z_)
vertex_pos = mi.Point3f(x, y, z)
N1 = len(z)
M = N*N
# Move the last vertex to the center
#vertex_pos[dr.eq(dr.arange(mi.UInt32, M), M - 1)] = 0.0
# Generate the face indices
idx = dr.arange(mi.UInt32, M - 1)
face_indices = mi.Vector3u(M - 1, (idx + 1) % (M - 2), idx % (M - 2))
# Create an empty mesh (allocates buffers of the correct size)
mesh = mi.Mesh(
"concave",
vertex_count=M,
face_count=M - 1,
has_vertex_normals=False,
has_vertex_texcoords=False, |
Beta Was this translation helpful? Give feedback.
-
Hello @buddhasystem, The simplest way to create meshes for use in Mitsuba is typically through Blender. You can then either export a single shape as OBJ or PLY, or alternatively use the mitsuba-blender add-on to export the whole scene at once. |
Beta Was this translation helpful? Give feedback.
Hello @buddhasystem,
The simplest way to create meshes for use in Mitsuba is typically through Blender. You can then either export a single shape as OBJ or PLY, or alternatively use the mitsuba-blender add-on to export the whole scene at once.