text:
How can I flip only negative faces in Geometry Nodes?

TLDR: turn any red face blue in geometry nodes
Im using an extrude node on a edge without faces, some of the faces generated by the node come out as negative despite the edge orientation being positive.
Is there a way I can use the Flip Normals node to be like "hey, any face that has a negative orientation must be flipped!"
I tried using a normal node and separate XYZ so that any normal with a negative value would flip over but it didnt seem to work

.blend file https://drive.google.com/file/d/1WaBBBELUtN8oMC9Bfa9p4QEagE83mt9r/view?usp=sharing

The "negative" faces are "positive" if you look at it from the other side.  There should be some way to define what side is the right one for the surface direction. You should figure this out first, because at the moment there is no way for any algorithm or group of geometry nodes to determine what you consider the right direction. There is no "Read My Mind" node in Geometry Nodes yet unfortunately.

This looks strange to me. When a continuous mesh line is extruded without double edges, there is always only one direction of the faces. Please check if there are any double edges lying around.

no double edges, i have also asked in the Erindale Discord. since this was a single edge loop someone suggested mesh to curve then curve to mesh to recalculate edge normal data and it seemed to have solved my problem.
although, this is not the solution on how to flip opposite facing directions. which is something im also interested in.
but since my issue was solved should i change title and description of the post to better match my specific problem which was already solved in a different way?

Please be so kind and share your blend file with us (https://blend-exchange.com/).  Without seeing the mesh, it is not possible to tell what is going wrong in this case.

@quellenform oki, post updated. apologies for not doing so, for some reason the site wont recognize the file as a .blend file format, so i shared with Gdrive instead

You're right, you can actually use the curves trick here, where you first convert the mesh to a curve, and then back to a mesh.
However, that doesn't answer the question, so here's the answer to the original question:

To align the normals of a face uniformly in this case, you would need to know in which direction the normals should point.
To do this, you would need to check the dot product of the position and the normals of the faces. If this value is greater than $0$, then the face points outward. However, this solution only works for a mesh like this one, where the faces are reasonably circular on a line.

If this technique doesn't work well because of the mesh, it can still be extended by using a common center point as a guide:

By the way, I've created a separate vertex group here that includes only the points along the edge. This way you save yourself some more nodes.

I suggest extruding first so the extrude operation has some info about surface direction and only after that delete the unnecessary geometry:

I think if you delete the unnecessary geometry first, you are left with an edge loop that has no info about surface direction, because it has no surface.

P.S. I didn't know you can do math with vertex groups. Is that intended functionality?

i would say so!, since vertex groups is just float data stored in each vert it would make sense to be able to math with them


text:
Why my object size has changed while appending?
I'm trying to follow an online course. I was creating my models on separate files and appending them to my scene. Until today, everything was working correctly. But now when I append my object, its size changes and it becomes very huge. Here is the screenshot of my scene:

I added every piece by File->Append... and didn't touch their size because they were already in the correct size but now when I append something it gets very huge. What would be the problem? Are there anything to follow while appending objects?
EDIT: Here are some steps that I go through before the problem occurs:

Added the plane surface to my scene
Set its coordinates to (0, 0, 0) by using 3D cursor
Realized that my chess board is floating so tried to set its coordinates to (0, 0, 0)
Tried to move all pieces at once by using 3D cursor and messed around with Apply Transforms option
Realized that my knight now looks weird because I didn't apply the mirror modifier in the original .blend file and it's now mirroring in the wrong axis
Deleted knight, appended it again but it comes with incorrect size now

I'm sorry if there are still missing details in my question. I don't know what to share as I'm new to Blender and 3D modelling in general.

The problem is solved. It appeared to be my mistake. When I complete the scene, I resized everything to make them fit in my view of camera because they were huge (the board's size was 48 Blender Units and the whole grid is 10 Blender Units as far as I know). So the newly appended objects were in correct size but every other object in my scene was too small compared to their original size.

... and didn't touch their size ...

Well... I think this doesn't count because I didn't resize them individually so I don't remember it while asking the question :D

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Checker-like Glitch on Cycles and Snow-like Glitch on Eevee Render
I'm on blender 2.83.5  Today I tried to render my model here, it seems okay with no problems in render viewport

And then weird glitch appears as soon as I press F12 .. I did try to render on both render engines

Cycles Render - Checker like texture

EEVEE render - Snow like texture
So what is the cause of this glitch and how do I solve it? Thank you!
EDIT: the texture is painted manually on Texture Paint workspace. I've already unwrapped all the mesh

Hello :). Perhaps you have a second copy of your mesh right under it. And if it's set to render only, it doesn't make problems in viewport :).

Jachym Michal  it worked! thank you!

No problem, this is actually quite a common issue :). Good luck with your project.

@JachymMichal How did you know? That's like God level luck or highly impressive knowledge.

@AlexSandoval You're too kind :). The 'checkered' mesh (called z-fighting) is a typical consequence of overlapping faces :). But 'God level luck' does have a nice ring to it...

Solved by Jachym Michal, there's a backup collection hidden from viewport, but it was set to appear on render

Have you UV unwrapped it yet?  If not you can go into edit mode and start creating seems where to create your flow and use smart unwrap

I already unwrapped it right away after modelling. The texture is a texture painting

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
How to create a flat base to a photogrammetry model in Blender?
I am trying to create something like this in Blender, but I don't know how exactly.

I captured a model of a WWI bunker with photogrammetry and processed it with Agisoft Metashape but I like to add an “earth base” for a nicer presentation. I imported the OBJ file into Blender but I'm having trouble making it work (I'm kind of new to Blender).
Extruding the model downwards gave bad results, so I tried duplicating the model, making it flat, selecting the edges of both the model and the base with Edge Loops and then Bridging the Edge loops but that gave really funky results (I think not all edges were correctly selected, resulting in an uneven amount of edges between top and bottom).

Could anyone propose a workflow to achieve this in Blender?

What I do usually is profit from the new vertex group options for generated geometry in the solidify modifier from version 2.83+.
First let's say we have an ocean modifier on an object.

Create a new vertex group.

Add a solidify modifier, set the Shell Vertex Group to your new group, and the Thickness to 0. This will effectively duplicate your geometry in place.

Now add a plane at the altitude at which you want the bottom of your foundation to be. Scale it so it is larger than your terrain.

Add a shrinkwrap, set the target to your plane, vertex group to your new vertex group, set the mode to project on the Negative Z axis. Hide your plane.

Now add a new material for the dirt/soil, assuming the first one is your photogrammetry raster info.

Get back to the solidify modifier and set the material offset to 1. Result :

With "proper" shaders:

Note : The geometry will be ugly if viewed from upside-down but what you can do is check "Only rim" in the solifidy modifier to only keep the rim of the object.

Thank you so much for this well laid out answer. I managed to follow without any problems until the shrinkwrap.
It seems to introduce extra geometry inside the bunker as well (see pics below). Is there any way to avoid this?
before: https://i.sstatic.net/VBO5j.jpg
after: https://i.sstatic.net/Am89c.jpg

Oh, right, I didn't plan for overhanging geometry ! Please see the very last bit of my answer, this should get solved if you check "only rim" in the solidify modifier (I think ?)

Thanks again. However, checking "Only Rim" does not get rid of the extra geometry at the inside of the bunker and makes the bottom ugly as you described in your answer. Only rim checked: https://i.sstatic.net/FVN2h.jpg ; https://i.sstatic.net/wXbfE.jpg ; Only Rim unchecked: https://i.sstatic.net/yhqqa.jpg

I think it is because the bunker part of your mesh is disconnected from the rest. You can try to merge adjacent vertices with right click > Merge > by distance in edit mode and vertex select mode and if that doesn't fix it, create a new vertex group and vertex paint only the edge of your mesh (doesn't matter if it's not precise so long as you don't include the bunker vertices) and restrict the solidify to only these vertices (the field below "Angle clamp")

Thanks again! Merging the mesh did not work for me so I tried redefining the Vertex Group by selecting only the edges (https://i.sstatic.net/2eZUN.jpg), however, it resulted in the same added geometry underneath the bunker roof and did something strange with the edges (https://i.sstatic.net/PV0ya.jpg). I really don't know what to do anymore...

Why not just extrude on Z axis and Scale to zero? Alternatively Delete > Limited Disolve for bottom part.

@vklidu What can I say, I like making things hard for myself, and procedural modelling (aka crippling fear of committing to something). :) Feel free to add as an answer, seems like my method is a bit too complicated for newcomers :p

OK ... if it's in the masochism (or non-destructive) category no problem :) I'm not going to answer this ... it has to be somewhere here :) I was just curious what I missed here.

@vklidu Come to think of it... One big advantage is the file size. When working with photogrammetry you often have millions of vertices which very quickly launch your file size into the hundreds of Mos. Duplicating geometry doubles it, while using a modifier keeps it manageable.

Yes .. but as mentioned, you can use dissolve Limited on sides and bottom, that results with increasing vertices about just 4 more and you don't need to run modifiers math every time you manipulate with object :) Never mind it is not necessary to discuss deeper ... thank you.

For anyone reading today, this answer still works 4 years later, even though the  menus look somewhat different now. There's just one gotcha: In the solidify modifier, the "shell vertex group" is not the "vertex group" option, these are two different ones, and the desired effect only appears with the shell one. So the answer is correct, but this is easy to get wrong.

@phil294 Thanks for the heads-up. Nowadays this should be relatively straightforward with a simple geometry nodes modifier using an Extrude node set to the edges selecting only edges which are linked to a single face then displacing the result of the extrude node


text:
What are the practical differences between beziers, nurbs and paths?
I know that Beziers, Nurbs curves and Paths have different controls:

Bezier handles have control over tangents, and the curve always touches the control point.

Nurbs curves don't touch the control points, they just bend towards them. The curve doesn't reach the first or last control points, but ends around the second/second-last point.

Paths are the same as Nurbs curves, except the curve continues to reach the first and last control points.

But what are the practical differences between them? What can each of them be used for that the others can't, or what about each of them makes them easier to use for certain tasks?

that can help ? https://www.blender.org/manual/modeling/curves/introduction.html#non-uniform-rational-b-splines-nurbs

See http://blender.stackexchange.com/questions/56713/what-is-the-difference-between-a-path-and-a-bezier for the best possible answer.

It would be much better to ask just about their differences, and let the practical applications to the user. Because it is dependent on the thing you want to do. For different situations different curve types fit the most and to name all the situations is much harder than to name just the curves differences and let the user to understand them, let him think with own head and apply the knowledge to specific practical tasks.

