Blender: Difference between revisions

From Bitpost wiki
Line 121: Line 121:
=== Extrude ===
=== Extrude ===
Ctrl-E > Extrude edges > (press x/y/z to constrain to one axis) > left-click
Ctrl-E > Extrude edges > (press x/y/z to constrain to one axis) > left-click
OR
Ctrl-E > Extrude edges > (middle-mouse-drag to constrain to one axis) > (let go, it will stay constrained) > (drag) > left-click


To extrude along an axis defined by existing elements:
To extrude along an axis defined by existing elements:

Revision as of 18:04, 28 December 2022

Blender IS FUCKING LIT. But deep as hell.

Installation

Best to get a direct download from here and unzip it into apps:

cd ~/apps
tar -xf blender-2.92.0-linux64.tar.xz 
ln -s blender-2.92.0-linux64 blender
~/apps/blender/blender&

You can do that for multiple versions of blender.

It's pretty lazy to use apt in Ubuntu, you'll more than likely get an older version, but maybe this helped with dependencies? I didn't uninstall it to find out:

sudo apt install blender

Bah it starts as the default, so I'm going to remove it.

Configuration

3dconnexion mouse

Use this driver:

[~/app] git clone https://github.com/FreeSpacenav/spacenavd.git
cd spacenavd && ./configure && make && sudo make install # to install to /usr/local

Then set up a systemd service:

cp contrib/systemd/spacenavd.service ~/config/etc/systemd/system/
setup_stow.sh
sudo systemctl enable --now spacenavd

Configure using this excellent video.

  • Make sure you have at least version 2.92 so you have access to needed NDOF settings.
  • Edit > Preferences > Input > NDOF
  • Pan 4.0, Orbit 4.0, Dead 0.0
  • Nav Free, Rotation Turntable
  • Invert zoom OFF, also turn off all Invert Axis Pan and Orbit
    • WAIT, I really like to turn invert ON for Orbit Y

Plugins

Download zips for these plugins from the Tutorial above:

Find them here:

/spiceflow/bitpost/softraid/software/apps/blender/plugins

Here's a newer beta one to try

Custom keybinding

Blender lets you right-click ANY setting checkbox and assign a key, holy hell how cool. See functionality-specific keys lists for my customizations.

If you need to remove any conflicts:

  • Edit > Preferences > Keymap > Key binding > Name tab > search: File context or whatever > uncheck

Object Modeling

To get basics going, work through this excellent video, which includes the best plugins to grab out of the box.

this one is super-precise about what you need to GET SHIT DONE. Nice.

Object center

  • To set an object's origin to its center:
select the object > rclick > Set Origin > Origin to Geometry

You can also use the object mode Object menu.

  • To move an object to the world center:
select object > open sideways-right-bar Item menu > Transform > Location > set to 0,0,0

Pivot point

To effectively rotate, you need to control the pivot point around which the rotation occurs.

Top 3D Viewport menu (starts with Edit/Object Mode) > two-circle icon right of Global (Transformation orientation) > dropdown > Active Element (this seems to work best)

Then numpad-. to center it.

Object rotate pan zoom

  • Left-click an object, numeric . to center on it
  • Use spacemouse to rotate objects - see tutorials on config, default is f8xxed
  • R key + mouse to rotate around center
  • G key + mouse to move on x-y plane
  • mousewheel to zoom; use Perspective mode to zoom inside objects
  • mhold to rotate
  • Sh+mhold to pan

Face/edge/vertice selection

  • TAB Hit tab to toggle object/edit modes
  • 1 2 3 Once in edit mode, use 1 (vertex) 2 (edge) 3 (face) selection modes
  • Shift-click to add to selection
  • Drag rectangle to group-select
  • You can also invert-select to select all BUT what you click
  • You can also x-ray select to get occluded object vertices
  • "Follow the edge" extended ring/line select: Alt-Sh-lclick an EDGE

