-
Notifications
You must be signed in to change notification settings - Fork 0
Knowledge
While working on the library project, I didn't document my learning process as comprehensively as I had initially planned. This means I missed out on building a robust knowledge base that could have been valuable for future reference.
To address this, I'm creating this document to compile my primary learning resources and gradually construct a knowledge base specifically for my 3D library. It will serve as a central hub for understanding the key concepts and functionalities within the library.
Call to Action:
As I continue to explore and develop the library, I'll keep adding resources and explanations to this document. Feel free to contribute if you have any relevant information or suggestions!
Core Concepts and Resources
A foundational resource for my learning journey was the Fall 2009 UC Davis Computer Graphics lecture series, available as a comprehensive playlist on the UC Davis Academics YouTube channel. You can find the playlist here:
https://www.youtube.com/watch?v=01YSK5gIEYQ&list=PL_w_qWAQZtAZhtzPI5pkAtcUVgmzdAP8g&index=1
3D primitives are the fundamental building blocks of 3D modeling. These basic shapes can be combined, modified, and textured to create complex 3D objects. Here are some of the most common 3D primitives:
1. Cube:
- A six-sided, regular polyhedron with all sides being squares.
- Used for creating box-shaped objects like buildings, furniture, and containers.
- Dual: Octahedron
https://mathworld.wolfram.com/Cube.html
related to: mesh.creator.primitives.CubeCreator
related to: mesh.creator.primitives.SegmentedCubeCreator
2. Sphere:
- A perfectly round geometrical object in three-dimensional space.
- Used for creating spherical objects like balls, planets, and domes.
3. Cylinder:
- A geometric solid with straight parallel sides and a circular cross-section.
- Used for creating cylindrical objects like pipes, cans, and pillars.
related to: mesh.creator.primitives.CylinderCreator
related to: mesh.creator.primitives.QuadCapCylinderCreator
related to: mesh.creator.primitives.SegmentedCylinderCreator
4. Cone:
- A geometric solid that tapers smoothly from a flat base (usually circular) to a point called the apex.
- Used for creating conical objects like traffic cones, party hats, and ice cream cones.
5. Torus:
- A doughnut-shaped object generated by revolving a circle in a plane about an axis coplanar with the circle.
- Used for creating torus-shaped objects like rings, donuts, and certain architectural elements.
6. Pyramid:
- A polyhedron formed by connecting a polygonal base to a single point, called the apex.
- Used for creating pyramid-shaped objects like the Egyptian pyramids and certain architectural structures.
7. Capsule:
- A combination of a cylinder and two hemispheres.
- Used for creating capsule-shaped objects like pills, certain types of bottles, and some biological structures.
8. Plane:
- A flat, two-dimensional surface that extends infinitely far.
- Used for creating flat surfaces like floors, walls, and tabletops.
Understanding the principles of subdivision surfaces is crucial for creating smooth, organic shapes.
Subdivision Schemes
- Loop
- Butterfly
- Catmull-Clark
- Doo-Sabin
related to: mesh.modifier.subdivision.CatmullClarkModifier
related to: mesh.modifier.subdivision.DooSabinModifier
https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html
Subdivision Surfaces (Part 1 & 2):
- Subdivision Surfaces Part 1
- Subdivision Surfaces Part 2
- (These resources provide an in-depth explanation of subdivision surfaces, a fundamental technique used in many 3D modeling applications.)
https://de.wikipedia.org/wiki/Catmull%E2%80%93Clark_Subdivision_Surface
https://en.wikipedia.org/wiki/Doo%E2%80%93Sabin_subdivision_surface
- Subdivision: Each triangle in the mesh is subdivided into four smaller triangles.
- Vertex Calculation: New positions are calculated for both the original vertices and the newly created vertices.
- Original Vertices: Their positions are updated based on a weighted average of their neighboring vertices.
- New Vertices: Their positions are calculated based on the positions of the vertices of the triangle they belong to.
- Repeat: This process is repeated multiple times, with each iteration creating a smoother and more detailed surface.
https://en.wikipedia.org/wiki/Loop_subdivision_surface
original thesis: https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/thesis-10.pdf
Platonic Solids: These regular polyhedra form the basis for many 3D models, including the icosahedron, which is often used as a starting point for spherical meshes.
https://en.wikipedia.org/wiki/Platonic_solid
Archimedean Solids: Understanding these semi-regular polyhedra can help in creating complex shapes with uniform edge lengths.
https://en.wikipedia.org/wiki/Archimedean_solid
Catalan Solids: These dual polyhedra of Archimedean solids offer unique geometric properties that can be exploited in 3D modeling.
https://en.wikipedia.org/wiki/Catalan_solid
Conway Polyhedron Notation: This notation system provides a concise way to describe complex polyhedra and can be used to generate various shapes.
https://en.wikipedia.org/wiki/Conway_polyhedron_notation
https://polytope.miraheze.org/wiki/Conway_polyhedron_notation
related to: mesh.conway
Dual Polyhedron:
https://en.wikipedia.org/wiki/Dual_polyhedron
https://mathworld.wolfram.com/DualPolyhedron.html
related to: mesh.creator.special.DualCreator
Goldberg Polyhedron
https://en.wikipedia.org/wiki/Goldberg_polyhedron
Antiprism:
https://en.wikipedia.org/wiki/Antiprism
https://mathworld.wolfram.com/Antiprism.html
related to: mesh.creator.special.AntiprismCreator
- Ported Cube:
https://www.youtube.com/playlist?list=PL3Aot9dMXzXZ21MXAzvirExu0sfsWWSHT
Möbius Strip:
https://en.wikipedia.org/wiki/M%C3%B6bius_strip
The functionality included within .mesh.creator.beam.*
was heavily inspired by the "Add Mesh: Extra Objects" addon in Blender. By analyzing the behavior and implementation of the beam creation tool within this addon, I was able to port and adapt the core concepts to the MeshCreator concept. This approach allowed me to create a similar, yet integrated, beam creation tool within my library.
https://docs.blender.org/manual/en/4.1//addons/add_mesh/mesh_extra_objects.html
https://en.wikipedia.org/wiki/Wavefront_.obj_file
MTL File Format Specification
An MTL file, or Material Template Library file, is a text-based file format used to define the material properties of 3D objects. It's often used in conjunction with the OBJ file format, which defines the geometry of the object.
Basic Structure:
An MTL file consists of a series of keywords and values, defining properties like color, texture maps, and illumination models. Here's a breakdown of the common keywords:
newmtl material_name
Ka r g b # Ambient color
Kd r g b # Diffuse color
Ks r g b # Specular color
Ns n # Specular exponent
Tr f # Transparency
illum i # Illumination model
map_Ka file_name # Ambient texture map
map_Kd file_name # Diffuse texture map
map_Ks file_name # Specular texture map
map_Ns file_name # Specular exponent map
map_d file_name # Alpha map
Explanation of Keywords:
- newmtl material_name: Defines a new material with the specified name.
- Ka r g b: Sets the ambient color of the material.
- Kd r g b: Sets the diffuse color of the material.
- Ks r g b: Sets the specular color of the material.
- Ns n: Sets the specular exponent, which controls the shininess of the material.
- Tr f: Sets the transparency of the material.
- illum i: Sets the illumination model, which determines how light interacts with the material. Common values are 1 (diffuse) and 2 (specular).
- map_Ka, map_Kd, map_Ks, map_Ns, map_d: Specifies the file paths for texture maps that modify the corresponding material properties.
Additional Notes:
- Comments: Lines beginning with # are treated as comments.
- Whitespace: Whitespace (spaces and tabs) is used to separate keywords and values.
- File Paths: Texture file paths can be relative or absolute.
- Material Libraries: Multiple materials can be defined within a single MTL file.
https://en.wikipedia.org/wiki/Wavefront_.obj_file#Material_template_library
Looking to learn about Bézier curves? This breakdown might be just what you need! Freya Holmér's video, "The Beauty of Bézier Curves," offers a clear, engaging, and visually rich explanation of the topic.
Here's why I recommend it:
- Easy to Follow: The video is presented in a way that makes understanding Bézier curves accessible.
- Entertaining: Learning doesn't have to be dry! This video uses animation and visuals to keep you engaged.
- Visually Rich: The animations and graphics effectively illustrate complex concepts.
Overall, Freya Holmér's video is an excellent starting point for anyone wanting to delve into the world of Bézier curves.
Bonus: Here's the link to the video for your convenience:
https://en.wikipedia.org/wiki/Skeletal_animation
https://garagefarm.net/blog/skeletal-animation-a-comprehensive-guide
Core Components:
Skeletal Hierarchy:
- A hierarchical structure of bones, representing the skeletal structure of a character or object.
- Each bone has a transformation matrix (rotation, translation, and scale) that defines its position and orientation in space.
Skinning:
- Assigning weights to each vertex, indicating the influence of different bones on that vertex.
- This allows for smooth deformations and blending between bone transformations.
Animation:
- Keyframes: Defining the position and rotation of bones at specific points in time.
- Interpolation: Calculating intermediate bone transformations between keyframes.
- Blending: Combining the transformations of multiple bones to determine the final transformation of a vertex.
The Blender Manual describes the taper option of it's Simple Deform modifier as follows:
Taper Linearly scales along the specified Axis. The scaling factor is weighted by the distance from the origin of the object in the deform axis. No scaling occurs in the plane of the origin of the object. The maximum scaling occurs at the vertices that are furthest away from the local origin. This can be a > positive or negative scaling, depending on the location of the origin. If the local origin is within the object, the deformed object appears tapered.
https://docs.blender.org/manual/en/latest/modeling/modifiers/deform/simple_deform.html
Advanced Modifiers:
- BendTwistModifier: Combines bending and twisting along a specified axis.
- FractureModifier: Fractures the mesh into smaller pieces based on specified criteria.
- MorphModifier: Morphs the mesh between multiple target shapes.
- SkinModifier: Creates a skin around a skeleton of bones.
- UVProjectionModifier: Projects UV coordinates onto the mesh.
- VertexPaintModifier: Paints colors onto the vertices of the mesh.
Procedural Modifiers:
- LSystemModifier: Generates complex shapes based on Lindenmayer systems.
- NoiseDisplaceModifier: Displaces vertices based on noise patterns.
- VoronoiFractureModifier: Fractures the mesh based on Voronoi diagrams.
Physics-Based Modifiers:
- ClothModifier: Simulates cloth dynamics.
- FluidModifier: Simulates fluid dynamics.
- SoftBodyModifier: Simulates soft body dynamics.
Other Creative Modifiers:
- PixelateModifier: Pixelates the mesh.
- TessellateModifier: Tessellates the mesh into smaller polygons.
- TwistModifier: Twists the mesh along a specified axis.
A critical feature for FPS-style controls is locking the mouse to the center of the screen and
hiding the cursor during gameplay. This is achieved through the input.center()
method, which
recenters the mouse every frame.
This approach is standard in FPS games because it ensures the player’s view is not disrupted by reaching the edges of the screen. Without mouse locking, gameplay could feel constrained or clunky, as players would need to constantly reset their cursor position manually.
https://discourse.processing.org/t/solved-creating-fps-like-mouse-detection/11946
https://discourse.processing.org/t/problem-with-robot-cursor/2046/2
Procedural Landmass Generation (E01: Introduction)
https://www.youtube.com/watch?v=wbpMiKiSKm8&list=PLFt_AvWsXl0eBW2EiBtl_sxmDtSgZBxB3
Regular Noise This type of noise generates random values between 0 and 1 without any correlation between neighboring points. It results in a completely chaotic pattern, lacking smooth transitions or recognizable structure.
Perlin Noise Perlin noise is a form of coherent noise, characterized by gradual changes between values. Unlike regular noise, neighboring points are smoothly correlated, creating natural and continuous patterns. When visualized as a slice, Perlin noise resembles mountainous terrain with rolling hills and valleys, making it ideal for generating organic textures and landscapes.
Key Terminology:
- Amplitude: Refers to the vertical scale, represented on the y-axis, which determines the height or intensity of the noise.
- Frequency: Relates to the horizontal scale, represented on the x-axis, which controls the level of detail or repetition in the noise pattern.
A single noise function often produces results that lack detail and appear overly smooth. To add complexity and richness to terrains, such as mountains, multiple layers of noise are combined. This technique, known as fractal noise, creates more detailed and realistic landscapes by blending noise at different frequencies and amplitudes.