Knowing the differences is easy. Knowing what difference those differences make is a matter of experience and trial+error. I was hoping someone could summarize some of the common applications of each curve type in an answer, explaining why it was best for that case.

You guys are so wonderfully technical. LOL. For me, the practical difference between the two types of curves in my artwork is that the N-curve lets me put the vertices of the curve exactly where I want them. The B-curve is for me madly confusing making those curves end up in the right place. It may seem tedious but I will almost bet that I can beat anyone time wise creating a complex of curves using the N-curve, extrude, click (rinse and repeat)like a little race car running around the contours of my design.

I make quite extensive use of Bezier Curve objects in Blender, I use them a lot more than I actually use mesh objects.
I work mainly in architecture mostly doing archviz, decoration and interior design projects. This is not a popular nor 'standard' modeling technique, and I am well aware how exotic it is, even in this business area.
Curve objects in Blender suffer from certain limitations when compared to meshes, like limited availability of modifiers, poor texture mapping capabilities, can't be unwrapped, can't have particles or participate in Boolean operations, and can't be rigged or easily animated with armatures like meshes do, although Geometry Nodes alleviated most of these.
However some of their very limitations are also their biggest strength, and when taken advantage of, provide particular constraints that make them well suited for these use cases.
Bezier Curves
By optionally being inherently bidimensional, bezier curve objects (in 2D Mode) automatically guarantee a flat 2D surface, avoiding dealing with accidental non planar surfaces unintentional caused by negligent geometry snapping, which is a frequent occurrence in real world modelling.
Because they you don't have to work with faces directly, you don't have to worry much about topology nor maintaining a good edge flows like you would with mesh objects. This alone lifts a huge burden and frees you from worrying about mico-managing geometry, and focus on speed and efficiency.
Hard-edge modelling is much easier, mixed straight and curved shapes live happily together, automatically handled by the bezier handle types and curve fill engine as well; so you also avoid having to worry about adding support edge loops or unwanted smoothing in straight areas as you would with subdivision based models.
Since curves have a builtin quality setting for curved segments smoothness you don't have to use Subdiv Modifiers which are often a source of concern for topology, while maintaining quality settings non destructive.
Because the fill engine also handles automatically inner curves and recursive shapes inside shapes it easily creates holes and islands inside outlines, avoiding extensive use of Booleans, which are slow, error prone and a frequent source of frustration.
The builtin bevelling, offsetting and extrusion features allow for a non destructive workflow, which you can easily go back to and change parametrically without having to redo manually.
Bevel objects also allow defining extrusion shapes along complex paths, common in metal work, frames and railings frequently found in architecture, and often provided in CAD format by manufacturers.
In building and construction area, Bezier curve objects end up being very versatile in designing:

Building walls, which can conveniently be defined as an extrusion of an architectural plan outline, that is often already provided by the architect, guaranteeing planar closed shapes with dimensional accuracy.
Facades, curtain walls, and elevations can also be easily defined from client provided elevation drawings, since again they are often mainly bi-dimensional extrusion structures with holes and island that are well defined from a 2D closed curve with holes for windows, doors, openings and stonework around them.
Pavement finishes or floor areas (like an room with a certain type of wood, carpet or ceramic tile finish) which are defined by a closed boundaries combining complex shapes with mixed curved and straight geometries.
Concrete slabs, or extensive ceilings areas with arbitrarily shaped openings for lighting and holes for installed equipment, are also easy to define because you don't have to worry about topology, manually deal with gaps, fill holes nor use booleans.
Railings, metal work, extrusion profiles and frames along complex paths are easily handled by the builtin Bevel objects.
A lot of other real world objects made from sheet materials (like table tops, wood board, furniture, cabinetry and carpentries) benefit from the same advantages like easy extrusion, tessellation and bevelling.

Other than that, they are also very useful as complement for illustration based graphical design type of work, like Logo design and symbol creation, or 2D type of motion graphics often used in TV, video and animation work.
NURBS
NURBS surfaces on the other hand are more suited for smooth almost organic-like shapes used in vehicle design like cars, boats, airplanes, or more aerodynamic industrial design objects.
They differ from subdivision surface because you never deal with faces directly, the emphasis on precision, trimming with trim surfaces, Boolean operations and BREP (Boundary Representation) or CSC (Constructive Solid Geometry).
Looking at Blender alone it's hard to imagine using them as an actual full featured modelling tool, since Blender's NURBS tools are admittedly a stub, with very limited features and lacking tools.
They are there more as a remnant of the past than as an actual production ready tool. Other dedicated software like Rhino, MoI, Katia, etc. have actually usable and full featured NURBS modelling workflow, capable of very accurate surface definition, surface trimming, Boolean operations, etc.
They are very suited for actual technical drawing extraction from models, since correct and exact elevations, plans and sections can be extracted from a NURBS or Solid based 3D model.
Paths
In practice, Paths in Blender are just NURBS curves (without surfaces). From what I gather they are mostly used for animations purposes, mainly to define animation paths animated objects may follow, sort like a railway. They are mathematically more accurately and precisely defined, yielding smoother animations and avoiding jitters and sudden movements or imprecise trajectories.
These can typically occur with bezier curves during animations specifically when having objects follow 3D curves in a scene, like a Follow Path constraint, or using Ctrl + P Make Parent > Follow Path.

Nice examples with the beziers, never thought of using them like that. About nurbs, I was referring to the nurbs curve objects, not the nurbs surfaces.

Ah yes, I don't think I've ever used a 2D NURBS curve as alternative to bezier. My guess is they are better at defining organic shapes, as opposed to mixed or straight-segments curves with beziers. Also depends on the desired actual shape of the curve, as you mentioned with bezier you define pass-through points, and with NURBS you refine tangents.

Aren't bezier curves and nurbs curves mathematically the same thing?

Not sure about the internal workings, but I've heard paths are more accurate. In practice the way you control them is also different, one passes through points, the other is "fit through".

Think of Bezier curves like nurbs, but on steroids. But as we all know, steroids can get you into trouble!!! There's a great film on youtube (link below) that shows that they're actually kinda like the same thing as N curves.
You know that first, 4 point N curve you get when you first create it? Well, just think of B curves like a whole series of those, joined together. Once you start to see these "troughs" in your B curves, it makes it much easier to manipulate them how you want!
https://www.youtube.com/watch?v=Qu-QK3uoMdY

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
I can't Vertex Paint draw but I can Vertex Paint fill (Set Vertex Colours),
After UV unwrapping, I tried to vertex paint. However, I don't know if I might turn on ( or off) something accidentally that makes me can't Vertex Paint draw at all. I followed basic tutorials and can easily draw on a new blender file but I couldn't draw on the file I'm having troubles with. I can still Set Vertex Colours. I also noticed that my brush size ring has a white colour. Please give me suggestions on how to fix the issue.

Could you upload your screenshot with Vertex Paint mode and Vertex Colors panel on right? Please consider upload your blend file so we can see your issue clearly.

@TergTurry thank you. here's the blender file i"m working on: https://pasteall.org/blend/128ba0b8498345c2ab4e3733cb454931

You forgot to remove Texture.002 on your brush setting.

Thank you so much. Could you explain why such a thing affects the vertex paint?

Texture.002 is completely black so it paint nothing.


text:
Morphing/contracting under physical force
I'm a biologist and I work on cell deformations under stress. I am new to Blender.
As a part of my project, I want to animate/simulate cells deforming under contraction force.
I want to morph/contract differently sized hexagonal prisms (all with the same volume) into a sphere of the same volume. I don't just want to directly morph it but I want to make it in such a way that there is some pulling force at the centre of the hexagonal prism which is pulling it with some (known)force which makes it deform into a sphere. And I want to record the time in which the process will be complete.

(Pardon my drawing) By contraction force, I mean that the hexagonal prism will collapse under its own force and will morph into a sphere. The blue dot at the centre is the location of the attractive/contractive force which pulls all the sides of the hexagonal prism and forces it to morph into a sphere
My assumption is that different sizes of hexagonal prisms will take different time morph.
Is there a way to do such a thing in Blender? If so, how should I proceed with the workflow for making this?
Please let me know if any more details are needed to answer this question! I'll be glad to provide. Thank You!!!

Could you add some image about the prisms? Also, what is the force here: some object that drive the prism to sphere morphing?

Sure! I'll add up the details

You tagged this with rigid-body-simulation, would soft-body be more appropriate?

@RonJensen I am a novice in this field so I don't exactly know what is appropriate for this. Thanks for the suggestion, I'll change it.

https://imgur.com/YnBblsG is this kind of like what you're thinking for a visualization? Strictly morphing, no simulation.

@RonJensen Yes, I'm looking for exactly this thing but just with physical forces included. Thank you very much;)


text:
How To Import .GCODE Into Blender For Rendering 3D Print Visualizations?
When I load a mesh into a 3D printer slicing program, I get a little wire preview of the tool paths the machine will take.
Since many prints take 8-24 hours or longer, I want to make neat rendered previews of these paths to show clients and friends what a print will look like ahead of time.
I found some old scripts that did this, but they don't work with Blender 2.8 so I tried to update them myself. I know nothing about programming or scripting, so I've done a terrible job, and I need help getting over the last few hurdles.
Here's what I've gotten so far:

It's a script that allows the user to import a .GCODE file and goes through the text doc line by line placing Curve Points for every command of the 3D printer nozzle.
Then it extrudes an oval along the curves to generate the 3D model.
The two big problems remaining are:
1)
The curves are all separate, straight lines. How can I continue them so instead of ugly stops in the extrusion, it's a more smooth curve?

The Curve Points are all sharing the same locations and the Curve directions flow properly. Even the shortest Curves are immediately from one spot to another, an unbroken-looking chain, as you'd expect a 3D printer to operate.
I need to either modify the script to make continuous curves or "Merge By Distance" these overlapping Curve Points afterwards, before extruding the oval.
2)
Also, every time you run the script, it appends a new button to the File menu.

These are definitely rookie problems, but I just can't figure out how to fix them.
Ultimately I am just trying to get a 3D model of the tool paths that I can render nicely in Cycles before physically 3D printing them. If anybody has a better option, please let me know!
Otherwise I need help getting this script working properly and I'm not sure what to do next. Thank you!
E d i t: This is a screenshot out of Cura, a 3D printing slice program. This is the type of results I'd like to see in Blender, for rendering with a nice plastic-looking material on a desk scene. Unfortunately I can't get this model out of a slice program without lots of work.