Add node where edges intersect

  • Next to X Y Z on top-right bar, select Auto-Merge
  • Once that tool is selected, configure it via the Active Tool (screwdriver + wrench) button on vertical right menubar
  • Open Options, click Auto Merge
  • Click dropdown to the left of Auto Merge to get to more options, and click the Split Edges and Faces checkbox

Now you are ready to perform the action.

  • select the edge to split
  • press G, DO NOT MOVE the mouse and click its left button to create a node at the intersection

Dissolve

To remove an edge without also deleting its nodes and everything they connect to, use Dissolve.

Select the edge > Ctrl-X

OR

Select the edge > Del > Dissolve (...)

Remove doubles

Do this to get rid of duplicate (or nearly duplicate) vertexes. This is now called Merge by Distance.

Edit Mode toolbar > Mesh > Clean up > Merge by Distance

Fix normals

Edit Mode toolbar > Mesh > Normals > Recalculate out/inside

Extrude

Ctrl-E > Extrude edges > (press x/y/z to constrain to one axis) > left-click

OR

Ctrl-E > Extrude edges > (middle-mouse-drag to constrain to one axis) > (let go, it will stay constrained) > (drag) > left-click

To extrude along an axis defined by existing elements:

  • View > Align View > Align view to Active > (top/bottom/right/etc... as desired)
  • E (I then clicked middle mouse button and the extrusion snapped to the desired direction. weird but it worked)

Mesh/bridge two objects together

You will be creating a "web" of new polygons between them (without changing source objects).

  • Object mode > Select both objects > press Ctrl-J to join them
  • Pick the vertices on BOTH OBJECTS that you want to mesh/bridge together (multiple follow-the-edge selects)
  • Alt-F to create the mesh! Awesome power. May not be perfect!

Create union of two objects

Use the "boolean modifier".

select object > Properties editor > Item|Tool|View menu > Item > Gear icon > Add Modifier > Boolean

Select the "clipping" object from the Object field (or use the picker).

From there you can select Intersect to "clip" the original object using the source object, or Union to join them. You should see your choice in realtime as you change options. Hit Apply. You can then delete the clipping object if needed, and you'll be left with only the intersecting parts of the original object. Cool.

WARNING: You may need to remove duplicates and normalize, or this just acts CRAZY.

Bridge edge loops

For when you have two rings that you want to connect. Need this to make threaded objects, so cool.

  • Select all the nodes of two loops / rings, where one is above the other with a similar node count.
  • Ctrl-E (to open edge menu)
  • Bridge edge loops

Put a "cap" on a loop

  • Alt-Sh click an edge to select the loop
  • Ctrl-E Enter (to extrude a duplicate set of vertices)
  • Alt-M > to Center (to merge them into the center of the loop)

Object modeling keys

  • mhold - rotate
  • Sh+mhold - pan
  • spacemouse - rotate object
  • Sh+spacemouse - pan object
  • Numeric . - center selection/object
  • Numeric 5 - toggle perspective/orthographic
  • Numeric 4/6 - rotate l/r
  • Numeric 8/2 - rotate top/bottom
  • Numeric 7/9/1/3 - snap view to perspective
  • Space - top menu (or play)
  • 1 2 3 - node/edge/face select in Edit mode
  • rclick - object menu
  • Del - delete menu
  • Tab - toggle object/edit mode
  • A - select all of your model
  • Sh+A - add new mesh menu
  • F - fill in an edge or face after picking vertices
  • G - move
  • R - rotate
  • Ctrl-R - add loop cut - crazy, move the mouse to detect loops, lclick to cut, then move mouse and lclick again to place cut
  • Sh+s - cursor/origin menu
  • Ctrl-W - toggle Overlays > Geometry > Wireframe (customized)
  • Ctrl-Z - undo, +shift to redo
  • Alt-Z - x-ray mode

Video Editing

