--- title: "Blender 入門筆記" path: "Blender 入門筆記" --- {%hackmd @RintarouTW/About %} # Blender 入門筆記 ![](https://i.imgur.com/G2sgY5U.png) `功能豐富且完整` 建模(含雕塑)與骨架 > 貼圖/材質 > 2D/3D動畫(含動作捕捉、場景重建等) > 合成(Shading 與色校等) > 剪輯與後製 > 輸出成果 > 果然是拿來弄電影的,絕不只是建模做遊戲。 # 基本操作 | Keys | Function | |:----------------------------- |:----------------------- | | <kbd>G</kbd> | Grab | | <kbd>S</kbd> | Scale | | <kbd>R</kbd> | Rotate | | <kbd>Tab</kbd> | Mode Switch | | <kbd>Ctrl</kbd>+<kbd>R</kbd> | Subsurface | | <kbd>E</kbd> | Extrude | | <kbd>1/2/3</kbd> | Select Vertex/Edge/Face | | <kbd>Alt</kbd>+<kbd>LMB</kbd> | Select connected | | <kbd>J</kbd> | Join two vertices | | <kbd>(Ctrl+)F</kbd> | (Grid)Fill face | # Modeling 建模 ![](https://i.imgur.com/ki3pwZo.jpg) ![](https://i.imgur.com/omDeut2.jpg) ## 基本觀念 ### Object * Mesh (Verteices/Edges/Faces) * Material ### Local/World Coordinate ### Normals ## Modifiers * Array * Bevel * Mirror * Screw * Solidfy * Subdivision Surface * Skin Modifier - Ctrl + A (Skin Resize), Mark Root on vertex for working on copied mesh * Skin Modifier => Low Poly Tree * Multiresolution Modifer (Sculpting) ## Addons * Jmesh * Ivy ![](https://i.imgur.com/ZIpZMA6.gif) * LoopTools (Make Circle) 1. Basic Modeling 2. Subdivision 3. Shade Smooth 4. Bevel 5. Supporting Loops > *Proposional Edit* > Scale the axis back to 0 to make edges straight on that axis > Edge Bevel Weight vs Supporting Edges vs Crease ## Hacks * (Search) Grid Fill - Prevent NGon <kbd>Ctrl</kbd> + <kbd>F</kbd> * Bevel + Edge Weight * Bevel + Subdivision + Edge Weight * Subdivision + Bevel + Edge Crease * Vertex Group + Vertex Weight * Skin Modifier * Multi resolution instead of Subsurface modifier * Save deformation in Shape Key (Morphing) * <kbd>Alt</kbd>+<kbd>D</kbd>, <kbd>Alt</kbd>+<kbd>R/G/S</kbd> $\rightarrow$ Duplicated the original to the world origin and modify it will relect to the original mesh. * Save original position on keyframe * Edit Mode: <kbd>Ctrl</kbd> + <kbd>H</kbd> Hook to New Object for animation * Edit Mode: <kbd>Ctrl</kbd> + <kbd>RMB</kbd> Continue * <kbd>Shift</kbd> + <kbd>S</kbd> : Cursor/Origin Setting * Bridge Edge Loops * Convert Hair Particles to Curves * Symmetrize * Particle Edit Mode * Physics * Soft Body + Collision ## 練習 ### Low Poly ![](https://i.imgur.com/I2YMg9q.png) ![](https://i.imgur.com/4H3B5lG.jpg) ![](https://i.imgur.com/xQ62nyV.jpg) ![](https://i.imgur.com/cQbJkgv.png) ![](https://i.imgur.com/UmjPqO0.png) ### 打點光 ![](https://i.imgur.com/7SHWQOy.jpg) ![](https://i.imgur.com/A1QIHIO.png) ### 曲面物件 ![](https://i.imgur.com/GknPdCS.png) ![](https://i.imgur.com/rqrlA8F.png) ![](https://i.imgur.com/3iPWSIa.png) ### 粒子系統 (Particle System) ![](https://i.imgur.com/jnPm8rg.jpg) # Scuplting (雕塑) - [ ] Todo ## Armature (雕塑所用金屬骨架) Rigging (船索系統,引申如操控木偶之意) ![](https://i.imgur.com/jkky5Ny.gif) ## Texture Paint * UV Mapping * Edit Mode $\rightarrow$ Select All $\rightarrow$ U $\rightarrow$ Smart UV Project * Fliers by UV Mapping * Texture Node * Procedually Generated Textures # Animation * Follow Path (Curve) * Motion Path * Timeline (Keyframes Recording) * Dope Sheet * Action Editor * Shape Key Editor * Mask * Grease Pencil * Graph Editor * Select keyframe, press T to choose F-curve types. * Nonlinear Animation Editor (NLA) * Driver Editor * RMB on the property of the target which should be drived, Add/Edit/Delete Driver (特別適合機械式動作) ![](https://i.imgur.com/bpPJydE.jpg) * Constraints > Markers are used to denote frames at which something significant happens - it could be that a character’s animation starts, the camera changes position, or a door opens, for example. Markers can be given names to make them more meaningful at a quick glance. They are available in many of Blender’s editors. ## 簡單動畫練習 鏡頭追踪 ![](https://i.imgur.com/U5GOXZy.gif) 鎖鍊物理模擬 ![](https://i.imgur.com/rUJTblC.gif) 物理碰撞模擬 ![](https://i.imgur.com/NMKGhc4.gif) # Compositor ## Shading * Node based ## Lighting * Studio Lighting * Emission * Refraction (反射) * Ambient Occulsion (環境光) * Bloom (強光) * DOF (Depth of Field) * Subsurface Scattering (散射) * Motion Blur * Volume BSDF + Volume Scatter + Volmetrics (霧) # Rendering ## Rendering Engine * Eveve * Cycles * Workbench > Blender 建構在 OpenGL 之上,支援 CUDA(Nvidia)/OpenCL(AMD) 加速。 ## Renderer 設定 * DOF # Movie Clip Editor 用以編輯 Motion Tracking & Masking # Video Sequencer Editor(VSE) 影片剪輯與輸出工具 # Advanced (Programming via Python) ## GPU Module(gpu) ``` This module provides Python wrappers for the GPU implementation in Blender. Some higher level functions can be found in the gpu_extras module. - GPU Types (gpu.types) - GPU Shader (gpu.shader) - GPU Matrix (gpu.matrix) - GPU Select (gpu.select) Geometry Batches Geometry is drawn in batches. A batch contains the necessary data to perform the drawing. That includes an obligatory Vertex Buffer and an optional Index Buffer. A batch also defines a draw type. Typical draw types are POINTS, LINES and TRIS. The draw type determines how the data will be interpreted and drawn. Vertex Buffers A Vertex Buffer Object (VBO) (gpu.types.GPUVertBuf) is an array that contains the vertex attributes needed for drawing using a specific shader. Typical vertex attributes are - location - normal - color - uv Every vertex buffer has a Vertex Format (gpu.types.GPUVertFormat) and a length corresponding to the number of vertices in the buffer. A vertex format describes the attributes stored per vertex and their types. The following code demonstrates the creation of a vertex buffer that contains 6 vertices. For each vertex 2 attributes will be stored: The position and the normal. import gpu vertex_positions = [(0, 0, 0), ...] vertex_normals = [(0, 0, 1), ...] fmt = gpu.types.GPUVertFormat() fmt.attr_add(id="pos", comp_type='F32', len=3, fetch_mode='FLOAT') fmt.attr_add(id="normal", comp_type='F32', len=3, fetch_mode='FLOAT') vbo = gpu.types.GPUVertBuf(len=6, format=fmt) vbo.attr_fill(id="pos", data=vertex_positions) vbo.attr_fill(id="normal", data=vertex_normals) Index Buffers Often triangles and lines share one or more vertices. With only a vertex buffer one would have to store all attributes for the these vertices multiple times. This is very inefficient because in a connected triangle mesh every vertex is used 6 times on average. A more efficient approach would be to use an Index Buffer (IBO) (gpu.types.GPUIndexBuf), sometimes referred to as Element Buffer. An Index Buffer is an array that references vertices based on their index in the vertex buffer. For instance, to draw a rectangle composed of two triangles, one could use an index buffer. positions = ( (-1, 1), (1, 1), (-1, -1), (1, -1)) indices = ((0, 1, 2), (2, 1, 3)) ibo = gpu.types.GPUIndexBuf(type='TRIS', seq=indices) Shaders A shader is a program that runs on the GPU (written in GLSL in our case). There are multiple types of shaders. The most important ones are Vertex Shaders and Fragment Shaders. Typically multiple shaders are linked together into a Program. However, in the Blender Python API the term Shader refers to an OpenGL Program. Every gpu.types.GPUShader consists of a vertex shader, a fragment shader and an optional geometry shader. For common drawing tasks there are some built-in shaders accessible from gpu.shader.from_builtin with an identifier such as 2D_UNIFORM_COLOR or 3D_FLAT_COLOR. Every shader defines a set of attributes and uniforms that have to be set in order to use the shader. Attributes are properties that are set using a vertex buffer and can be different for individual vertices. Uniforms are properties that are constant per draw call. They can be set using the shader.uniform_* functions after the shader has been bound. Batch Creation Batches can be creates by first manually creating VBOs and IBOs. However, it is recommended to use the gpu_extras.batch.batch_for_shader function. It makes sure that all the vertex attributes necessary for a specific shader are provided. Consequently, the shader has to be passed to the function as well. When using this function one rarely has to care about the vertex format, VBOs and IBOs created in the background. This is still something one should know when drawing stuff though. Since batches can be drawn multiple times, they should be cached and reused whenever possible. Offscreen Rendering What one can see on the screen after rendering is called the Front Buffer. When draw calls are issued, batches are drawn on a Back Buffer that will only be displayed when all drawing is done and the current back buffer will become the new front buffer. Sometimes, one might want to draw the batches into a distinct buffer that could be used as texture to display on another object or to be saved as image on disk. This is called Offscreen Rendering. In Blender Offscreen Rendering is done using the gpu.types.GPUOffScreen type. ``` ###### tags: `blender` `3D`