Here is the script so far:
    # ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

## blendish python ripped from fro io_import_dxf

import os
import warnings
import re
import string
import bpy
from bpy.types import Operator
from bpy.utils import register_class
from bpy.utils import unregister_class
import mathutils
from mathutils import Vector
import math
import copy

bl_info = {
    'name': 'Import Slic3r GCode',
    'author': 'Lee Butler, updating (in progress) to 2.8 by Dalton Strong',
    'version': (0,2,0),
    'blender': (2, 80, 0),
    'location': 'File > Import-Export > Gcode',
    'description': 'Import and visualize gcode files generated by Slic3r (.gcode)',
    "wiki_url": "https://github.com/iraytrace/BlenderGcodeImport/wiki",
    "tracker_url": "",
    'category': 'Import-Export'}

__version__ = '.'.join([str(s) for s in bl_info['version']])

class IMPORT_OT_gcode(bpy.types.Operator):
    '''Imports Reprap FDM gcode'''
    bl_idname = "import_scene.gocde"
    bl_description = 'Gcode reader, reads tool moves and animates layer build'
    bl_label = "Import gcode" +' v.'+ __version__
    bl_space_type = "PROPERTIES"
    bl_region_type = "WINDOW"

    filepath = bpy.props.StringProperty(name="File Path", description="Filepath used for importing the GCode file", maxlen= 1024, default= "")

    def __init__(self):
        # current tool position
        self.pos = {'X':0.0, 'Y':0.0, 'Z':0.0, 'E':0.0}

        # set of accumulated points on current extrusion path
        # a set of points makes up a polyline
        self.points = []

        # set of polylines
        self.polys = []

        # each layer is a set of polylines at a constant Z
        self.layers = []

        # set of Z elevation changes.  Most common is layer height
        self.thickness = { }

        self.ySquash = 0.5
        self.xOoze = 1.65

    ##### DRAW #####
    def draw(self, context):
        layout0 = self.layout

    ##### EXECUTE #####
    def execute(self, context):
        print('execute')
        self.parse(self.filepath)
        return {'FINISHED'}

    ##### INVOKE  #####
    def invoke(self, context, event):
        print('invoke')
        wm = context.window_manager
        wm.fileselect_add(self)
        return {'RUNNING_MODAL'}

    ##### PARSE #####
    def parse(self, fileName):
        self.points = []

        #print ('---------- read ' + fileName + ' ------------')
        # get the object/curve names from the filename
        self.obName = fileName.split(os.sep)[-1]
        self.obName = self.obName.replace(".gcode", "")

        f = open(fileName)
        for line in f.readlines():
            # remove comments and leading/trailing whitespace
            line = line.split(';', 1)[0].strip()

            # skip the blank lines
            if len(line) < 1:
                continue

            # tokenize the line
            tokens = line.split()

            self.dispatch(tokens)
        f.close()
        self.newLayer(-1.0)

        #print ('---------- build ------------')
        #print (' %d slices' % len(self.layers) )
        #print (' deltaZ values:')
        count = 0
        radius = 0
        # find the most common inter-layer distance
        for key in sorted(self.thickness.keys()):
               #print( '  %s : %d' % (key,self.thickness[key]) )
               if self.thickness[key] > count:
                   count = self.thickness[key]
                   radius = key

        profileName = self.obName + '_profile'
        profileData = bpy.data.curves.new(profileName, type='CURVE')
        profileData.dimensions = '3D'

        profilePoly = profileData.splines.new('POLY')
        profilePoly.points.add(7)
        angRad = radius * 0.70711
        profilePoly.points[7].co = (radius * self.xOoze,  0.0,                 0.0, 1)
        profilePoly.points[6].co = (angRad* self.xOoze,  angRad* self.ySquash, 0.0, 1)
        profilePoly.points[5].co = (0.0,                 radius* self.ySquash, 0.0, 1)
        profilePoly.points[4].co = (-angRad* self.xOoze,  angRad* self.ySquash, 0.0, 1)
        profilePoly.points[3].co = (-radius* self.xOoze,  0.0,                  0.0, 1)
        profilePoly.points[2].co = (-angRad* self.xOoze,  -angRad* self.ySquash, 0.0, 1)
        profilePoly.points[1].co = (0.0,                  -radius* self.ySquash, 0.0, 1)
        profilePoly.points[0].co = (angRad* self.xOoze,  -angRad* self.ySquash, 0.0, 1)
        profilePoly.use_cyclic_u = True
        #print (dir(profilePoly))
        profileObject = bpy.data.objects.new(profileName, profileData)

        scene = bpy.context.scene
        scene.collection.objects.link(profileObject)
        profileObject.select_set(True)

        for layerNum,layer in enumerate(self.layers):

            layerName = self.obName + '_slice_%d' % layerNum
            curveData = bpy.data.curves.new(layerName, type='CURVE')
            curveData.dimensions = '3D'
            curveData.bevel_object = profileObject
            #print (layerName + ':')

            for poly in layer:
                pointNum = 0
                for point in poly:
                    if pointNum == 0:
                        x,y,z = point
                        oldPt = mathutils.Vector((x, y, z, 1))
                        pointNum = 1
                    else:
                        polyline = curveData.splines.new('POLY')
                        polyline.points.add(1)

                        x,y,z = point
                        newPt = mathutils.Vector((x, y, z, 1))
                        polyline.points[0].co = oldPt
                        polyline.points[1].co = newPt
                        oldPt = newPt
            layerObject = bpy.data.objects.new(layerName, curveData)
            scene.collection.objects.link(layerObject)
            bpy.context.view_layer.objects.active = layerObject

        # print('-------------- done -------------')

    ##### DISPATCH #####
    def dispatch(self, tokens):
        if tokens[0] in dir(self):
            eval('self.' + tokens[0] + '(' + str(tokens[1:]) + ')')
        else:
            print( 'unknown command:' + str(tokens[0]))

    ##### newPoly #####
    def newPoly(self):
        # stash points into curves
        # need to make this a copy
        if len(self.points) > 0:
            #print( 'poly with %d points' % (len(self.points)) )
            #for i,p in enumerate(self.points):
            #    print( '\t %d %s' % (i, str(p)) )
            self.polys.append( self.points[:] )
            self.points = []

    ##### newLayer #####
    def newLayer(self, delta):
        # stash existing points into curve
        self.newPoly()

        # stash existing set of polys into layer
        if len(self.polys) > 0:
            #print( 'new layer with %d polys' % len(self.polys) )
            self.layers.append( self.polys[:] )

            self.polys = []

            if delta > 0.0 and delta < 1.0:
                if delta in self.thickness.keys():
                    self.thickness[delta] = self.thickness[delta] + 1
                else:
                    self.thickness[delta] = 1

    ##### moveTo #####
    def moveTo(self, newPos):
        if newPos['Z'] != self.pos['Z']:
            delta = newPos['Z'] - self.pos['Z']
            self.newLayer(delta)

        if newPos['E'] <= self.pos['E'] or newPos['E'] <= 0.0:
            self.newPoly()

        if newPos['E'] > 0 and newPos['E'] >= self.pos['E']:
            self.points.append([newPos['X'],
                            newPos['Y'],
                            newPos['Z']])

        # should this be an explicit copy?
        self.pos = copy.deepcopy(newPos)

    ###### parseCoords ######
    def parseCoords(self, tokens):
        npos = { }
        for tok in tokens:
            axis = tok[0]
            if axis in ['X', 'Y', 'Z', 'E']:
                npos[axis] = float(tok[1:])
        return npos

    ##### parseCoordsUpdate #####
    def parseCoordsUpdate(self, tokens):
        npos = self.parseCoords(tokens)

        for axis in ['X', 'Y', 'Z', 'E']:
            if axis not in npos.keys():
                npos[axis] = self.pos[axis]

        #print('coord: %8g %8g %8g  %g' % (npos['X'], npos['Y'], npos['Z'], npos['E']))
        return npos

    def N(self, tokens):
        '''line number and checksum'''
        # checksum not implemented
        self.dispatch(tokens[1:])

    def G0(self, tokens):
        '''move fast'''

        newPos = self.parseCoordsUpdate(tokens)
        self.moveTo(newPos)

    def G1(self, tokens):
        '''move to'''
        self.G0(tokens)

    def G21(self,tokens):
        '''set units mm'''
        pass

    def G28(self, tokens):
        '''move to origin'''

        npos = self.pos
        for tok in tokens:
           axis = tok[0]
           if axis in ['X', 'Y', 'Z', 'E']:
               # note that value is ignored
               npos[axis] = 0.0

        # no matter what we won't be extruding
        npos['E'] = 0.0
        self.moveTo(npos)

    def G90(self, tokens):
        '''set absolute positioning'''
        pass

    def G92(self, tokens):
        '''set position'''
        # fortunately Slic3r does not set arbitrary coordinates
        # or do relative positioning.  This is used just to zero
        # out the position on the extruder.

        newPos = self.parseCoordsUpdate(tokens)
        if newPos['E'] == 0:
            self.newPoly()

        self.pos = newPos

    def M82(self, tokens):
        '''set extruder absolute mode'''
        pass

    def M84(self, tokens):
        '''stop idle hold'''
        pass

    def M104(self,tokens):
        '''set extruder temperature'''
        pass

    def M106(self, tokens):
        '''fan on'''
        pass

    def M107(self,tokens):
        '''fan off'''
        pass

    def M109(self,tokens):
        '''set extruder temperature and wait'''
        pass

# ------------------------
# Registering

def menu_func(self, context):
    self.layout.operator(IMPORT_OT_gcode.bl_idname, text="GCode (.gcode)", icon='TEXTURE')

classes = (
    IMPORT_OT_gcode,
)

def register():
    from bpy.utils import register_class
    for cls in classes:
        register_class(cls)
    bpy.types.TOPBAR_MT_file_import.append(menu_func)

def unregister():
    from bpy.utils import unregister_class
    for cls in classes:
        unregister_class(cls)
    bpy.types.TOPBAR_MT_file_import.remove(menu_func)

if __name__ == "__main__":
    register()

Instead of recreating all the print paths, you can also just use the original model and add a shader to it making it look 3d printed. For example, here: https://blender.stackexchange.com/questions/6210/how-to-make-a-mesh-look-like-it-was-3d-printed.

@EricXue That's what I've been doing before looking into this. It's a good way to do it, but not quite as high quality as what I could get with actual geometry. Also the pattern of the extrusion on the top surface of the printed model changes and I'd like the render to show that.