Set up project

  • Start blender, make sure "Info" view is selected in top left Editor Type dropdown
  • Change the "screen block" (first dropdown to the right of the File-Render-Window menu in the far top-left corner) to Video Editing
  • Now you have three areas, what I'll call top-left "graph", top-right "video preview", middle "video sequence", bottom "video playback"; each has a viewbar at the bottom of the area
  • in the "graph" area, select the area type dropdown (far left) and change it to "properties"; note that strangely, the properties ares has its area type dropdown at the TOP of the area, doh
  • In the video playback (very bottom toolbar), set the End frame to give enough width to fit the videos, eg 250 > 25000 (or more)
  • In video playback (the very bottom toolbar), change the "how to sync playback" combo from [No Sync] to [AV-sync] before importing anything.
  • Once you have the first video imported, hover over the preview clip, press N, select Proxy render size 25% - you should only have to do this once

Set up Render

  • In the top-right preview window, you are viewing VSE output (looks like a filmstrip S shape)
  • Carefully change that to Properties (remembering that the fucking toolbar will POP from bottom to top of the window - you want to set it BACK to VSE when done configuring the render properties)
  • Now you can change "Render Settings"
    • Dimensions > Resolution > (default is 1920x1080, you might want 1920x1920 if you have both vertical and horizontal footage); See Add a movie, below, to use Image Offset when importing to center each one accordingly
    • Output > directory to (project)/output
    • Output > ffmpeg video, RGB
    • Encoding > Container > MPEG-4, Codec H.264
    • Encoding > Audio Codec > AAC
    • Always select a different framerate, then select the correct framerate, at least once (to avoid a bug initializing the setting)
    • (used to have Presets > MPEG-4, Codec > H.264, Audio Codec > AAC (these codecs play on iphone + android + chrome + firefox!))

Add a movie

  • In the "video sequence" area, click Add > Movie to get a file browser and pick a movie file
    • I find it easiest to drag from a project folder visible in nautilus
    • You can also change the view to list and sort to by date by using the toolbar
  • Set up smaller "proxy" videos for each video strip you import; right-click video strips to select them, select Proxy/Timecode in properties, 25%, then click rebuild proxy and timecodes - YOU HAVE TO DO THIS FOR EVERY STUPID CLIP

Rotating Zooming Panning Video

Annoyingly Blender does not use the camera metadata to rotate the video, so you often need to fix this manually. It's not too bad once you're used to the process. You have to attach a "transform" strip to the video strip you want to ... transform.

  • select the target video strip (rclick or G)
  • VSE menu one up from the bottom > Add > Effect strip > Transform
  • select it, set the rotation to whatever you need
  • You can also zoom and crop the video with this same process, it's very useful
  • There is a way to set up a "driver" for dynamic panning etc. but I'm not smart enough for that yet

You can also rotate video FIRST with ffmpeg. But I got shit results, as it always seems to decode+encode, f that. This will strip the metadata so make sure you rotate the raw video to the correct rotation:

# To simply remote metadata:
ffmpeg -i VID_20180712_202358.mp4 1_grandentry.mp4

# To rotate
# transpose=1 means CW 90 degrees
# transpose=2 means CCW 90 degrees
# Use -vf "transpose=2,transpose=2" for 180 degrees
ffmpeg -i VID_20180712_202358.mp4 -vf transpose=2 -codec:a copy -metadata:s:v:0 rotate=0 1a_grandentry.mp4

Rendering output

  • Once you want to spend time to render the final output, go to the VSE, switch to properties, and set Render > Display to New Window
  • Hit the animation button and a new window should open and start rendering.
  • If nothing happens, check the log for errors. Usually a bug shows up that says "The encoder timebase is not set". You have to select a different framerate in properties, then reselect the correct framerate, to fix the error.
  • You can also use the Info view Render menu > Render Animation.

Video editing keys

  • Use the scrollwheel to zoom out, and ctrl-scrollwheel to center the sequence
  • Ctrl-s to save (Or use the Info view's File menu)
  • Shift-Ctrl-s to save-as
  • A to unselect all, then B to "box select", then drag the mouse
  • On a strip...
    • press K to cut it
    • press X to delete it
    • press G to move it left/right/across tracks
  • Click in the video sequence to set the current position; press M to leave a Marker there that can be returned to using the Marker menu
  • Alt-A to play/pause