-
-
Notifications
You must be signed in to change notification settings - Fork 58
basic improvements for docs #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| ### Custom Attributes | ||
|
|
||
| Meshes support arbitrary custom attributes beyond the standard position, normal, and UV coordinates. You can attach per-vertex or per-face data like material properties, identifiers, or computed values. These are stored in `mesh.vertex_attributes` and accessed using the same interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like using material as a faceview example. That's not something that changes on such a low level imo. Like a loaf of bread is gonna be made out of bread no matter where you look at it, even if details like color, roughness, reflectivity etc change. Material details changing per face also seems odd to me.
Maybe we can just remove the association with materials here and directly have reflectivity etc as vertex/face attributes? Or use something else as an example, e.g. color?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I envisioned materials to be used is to mark sections of the mesh with views and have corresponding materials in a metamesh. E.g.:
using GeometryBasics
using Colors
struct Material
color::RGB{Float32}
diffuse::Float32
specular::Float32
shininess::Float32
end
head = GeometryBasics.mesh(Sphere(Point3f(0), 0.3))
needle = GeometryBasics.mesh(Cone(Point3f(0, 0, -0.2), Point3f(0, 0, -2.0), 0.1))
pin = MetaMesh(
merge([head, needle]),
materials = [
Material(RGB(1, 0, 0), 0.8, 0.4, 4.0),
Material(RGB(0.8, 0.8, 0.8), 0.4, 2.0, 64.0),
]
)
# contains two ranges, one for the faces from sphere, the other for faces from cone
pin.views
pin[:materials]
using GLMakie
f = Figure()
a = LScene(f[1, 1])
# This basically undoes the merge, could also pass pisitions, normals etc as usual and faces as `faces(pin)[pin.views[i]]`
submeshes = GeometryBasics.split_mesh(pin.mesh)
for (m, material) in zip(submeshes, pin[:materials])
Makie.mesh!(
a, m, color = material.color, diffuse = material.diffuse,
specular = material.specular, shininess = material.shininess
)
end
fIirc obj/mtl loading has another step of indirection here, where views correspond to material names which are used to look up materials in a dict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be better to just store maybe measurement_time per vertex and color per face?
No description provided.