There is a G-code importer addon for Blender 2.8 here.
https://github.com/Heinz-Loepmeier/Blender-Gcode-Import
The beveling/meshing of the curve is best done with Blenders internal curve editing tools.
You can choose a custom bevel profile there, that will get rid of unconnected geometry around the corners.


text:
Blender 2.9. Flip Region missing?
UPDATE:  The "screen: flip region" command from the Menu Search is either accidentally or intentionally missing from both stable, beta, and experimental versions of Blender 2.90.  Downgrading to Blender 2.8x has solved this problem for question A, however even though the Flip Region command can be executed on the panel in question B, it doesn't actually do anything. :(
A.  I am trying to move the Toolbar to the right hand side of the screen.  Is this still possible in Blender 2.9?
In scrolling through the forums, it appears that pre-2.8 there was a "flip side" feature on the toolbar that could be accessed by the search bar with F3. However the feature doesn't appear to exist post 2.8, likely due the appearance on forums that many people were doing this unintentionally and coming here for help reversing it.  Maybe I need to look in a new place?  Any information is appreciated.
B.  Similarly I would like to move this. (I'm not sure what its called so for this post I'm calling it Tool Properties).  Is there a way to move or scale up the Tool Properties or view them in the larger Editor Properties panel as highlighted?
Additionally if someone knows the proper name of the panel please let me know.

I apologize if these questions have been answered already.  I attempted to find solutions myself but have come up empty.
Thanks,
Ryan

That's indeed a toolbar panel, and I don't think it is possible to set it to the right hand side. And the size is also designed as "fix width" which only change when the UI scale factor change. The tool shelf itself belong to the 3D view space so it's unlikely to have it at other panel. Blender doesn't support pure float UI panel now. And this might help you: interface - Is there a way to create a loc/rot/scale shortcut in the context menu? - Blender Stack Exchange

To use this with Blender 2.90 or later, it seems that you have to manually add the keymap of the following command.
Settings> Keymap> Screen>
screen.region_flip

As for the name of B's menu, it looks like "Redo Last".
The operator name that calls this menu in a popup is "Redo Last".
screen.redo_last
Apparently it was intentionally deleted.
↓ It's not the task of this problem itself, but it says so.
⚓ T71810 UI: Flipping a Sidebar with more tabs isn't aligned correct

Finally I got it. Thank you @Bookakuno.

Open up the User Preferences / Key map / Screen/ Screen(Global)
Press Add New
Open up the textbox on the left by clicking the little triangle
Rename as screen.region_flip and set the key to F5
Move the mouse over the Toolshelf and press F5


text:
What is the Exponent input of Voronoi’s Minkowski Distance?
Is the parameter “Exponent” of Minkowski Distance the p value of Minkowski Distance formula? Thank you!

P/S: To moderators, sorry if this post doesn't fit this site. Please keep it up for at least a day, I've asked everywhere else and still haven't received an answer. There's a chance someone here has the answer to this.

Personally, I think there's no problem with this question. it's about understanding, which aids the use of the application. Hopefully someone can scurry into the code and have a look for you. (The exponent seems unlikely to be anything other thanp)

Yes, the distance formula is the one you show: If you look it up in the Blender Reference Manual for older versions, the formula is given there, in the manual for the current version there are Wikipedia links to the formulas.
Read the Blender Reference Manual entry for the Voronoi Texture here:
Voronoi Texture Node
If you follow the link to the Wikipedia article there, you will find this formula for the Minkowski distance:
$$D\left(X,Y\right) = \left(\sum_{i=1}^n |x_i-y_i|^p\right)^{\frac{1}{p}}$$
But of course the exponent ${\frac{1}{p}}$ can be written as
$$D\left(X,Y\right) = \sqrt[p]{\sum_{i=1}^n |x_i-y_i|^p}$$
and that is the formula you have in your question.
Now the Exponent which the node is referring to is not the "outer" exponent ${\frac{1}{p}}$, but the "inner" exponent $p$ as you already suspected.
In the old version's manual entry the formula is given directly with the notation using $\frac{1}{p}$, but the description clearly says:

Minkowski
A generalized algorithm that can represent all other distance metrics by configuring the Exponent input. This exponent represents $p$ in the Minkowski distance function.

"A generalized algorithm that can represent all other distance metrics" means, if you for example set $p=1$ you get the Manhattan distance, $p=2$ of course gives the Euclidean distance and $p\to\infty$ (if you could enter $\infty$ as value) would be Chebyshev.

Thank you! I'm also inclined to believe that $p$ (instead of ${\frac{1}{p}}$) represents the Exponent input. Just to add, in the tutorial linked below, the tutor explained that when $p=2$ (not $\frac{1}{p}=2$), Minkowski Distance becomes Euclidean Distance.
https://youtu.be/eutzTEGgLpE?t=629

@IanAmbrose Yes, I made a few tests with the Voronoi Texture and found it must be $p$, I already edited the answer to make it clear.


text:
Mathematically, what does Faceforward function mean?
Blender's description of Faceforward function is, quoted from Blender's document:

Orients a vector A to point away from a surface B as defined by its normal C. Computes (Dot(B,C)<0)?A:-A

I have a few questions regarding this description.
1.. A Dot Product between a surface (B) and a vector (C)? Is this Mathematically correct? As far as I know, there's no concept of Dot Product between a surface and a vector.
2.. This is the Faceforward node, why is B here defined as "incident (vector)" whereas it was defined as a "surface" in the document? So what actually is it, a surface or a vector?

3.. Why did the developers name the normal vector as "Reference"? Why didn't they just name it "normal"?
4.. Assuming B does act as surface according to the document, what controls the orientation of the surface then? Surface B or normal vector C?
5.. “Orients a vector A to point away from a surface B as defined by its normal C” - Is the function’s job really just to make A points away from the surface? Because it does make vector A points into the surface too.
(Dot(B,C)<0) ? A : -A means:
-- If B points inwards (i.e. B•C < 0), keep A that way (even if A pointed inwards or outwards, doesn’t care, keep it that way).
-- If B points outwards (i.e. B•C > 0), flip A (if A pointed inwards, flip it to point outwards and vice versa).
So does Faceforward’s job really to only make A points outwards?
Thank you. Any help is appreciated!

The question is very good, and I personally am interested in the answer too. I took the liberty to add the tag [tag:geometry-nodes], because there is the same vector-node, and I have faced this question there a few times too. Surface>Vector>Incident, Huh?

@quellenform Thank you! I've asked around, if you're interested in hearing a few people's opinions on this problem, you can check here: ---- https://devtalk.blender.org/t/what-does-faceforward-formula-mean/26634/5 ------ https://www.reddit.com/r/blenderhelp/comments/yyftzk/what_does_faceforward_formula_mean/ --------

I really wish the developers went extra miles to make the function at least comprehensible on the basic level. I've asked on Devtalk and no devs helped me.

I'm reasonably sure the reddit comment is wrong since A is definitely your main input vector and you're not interested in its dot product with anything. You're interested in the dot product of two other vectors (B and C)—if those are pointing in the same direction (dot product is positive) then A stays untouched, if not, you flip it (-A). One of those is a "surface as defined by its normal" and the other is an incident vector. I think they used the OpenGL nomenclature here: https://docs.gl/sl4/faceforward, which is equally poorly/obscurely written. (cont.)

The explanation for the same method in Unity is much clearer: "Conditionally flips a vector n (A) if two vectors i (B) and ng (C) are pointing in the same direction. Returns n if dot(i, ng) < 0, -n otherwise." Wording here is much more generalized, even though the letters used—i and ng—points to the same terminology underneath: i for incident and ng for normal. In summary, the second video in your devtalk thread is a pretty neat demonstration and yes, manual seems to be clumsily written.

@Kuboå firstly, thank you so much for your help! And sorry for my late reply.

@Kuboå OK so looks like Unity's description (which makes more sense than Blender's) doesn't define one of their vectors as the "surface" bullcrap (sorry I'm so mad at how they write their manual), they define 3 vectors as simply "3 vectors", and Unity says that the function flips the vectors A instead of making the vectors A "point away", which makes more sense considering that the function does flip the vectors instead of just making them point out from the surface.

@Kuboå Please tell me if what I'm saying is correct: C is an normal vector which is orthogonal to an (invisible) surface, its job is to control the orientation of the surface. If an incident vector B points into from the surface (i.e. B•C < 0), keep all directions of vectors A the same way, but if B is orthogonal to C (i.e. B•C = 0) or points away from the surface (i.e. B•C > 0) then the function flips all the directions of all vectors A.

@IanAmbrose Correct. Robin's example in his answer is a nice one. Imagine your camera's position is your incident vector, if it's on the "wrong" side of the billboard, it flips your main vector so the writing always looks normal to you no matter where you're looking at it from. Manual tries to convey both the "meaning" of the whole operation (there's a plane and we care about its orientation incidental/in relation to another point) and the technically correct nomenclature (we use not the surface itself, but its normal as the reference), but ends up jumbling them both.

@Kuboå Thank you! Wish you wrote your comments as answers so I could accept hem.

The official Blender documentation seems just plain wrong here.

I don't think there's much mystery to what the function is doing. The mystery (to me, anyway,) seems to be in the vocabulary used to describe it, and when you would want to use it?
The Vector input is a vector, (any vector) to be modified. Incident and Reference are two other vectors. Again, any vectors.
If Incident and Reference point into the same hemisphere, then Vector is reversed. Otherwise it's left alone. Effectively, this group:

Below, Incident is the blue arrow. Reference is the green arrow, normal to the plane 'surface'. The 'F' is aligned to the input Vector, as modified by the node:

So, if, for example,  you textured a single-plane billboard with an advertising slogan, you could fix it so it reads correctly from both sides.

Thanks Robin for the visualization! Now I understood it too. Here is another highly simplified example: https://i.sstatic.net/7TLCA.gif (with a reference plane instead of a Vector)

@quellenform zackerly! I'm getting the feeling the whole thing was cooked up to texture billboards  / bump /  other lighting effects on single-sided faces, and just migrated to GN because it was there? But that's only a feeling. Maybe someone knows.

+1 another great answer from the master !!


text:
How to fit the keyframes of an object into the new Frame Range, perfectly?
I want to edit the Frame Range in my scene from 0 - 2000 to 0 - 1000, that means I will have to resize the keyframes correspondingly to fit into that 1000 frames, so that the animations and movements don’t get stretched out.
First question, how do I do this, easily?
Second question, if the only way to do that is to resize the keyframes in Timeline, then here’s my problem, I intended to simply click an object to expose all keyframes of it in Timeline and then scale them, but, Timeline displays keyframes in a very limited way, to see the keyframes of a node, you have to click that node, but I keyframes literally everywhere, I can’t keep track of everything.
So, how do I click into an object and then see ALL keyframes that are attached to it, regardless of where the keyframe were assigned?
Thank you!

Use a Dopesheet window instead of the Timeline, select all keyframes you need to scale, place the time cursor on the first keyframe and press S, 0.5, Enter.

Thank you! I've just found another of your relevant answer here (https://blender.stackexchange.com/a/290243/105546) which also helped a lot.


text:
Geometry Nodes - How to procedurally subtract the unwanted part of a mesh after applying it with particles?

This is how everything looks at the moment

This is what I expect the result to look like (partially instanced particles, partially original mesh)

The nodes setup

There are two ways to do that: 1) With Geometry Nodes (GN) itself or 2) with Geometry Nodes (GN) and Shader Nodes (SH).
Method 1:
First distribute the ponits/particles then generate volume mesh from those points. Next, boolean the input mesh mesh with volume mesh and combine it with the points/particles mesh.

Blend File:

Method 2:
In this case, we generate a Vertex Color based on the distance to the points/particles then use this as mask in the Shader Nodes to make that area of mesh transparent,

Blend File:

Damn....wow. Learn every day here!! ;)

a little improvements suggestion: your links in your screenshots can hardly be seen... :(

@Chris Thanks I'll improve that. But links are visible in the full screen image. I have also added the Blend Files.

yes, with the blend files added - everything is great!!! ;) thanks for that great answer!!!


text:
Geometry Nodes messes up Vector Displacement
Please help me check out the Maths of these nodes.
I’m combining the Shader Nodes and Geometry Nodes to create something.
This “Multiple Balls” object is using Geometry Nodes to assign “Individual Ball” object as instances on it.

What I want to achieve is,

wherever I slide the red colored node to, the instances get spiked up and that part is colored darker blue, which exactly is happening with the desired version on the right (it is done without Geometry Nodes, it’s just 5 boxes being copypasted manually). And the failed version on the left fails to display what I want and it uses Geometry Nodes, so I suspect that the problem comes from Geometry Nodes instead of Shader Nodes.
Blender file: https://blenderartists.org/uploads/short-url/webCSUCDF129U0B5WutAfQqjnEj.blend
Thank you!

It's looking like linked objects can't have different vertex positions, since they have shared mesh data. So that you have to realize instances.
Then enable Realize instances, I save center of instances in points domain:

Then to get coordinates, just subtract saved value from object coordinates:

Here is the result:

Really appreciate your help!
May I ask what happened to your uploaded picture? The pictures don't show up but there's a message saying that "(can't upload picture, will try later)"?

@IanAmbrose it didn't load yesterday, so I wrote this message

Hi, sorry for bothering you, could you please work with my file again, but this time, you change absolutely nothing but add new necessary stuff that can help me achieve my purpose. Would that be possible? You removed a few important nodes of mine in Shader Nodes which Mathematically confuses me.


text:
What does ''Axis'' input of Vector Rotate node do?

What does the Axis input do? I’m aware that if the input is 0-1-0, the rotation will be performed around Y axis, 1-0-0 for X axis and 0-0-1 for Z axis. The math to perform the rotation using those Axis inputs are Rotation Matrices with matrices as written above.
But what if the Axis input was ''unusual'' like 1-1-1? or 0.5-0.2-0.8? or 5-2-8? (The node let you manually type the number larger than 1 and less than (-1)). I don’t understand the math behind those ''unusual'' inputs.
How are these Axis inputs going to be performed with above matrices? Do they perform with the matrices at all or do they have to use different kind of math?
Any help would be greatly appreciated!

This question on Stack Overflow has an accepted answer that discusses the mathematics of rotation around an axis other than one of the three coordinate axis:

A product of the aforementioned matrices should be enough if you only need rotations around cardinal axes (X, Y or Z) like in the question posted. However, in many situations you might want to rotate around an arbitrary axis/vector. The Rodrigues' formula (a.k.a. axis-angle formula) is a commonly prescribed solution to this problem.

Where the answer uses "arbitrary axis/vector" it is describing the Axis input of the Vector Rotate node.  The node basically plugs the normalized value of Axis into  Rodrigues' rotation formula as K and performs the operations of that formula to create the rotation matrix that is then applied in the usual way.

Hi Mr. Fouts, I've made a new question regarding the same ''Vector Rotate'' node and the math behind it. Can please take a moment to look into it? I really need your help. Thank you!
https://blender.stackexchange.com/questions/241078/whats-the-math-behind-vector-rotate-node

@HuyHồVĩnh I've seen that question, but it's late here, so I'll try to answer it tomorrow my time.

Yes sir! Thank you for your help


text:
How does Smooth F1 Voronoi work mathematically?
I’m told that Smooth F1 Voronoi uses Smooth Minimum to visually smooth out the Voronoi Edges.
But how does it do that? I know the math behind Smooth Minimum and F1 Worley Noise, but how does Smooth Minimum selectively smooth out the Voronoi Edges instead of the top or bottom of the Voronoi Diagram?

(F1 Worley Noise)

(F1 Worley Noise with separate Minimum node applied)

(F1 Worley Noise with separate Smooth Minimum node applied)

(Smooth F1 Worley Noise)
You can see that the separate Minimum function slices the top of the displaced Voronoi Diagram, but to make that slice looks more organic, we can use Smooth Minimum (smin) instead of Minimum (min).
smin literally does the same job as min, it also visually smooth out the sharp corners generated by min.
So, Smooth F1 Voronoi is different to F1 Voronoi + Smooth Minimum. Please help me understand what the math behind Smooth F1 Voronoi is. Also, what is “Smoothness” input? Is it the same as parameter “Distance” of Smooth Minimum?
Thank you!

Nice question, nice answer. :)

It uses a weighted sum of neighbour voronoi cells. Hopefully the below code helps?
ccl_device float smooth_step(float edge0, float edge1, float x)
{
  float result;
  if (x < edge0)
    result = 0.0f;
  else if (x >= edge1)
    result = 1.0f;
  else {
    float t = (x - edge0) / (edge1 - edge0);
    result = (3.0f - 2.0f * t) * (t * t);
  }
  return result;
}

Source - GitHub commit:
https://github.com/blender/blender/commit/613b37bc2c81202a34346b40465923e8f47cebbf


text:
What's the math behind Vector Rotate node?

I’ve been taught that the Axis input is the value for input vector n^ of the Rodrigues’ rotation formula:
v’ = (1-cos(θ))[(v·n^)n^]+cos(θ)v+sin(θ)n^×v
But I don’t understand what ‘’Center’’ input do. And its effect on the Rotation.
I’ve done some tests in Blender. With Center = (0,0,0) and n^ = (0,0,1)
the result looks like the following diagram:

Description: All vectors including v rotate around vector n^ =
<0,0,1> (AKA Axis input) with its ‘’Center?’’ = <0,0,0> (AKA center input) for a θ angle
With Center = (1,0,0) and n^ = (0,0,1), the result looks like the following diagram:

Description: All vectors except for v rotate around vector n^ =
<0,0,1> (AKA Axis input) with its ‘’Center?’’ at <1,0,0> (AKA center input) for a θ angle.
So my guess is: Axis input is to control direction, Center input is to control position?
I’ve done researching and found out about the ‘’Rotation around a pivot point’’ formula:
p.x’ = [(p.x-o.x)*cos(θ)-(p.y-o.y)*sin(θ)]+o.x
p.y’ = [(p.x-o.x)*sin(θ)+(p.y-o.y)*cos(θ)]+o.y
This formula basically applies for cases where the ‘’point’’ of rotation is any where except for the Origin = (0,0,0)

But is this actually the case? Was this formula used for the instance where Center input = (1,0,0) ?
So my question is: what’s actually the math behind the Vector Rotate node? Assume I’m gonna use just Rodrigues’ Formula instead of Matrix 3D Rotation, what are the formulas, the steps and computations gonna be?
Is ''Axis'' input actually used to define the direction for all vectors to rotate around and ''Center'' input to define the point for all vectors to rotate around? Illustration on how the process go would be greatly appreciated.
All of what I’ve said above are just speculations on how the node work but I need actual math and the proof of it.
Please explain like I’m five. Explanation along with mathematical proof would be amazing. Thank you!
In case, if anyone wants to illustrate a diagram for me, you can use mathcha.io , it’s a very cool ‘’write and share’’ mathematic site.

Related https://blender.stackexchange.com/questions/194796/matrix-math-to-translate-rotate-scale-with-respect-to-a-pivot-point-in-object

@batFINGER actually no, the linked question isn't related in the kind of math with this question. They didn't ask and discuss about formulas, derivation and steps of the formulas related to 3D rotation. This question however did.

I'm going to assume Blender is going to use a matrix to move mesh vertices, so at the end of the day we need a matrix.

@RonJensen
Most of 3D softwares use matrices to perform almost every tasks regarding 3D stuff. The thing is formulas can be translated into matrix form and vice versa. And I need the mathematical formulas and derivations of the formulas and the proof behind it, just like what the question is about. But thank you for commenting.

Related https://stackoverflow.com/questions/14607640/rotating-a-vector-in-3d-space and https://blender.stackexchange.com/questions/240142/what-does-axis-input-of-vector-rotate-node-do

Nathan is correct. See sh_node_vector_rotate_around_axis, which calls axis_angle_to_mat3 for the rotation matrix.

3D transformations, like rotation, occur about the origin: 0,0,0.  (The origin of what space?  Whatever space you're measuring your coordinates in.)
However, the math to do 3D transformations about any other point is straightforward: you translate all points by what it takes to translate your center to 0,0,0, then you do your transformation, then you do the inverse translation for all your points.
One way to think about this is that we're not measuring in the same space as our coordinates; we're transforming the space into a new coordinate system where we can rotate about the origin, then we're transforming those coordinates back into our original coordinate system.
So given a point P [Px,Py,Pz] and a center C [Cx,Cy,Cz] and a rotation function f(x,y,z), then you:

P = P-C
P = f(P)
P = P+C

Or, as a function instead of an algorithm:
P = C + f(P-C)
By the way, this is true of scaling as well as rotation.
As for what exact code is used-- as you can see, there are a number of ways we can word the exact same operation.  We could also be doing matrix multiplications to transform the spaces.  But when all of these different techniques give the exact same output for any given input, they are isomorphic-- they are the same function, just expressed with different symbols.

Thank you for explaining how rotation around a pivot point work.
But can you please explain how the formulas work if there is any?

What are the formulas for the ''Center'' input?

How do they work?

How are they gonna work correspondingly with the Rodrigues' Rotation formulas which is also the formula for the ''Axis'' input?

What are the mathematical proof?

These above are also the questions that were written in my post. Because you know, I need the formulas do the calculations -

Thank you.

Hi Nathan, I've successfully written the formula thanks to the hints from your answer. Really appreciate your help. I'm sorry if I was being a d!ck earlier.

@IanAmbrose Not at all, and I'm happy to be of some help.  I know people get their information best in various ways, and maybe I can help present it in a useful way, and maybe I can't-- it doesn't just depend on me, but on the person I'm speaking with.  So if it's not the best way for someone in particular, that's fine.


text:
More pixels rendered, worse screen space reflection result. [EEVEE]

Hello everyone, I'm having this problem: The more pixels being render, the worse screen space reflection outcome, also in contradict, the less pixels being render, the better the reflection.
It's actually not like better or worse though, looks like the reflection just disappear. Look at the ground of the 1000px version vs 3000px version, the reflection of the roof where the lights is being placed just simply disappears, and the reflection on the other parts disappear as well but the picture I'm having for you here is too poor quality to be analyzed further. Also if the render had even less pixels to be rendered (below 1000px for example), then it will have even better reflection than the 1000px version itself. And if it got more pixels to be rendered, reflections will gradually disappear.
Please help me solve this problem. It's a important project for my class. Any help is greatly appreciated! Thank you.
[EDIT] PROLEM SOLVED:

NEVER NEVER set the trace precision to the max (1000) as it will cause reflection errors like this. 0.999 works great, as long as not the maximum setting.

Some thoughts as to how to diagnose this... 1) Can you create a simplified test case that you can share with others or provide simple instructions as to how others can replicate it? 2) Is it a gradual difference or something sudden? eg, does 2500x2500 work and 2501x2501 not work or is it a gradual change as you move up the resolution? 3) What version(s) of Blender have you tried this on and do other versions produce the same result.

@RichSedman

I will try my best if I can make another simple scene as a test case in the next few hours.
Yes, it is a gradual difference, the reflection gradually disappears when increasing up the solution and gradually appears when decreasing the solution. It means at around 100x100px, the reflection will be seen more clearly and will disappear completely at around 10000x10000px.
I tried this on the 2.9 version. I don't want to use the previous versions as they lack of functions that the 2.9 have.

Glad you've identified the cause. Thanks for updating the question with your solution. Please add an answer (instead of an edit to the question) and you can then mark that as the accepted solution. This way the question doesn't remain 'Unanswered' and other people can more easily learn from your experience.

Solution to the problem:
Don't set the Trace Precision to the maximum (1000) as it will cause reflection errors like this. The screen space reflection will work perfectly if set to be around 0.950 or lower.


text:
How would I make an indented swirl around this sphere
How would I go about making an even swirl from the bottom to the top that is indented?
I figure you would just insert it, but I don't know how to cut the swirl shape into the object.
I tried to use the knife tool but it doesn't make a uniform curve around the object.

unclear what you want , please elaborate

You could use a knife tool to cut a "swirl path", then select the whole path, bevel it slightly so it becomes a "channel", and then extrude the channel inwards (extrude faces along normals).

What do you mean by swirl? Could you add some drawing?

A way to do it is to start with a UV sphere which has a lot of rings. For instance, 360 rings or 720 depending on the amount of turns you want to give to the swirl. Keep segments as default (32 or so).

Having these many rings allows to proportionally rotate around Z the summit of the egg for n times 360 degrees.
Here set proportional editing on, set the fallog to linear, and use RZ360. Make sure the proportional editing sphere reaches the bottom of the egg. Repeat it for each turn you want to give.

Now select an edge loop joining the top and the bottom. Set proportional editing to smooth, and S to scale shiftZ to scale only on X Y and lower the proportional editing sphere so that it influences few vertices around the selected edge loop.

Can also animate the twist... using a simple deform modifier:

In that case, same principle but rotate nothing first just make the indent.
Then add the simple deform modifier and animate the angle:

You could do it this way:

Create a plane, rotate it 90° on the X axis, apply the rotation, subdivide it 20, then CtrlE > Un-Subdivide (Iterations > 1 in the Operator box):

Bevel and extrude the oblique edge:

Give it a Simple Deform modifier /Bend mode, with a Deform Angle of 360°:

Create a cube that contains the plane, display it as wireframe, scale it, subdivide it:

Give your plane a Mesh Deform modifier with the cube as Object, click on Bind. Select your cube, give it a basis shapekey then a second one, go in Edit mode and scale it so that it deforms the plane until it looks like an egg:

Give your plane a Subdivision Surface modifier, add some bevel to sharp the edges, apply the modifiers, fill the holes, etc...


text:
Texture for 3D models are transparent at places
I am using Blender 2.83 as a part of my Masters project. I have obtained 3D models of various fishes (.obj files), and I import them using
File > Import > Wavefront (.obj)
The models loads without errors, but the textures are "corrupted". I would appreciate any help and/or pointers on how to fix this. You can see images below. The "dark spots" are transparent spots

Some (maybe all) of the models are obtained from sketchfab, which have 3D previews where the textures look correct. The fish "groups" are the models viewed from left and right.
Beneath you can see a closer look of a model as well as the UV-editor view in case that is relevant.

Hello, maybe pack your images and share one of your fishes so that we can take a look: https://blend-exchange.giantcowfilms.com/

Hello :). If this only happens in Eevee, you need to change the material blend mode (perhaps to opaque).

@JachymMichal Thank you very very much, that fixed it!
If you post as an answer I can check your answer as correct :)

This is caused by your material's blend mode.
You have 2 options:

In Material settings uncheck Show Backface

or

Change Blend mode to Opaque (this will fully disable transparency)


text:
Learning Rigid Body Constraints (Slider & Piston) - Active object keeps passing through passive?
So I'm trying to teach myself some basic rigid body physics with rigid body constraints. I have a 2.83.4 .blend file with several collections (one for each constraint I'm trying to understand) and I'm struggling with the Slider and Piston constraints. Basically, I make two cubes and connect them and assign the constraints accordingly. When I try to simulate it, it does work initially, but the active cube that is constrained just passes through the passive cube, thus ruining the simulation. However, when I make a new passive cube and put it next to the original passive cube (the one that got constrained to the active cube) the active cube doesn't pass through it. I haven't had any issue with the Fixed, Hinge, or Point constraints, just these two so far.
All my googling has found videos from much older version of Blender, or a recommendation to increase the number of steps. I've tried everything I've seen, but I can't figure this one out. Can someone take a look at my file?

Thanks!

You are trying to get the objects 'Active1' and 'Passive (connected to Active1)' to collide. These two objects share a rigid body constraint through the empty 'Piston Constraint.' This constraint has 'Disable Collisions' checked. This is telling Bullet to ignore 'Active1' and 'Passive (connected to Active1)' collisions.

Oh my goodness... how did I miss this... Thank you very much! A valuable lesson has been learned tonight... Thanks again! :)


text:
How to animate an object with similar ghosting effect?
Can anyone give me any ideas onw how to recreate the effect as seen in this gif?

I would imagine it being simple, like having a single stick as the primary object, animating it along a path, and then somehow telling Blender how to leave a "ghost image" of that object every X number of frames.
I can do the first two parts, but the ghosting effect is something I am a bit lost on. Any tips would be appreciated! :)
Thank you!

Please embed the image into the question directly…

Updated, sorry.

Okay. Hmm, wondering about what this looks like in 3D since the trailing end doesn’t look like it just gets smaller. But as for the ghost effect, I might try using an array, and making sure the distance the stick moves each frame is the same distance between the sticks of the array. May not work


text:
Object not rendering smoothly - Can see where it bends regardless of how many loops cuts I have
I'm making this shape which is just a cylinder with a curve modifier on it.

I can't seem to figure out why you can see the subtle bends in the cylinder. I've rendered it multiple times with varying subdivision render levels, and I've even tried increasing the number of loop cuts from 100 all the way to 400+, and I can still see those bends/vertices/loop cuts.
I must be overlooking something. Can anyone help me out? I'll post my .blend in a moment.
edit: I'll note that I did apply shade smooth and autosmooth normals, and the problem persists. I currently have the subd render level to 3.

Thanks!

did you do shade smooth on your model?

Yeah, shade smooth and autosmooth normals.

In the Subdivision Surface modifier, the subdivision for viewport is only 1, does it change something if you change to 2?

Nope. I just tried re-rendering it and it's the same.

maybe try selecting everything in edit mode, and then subdivide it a bunch?

The imperfections are inherited from the curve used in the curve modifier. Select it, go to edit mode, select all and then search(f3) for Set Spline Type operator and set to NURBS:

You will also be able to control the resolution of it in the curve properties tab, but default 12 should be fine.
Or you could also solve the problem by moving the subdivision modifier below the curve:

I would recommend to do both - make the curve smooth and also use the subdivision modifier in the right order.
Just to clarify: by "right" order I mean probably the more efficient way - first modify the less dense geometry by curve modifier requiring less computation and only then smooth it by subdivision also increasing the density. I might not know some of the context to use such strong words as "right" ;)

Well hot damn... The NURBS change did it! Thanks a ton! Although I guess I don't quite understand curves that well. NURBS have more control than Bezier?

They are only different ways to control the curvature. I think its just easier to do with NURBS in this case, but you might as well use bezier and set vector handles to automatic. I don't think there is much difference, whatever is easier for you to work with. I tend to like NURBS a bit better, but it's not based on any facts, just personal preference so use whatever works best for you. The true issue was the sharp corners on poly type curve.


text:
One object isn't rendering a shadow in Cycles
I haven't encountered this issue before, so I apologize if this is a simple fix... but I'm trying to work on a small interior scene, and for some reason, I can get the shadow of a table to show up in the 3D viewport, but the same shadow doesn't show up in the actual render.
Some screenshots:
There's no shadow in the bottom right of the image.

If I hit Tab to enter edit mode, the shadow reappears.

But then even with the shadow visible, when I render the image, the shadow is gone again.

Can someone poke around my .blend file and see if anything is strange? Again, I've never encountered this issue before, so I'm not sure what could be the cause...
Thanks! :)

Hello, your file is 542 Mb large, please post a minimal working example without the textures if you want us to take a look. Also please make sure "Shadow" is not disabled for this particular model in the properties  https://i.sstatic.net/Erpr9.png

Hello, I updated the link... It's still 160mb though.. I don't know how to make it any smaller. :(

next time delete all objects not necessary and include the textures to the blend file (otherwise the scene is all violet)

you just need to select the table and check the "shadow" checkbox under "object properties"


text:
How to make particles fall and land into predetermined shapes (like text)?
I'm wondering how to approach this problem. I just watched a video on how to get particles to "morph" shapes, but what I'm looking for is more natural-looking... My specific idea is to have pieces of candy corn fall into the letters BOO! I can figure out the particle system emitter, and I can get the particles to fall, but I'm scratching my head on how to get them to naturally fall into the BOO shape.
Are there any good resources for this kind of simulation?

Thanks!

you need to give your letters a Physics > Collision, but maybe share your file so that we see where is the problem more precisely

I should clarify: I'm not trying to get them to fall into a physical object... the idea is that the particles fall onto a flat plane, but the particle trajectory/path's end position is going to spell out a word. I'm still working on my blender file at the moment. I'll try a couple things and then post my .blend file. Thanks!

so maybe create some letters and make them invisible?

I'm not sure I'm following.... I added my .blend file to my original post, in case you wanted to poke around.

something like that except you make the letters invisible in render: https://zupimages.net/up/20/43/ofmm.gif

ben's solution seems to be a nice addition to my idea, put all you candies inside invisible letters then make them move up (depends on where they are supposed to come from though)

Could you explain more what is "natural looking"? Is it about the fall or the final shape (or other)?

Or https://i.sstatic.net/H9EKV.gif ?

So I guess what I was aiming for was this: imagine you have a handful of candy corn and you simply toss it onto a table or similar surface. I wanted to the candy to naturally slide a little bit on the table, and have their ending position be in the shape of the text. Does that make sense?

So, two steps: they fall on the table then from the table they move to form the text?

Yes, that would be correct... I want them to fall onto the table while sliding/bouncing/colliding towards the shape of the text.

You could do it backwards.  Have a mesh (set to not be visible in the render itself) define the shape for the particles to end up in, have this mesh start with a lot of particles only inside its volume, and then animate them all 'falling' randomly upwards under an appropriate force.  Then reverse the animation, either externally or via baking it and reversing the order of keyframes.
Whether this looks good or very faked will depend on the look you're going for and the shapes of your targets.

Thanks @Ben, you've given me an idea for this year's Christmas card!  :)

Start the animation with a huge number of particles and make them fall onto the plane.
Bake them and transform the particles into real objects with keyframes.
Select all the particles and remove from selection (You can use the C shortcut to activate the circle selection) those in the places you want to save (where the letters should be drawn) and delete the others.

You can create invisible letters and make your candies fall into. For the letters, in the Properties panel > Physics > Rigid Body > Collisions > Shape, choose Mesh:

If you don't want candies to fall out of the letter, once they have fell into the letter, you can select them all at frame X, go in the header menu > Object > Rigid Body > Bake to Keyframes, then, as suggested by Ben, give them a new Rigid Body, but this time make them move up with a Gravity of -1 in the Scene settings, or with some Force Field, then invert the render so that they fall down into the letter.

Very nice! Absolutely better than my solution!

Fake physics with keyed particles

Keyed particles allows to drive in time the movement of the particles along several objects.
The driver has itself a particle system in which settings we can define the sequence of other objects the particles will go through.
The objects of this sequence have their own particle system (with eventually their own parameters).
Here I've placed:

a cube to start with,
a plane that will fake the point where particles should fall to the table,
another shape that defines the surface of the table the particles fall on
the text object

The driver particle system has the following settings:

where:

Physics is set to keyed
Use timing is on
In relations are added the object sequence
And for each of them we indicate the time (in frames) at which the particle will be on it and the duration it will stay on it (these times are relative to its birth)

The documentation is here.

Applied Remesh modifier with 0.01 used on letters helps to even distribution (especially on letter B :) BTW particles are quite crossing each other, I'm wondering if that can be avoid somehow? Thanks :) Great answer.

@vklidu, thanks for this comment. I was not able to make rigid body work when using keyed. So, yes, they overlap. Don't know if there is a solution.

Rigid Body

Convert particles to Rigid Body (with add-on or if you don't mind how they appear on scene just apply particle modifier).  Similar to moonboots's answer, but ...

Use one plane collider as floor to let candies fall on a desk.
Then use another collision object with letters shape extruded conicaly upward, and animate location on Z axis.


text:
Why is my high-poly mesh bake result poor?
I'm new to baking maps in general, so I'm sorry if this is a dumb question.
I'm making some drumsticks, and I wanted them to appear used and "beat up", so I sculpted a lot of details into them. I'm trying to bake the highpoly into the lowpoly, but every time I try, the map has these vertical tears in it, and the map doesn't look good.

Am I adding too much detail? From what I understand, you have select your highpoly mesh first, then select the lowpoly - and as long as they're both in the same location in 3d space, you can bake it without issue. Is my understanding correct?
I'm new to sculpting as well, so I have no idea if how I sculpted it was good or bad. Can anyone point me in the right direction?
Cheers!
My .blend file is here. It was too large to upload normally, which makes me feel like I'm doing something wrong already, haha.
EDIT:
Here's a screenshot of my normal map (I had to zoom in a little to show the artifacting)

Your object is very small in your scene, so with an Extrusion of 0.5 it will miss the bake, bring back this value to 0, give a Ray Distance of 0.0001 and it will work.

Is the Extrusion setting in the Bake options?

Actually, I just tried it with the Ray Distance set to 0.0001, and it baked, but my normal map is quite sheared/torn vertically.. I'll update my main post and show you my normal map.

I can't say why it doesn't work, it works fine for me  :((

Do you think you can screenshot what the normal map looks like for you?

See my edit, I've recreated a 1024 x 1024 picture to make it quicker


text:
Copying and rotating object via Blender Python API
I'm new to the Blender API, so I've been doing a lot of playing around with it. I'm having some issues trying to do something that should be simple.
My goal: make a copy of a "base" object, enter edit mode, rotate it by 90 degrees on the Y axis (so it's on its side), and then put the new edited object into the "base shape" collection.
My problem: When I get the object and try to rotate it, it affects all of the other objects in the "base shape" collection.
My function:
def make_side_arch():
base = C.collection.children['Base Shapes'].objects['Semi_Arch']

ob = base.copy()
ob.data = base.data.copy()

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.transform.rotate(value=radians(90), orient_axis='Y')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode='OBJECT')

ob.name = 'Side_Arch'
ob.data.name = 'Side_Arch'
ob.data = ob.data.copy()

C.collection.children['Base Shapes'].objects.link(ob)
return ob

In the screenshot below, I am trying to apply it to the objects called Semi_Arch. (I'll attach the blend file at the end). It seems to be affecting all the other shapes in the file though, and I'm struggling to understand why. I know I'm probably in the wrong context or something, but it's been really, really confusing wrapping my head around it. Any help is greatly appreciated!
I know people say to avoid bpy.ops, but I don't know how to do most things without it.

Staying away from ops is a good idea, since they are context-dependent. However, if everything is working, it's ok to use them.
In your case, you have to make sure your ob is active and selected before using them. I don't see that in your code.
If you don't mind them in the first place, I think the quickest fix would be, to replace
ob = base.data.copy()

with:
bpy.ops.object.duplicate()
ob = bpy.context.active_object

But make sure the correct base object is active and selected.

What would be the best way to do that without ops? I'd like to make it a habit of not using ops when possible, just to make things faster for me down the road. I was able to get my script working to an extent... except that I forgot that the object origin is on the bottom face, so when the objects get rotated they're no long on the same level... so if you have a fix for that as well, that would be great, ha. I tried entering edit mode, but it doesn't seem to work.

Something along the line of make a mesh bmesh, or regular from .data or .data.copy(), then use matrix multiplication on each vertex. https://blender.stackexchange.com/questions/102917/rotation-matrix-addition


text:
aligning 2 objects based on child objects
I have seen a LOT of answers to questions similar to this but havent been able to make any of them work yet.
in the pic I have a pentagon and a dodecahedron. I have placed triangles on the faces to be guides in an addon/workflow Im trying to accomplish.
I need to get the pentagon to snap to a face of the deodecahedron based on the triangles they both have as a guide, so if the triangle is bigger or angled etc., that's how it gets applied.
Currently I have:
def fnRotateTo(objToRotate,objTargetVector):
    objFromVector=fnGetCenter(objToRotate.data.vertices)
    objToRotate.rotation_mode = 'QUATERNION'
    objToRotate.rotation_quaternion = objTargetVector.to_track_quat('Z','Y')

and that gets me close, but it's obviously not right.
I have a bunch more code to this I'm willing to share if it helps. I basically get the center/normals of the traingles and then move the parent object and rotate by the function above. The rotation is where I'm stuck.

all code so far
bl_info = {
"name": "Anchors Aweigh",
"author": "Anthony Aragues",
"version": (1, 0),
"blender": (2, 80, 0),
"location": "n > Anchors",
"description": "Create anchors on objects and use themn to snap to each other with size and scale",
"warning": "",
"doc_url": "",
"category": "Modeling",
}
'''
 NOTES
 # nice helpful template https://gist.github.com/tin2tin/ce4696795ad918448dfbad56668ed4d5
 # need a way of setting a primary default anchor for many to many anchor snaps

 # parent the anchor to the original mesh

 # give it special properties to use to recognize its an Anchor

        #user selects a target object
        #user selects a an object to snap to anchors on the previous object
        #user presses the button to go

        #show a list of the anchors on target object, allow select/ deselect, default apply all

        #for each anchor in target object, copy the slected object, scale and rotate to match anchor.

        #bonus, allow a collection with anchors to be used instead of a single object
        #option to create a free form anchor and put anywhere on any object
        #allow iteration without colliding objects, with optional random anchor selection

'''

import bpy, bmesh, mathutils
from mathutils import Vector, Matrix

def fnGetScale(arrVerts):
    objScale={"x":0,"y":0,"z":0,"center":{"x":0,"y":0,"z":0}}
    intMinX = None
    intMinY = None
    intMinZ = None
    intMaxX = None
    intMaxY = None
    intMaxZ = None
    for objVert in arrVerts:
        #coordinates per point per face of selected object
        arrCo=objVert.co.to_tuple()
        if intMinX == None or arrCo[0] < intMinX:
            intMinX=arrCo[0]
        if intMaxX == None or arrCo[0] > intMaxX:
            intMaxX=arrCo[0]
        if intMinY == None or arrCo[1] < intMinY:
            intMinY=arrCo[1]
        if intMaxY == None or arrCo[1] > intMaxY:
            intMaxY=arrCo[1]
        if intMinZ == None or arrCo[2] < intMinZ:
            intMinZ=arrCo[2]
        if intMaxZ == None or arrCo[2] > intMaxZ:
            intMaxZ=arrCo[2]
    objScale['x'] = intMaxX-intMinX
    objScale['y'] = intMaxY-intMinY
    objScale['z'] = intMaxZ-intMinZ
    return objScale

def fnGetCenter(arrVerts):
    verts_sel = [v.co for v in arrVerts]
    objCenter = sum(verts_sel, Vector()) / len(verts_sel)
    return objCenter

def fnRotateTo(objToRotate,objTargetVector):
    #Ive been using this to face a newly created item in the direction as a normal, give it a face.normal as a target
    #get vector to calc with from obj to move
    objFromVector=fnGetCenter(objToRotate.data.vertices)
    objToRotate.rotation_mode = 'QUATERNION'
    objToRotate.rotation_quaternion = objTargetVector.to_track_quat('Z','Y')
    #objToRotate.rotation_quaternion = objFromVector.to_track_quat('Z','Y').inverted() @ objTargetVector.to_track_quat('Z','Y')

def rotate_object(obj, loc, normal):
    up = mathutils.Vector((0, 0, 1))
    angle = normal.angle(up)
    direction = up.cross(normal)

    R = mathutils.Matrix.Rotation(angle, 4, direction)
    T = mathutils.Matrix.Translation(loc)
    M = T @ R @ T.inverted()

    obj.location = M @ obj.location
    obj.rotation_euler.rotate(M)

def fnGetFirstSelectedNormal(objMesh):
    for objFace in objMesh.faces:
        if objFace.select == True:
            return objFace.normal

def fnGetAnchor(objTarget):
    arrAnchors=[]
    for objChild in objTarget.children:
        if "anchor" in objChild:
            return objChild

def fnGetAnchors(objTarget):
    arrAnchors=[]
    for objChild in objTarget.children:
        if "anchor" in objChild:
            arrAnchors.append(objChild)
    return arrAnchors

def fnCopyObject(objSource,context):
    objNew=objSource.copy()
    objNew.data = objSource.data.copy()
    objNew.animation_data_clear()
    context.collection.objects.link(objNew)
    return objNew

#user input fields
class AnchorsInputs(bpy.types.PropertyGroup):
    #builting string (variable)property
    anchor_name: bpy.props.StringProperty(name='name')
    target_object: bpy.props.PointerProperty(type=bpy.types.Object, name='target')
    move_object: bpy.props.PointerProperty(type=bpy.types.Object, name='move')
    move_anchor: bpy.props.EnumProperty(name='anchor', items=[('wtf','wtf','wtf')] )
    apply_to_all: bpy.props.BoolProperty(name='copy to all anchors')

class Snap_Op(bpy.types.Operator):
    bl_idname = 'snap.go'
    bl_label = 'Move the parent objects together based on the anchors'

    #this is the operator function that will be called on button press
    def execute(self, context):
        if context.scene.custom_props.move_object != None:
            objMove=context.scene.custom_props.move_object
            objMoveAnchor=fnGetAnchor(objMove)
            bpy.data.objects[objMoveAnchor.name].select_set(True)
            bpy.ops.view3d.snap_cursor_to_selected()
            bpy.data.objects[objMove.name].select_set(True)
            bpy.ops.object.origin_set(type='ORIGIN_CURSOR', center='MEDIAN')
            #objMove.origin_set(fnGetCenter(objMoveAnchor.data.vertices))
        if context.scene.custom_props.target_object != None:
            objTarget=context.scene.custom_props.target_object
            arrTargetAnchors=fnGetAnchors(objTarget)

            for objTargetAnchor in arrTargetAnchors:
                objTargetWorld=objTargetAnchor.matrix_world
                objTargetCenter=fnGetCenter(objTargetAnchor.data.vertices)
                loc = objTargetWorld @ objTargetCenter
                objNew=fnCopyObject(objMove,context)
                objNew.location=loc
                print(objNew)
                fnRotateTo(objNew,loc)
        return {'FINISHED'}

class CreateAnchor_Op(bpy.types.Operator):
    bl_idname = 'createanchor.go'
    bl_label = 'Create an Anchor for the faces selected'

    #this is the operator function that will be called on button press
    def execute(self, context):
        #get the scene
        objScene = context.scene
        # Get the active mesh
        obj = context.edit_object
        # Get a BMesh representation
        objMesh = bmesh.from_edit_mesh(obj.data)

        #get the area between all verts selected
        arrVerts=[]
        for objVert in objMesh.verts:
            if objVert.select == True:
                arrVerts.append(objVert)
        objScale= fnGetScale(arrVerts)

        #get the normal direction of the selected faces (only need 1 face)
        objNormal = fnGetFirstSelectedNormal(objMesh)

        objCenter=fnGetCenter(arrVerts)

        bpy.ops.object.editmode_toggle()

        intRadius=objScale['x']/2
        if objScale['y']/2 < intRadius:
            intRadius=objScale['y']/2
        if objScale['z']/2 < intRadius:
            intRadius=objScale['z']/2

        bpy.ops.mesh.primitive_circle_add(
              enter_editmode=False, align='WORLD', vertices=3, fill_type='NOTHING'
            , location=(objCenter)
            , radius=1, scale=(1, 1, 1))
        objAnchor = context.active_object
        bpy.ops.transform.resize(value=(intRadius/1, intRadius/1, intRadius/1), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)),
            orient_matrix_type='GLOBAL', constraint_axis=(False, True, False), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
        objAnchor.name=objScene.custom_props.anchor_name
        objAnchor.parent=obj
        objAnchor['anchor']={"default":True}

        #  set the rotation the anchor in the direction of the normal
        objPointTo=obj.matrix_world @ objNormal
        fnRotateTo(objAnchor,objPointTo)

        #print(objScale)
        return {'FINISHED'}

class Anchors_Panel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Anchors"
    bl_category = "Anchors"
    bl_idname = "OBJECT_PT_AnchorsPanel"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'

    def draw(self, context):
        layout = self.layout
        #start with first camera found
        row = layout.row()
        row.label(text="Create Anchors")
        row = layout.row()
        row.label(text="1. Selected faces in edit mode")
        row = layout.row()
        row.label(text="2. Name the Anchor")
        row = layout.row()
        row.label(text="3. Run the Create script")
        row = layout.row()
        layout.prop(context.scene.custom_props, 'anchor_name')
        layout.operator("createanchor.go",text = 'Create Anchor')
        row = layout.row()
        layout.prop(context.scene.custom_props, 'target_object')
        layout.prop(context.scene.custom_props, 'apply_to_all')
        layout.prop(context.scene.custom_props, 'move_object')
        layout.prop(context.scene.custom_props, 'move_anchor')
        layout.operator("snap.go",text = 'Move and Scale')

def register():
    bpy.utils.register_class(AnchorsInputs)
    bpy.types.Scene.custom_props = bpy.props.PointerProperty(type=AnchorsInputs)
    bpy.utils.register_class(CreateAnchor_Op)
    bpy.utils.register_class(Snap_Op)
    bpy.utils.register_class(Anchors_Panel)

def unregister():
    del bpy.types.Scene.custom_props
    bpy.utils.register_class(AnchorsInputs)
    bpy.utils.unregister_class(CreateAnchor_Op)
    bpy.utils.unregister_class(Snap_Op)
    bpy.utils.unregister_class(Anchors_Panel)

if __name__ == "__main__":
    register()

If this is a question about achieving this with Python, could you add 'Python' to the tags? I'm not sure whether that's what you want, so haven't done it for you.

Also recommend posting minimal working code, especially when referencing other custom methods. Suggest matching matrix world of source triangle to that target triangle.  Flipped if its a magnet type arrangement. Post more info if this is an issue.  btw @RobinBetts is a good looking rooster with hair..

added the python tag and all my code so far, thanks for looking @RobinBetts

updated, thanks @batFINGER


text:
Vertices disappeared on some but not all Objects
Vertices disappeared on some objects (not all). I'm trying to merge 2 vertices at center, but nothing happens when I select 2 vertices, and select that option. I'm very new to Blender editing. I've searched YouTube, and all Stack Exchanges, only old references come up, nothing about this issue. Please help.
In my image, you can see, there are no vertices on the 2 right objects. Even for the left two, I cannot merge any of those vertices together. All 4 objects will eventually be merged, but I can't merge if there are no vertices to do so with.

cant see the image

I Edited, sorry, forgot to upload image initially. :)

I think you must try going to the object mode and select your 4 objects and press Ctrl +J to join them and try , If you can't use the at center option try snaping cursor on the 2 vertices and then merge them

I learned that you can only "edit" 1 object at a time, so yes this answer helped me come to an answer that I needed. Thank you.

then you can click the tick to declare this correct

Solved by leaving Edit Mode, selecting all objects in the viewer, re-entering edit mode (coming from Object mode), and as Shikha Mittal mentioned I joined them all together, and that allowed me to see the vertices on all the 4 shaped objects.


text:
I can not find mesh panel or mesh check box which should be in the fluid tap
I can not find mesh panel or mesh check box which should be in the fluid tap
first, I succeeded in making fluid particles, but for the next step, I stucked.
Many tutorials say that I should click the Mesh checkbox to bake mesh, but there is no such box..
Where can I find it? Plz help,,

Thank you so so much!,, it was a stupid question

Click the little arrow beside the 'Liquid' checkbox which will expand the panel and you'll find the Mesh entry on that panel.

Thank you for your answer. You guys made me keep motivated.

You're welcome!


text:
Midway through rendering my animation, the color management seems to have changed. How did this happen, what should I do?

The first image is what I had been rendering (it's frame 36/255) and the second is what it changed to on frame 37/255. I have no idea how this happened and I can't find a way to fix it. (Cycles render btw)
Extra clarification:
The colors aren't the 'texture not found' colors, they are just different, again it changed midway through the rendering process. The textures used are principle BSDF nodes with a change in the base color.

Did you delete or move any of the images used in the scene? Pink means that blender can no longer access the image file.

possible duplicate of: https://blender.stackexchange.com/questions/5368/why-are-all-the-textures-in-my-file-pink