text:
How can I make a 2d gpu polygon and text follow the cursor?
The code:
import bpy, bmesh
import bgl
import blf
import gpu
from gpu_extras.batch import batch_for_shader

vertices = (
    (60, 425), (310, 425),
    (60, 580), (310, 580))

indices = (
    (0, 1, 2), (2, 1, 3))

shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)

def draw_bevel(self, context):

    #box
    shader.bind()
    shader.uniform_float("color", (0.3, 0.3, 0.3, 0.8))
    batch.draw(shader)

    #text
    font_id = 0
    x_offset = 0
    y_offset = 0
    active = context.active_object
    bevelWV = active.modifiers["Bevel"].width
    bevelWV = round(bevelWV, 4)
    bevelSG = active.modifiers["Bevel"].segments
    bevelSG = round(bevelSG, 4)

    blf.color(font_id, 0, 0.292, 1, 0.7)
    blf.position(font_id, 78, 510, 0)
    blf.size(font_id, 27, 176)
    blf.draw(font_id, "BEVEL" )

    blf.color(font_id, 0, 1, 0.232, 0.7)
    blf.position(font_id, 83, 480, 0)
    blf.size(font_id, 27, 81)
    blf.draw(font_id, "WIDTH" )

    blf.color(font_id, 0, 1, 0.232, 0.7)
    blf.position(font_id, 83, 450, 0)
    blf.size(font_id, 27, 81)
    blf.draw(font_id, "SEGS" )

    blf.color(font_id, 1, 1, 1, 0.7)
    blf.position(font_id, 195, 480, 0)
    blf.size(font_id, 27, 81)
    blf.draw(font_id, str(bevelWV))

    blf.color(font_id, 1, 1, 1, 0.7)
    blf.position(font_id, 195, 450, 0)
    blf.size(font_id, 27, 81)
    blf.draw(font_id, str(bevelSG))

class BevelSetModal(bpy.types.Operator):
    """Move an object with the mouse, example"""
    bl_idname = "bevel.set_operator"
    bl_label = "Bevel Set modal"

    first_mouse_x = IntProperty()
    first_value = FloatProperty()

    @classmethod
    def poll(cls, context):
        mod_types = set()
        for o in context.selected_objects:
            for m in o.modifiers:
                mod_types.add(m.type)
        return 'BEVEL' in mod_types and context.object.type == 'MESH'

    def modal(self, context, event):
        context.area.tag_redraw()
        if event.type == 'MOUSEMOVE':
            self.mouse_path.append((event.mouse_region_x, event.mouse_region_x))
            delta = self.first_mouse_x - event.mouse_x
            bpy.context.object.modifiers["Bevel"].width = self.first_value + delta * -0.001

        elif event.type == 'MOUSEMOVE'+'P':
            self.mouse_path.append((event.mouse_region_x, event.mouse_region_x))
            delta = self.first_mouse_x - event.mouse_x
            bpy.context.object.modifiers["Bevel"].profile = self.first_value + delta * -0.001

        elif event.type == 'V' and event.value=='PRESS':
            bpy.context.object.modifiers["Bevel"].use_only_vertices = True

        elif event.type == "WHEELUPMOUSE":
            bpy.context.object.modifiers["Bevel"].segments += 1

        elif event.type == "WHEELDOWNMOUSE":
            bpy.context.object.modifiers["Bevel"].segments -= 1

        elif event.type == 'LEFTMOUSE':
            bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
            return {'FINISHED'}

        elif event.type in {'RIGHTMOUSE', 'ESC'}:
            bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
            bpy.context.object.modifiers["Bevel"].width = self.first_value
            return {'CANCELLED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):

        if context.area.type == 'VIEW_3D':
            args = (self, context)
            self._handle = bpy.types.SpaceView3D.draw_handler_add(draw_bevel, args, 'WINDOW', 'POST_PIXEL')
            self.mouse_path = []

        if context.object:
            self.first_mouse_x = event.mouse_x
            self.first_value = bpy.context.object.modifiers["Bevel"].width
            context.window_manager.modal_handler_add(self)

            return {'RUNNING_MODAL'}
        else:
            self.report({'WARNING'}, "No active object, could not finish")
            return {'CANCELLED'}

Basically what this does is draw a 2d polygon box using the new gpu module in 2.8 and some blf text which displays the bevel modifier data, in a modal operator (if there is a bevel modifier present on the mesh object).

As you can see the coordinates of the box and the blf text are both hardcoded. My goal is make the elements get aligned to the right side of the cursor and move along with it. I absolutely have no idea on how to even approach this.

I tried adding the solution provided by @brockmann but this is what happens:

The box is just moving diagonally instead of following the mouse x,y. The example script works fine on its own but the mouse coordinates seem to be confliciting with the modal operator mouse maps.

Might be an idea to post your code using answer below that produces wrong result shown.  Couple of recommendations. Don't rely on gloabally using bpy.context .. if context is an argument of method use that instead.  Also look into using other methods than ob.modifiers["Bevel"] which throws an error if no modifiers, if modifier named "Bevel" doesn't exist or has been renamed, or is named "Bevel" but isn't a bevel modifier.  eg mods = [m for m in ob.modifiers if m.type == 'BEVEL'] is a list of all bevel mods on object. Do nothing if there is none.

Record the cursor path using Event.mouse_region_* and offset the vertices of the rectangle based on x and y coords of the cursor. Following code is based on operator_modal_draw.py template:

import bpy
import bgl
import blf
import gpu
from gpu_extras.batch import batch_for_shader

def draw_callback_px(self, context):
    x, y = self.mouse_path[-1]

    vertices = (
        (x, y-50), (x+70, y-50),
        (x, y), (x+70, y))

    indices = (
        (0, 1, 2), (2, 1, 3))

    bgl.glEnable(bgl.GL_BLEND)
    bgl.glEnable(bgl.GL_LINE_SMOOTH)
    shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
    batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glLineWidth(1) # Set the line width
    shader.bind()
    shader.uniform_float("color", (0.2, 0.7, 0.2, 0.5))
    batch.draw(shader)

    font_id = 0  # XXX, need to find out how best to get this.

    # draw some text
    font_offset = 10
    blf.position(font_id, x+font_offset, y-font_offset*2, 0)
    blf.size(font_id, 20, 72)
    blf.draw(font_id, "Hello")

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)

class ModalDrawOperator(bpy.types.Operator):
    """Draw a line with the mouse"""
    bl_idname = "view3d.modal_operator"
    bl_label = "Simple Modal View3D Operator"

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def modal(self, context, event):
        context.area.tag_redraw()

        if event.type == 'MOUSEMOVE':
            self.mouse_path.append((event.mouse_region_x, event.mouse_region_y))

        elif event.type == 'LEFTMOUSE':
            bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
            return {'FINISHED'}

        elif event.type in {'RIGHTMOUSE', 'ESC'}:
            bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
            return {'CANCELLED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        if context.area.type == 'VIEW_3D':
            # the arguments we pass the the callback
            args = (self, context)
            # Add the region OpenGL drawing callback
            # draw in view space with 'POST_VIEW' and 'PRE_VIEW'
            self._handle = bpy.types.SpaceView3D.draw_handler_add(draw_callback_px, args, 'WINDOW', 'POST_PIXEL')

            self.mouse_path = []

            context.window_manager.modal_handler_add(self)
            return {'RUNNING_MODAL'}
        else:
            self.report({'WARNING'}, "View3D not found, cannot run operator")
            return {'CANCELLED'}

def register():
    bpy.utils.register_class(ModalDrawOperator)

def unregister():
    bpy.utils.unregister_class(ModalDrawOperator)

if __name__ == "__main__":
    register()

To control the bevel modifier interactively I'd suggest store a reference to the bevel modifier in your invoke() method. This way you can access all the modifier properties from all other methods as well as adding a bevel modifier in case there is no modifier added to the object already.

import bpy
import bgl
import blf
import gpu
from gpu_extras.batch import batch_for_shader

def draw_callback_px(self, context):
    x, y = self.mouse_path[-1]

    vertices = (
        (x, y-50), (x+100, y-50),
        (x, y), (x+100, y))

    indices = (
        (0, 1, 2), (2, 1, 3))

    bgl.glEnable(bgl.GL_BLEND)
    bgl.glEnable(bgl.GL_LINE_SMOOTH)
    shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
    batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glLineWidth(1) # Set the line width
    shader.bind()
    shader.uniform_float("color", (0.2, 0.7, 0.2, 0.5))
    batch.draw(shader)

    font_id = 0  # XXX, need to find out how best to get this.

    # draw some text
    font_offset = 10
    blf.position(font_id, x+font_offset, y-font_offset*2, 0)
    blf.size(font_id, 20, 72)
    blf.draw(font_id, "{:.2f}".format(self.bevel_mod.width))

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)

class ModalDrawOperator(bpy.types.Operator):
    """Draw a line with the mouse"""
    bl_idname = "view3d.modal_operator"
    bl_label = "Simple Modal View3D Operator"

    def bevel_modifier(self, context):
        obj = context.active_object
        mods = [m for m in obj.modifiers if m.type == 'BEVEL']
        return mods[0] if mods else obj.modifiers.new("Interactive Bevel", 'BEVEL')

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def modal(self, context, event):
        context.area.tag_redraw()

        if event.type == 'MOUSEMOVE':
            self.mouse_path.append((event.mouse_region_x, event.mouse_region_y))
            self.bevel_mod.width = event.mouse_region_x * .001

        elif event.type == 'LEFTMOUSE':
            bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
            return {'FINISHED'}

        elif event.type in {'RIGHTMOUSE', 'ESC'}:
            bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
            return {'CANCELLED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        if context.area.type == 'VIEW_3D':
            # the arguments we pass the the callback
            args = (self, context)
            # Add the region OpenGL drawing callback
            # draw in view space with 'POST_VIEW' and 'PRE_VIEW'
            self._handle = bpy.types.SpaceView3D.draw_handler_add(draw_callback_px, args, 'WINDOW', 'POST_PIXEL')

            self.mouse_path = []

            # Bevel Modifier
            self.bevel_mod = self.bevel_modifier(context)
            self.bevel_offset = self.bevel_mod.width

            context.window_manager.modal_handler_add(self)
            return {'RUNNING_MODAL'}
        else:
            self.report({'WARNING'}, "View3D not found, cannot run operator")
            return {'CANCELLED'}

def register():
    bpy.utils.register_class(ModalDrawOperator)

def unregister():
    bpy.utils.unregister_class(ModalDrawOperator)

if __name__ == "__main__":
    register()

please check the edit

Working for me, check out the gif... so I guess there is something wrong with your implementation. @Retrax Suggest add your code to the q.

The code is exactly the same as before I just replaced my box implementation with yours

I guess that's caused by your additional calculation (delta variable) in your modal method @Retrax I'd suggest try to implement your bevel actions step by step based on my code above. I won't go over that since this is out of question scope IMHO. Also note: according to pep8 variable names should be lower_case...

Perhaps use blf to put object name in box.

Done. Had some time Sherlock... @batFINGER


text:
Clear Parent and Keep Transformation
Add a Plane, Rotate (here on Z axis 45°) ...

Add an Empty, Parent the Plane to the Empty Ctrl+P and Scale the Empty
(here scale along X axis 0.5)

The Plane transformation as expected ... but already here the Dimension value is strange.

Select the Plane and Clear Parent and Keep Transformation Alt+P.

Result is weird looking Plane ... not only the Transformation wasn't kept, but also original Rotation and Scale is somehow shifted.

Note: Empty and Plane with the same rotation (Collection 01 and 03) works fine. Since a "child" is rotated it fails (see Collection 02).

Scale can not be propagated to children, since Blender doesn't support shearing.

Leander, I'm not sure what you mean, if you parent a cube to an empty, scale the empty, the cube will scale as well. If you unparent the cube with the Keep Transformation option, it should keep its inherit scale. It's not happening here, why that?

@moonboots Only if the scaling is uniform on all axes (e.g. 3, 3, 3). Any "non-uniform" (don't know a better word) scale like 1, 2, 3 combined with a rotation would apply into a sheared matrix, which Blender doesn't support. (Search for shear.)

ok so maybe give a full explanation as answer  ;)

@ Leander: Scaling 1,2,3 itself doesn't seem to be a problem, so since a child is in angle against a parent, it results in "shearing" transformation, right? But since there is not a problem to transform mesh in some result as child, what's the problem to let blender regenerate vertecies in the same exact position?

I tried to provide an explanation and a workaround. Is is, unfortunately, both wordy and still requires some previous knowledge. The python code is intended for 2.8, are you using 2.79? If you are using 2.79 you have to replace the matrix multiplication operator @ with an *.

@ "What's the problem to let Blender regenerate vertices in the same exact position?" - I would like to know as well! This is exactly what I would do with the script at the end of my answer. Perhaps someone else knows, where that button is hidden in Blender.

Blender does not support shear or skew transformations, thats why the state you request can not be reached on object/transform level but only on data/mesh level. I have added a possible workaround at the end of the post.
Translation, Rotation, Scale
First, let's confirm that Blender only supports translation, rotation and scaling transformations. Select the untransformed default cube.
Open up the Blender Python console, type bpy.context.object.matrix_world and press enter.

Cool, we are confronted by 16 numbers of a matrix. bpy.context.object is simply a reference to this object. matrix_world is the transformation matrix. A transformation matrix contains the objects transformation: translation, rotation, resizing, shearing and skewing.
Look at these slides for a brief overview or this beautifully crafted blog post for a more detailled explanation.
The _world part in matrix_world simply refers to the resulting matrix with all parents transformations applied. Since the default cube has no parents, we could also use matrix_local.
We can not only output the matrix of the default, we can also assign it using python. Obviously we usually only work with partial components of the transformation matrix of object (tranlation, rotation, scale) since the matrix is not very intuitive. Open Blenders Text Editor and paste the following script.
import bpy
import mathutils
from math import cos, sin, pi

mat = mathutils.Matrix( [ [1, 0, 0, 0],
                          [0, 1, 0, 0],
                          [0, 0, 1, 0],
                          [0, 0, 0, 1] ])

ob = bpy.context.object
ob.matrix_world = mat

Here we assign a matrix to the active object. Pressing ⎇ AltP or the Run Script button will assign this matrix to the cube. We don't see a change, because this is the so called identity matrix, which doesn't transform the object (or it transforms all points in place).
However, we can do simple transformation with a matrix via python code. Here are three examples (for translation, rotation and scale) which you can replace in the above code snippet. The results are seen in the image below.
# translate x by -1
mat = mathutils.Matrix( [ [1, 0, 0, -1],
                          [0, 1, 0, 0],
                          [0, 0, 1, 0],
                          [0, 0, 0, 1] ])
# rotate z by pi/8 (~22.5°)
mat = mathutils.Matrix( [ [cos(pi/8), -sin(pi/8), 0, 0],
                          [sin(pi/8), cos(pi/8), 0, 0],
                          [0, 0, 1, 0],
                          [0, 0, 0, 1] ])
# scale y by 2
mat = mathutils.Matrix( [ [1, 0, 0, 0],
                          [0, 2, 0, 0],
                          [0, 0, 1, 0],
                          [0, 0, 0, 1] ])

Shearing or Skewing
As far as I understand, the following matrix should shear the object along the objects X axis. You may be familiar with Shearing from Edit Mode, where you can shear points with ⎈ Ctrl⇧ Shift⎇ AltS.
[1, 1, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]

However, in the 3D view, we can see, that assigning this matrix with the code snippet from earlier will only scale and rotate the object. What happened? I guess, Blender is trying to show the transformation in the GUI, converted it to TRS and displayed it in the Transform panel. The other parts of the matrix were ignored and the matrix reconstructed without the shear/skew.
In fact, if we go into the python console and execute bpy.context.object.matrix_world it shows an entirely different matrix, than what we just inserted.
<Matrix 4x4 ( 0.9210,  0.5395, 0.1117, 0.0000)
            (-0.3815,  1.1907, 0.5395, 0.0000)
            ( 0.0790, -0.5395, 1.3025, 0.0000)
            ( 0.0000,  0.0000, 0.0000, 1.0000)>

What can happen when unparenting?
When unparenting an object, it can require a transformation matrix, which includes shear/skew and can't be expressed with just TRS.
Let's look at an example, where everything is fine first. The Empty is the parent of the Cube.
The empty is scaled to 0.5as can be seen in the Transform panel.
The Cube is scaled to 2 on the Y-Axis.

Even before doing any unparenting, we can figure out, what's going to happen. The Cube must have a scale of 0.5, 1.0, 0.5 to remain in its current transformation.
We can also figure this out, by multiplying the matrices.
[ 0.5 0   0   0    ]         [ 1   0   0   0    ]       [ 0.5 0   0   0  ]
[ 0   0.5 0   0    ]    x    [ 0   2   0   0    ]   =   [ 0   1   0   0  ]
[ 0   0   0.5 0    ]         [ 0   0   1   0    ]       [ 0   0   0.5 0  ]
[ 0   0   0   1    ]         [ 0   0   0   1    ]       [ 0   0   0   1  ]

This is the same as what Blender would tell us when calling matrix_world of the child Cube.
>>> bpy.data.objects['Cube'].matrix_world
Matrix(((0.5, 0.0, 0.0, 0.0),
        (0.0, 1.0, 0.0, 0.0),
        (0.0, 0.0, 0.5, 0.0),
        (0.0, 0.0, 0.0, 1.0)))

In this second case the cube is rotated by an angle which is not a multiple of 90° and the empty has a non-uniform scale of 1, 0.5, 0.5.

[ 1   0   0   0    ]         [ 0.7 1.4 0   0    ]       [ 0.7 1.4 0   0  ]
[ 0   0.5 0   0    ]    x    [-0.7 1.4 0   0    ]   =   [-0.3 0.7 0   0  ]
[ 0   0   0.5 0    ]         [ 0   0   1   0    ]       [ 0   0   0.5 0  ]
[ 0   0   0   1    ]         [ 0   0   0   1    ]       [ 0   0   0   1  ]

Even though we can't see it in the numbers, we end up with a transformation matrix which is not representable with only translation, rotation and scale.
Unparenting the cube results in it's shear changing.

And it's obvious, that we can't scale the right cube towards the shape of the left. We need to scale along the green arrow, but there is no axis of the cube which points in that direction. If the rotations were done at 90° angles, this would not be a problem. Again ...
Most transformations can not be reached using only location, rotation and scale.
But wait, right before unparenting, we were able to see the correct transformation matrix using matrix_world of the child Cube, right? Yes, and that is a way to "apply" the transformation to the points.
What happens to the matrix when unparenting?
How does the matrix change when unparenting since shear and skew are ignored?

We can reproduce this process by extracting TRS from matrix_world with python and the mathutils module.

Get the matrix_world of the child Cube.
Extract the location, rotation and scale using the the matrix' decompose() function.
Assemble a new matrix from the location, rotation and scale.

The result will be the same matrix as the one we receive, when we unparent the Cube. It is different from the original matrix.
import bpy
import mathutils

mat = bpy.context.object.matrix_world

loc, rot, sca = mat.decompose()

mat_loc = mathutils.Matrix.Translation(loc)
mat_rot = rot.to_matrix().to_4x4()
mat_sca = mathutils.Matrix.Identity(4)
mat_sca[0][0], mat_sca[1][1], mat_sca[2][2] = sca

mat_out = mat_loc @ mat_rot @ mat_sca
print(mat_out)

We want the points of the mesh to be transformed by the original mat, but we are left with the reduced mat_out after the transformation.
The Workaround
We want to apply the missing transformation directly to the points, so that the unparented resulting transformation matrix is "enough" to reproduce the original transformation.
Using the naming from the previous code snippet:
mat_out @ mat_h = mat

mat_h is the missing part of the transformation, which is needed to return to the original transformation (mat). We can get it's value with the following line:
mat_h = mat_out.inverted() @ mat

And we can apply this to the cube, before unparenting is with a short script.
import bpy
import mathutils

ob = bpy.context.object
mat = ob.matrix_world

loc, rot, sca = mat.decompose()

mat_loc = mathutils.Matrix.Translation(loc)
mat_rot = rot.to_matrix().to_4x4()
mat_sca = mathutils.Matrix.Identity(4)
mat_sca[0][0], mat_sca[1][1], mat_sca[2][2] = sca

mat_out = mat_loc @ mat_rot @ mat_sca
mat_h = mat_out.inverted() @ mat

# Unparent the object.
bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')

# Move the vertices to their original position,
# which the mat_out can't represent.
for v in ob.data.vertices:
    v.co = mat_h @ v.co

Paste this script in Blenders script editor and press Run Script or ⎇ AltP. It will unparent the mesh and apply the transformations, which can no longer be represented by location, rotation and scale, directly to the points.

Killing answer !!! :) You are number one, I hope you are in touch with devs, so there is a chance to get the result natively without workarrounds. Works in glance. Thank you for your time.

Thank you for your kind words! While this would probably be a cool feature, I think that it wouldn't be intuitive if unparenting changed your vertices (at geometry level).

So what about to rename it to “Clear Parent and Apply Transformation”?  Like that transformation can be applied on object level as well (now it is a mix). Seems to me clear, right? Or add it as a new operator, because like now - end user primarily needs object in specific shape. Current blenders posibilities does not fits to this.

It happened to me and I wanted to share small tip which was solution for me.
Check it if you have keys on it. It applies the key position.
If you need to unparent more than one object, then be sure that you are in Dope Sheet instead of Action Editor. You can click to arrow to see only what you select and delete all the keys on them.

Thanks, but I don't use any keyframes ... or I didnt understand your tip.

source: Stack Exchange

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

sort: votes


text:
Shortest path through an ordered list of points
Intro
Shortest Path is very well documented if you want to generate Start / End path specified by two points. Like here Start at index 0 and End at index 3 ...

Note: Specifically in my case I will use some obstacles blocking the direct connection ...

My question
Is it possible to generate shortest path passing through a several points? Like in this example (with randomly selected vertices) ... the path should start at index 1 find shortest path to index 14, than shortest path to 40, than 44, 58, 61, 70, 74 and end at index 80.

Sorry for old version of blend (3.4 alpha) home workstation limit :) at work I use the latest version.

Note: I already tried connect bunch of points by a spline and thanks to Markus's answer I could let a curve to push from an obstacle, but there are a lot of splines penetrating an obstacles for some reason. So I would like to try a different approach (also recommended in my original post).

Hi, there.. would 'Shortest path through an  ordered list of points'  be a more accurate title? Just quibbling, might be wrong..

Sure ... Thanks :) It is already a few days I'm scratching not only my head for this topic ...  trying to find right direction from many directions :) so I'm loosing control and my healthy distance.

sounds like you answered your own question in your question: why don't you make several "shortest path" for every "subpath" and then connect them?

@Chris Because I don't have a clue how to automate such process :) ... and also I thought there could be probably much better way.

If I understand correctly you want to connect via shortest path the indices pairwise: 0>14,14>40, 40>44, 44>58, 58>61, 61>70, 70>74, 74>80.  This can't be done with a single Shortest Path node set up. You need exactly one start vertex and one end vertex to force a pair connection.  That means you need 8 Node setups with the current algorithm. If there is a way to define a set of points as mandatory to pass through then that would be great. The only way with the current algorithm I see is via manipulating the Edge Cost values. Not sure how to that yet, but its worth exploring.

As i said, just use a repeat zone and pass the start and end values. Then you get something like this: [1]: https://i.sstatic.net/9VTT1.png i added a few more obstacles to make it more interesting. - and yes, i didn't make the last step and connected the several splines, but i think that is the easiest part of it.

just a hint how to do it: you shouldn't use the distance as edge cost, but the proximity value (fine tuned with a map range value) to your obstacles. So the cost should be high very close to obstacles, everywhere else zero. Mine looks like this through the viewer: [1]: https://i.sstatic.net/MDtR1.png

all i did was a) changing the cost b) using your node tree and adding a repeat zone which changes the start and end values.

Thanks :) I didnt noticed you were speaking about "repeat zone" ... Sounds good to me ... any reason you hesitate to create your answer? :) ... so it can be credited :)

yes - my time - maybe tomorrow i can write one.

Sure I would appreciate that ... I don't think I get it how to use the repeat zone and mainly ho to feed the list of indexes to it (I hope you are not speaking about situation I would have to manually set indexes 0>14,14>40, 40>44, 44>58, 58>61, 61>70, 70>74, 74>80 ... the real model looks way complicated :)

no, not manually

@Chris ... if you don't have a time for answer  I would appreciate if you can share just your blend file with your test, so I can try to learn from that file. Thanks

@vklidu It seems the Edge Cost is a little be tricky to handle across multiple points. Also I think selecting a Grid as a plane is not  a good choice. The random points when connected look like zig-zag also there is a serious backtracking (overlapping shortest paths). I think it is better to choose a triangulated mesh. Here is the result I am getting so far: With Grid (https://i.sstatic.net/Mux0n.png), With triangulated plane (https://i.sstatic.net/w9z6e.png). Based on joining paths between each pair of points and smoothing the result - so repetition of modules is unavoidable.

@RumenBelev ... right, the triangulation is better (I didnt focuse on that since I mainly wanted to know if it is possible to work with shortest path guided by other specified points). Even I'm still interested how does it can be done ... you spotted probably one of the issue - the path will be probably quite straight so I would have to move distort plane by some texture (or use a texture to mix it as a value for Edge Cost). Anyway it seems to me I'm the only one who didnt understand how to achieve it? :) Thanks for more info. ... BTW We are close to Chat Room :)

@vklidu I would suggest opening a thread on Blenderartists if you have an account there. Or we can set up a chat via https://chat.stackexchange.com

Yes I have the account on BA (same name) ... I was there quite active before I noticed BSE make more sence :)

This is my approach to solve this problem without simulations. Let's give it a name - Constrained Shortest Path.
In summary, the idea is to force a path [edge selection] via iteration of the Shortest Path algorithm that passes through select set of points (in ascending index number order) from a Mesh grid, giving the resulting path a tangled cable appearance.
Here is the result so far:

The Mesh grid will be added for clarity. As you can see holes are implemented via points deletion using a control Empty object.

Here is the node set up, however it is too complicated to explain in detail here. A .blend file is provided at the end of the post for your own studies.

Here is the short description:

Initial Point selection - Select points from the Mesh plane via random value generation to speed up the testing process. As it is hard to control the exact number of selected points or generate a good point distribution this way other methods for selection initializing should be considered.

Plane with Hole(s) - this is the mesh from which we select the initial points. The plane has an option for vertex deletion (single hole) . The hole widens with scaling the Empty object.

There are few types of input Geometry grids tested:

Ordered quad grid - separate object, when the random points are connected they produce a zig-zag like pattern and are not a good candidate.
Quad grid - separate object with vertex index randomization
Triangulated grid via modifiers - the host Plane object with modifiers stack before the Geometry Nodes modifier.
Triangulated grid - separate object with vertex index randomization

Here is a comparison:

All grids are available for testing in the file

Elevate the initial point selection - The selected points are moved slightly above the surface, the end points - even higher.

Shortest Edge Path Modules - The process is as follows:

a) Select first two vertices from the selection (in ascending order) - Output shortest path via curve
b) Remove the smaller index vertex from the selection.
c) Pass the resulting selection to the next module.
d) Repeat the process.
There are 1+20 operations currently. The file will work best with about 21 selected vertices or less. Add more modules for larger number of selected vertices.
Blender 3.6 doesn't have looping nodes, A Repeat zone is expected to be released in Blender 4.0. This will make the iteration over repetitive processes so much easier.

Distribute Mesh Line on Paths - All generated paths are joined in specific order so the indices are in ascending order. A Mesh Line is generated to match the point count of the curve and the positions of these points thus forming a continuous single thread. The Mesh Line is then converted to Curve.

6 Randomize slightly Z positions - just to decrease the amount of overlapping points due to path backtracking.
7 Resampled Auto Handle Curve to Cable - giving the curve a Bezier type with Automatic point handles gives best cable like appearance. Lastly a simple Curve to Mesh node is applied to generate the cable.
You are welcome to explore the .blend file:

Edit: As requested by @vklidu I am including the setup for the upcoming Blender v4.0 using the Utilities > Repeat Zone instead of connecting / removing modules for different amount of selected points:

and a close-up:

You can change the number of Iterations manually or plug the number of selected points to control it automatically.
This should work for Blender Versions 4+. I can't guarantee the Repeat Zone will change after release, but it is most likely to remain the same.

Thanks a lot for the answer ... may I ask you to extend your answer about Repeat Zone version you mentioned? That is  something I hoped for :) Thanks for your time.

Edited the answer to include the Blender v4 Repeat Zone. This will save a lot of Node space :)

Awesome :) Thank you again.

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


text:
Material suddenly showing up weird on one object, but is fine on other objects and in Material View
I have a wood planking material along the deck of my ship model. I'm not sure what happened but suddenly the material looks weird in Render view but fine in Material view. To emphasize, it did look good earlier and only recently started to look like this.

Edit: Some interesting findings. If I assign the material to any other face on the object it appears this same weird reflective thing. I duplicated the object and the material worked just fine on the duplicate. I'd use the duplicate, but I still wanna figure out what's going on here.

Check normals and make sure there is not duplicate geometry

How about removing all other object and sharing your file.

So, I looked around and found an object called "SymmVert". I had no idea what it was (looks like it was just a single vertex) so I deleted it and suddenly everything's fine. -shrug-


text:
How to change pose without deforming my mesh?
Im not sure if its possible but there are cases where changing pose (by moving/pulling bones) modify the mesh very uglily.
Before:

After:

How can I prevent it? The place where legs connect is character body, and its very weirdly deformed. Knees deform very well, but body doesnt.
Any help appreciated really.
This is probably caused because the bones are too closer to each other, but thats how I planned these legs to be.
Is it possible without changing plans?
EDIT:my blend file:

another screen of what im trying to avoid without success:

Please attach your .blend by uploading it with the official uploader

@WhatAMesh i looked in google and generally for official uploader but couldnt find so i used blend exchange hope thats fine.

Well thats the official one I meant, sorry I should clip the link to my bookmarks and copy paste it

I don't know a lot about the Skin modifier but it looks like the parentage was not good. If you apply the Skin modifier, then put your armature in Pose mode, then put your mesh in Weight Paint mode, you can see that the weight painting is not good, the legs control the hip, when they are not supposed to. Now you can correct with the brush.

Hey, thanks for your post. I used weight brush and it changed position of my mesh parts. it doesnt appear red anymore, but its also not in the position i wanted it to be. i only could apply weight paint after applying armature and skin, and somehow i cant move the body anymore via moving bones in pose mode

don't apply the Armature modifier, only apply the Skin modifier, because I'm not sure you can improve your rigging without applying the Skin modifier. Applying it will just give you a classic mesh.

even after I apply skin modifier and weight paint it, armature seems to disconnect (when i move bones it doesnt move mesh) PS not sure if i was clear in thread but I wanted to make simple walking and moving legs deforms body as you see

try to reparent it With Automatic Weight

that doesnt do anything

you see on my screenshot that it works, so you must do something wrong somewhere


text:
Export instances position from Spreadsheet to csv
I'm looking for a method to export the position of my instances to a .csv file to make some considerations in Excel.
Does anyone know how to do this?
Cheers!
EDIT: I don't think this post is the solution
'Saving and loading object name location and rotation of a selection,'
I'm searching how to export the positions of my instances (the origin) from the spreadsheet editor of geometry node, not the mesh vertex

https://blender.stackexchange.com/questions/51706/exporting-coordinates-of-vertices-to-csv

I'm sorry, but the vertex coordinates are not the same as the instances origin, nor is the post "Saving and loading object name location and rotation of a selection" because Blender 2.8 did not have a spreadsheet or geometry node!

In that case please add a little bit more information about your setup. Instances can mean different things in different contexts


text:
Inconsistent ORM Texture Atlas Automatic Baking Results in Blender ( 3.3.1 LTS)
I've encountered an issue where the output Occlusion Roughness Metallic (ORM) atlas appears too bright, specifically the roughness channel. Interestingly, this problem only occurs in my script, not when I bake textures manually.
The key difference in my script is that the roughness is baked in "Roughness" mode, while metallic and ambient occlusion (AO) are baked in "Emit" mode. To address this, I applied a gamma correction of 2.2 to the output ORM, which resolved the brightness issue. However, I'm keen to understand why my script produces this result in the first place.
Can someone shed light on what might be causing this inconsistency between manual and automatic baking, particularly with respect to the roughness channel?
Thanks in advance!
EDIT : I tried fiddling with the colorspaces, I'm on "Standard" rather than Filmic, I tried turning on the 'None' option on Display Device, and the original ORM texture to be baked is in Non color mode...
EDIT2: I'm using the save_render function, I'm wondering whether the problem doesn't come from there, but when trying to use 'Image.save', the filepath argument I put in is not recognized...

After a bit more tests and research, it's possible that the reason I have a colorspace problem with the automatic process comes from the fact that I am using image.save_render (see this post)
Here's the part of my code that takes care of the bake:
set_scene_parameters(context, bake_margin, cycles_samples, bake_lighting, bake_color)

image = create_image(resolution, bake_alpha)

baked_uv_name = prepare_uvs(context)
bake_node = []

    for ob in context.selected_objects:
        for material in ob.data.materials:
            bake_node = set_shader_graph(ob, material, baked_uv_name, image)

    textures_dictionary = {}
    if bake_diffuse :
        bpy.ops.object.bake(type='DIFFUSE')

        if bake_alpha :
            context.scene.render.image_settings.color_mode = 'RGBA'
            filepath = os.path.join(output_directory, 'D_baked.png')

        else:
            filepath = os.path.join(output_directory, f'D_baked {texture_format}')

        image.save_render(filepath=filepath)
        textures_dictionary['diffuse']=filepath

    context.scene.render.image_settings.color_mode = 'RGB'

    if bake_roughness:
        bpy.ops.object.bake(type='ROUGHNESS')
        image.filepath = os.path.join(output_directory, f'R_baked.{texture_format}')
        filepath = os.path.join(output_directory, f'R_baked.{texture_format}')
        image.save_render(filepath=filepath)
        textures_dictionary['roughness']=filepath

I have currently three possible solutions:

Write the image with PIL
Use the Image.save() function = this renders a black image
Post process the ORM with the gamma correction after GLB output

UPDATE
After even more tests, I found out that my problem probably came from the fact that the image used for baking the roughness must be put in Non-Color before the baking. Weirdly enough, I don't remember doing that in the manual process, but that might also be because at the time, my scene was in Filmic Color Management.
I've rewritten my script to make sure the roughness bake image is Non Color, and it seems to work for now.
I'm leaving this thread open anyway, because that might not be the end of it, and it could still be useful to a fellow programmer having the same kind of issues.
Thanks all,

By the way, what is ORM? If it's Ambient Occlusion/Roughness/Metallic, you should clearly define it before using the abbreviation. This is a common source of completely unnecessary confusion.

Sorry, you're absolutely right :) I'll edit my post

"Gamma correction" is not a thing. This term is a symptom of someone not understanding what is going on with color management. "Incorrect gamma" most likely means it's a color space mismatch. If gamma of 2.2 sort of fixes stuff, I suspect it is likely, linear values are exported, but sRGB are for some reason expected. Converting linear RGB to sRGB is more than raising values to the power of 2.2. See some formulas here:

So however you are using the maps, it seems sRGB might be expected instead of linear colors that you seem to bake, however, if you bake stuff that is supposed to be linear to 8bit format in sRGB, you might be loosing detail, because sRGB will compress the range of values to match human vision that is not linear, so this might not be the desirable situation. You might need to adjust how shaders work in the software you are viewing the exported maps in. You might want to consider using higher bit depth and/or linear values instead of sRGB for some maps. For example normal or displacement maps could benefit from 16 or even 32 bits per channel and formats such as TIFF or EXR. EXR can only store linear color from Blender so that might make things easier because you don't need to find out how to set things up correctly and you can always expect linear values from EXR format.

Thank you for your quick answer. When I was talking about gamma correction, that was probably a shortcut to talk about global linear workflow, which I understand is a way to counterbalance the fact that the computer monitor doesn't display colors correctly ( a least in my memory). Your explanation is very thorough but in this case the first problem I would like to understand is why the colorspace is perfectly outputted when I'm doing the process manually, but not automatically. Also, because of the final goal of the GLB, I can't use EXR's...I have to find another way to fix it. But thank you!

It might be helpful if you could share the code you are using to bake and define the context the textures are going to be used in a bit better so it would be possible to reproduce and test the problem somehow.

The more I test the more I think it comes from the function image.save_render(). I saw another post on Stack Overflow saying that the manual process of saving as render creates colorspace problems.I'm going to answer with a new post to put the part of my code that I think is concerned


text:
Creating new geometry per frame
I have a node group that calculates a Trefoil knot segment based on the current frame, and I am instantiating points at the ends of this segment in each frame. This works fine. However, in the following frame, these points disappear and only points created in the current frame are visible.
Can I create additional permanent points/geometry in each frame using Geometry Nodes?
====== Update ===

I used Chris' (who has deleted his comments and his wrong answer) suggestion but it still only shows a segment calculated in the current frame.
Blend file

custom nodes simply calculate the beginning and the end of the segment depending on the frame number.

GN don't hold a reference to what happened in the previous frame and don't know what will happen in the next one. One solution I see is to use a script that will create a new object for each frame using the evaluated GN modifier at that frame

Sorry but is not added if you have one and add one in another frame you should have two and this is not the case. Still it does not matter if it is a single point or a line with two points the geometry from the previous frame does not persist in the future frames. and if you read my actual question, this is what I asked about: Can I create additional permanent points/geometry in each frame using Geometry Nodes?

Unless you apply the modifier after each frame or create a new object like I suggested the answer is no

The coordinates of points on a trefoil knot can be expressed parametrically, as functions of t.
t is 0 at the beginning of the curve, and 2*pi at the end.
If you start your GeoNode tree like this, you initially construct a straight vertical line from the origin, which will grow from 0 to 2*pi units high at Frames frames, divided into Segments segments:

t is encoded in pz, the Z coordinates of the points in the line.
pz is an attribute,(equivalent to t), and can be used to calculate  x(t),y(t),and z(t). Those values can be substituted into the position attribute of the vertical line's vertices at the end of the tree, forming the knot incrementally, as the original vertical line grows with the number of frames.

Which gets you as far as this:

Blender 3.0a

Perfect. that's what I needed. Thank you.


text:
Constrain position of group of wiggling objects within another
I try to animate a group of objects with Animation Nodes and I am using Vector Wiggle but I would like to constrain the position of the particles or other objects, within an inside of e.g. a torus. Just to emphasize, I do not want to use a particle system because it is not loopable.
I tried a rigid body and collision modifiers but that does not seem to work for me.

Here i created points inside a torus using particle system and animated it using wiggle vector node. Using bvh trees we can find the points which are inside torus, the points outside is replaced with nearest surface point on the torus.
You can work more on nearest surface point to get more smooth animation.

Thank you for this. I was not too clear - I do not want to use the particle system because it is not loopable. (I have modified the question)

@kwicher ok, i don't have any easy solution for that.

OK, I figured it out. I could Shrinkwrap the objects to the inside of the torus. Obviously, if the wiggle is too big they will all move only along the inside surface of the torus so one has to play with the wiggle amplitude but it is possible to do, a relatively cool effect.


text:
Dynamic parenting in Animation Nodes
I am trying to set up dynamic parenting of some vertices to an empty based on their distance from the empty in Animation Nodes, to be able to move these vertices with this empty.
I am ok with selecting the vertices but I am running into problems after using Object Attribute Output with a parent as the attribute with a value of the empty object.

What happens is that the vertices are being pushed away from their places by the vector equal to their distance from the world origin.
In the simplest situation, I would just use the Object ID key for initial transforms and use matrix math to calculate the location based on the empty, however, the aim is to be able to use different empties one after another to control the vertices, for that my initial transforms saved in the Object ID key will be irrelevant.
So my question is, is there any trick to properly set up parenting in AN? Just to say, if I manually parent the vertices with the empty, they behave as intended.

Maybe using the actual blender operator in a script would let you use the operator parent_no_inverse_set or whatever it is called for vertices ? Could you post the relevant part of your node network ?

Thank you @Gorgious. I added the network. It is really simple. I was thinking about scripting but thought that maybe it would be possible with just nodes.

OK. I used Python and vert.parent = rotator;  vert.matrix_parent_inverse = rotator.matrix_world.inverted() to avoid the vertices changing the position upon parenting but now when I rotate the empty (rotator here) the parented vertices do not move.

Actually it does work, just needed to change a node tree a bit.


text:
how do i make a ramp around a corner?

how do i curve a ramp around a corner like this?
whenever i try something, it's just frilly.
is there any good method to do this?
EDIT: people didn't understand, so here:

I'm not sure it's very clear, could you please explain again?

i want a ramp to go around a corner, and stay smooth.

I appreciate your adding a screenshot but I have to admit I find it extremely confusing.  A simplified diagram or two that eliminates extraneous elements would be very helpful.

Make an auger, (see below) and scale to suit.
Delete the sections you don't want.
Extrude it's ends to provide entry/exit platforms.
Extrude all vertices down in the Z axis for thickness if necessary.
(the cylinder at center is optional)
Auger Blade -
-========-
Add a Curve path, leave it a, straight line.
Add the "Screw" modifier.  The bezier will turn into a solid disc.
Increase the "Screw" slider to watch the  Auger forming up.
Increase the "steps" to improve the circumference curvature.
Use ATL-C in Object mode to convert it to mesh.

it seems to suffer from some of the same problems, but this does make it much easier to manipulate. i guess i'll have to see what works best for the situation. thanks though!

Try increasing the "Steps" slider in the modifier. I've used the bare minimum here but when increased to say 32 or more, it rounds off the outer curve significantly. There are also "Render steps" but I think that's just for the display, to speed the 3D window up during construction.  When it comes down to it, curves are made up of a series of 'steps'.  The more you have, the finer the 'resolution'. Good luck with your project...

i'm trying to keep polygons to a minimum, and i can only use flat triangles. i'm exporting this to a pretty limited engine, so i can't do smooth shading either.

You can try something rounded like so.

that's pretty much a staircase, i need a ramp.
also, you could reduce the amount of polygons on the far corner, all you need is one triangle.

I have a feeling you're looking for something that may not be geometrically possible (a smooth continuously sloping ramp like you are describing can't be made out of a small number of simple tris/coplanar quads).  The answers given so far have provided some pretty good options within the constraints of what can be done.  Here is one more option:

You might call this a variation on some of the answers already given.  This was created by making a helical "screw augur" as described in @Edgel3D's answer and then slicing it into a square shape using boolean modifiers with cube objects as the cutters, one for the exterior and one for the interior.
When the augur helix is sliced up this way, the exterior and interior edges are a bit "wavy", they do not describe straight lines but rather slight sine curves.  They can be straightened, although this is a bit tedious: the vertices along each edge have to be manually aligned to a line using a custom transform orientation, using the technique described in @Mentalist's answer to this question:
Straighten Vertices Along a Line
The resulting shape is a bit curious, it is composed of quadrilaterals whose vertices are not quite coplanar.  But the end result is a ramp where the distortions are spread out and therefore more or less "smooth", rather than confined to the corners of the ramp.

You could create a 90-degree angle and use a subdivision surface set to around 2 or 3. Then click smooth in the left panel. This should create a smooth enough curve. You can use loop cuts to straighten out parts you don't want curved.

what do you mean by create a 90 degree angle? should it be a right triangle, a rectangle, and then where does it go? this post is extremely vague.

You should be looking for something like this https://imgur.com/gallery/vOPNWhk. If you add a subdivision surface it will create a curve.

that's not what i want though

How? What do you want?

i need a ramp to go around the corner, like in the picture...


text:
How can I activate another object via python when a object is in Edit Mode?

In Blender, there are three selected situations.
an active object, an "activate" item and selected objects.
Now, I know how to set an active object or selected object in Python.
And I know that to activate an object is about "bpy.ops.outliner.item_activate(deselect_all=True)
", but the operator needs the context about Outliner.
I need to activate an item as the selected situation in 3D Viewport.
How can I do that in 3D Viewport via Python.

I would essentially disregard the outliner.item_activate method, that's really not how you want to select objects in basically any scenario. To set the object as the active object you use bpy.context.view_layer.objects.active = your_object and to set the object as selected you use bpy.data.objects['your_object'].select_set(True)

I know those APIs, but I need to activate another object (but the active object) to test the bugs  I meet.

You'll need to look into overriding context

Thank you very much！That helps me a lot!


text:
How do you extract a smaller grid out of a larger grid to prevent overlapping of the grids?

Hello!
I am trying to create a single grid with multiple denser grids towards the center. I initially thought of using the loop cut tool but those cuts go from one side of the plane to the other, making it impossible for me to achieve this denser grid inside a grid kind of result.
As things are currently, if I were to merge them, the grids would all overlap within each other rather than to have a smooth stepping inside of each grids unique area, so simply joining them together didn't work out for me.
I am looking for a way to "cut out" the shape of the smaller grids from the bigger grid, to effectively only have one grid fill out each of the spaces, to then merge them together into one coherent, stepping grid.
None of the search queries I could think of resulted in me being able to solve this, so I figured I'd ask here.

you could try it with geometry nodes:

result:

i start with a grid with 3x3 faces.
In the node group i am checking the absolute x and y values, whether they are less than a certain value (the middle), if yes, i subdivide that. Than outside the node group a scale the whole mesh so that i can reuse my node group again.
some more steps:


text:
How to make a floating feather?
I wanted to ask you how would you make a feather softly falling to the ground. Cloth simulation? Manually? I need help. So grateful!

https://blender.stackexchange.com/questions/68549/how-to-animate-falling-feathers

wow thank u so much! that will work!

well...of course you can do it with physics, but of course it is a lot of try and error...that's what i did :)
i made this geometry

then added subdiv modifier and cloth:

and a bit of wind with some random rotations and some noise modifier on the strength and i got this:

i know...it is not falling, but i think it has a nice movement ;)


text:
Why the mesh is broken?
I imported a photogrammetry for rig it and animate it, but once I have the mesh it seems to be fractured, although is only one mesh. When I animate it folds in those fractures.What can I do?

I suggest you edit your question title to something like "rigged photogrammetry mesh doesn't properly animate", which will attract more attention from those with specialist talent.

Your character mesh appears to have a very low poly-count, which may be part of the problem.   Have you looked at https://youtu.be/YX7OSJ26clo for rigging a photogrammetry mesh?   Unfortunately it may be using an ideal mesh that may not help problem-solve your issue.

You can merge the parts first, with the Merge by Distance tool. Then may be you want to decrease the polycount with the decimate modifier.
https://docs.blender.org/manual/en/2.80/modeling/meshes/editing/vertices.html#merge-by-distance
https://docs.blender.org/manual/en/2.80/modeling/modifiers/generate/decimate.html?highlight=decimate


text:
Change Encoding Settings through Python API
I need help with the python api for setting the video encoding in Blender 2.79a.
I have already set the output type to FFMPEG via:
bpy.data.scenes["Scene"].render.image_settings.file_format = 'FFMPEG'

I now need to set the encoding to output video in MP4 format and haven't been able to find this information yet.
Thanks

Set Output.file_format to FFMPG and adjust the attributes of Render.ffmpeg:
import bpy

scene = bpy.context.scene
rd = scene.render

# Set output type
rd.image_settings.file_format = "FFMPEG"

# Set output format
rd.ffmpeg.format = "MPEG4"

# Set the codec
rd.ffmpeg.codec = "H264"

...

Other options:

codec: MPEG1, MPEG2, MPEG4, HUFFYUV, DV, H264, THEORA, DNXHD, PNG
format: MPEG1, MPEG2, MPEG4, AVI, QUICKTIME, DV, H264, XVID, OGG, MKV
video_bitrate: 0 - infinity (integer)
maxrate: 0 - infinity (integer)
audio_channels: MONO, STEREO, SURROUND4, SURROUND51, SURROUND71
audio_bitrate: 32 - 384

For all available options, see the API on FFmpegSettings.

I ended up finding the solution in this
post
To set the individual settings for ffmpeg use:
bpy.data.scenes["Scene"].render.ffmpeg.<SETTING_TO_MODIFY>

For example to set settings to use H264 with MP4 container:
    bpy.data.scenes["Scene"].render.ffmpeg.format = "MPEG4"
    bpy.data.scenes["Scene"].render.ffmpeg.codec = "H264"
    bpy.data.scenes["Scene"].render.ffmpeg.constant_rate_factor = "MEDIUM"
    bpy.data.scenes["Scene"].render.ffmpeg.ffmpeg_preset = "MEDIUM"

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


text:
How to re-render specific view layers?
I have a scene split into several view layers. They are rendered separately and then put together in the compositor.
I would like to re-render only some specific view layers, not all of them. How can I do this in 2.8x?

How about one at a time using "Render Single Layer" check box? Or simply deselect the "Use for Rendering" from the layers you don't want to re-render.

Render single layer works on a layer by layer basis. But I want to render several at once. Also, when I uncheck “Use for rendering” that layer becomes empty after rendering. As a result I cannot use it for further compositing


text:
Getting weir artifacts when I use boolean modifier (union) to attach two objects together
Hey so I am doing a body horror sculpt project in Blender 2.92. Basically, I'm having a man's abdomen open up into a mouth with teeth.

Unfortunately, whenever I use the boolean modifier, and set it to union, to add the gums holding the teeth for the monster mouth, I get a bizarre result.
I tried flipping the normals, but that still gives me some weird results.
This is what it looks like when I flip the normals on the outside for just the main body. Some of the gums disappear.

This is what it looks like when I flip the normals on the outside for the gums and the body. Some of the gums disappear (just like last time), AND a few of them will even cut holes into the main body.

Finally, this is what it looks like when flip the normals to the inside for both the main body and the gums. None of the gums disappear nor do they cut holes into the main body, but I get these weird artifacts in the mesh of the main body. When I try to smooth it out with the smooth brush, it just makes it worse.

Also, when I set all of the normals to the outside like this,

I'm still having a few problems when trying to apply the boolean modifier (to the second row of smaller gums). It'll look like the picture below where most of the gums are deleted and a few of them will even cut holes into the main mesh (circled in red).

Does anyone know how to fix this problem so that when I apply the boolean modifier and setting it to union), the gums will fuse smoothly (with no artifacts in the mesh)???
Here is a link to a copy of the project. The vertex count is kinda high. If you need me to use a decimator modifier to lower the poly count, I'll be more than happy to do that.

your face orientation looks like this:

red is bad, so in edit mode, select all with A and then Mesh->normals->recalculate outside. You have to do it for your whole model until all is looking like this:

then you can use your boolean modifier and it will work.
Changing the solver to fast/exact helps often. Yes, sounds weird, but sometimes it works with fast better, sometimes with exact.

Thanks @Chris!
So I flipped the normals so they all look blue like this picture 1.
But when I try to apply the boolean (set to union) on the second row, some of the gums holding the teeth go missing and they'll even be holed cut into the mesh like in this picture linked below.
picture 2.
Is there anything else I should do?

Yes, upload your file again without applying your Boolean and tell me the object which has the Boolean and I will check again…

Sure thing, @Chris! So the object that has the boolean is the "BODY." The "BODY" is the main object.
I am trying to fuse "MONSTER GUMS ROW 2" onto the "BODY."
Here is the new project file.

change the solver to "fast" in the boolean modifier. This helped when i tried it

Hey! That actually did kinda help. However, for a few of them, I am still getting some weird artifacts like this.
Do you think there's any way to get rid of those?

are you sure that you have all faces correct? you can check the face orientation by clicking "face orientation" here: [1]: https://i.sstatic.net/trWkX.png

Sorry for the late reply.
Yeah, the faces are in the right direction. All of your suggestions helped a lot to solve the problem; however, it looks like another problem has to do with non-manifolds that are in the mesh that I am having trouble getting out.
The non-manifolds are the source of the bizarre artifacts I mentioned earlier, but I am unsure about how to get them out.


text:
How to rigify with 2.8
So I am creating a low poly monkey and am trying to rig it for a game. I am new to rigging and trying to figure out how it works. After creating my character's bones, I press rigify and nothing happens. I can't seen to get my meta rig (I think that's what it's called) to show up. The only thing that shows up are the arrows pointing in all directions beneath my character.
Can anyone help me create the meta rig so that I can move my character around???
Here is a link to my project and down below is a screen shot of my project.

I am trying to get something like this, with all of the blue icons and controls.

For a good tutorial start with the video at https://www.youtube.com/watch?v=-JSFcSxsaTs

Totally endorsing this. This video will show you the basic steps from the metarig to the GENERATED RIG. It is important you distinguish between both of these armatures in the bone layers and outliner.

The rigify addon is setup to work with an armature that has been configured a specific way, this is made easy by using the premade rigs that the addon supplies. If you want any of the IK/FK rig features, you should start with one of the prebuilt rigs.
The shapes that you refer to are called custom bone shapes and can be manually added to any rig, not just by using the rigify addon. You will find the viewport display options (called display in 2.79) under the bone properties while in pose mode, where you can choose any mesh object to be displayed in place of each bone.

The viewport display hyperlink redirects to a page that doesn't exist - it was either moved or deleted.


text:
Don't know what the dotted line means
I have a dashed line in my model to "a coordinate origin" or something similar.
Can you describe me what it is?
Is this correct or do I need to move the point in my model?
How can I move it?

Model:

This is a line indicating a Parent-Child relationship between the armature and the selected mesh. You can remove it by Alt + P but in this case mesh will not follow the armature, that's moved in Object mode.

The position of the point is then probably irrelevant?

This is the center of armature that you have created


text:
Viewport Shading gray. I must have pressed something because it was all fine a minute ago
Does anybody know why my Viewport Shading has gone all grey. I must have pressed something because it was all fine a minute ago.. In other mode, that fine.

check your Viewport Shading panel and disable Scene World option?

Je suis nouveau là-dedans.. Tu veux dire quoi pour le panneau des Viewport? J'ai essayé de regarder des vidéos pour mon problème mais aucun n'est pour ma version..

Hello and welcome. English is mandatory language for the site. If you are not comfortable writing in English feel free to use any online translation service.


text:
Window Hiding Layout/object mode
As I was trying to work on my model, I accidentally pulled a window over my layout/thing I was working on and now I can't figure out how to close it. I tried reopening the file but it presented me with the same issue.
Thank you

Every window that you open have an "Editor Type" menu

Just click that and select 3D Viewport

In the top-left corner of any area, you can see this button:

Click it to open the editor list, and chose any editor you want for that area.


text:
How to add UDIM Tiles to an image and fill them via python?
I'm writing an addon that bakes various passes to textures using cycles bake.
The script checks the geometry and works out which UDIM tiles the uvs on the mesh are occupying, creates a new image and then adds those tiles to the image. So far I've found two different ways to add tiles to the image:
Method 1:
image_name = obj.name + '_BakedTexture'
img = bpy.data.images.new(name=image_name, width=1024, height=1024, tiled=True,float_buffer=True, alpha=False)
new_tile = img.tiles.new(tile_number=1002)

This is my preferred method, since it avoids using bpy.ops, but I cant for the life of me figure out how to fill the UDIM tile.
Method 2:
image_name = obj.name + '_BakedTexture'
img = bpy.data.images.new(name=image_name, width=1024, height=1024, tiled=True,float_buffer=True, alpha=False)
bpy.context.area.ui_type = 'IMAGE_EDITOR'
bpy.context.space_data.image = img
bpy.ops.image.tile_add(number = 1002, generated_type = "UV_GRID", alpha=False, float=True)

Method 2 does everything I need it to do, since bpy.ops.image.tile_add has the added bonus of filling the tile, and this script works fine when run from the Text Editor in blender, but I get the following error when running it from a panel in the 3D View:
bpy.context.area.ui_type = 'IMAGE_EDITOR'
AttributeError: 'NoneType' object has no attribute 'ui_type'

I've looked at these two posts, which is how I got to this point:
UDIM tiles not importing properly image texture shader
Fill a UDIM tile with python API
But neither of them solves the above issue.
Thanks in advance!

My Solution
Hi, solution that worked for me after days of trying
(context overriding):
    image = bpy.data.images[0] # your image
    # for my addon i use this kind of range specification,
    # but for you this might be just a simple **count = 10** variable
    start_tile_index = 1001 # start tile number
    end_tile_index = 1012 # end tile number

    image_area = None
    image_screen = None
    image_region = None
    old_area_type = None

    # NOTE: it is possible to find image/uv editor and execute fill there
    # but for some reason **context incorrect** error appears every time
    # finding image_editor area to exec image OTs
    # for screen in bpy.data.screens:
    #     for area in screen.areas:
    #         if area.ui_type in ['IMAGE_EDITOR', 'UV']:
    #             image_area = area
    #             for region in area.regions:
    #                 print(region.height, region.type)
    #                 if region.type == 'WINDOW':
    #                     image_region = region
    #             # XXX don't know if there's always a WINDOW region
    #             if image_region is None:
    #                 image_region = area.regions[0]
    #             image_screen = screen
    #             break

    # NOTE: but looks like it works with just changing current area
    # if not found: change context.area ui_type
    if any([image_area is None, image_screen is None]):
        old_area_type = context.area.ui_type
        context.area.ui_type = 'UV'
        image_area = context.area
        for region in image_area.regions:
            if region.type == 'WINDOW':
                image_region = region
        # XXX don't know if there's always a WINDOW region
        if image_region is None:
            image_region = area.regions[0]
        image_screen = context.screen

    # set image_editor active image
    old_active_image = image_area.spaces.active.image
    image_area.spaces.active.image = image

    # overriding context to avoid RuntimeError
    context_overridden = context.copy()
    context_overridden['area'] = image_area
    context_overridden['screen'] = image_screen
    context_overridden['region'] = image_region

    # filling existing tiles to get the ability to add new ones
    # i guess all tiles should be filled
    for tile_index, tile in enumerate(image.tiles):
        # setting active tile and filling it
        image.tiles.active_index = tile_index
        bpy.ops.image.tile_fill(context_overridden,
                                # your args #
                                # color=color,
                                # generated_type=generated_type,
                                # width=width,
                                # height=height,
                                # float=float,
                                # alpha=alpha
                                # your args #)

    # adding tiles of count: udim baking range
    # and filling
    bpy.ops.image.tile_add(context_overridden,
                           number=start_tile_index,
                           count=(end_tile_index - start_tile_index + 1),
                           label='',
                           fill=True,
                           # your args #
                           # color=color,
                           # generated_type=generated_type,
                           # width=width,
                           # height=height,
                           # float=float,
                           # alpha=alpha
                           # your args #)

    # restore old active image in the image_editor
    if old_active_image is not None:
        image_area.spaces.active.image = old_active_image
    # if context.area changed, restore back
    if context.area.ui_type != old_area_type and old_area_type is not None:
        context.area.ui_type = old_area_type

More
here is some additional information i found on my way to solution:
context regions
file_tile poll() and source code
# NOTE:
# from what i understood, it checks if image is not None
# (bpy.data.images[0] is not None)
# image source is tiled (bpy.data.images[0].source will give you that)
# there is a comment about filling (basically that's why i loop over
# and fill all tiles before adding new ones)

# C CODE
# 4117 static bool tile_fill_poll(bContext *C)
# 4118 {
# 4119   Image *ima = CTX_data_edit_image(C);
# 4120
# 4121   if (ima != NULL && ima->source == IMA_SRC_TILED) {
# 4122     /* Filling secondary tiles is only allowed if the primary tile exists. */
# 4123     return (ima->active_tile_index == 0) || BKE_image_has_ibuf(ima, NULL);
# 4124   }
# 4125   return false;
# 4126 }

# it also checks for created image buffer (BKE_image_has_ibuf)
# i suspect this is the error i get when trying to find existing image editor
# below is the source code for it i also found:

# C CODE
# /* checks whether there's an image buffer for given image and user */
#bool BKE_image_has_ibuf(Image *ima, ImageUser *iuser)
#{
#   ImBuf *ibuf;
#
#   /* quick reject tests */
#   if (!image_quick_test(ima, iuser))
#       return false;
#
#   BLI_spin_lock(&image_spin);
#
#   ibuf = image_get_cached_ibuf(ima, iuser, NULL, NULL);
#
#   if (!ibuf)
#       ibuf = image_acquire_ibuf(ima, iuser, NULL);
#
#   BLI_spin_unlock(&image_spin);
#
#   IMB_freeImBuf(ibuf);
#
#   return ibuf != NULL;
# }

image c headers
image c code


text:
Blender render by F12, the result is weird, but view point render is good(simple flag with cloth and wind)
It's a fluttering flag, and the view point is rendered well.
But the F12 render result is weird, there 's strange lines and jagged something.
Why?
This is the view point render result(cycles)

This is the render result:

I suppose you have subsurf modifier before cloth, that's has different levels for viewport and render. The numbers should be the same:


text:
Lighting a volume with a bi-color point light (2)
This question is a following of  this one
I would like to light the center of a cylindric volume with a gradient light White -> Red -> Blue radially from the center to the border.
I made a test of the lighting one a plane mesh and get this result (after some settings) :

The color gradient is OK
Now I renderer the cylindric volume at the same position than the plane.
And I have this result :

This is nearly what I want.
Nearly, because I had in idea to see a white glow inside the volume and the outter volume seems to hide the center of the object.
I tried to change the density, reflection, and scattering settings of the volume but I didn't succeed to see the white glow.
Is it possible to give transparency to a volume and see the inside lighting with special settings ? Or not ?

transparency = density with volumes. If your inside is really white glowing as you claim, make the center more dense and the outside less dense. I am sure you will see the center.

It would be better not to light the volume with a light but let the volume emit light itself - with an added emission shader. The center could have more strength than outsides and you can control the color easily imho.

@Jerryno Note that volumes can't actually emit light in BI (as in illuminate other objects)

@gandalf3 oh this isn't cycles..you are right

Related: http://blender.stackexchange.com/a/14469/599

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


text:
[Cycles]Is there any way to bake float values
I want to save the 32-bit floating point values generated in a set of OSL procedural nodes to a bumpmap. Is there any way to finagle that?
Also, if it just can't be done, I'd like to get that out of the way.

I'm pretty sure this is the default behavior.. Make sure you are saving the baked image to format which supports floats (e.g. exr).

There is currently no support for sending data from an OSL node to a file, values can only be passed into a nodetree used by cycles, which does mean that your OSL script can replace the image node you would use for a bumpmap.
By setting a float output value you pass your calculated height directly into the node setup to be used to alter the displacement or bump of the material.
shader myosl(output float Height = 0.0 )
{
    Height = sin(P[1] + 0.25);
}

While you probably don't want to use both displacement and normal adjustment, you may realize that you don't have to use a closure output in your script. You can calculate any value you want and integrate it in your nodes where you need it.

What bake type would I use to get a 32-bit bumpmap out of cycles? I need to get the data out of Blender, not just pretty pictures.


text:
CryBlend error: "There is more than one Texture of type diffuse. Please correct that and try again"
I want to export a plant with the CryBlend Addon. In Blender are 2 Textures applied to the model. When I click on export it always returns the following error:

"There is more than one Texture of type diffuse. Please correct that
  and try again"

Is there any solution for it?

Welcome Littlejofel :) Please start with the tour: http://blender.stackexchange.com/tour, for a solid answer you could also upload your file, see this meta post: http://meta.blender.stackexchange.com/questions/630/announcing-blend-exchange-a-new-solution-to-blend-hosting. Anyway, enjoy blender.se!


text:
Multiple KeyErrors leading to segfaults with custom properties
I know that Segmentation Fault is some sort of memory error having to do with C and C++ - beyond that I don't really know how to handle it. I read up on this error through this post on stackoverflow, and this post on multi-file registering/unregistering but still don't have much of a clue.
I am experimenting with custom properties, sliders and operators. Everything as far as I can tell is accessing what it is supposed to (as in, I adjust the slider and the appropriate object's value is updated) but I am getting a bajillion KeyError's and then Blender crashes with a segfault.
Code
# Functions/Callbacks

    def get_rotate_cam(self):
        return self["Rotate Camera"]

    def set_rotate_cam(self, value):
        self["Rotate Camera"] = value

    def update_rotate_cam(self, context):
        for obj in bpy.context.selected_objects:
            bpy.ops.opject.select_pattern(pattern="Camera")
            obj.rotation_euler[0] = get_rotate_cam_x(self)

#Property Group

    class SliderProperties(bpy.types.PropertyGroup):
        bpy.types.Scene.rotCam = FloatProperty(
            name="Rotate Camera",
            description="Rotate the camera with the slider"
            default=0,
            min=0,
            max=360,
            update=update_rotate_cam,
            get=get_rotate_cam,
            set=set_rotate_cam
        )

#Panel

    class EditStuff(bpy.types.Panel):
        bl_label = "Edit"
        bl_space_type = "VIEW_3D"
        bl_region_type = "TOOLS"
        bl_context = "objectmode"

        def draw(self, context):
            layout = self.layout
            layout.prop(bpy.context.scene, "rotCam")

# Registration

    def register():
        bpy.utils.register_module(__name__)
    def unregister():
        bpy.utils.unregister_module(__name__)

    if __name__ == "__main__":
        register()

So I am clearly doing something super inefficient here, I'm just not sure what it is. What is also throwing me off is when I use the custom slider once, clear the terminal, I don't get the KeyError any more. That has me thinking that it is some sort of initialization or context shenanegains going on. Hanging pointer maybe? Just not sure.
I also have a similar set up with compositor nodes to adjust things like shadows. Everything works correctly, I can adjust the shadows, but the KeyError makes Blender crash.
Thanks for the help!

While Blender shouldn't crash. Calling an operator from an update callback is risky business. ... not sure if its the cause but this is likely to cause problems.

Hmm didn't know that - pretty new to python scripting. I'll go review property groups again and see if I can figure out a better way to do that...unless you have a quick suggestion @ideasman42?

I might be mis-interpretting your question but, this works:
import bpy
import math

def update_rotate_cam(self, context):
    v = bpy.context.scene.rotCam
    bpy.data.objects['Camera'].rotation_euler.x = math.radians(v)

class SliderProperties(bpy.types.PropertyGroup):
    bpy.types.Scene.rotCam = bpy.props.FloatProperty(
        name="Rotate Camera",
        description="Rotate the camera with the slider",
        default=0,
        min=0,
        max=360,
        update=update_rotate_cam,
    )

class EditStuff(bpy.types.Panel):
    bl_label = "Edit"
    bl_space_type = "VIEW_3D"
    bl_region_type = "TOOLS"
    bl_context = "objectmode"

    def draw(self, context):
        layout = self.layout
        layout.prop(bpy.context.scene, "rotCam")

def register():
    bpy.utils.register_module(__name__)

def unregister():
    bpy.utils.unregister_module(__name__)

if __name__ == "__main__":
    register()

In python a safe way to access items using a key is often done this way:
# returns None if key isn't found
v = some_collection.get(key_name)

# or provide the fallback value if not found
v = some_collection.get(key_name, fallback)

you saved my butt again! SO much simpler than what I was trying to do. I have this great habit of making convoluted code. And thank you for the python pointer. What would I do without you?

Get stuck into the Python manual, and read a lot of add-on code. The scripts directory is full of very interesting recipes.


text:
Fixing the Rotational Origin of a Bone
I'm trying to set up an eye rig, but when it comes to the bones, the eyes don't rotate the way I want to. It's difficult to explain, but it looks like the eyes are rotating in the wrong origin point. I have the bones assigned with a 1.0 weight on all vertices for each eye.
Here's how the bone rotates:
https://imgur.com/a/gsTbQyT
Edit mode is able to give a good demonstration of how I want the eye to rotate. Basically I want to rotate the eye with the origin at its center.
https://imgur.com/a/dd4iVD6
I've tried changing the roll, the object's origin, and moving the bones, but can't find anything that works.

Go to Object Data Properties (green triangle of vertices icon), Vertex groups section, and delete all vertex groups except the correct one.
If the Edit mode rotation is ok, when in edit mode and with all vertices selected, press Shift S > Cursor to Selected, then select the Armature, go to edit mode, select the bone and press Shift S > Selection to Cursor.
If this doesn't solve, please upload the file.


text:
Mesh "glitches" at moments when moving rig
I have this tongue mesh that has certain spots when moving the root bone where it sort of glitches or messes up the mesh and I can't figure out why. As you can see in the video link below, certain locations causes the tongue to get all twisted up.
https://imgur.com/a/ppjqwbn
Here is the blend file:

The bone causing the twitching is the first def bone of the tongue, which is a 5-segment bendy bone that gets roll-in and roll-out from its parent and child respectively.  But its parent and child have rolls pointed in almost opposite directions, meaning that the rest pose of this set of segments is actually rotating through almost 180 degrees.
We'll enable the display of bone axes (almost always a good idea when working on a rig) and switch the display to bendy bones, since those are what we are working with and we need to see what they're doing.  (Custom shapes, bone colors, stick display, etc-- all that is for the animator, and while rigging, those are only going to obscure information that we need to identify and fix issues.)

The roll is an angle, read only in the -180 to 180 range, but because that angle is distributed over 5 segments, there is a very big difference between -179.99 and +179.99 degrees: -180 is the same as +180, but some fraction of -180 is not the same as that fraction of +180.  Since it is basically 180 degrees to begin with, tiny imprecisions can lead to it flipping which angle it's seeing, and we see that just moving the root sometimes leads to the pose shown at right.
If we align these bones' axes, it'll stop having a "rest twist" on this bone.  Because the child is also a bendy bone, and we don't want to screw up its roll either, we'll do this by setting the roll of its parent, "Ultimate_tongue_rig", to 180.  When we do this, the rest twist disappears and the tongue stops twitching when we move it.


text:
How to apply gamma node to image
Is there a way to apply a gamma node to the image file, like how you can apply a modifier to a mesh?

You could probably do that in the compositor. Add the Gamma node in there and render the image to apply the gamma.


text:
Assign faces to UV map
I have an object that I want to use a UV project modifier on, but I only want the modifier to affect certain parts of the mesh. I need a way to assign the areas I want moved to a second UV map. How can I approach this?

You can create a b&w image in order to create a mask that will separate a part from the other if you plug it into the factor of a Mix Shader or of a MixColor, and you can create another UV Map and use an Input > UV Map node, but maybe give some details about the object etc

You can mask between your UV-projected texture and another, based on a separate UV map, in any way you like. It could be any float-attribute on the mesh, set via a vertex-group, or perhaps using Geometry Nodes...
Here, it's a B/W mask painted into an image: 'UV Mask', as mapped by the UV map: 'Not Projected'.
The 'Not Projected' UV also maps a Brick texture. The colored circles are mapped using the 'Projected' UV map, which is generated by a UV Project modifer.

So the maps are independent:


text:
Connecting all bones in a chain
I have a chain of bones that I am using for a rigify armature.

I need to have each bone connected to its parent. Is there a fast way of doing so, as individually connecting each bone would be very tedious.

It looks the bone heads and tails already where they would need to be for such, are they already parented together in the right order (the leftmost being the parent of the second left most, which is parent of the third leftmost, Et cetera)?

You can hold down ⎇ Alt while changing a property to propagate the change to the selection.

Switch to Edit mode in the armature
Select all bones
While holding down ⎇ Alt, enable the Connected property in the bone data property tab > relations panel:


text:
How to have driver be affected by multiple custom properties
I have an armature with two custom properties and I would like an object to be hidden if either property is turned in. Is it possible to have a driver work for both custom properties?

Yes.

Create the driver on the render visibility of the object (the camera icon next to it in the outliner).
Make sure the driver type is "Scripted Expression".
Rename the single default input variable "var" to "p1" or something without a space.
Set the Prop ID Type of the input variable to "Object" if it isn't already (it probably is). You do this by clicking whatever icon is on the left of the field next to the word "Prop:"
Pick the armature object as the input object for the property. Note that in the screenshot below this would be where “Your Object” is.
Set the Path RNA to ["first prop's name here"].
Add a new Input Variable, and repeat steps 3-6, but with a name like "p2" and the second prop's name for the RNA instead.
Set the script field to p1 or p2, substituting whatever you named the in put variables.

The result should look something like this:


text:
How to port 4.0 blend files to older versions of Blender
Due to my computer's graphics I am unable to use Blender 4.0+. Some models I am interested in are made in that version. Is there a way to port these models to an older blender version?

Try to append from the 4.0 files (but that may fail).

"E.g. Blender 3.6 LTS is able to open the new Mesh data from Blender 4.0 onward, and to save it back into a format compatible with all Blender 3.x versions." from https://developer.blender.org/docs/handbook/guidelines/compatibility_handling_for_blend_files/

@Blunder when I open 4.0 files in 3.6 it gives me a warnign that data loss could occur if I save.

yes, that's a normal warning. If you want to be on the safe side, use the menu item File > Append ..., as suggested by lemon. I've just added the link for the additional info about compatibility and to make it clear that only Blender 3.6 LTS can read both formats (3.x and 4.0). Earlier versions immediately crash when you try to open a 4.0 blend file.

I figured out how to do this. Blender 3.6 can open models made in 4.0+, so just using 3.6 works.


text:
How do alpha channels work in Blender?
A lot of times I come across models that have alpha channels in the textures (specifically on the diffuse and normal maps). Are these channels necessary for both texture types, and if so, how do I use them?

Both diffuse maps and normal maps shouldn't use alpha. Adding an image example to your question would help.

Hello and welcome. Please don't post the same question more than once. If your previous question was put on hold, address the raised issues by editing it so it can be reopened rather than post a new one, otherwise see What should I do if no one answers my question?

Alpha channels define Transparency. If you are using an Image Texture in Blender with an alpha channel, use the shading tab, and connect the alpha component of the Image Texture to the alpha connection on the Principled BSDF. If you are using EEVEE (Pre 4.2), you must also change the material's Blend Mode to something other than opaque.

Alpha channels are most often masks (think stencils) that can be used as a mix factor between a Transparent Shader and one or more other Shaders (although most shader systems often "understand" what's happening if an alpha channnel is being used in conjunction with a diffuse shader and automatically apply it to the Normal Map, thus the Normal map generally does not require an alpha channel).

Black and white textures (including procedural ones) can be used for an alpha channel as well, with white representing opaque and black representing transparent. Shades of grey represent varying levels of semi-transparency depending on the darkness:


text:
I can't flip my pose for my animation?
So I am currently following a mech tutorial on animating a run cycle. At about 7:27 in the video (after he posed/key framed the mech in the first frame), the guy copied the key frames in the first frame and pasted/flipped them (ctrl+shift+v) on frame 10. The pose was perfectly flipped for him.
On the other hand, when I tried to do it, my mech became distorted. Here is the first frame of my mech's run cycle.

And here's how my mech looks in frame 10 when I paste/flipped the pose in frame 10.

As you can see, the body becomes distorted and weird. I did some research and I tried to rename the control bones on my feet to indicate which ones are left and right, but that didn't work.
I tried to recalculate my roll (shift+N) for all my bones for the Global +Z Axis in edit mode, but that didn't work either.
I should note that when I did recalculate my roll, the z axis for most of my bones did recalculate properly, except for a few. Including the pole bones for my feet.
Here's a photo before of all of my bone's axises before I recalculated their rolls.

And here's the after image.

Does anyone know what I'm doing wrong??? How do I flip my pose correctly?
Here's a copy of my Blender file.

I guess your problem is a mix of wrong names and bad orientations.
You say that you tried to rename your bones, but in your file they are not properly renamed. The left foot must be named something like foot_L, and right foot something like foot_R, otherwise when you'll flip the pose, Blender won't be able to understand to what bone it is supposed to paste.
So when you have finished a side of your armature you should properly name all your bones, then, in Edit mode, select them all and Armature > Symmetrize so that it copy paste on the other side.
Also, you'll probably need to correct the rotation of the lower leg due to the IK: Once in Pose mode, select the lower leg, go into the Properties panel > Bone Constraints, play with Pole Angle value to correct the orientation.

My bad. Looks like I just named the pole bones. Thought I renamed them and the foot control bones.
So I renamed the two control bones (along with every bone in the rig) and it helped a little, but the feet are still a bit distorted. Also I tried ctrl+R (in pose mode) and shift+N (in edit mode). Ctrl+R didn't seem to do much of anything and shift+N seemed to distort the legs even more.

here is a copy of my most recent save link. Note on this copy I ctrl+z the shift+n that I performed earlier.

So what you need to do is delete all the right bones in Edit mode, symmetrize the left bones (select all, then Armature menu > Symmetrize), in Pose mode correct the lower_leg.R pole angle to 180° (in the IK constraint panel of the bone), then it works fine. Also put the root in the middle.

@SMH It will definitely be worth it to put some time into naming your bones properly. Otherwise you can easily get confused or slow when animating or checking the graph editor.

@moonboots thank you for saving my ass again


text:
How to make height map more pronounced?

So I am watching CG Geek's tutorial on how to create a Star Destroyer, and I'm pretty much finished with it, but there's one small problem that I am having. On his tutorial, his displacement map on the model is so pronounced and stick out more.My displacement map stick out a little, but barely at all. It just looks flat.
I tried using a math node on the image texture in order to amplify the map, but it doesn't seem to do anything.In the video, CG geek is using Blender 2.78. I'm using 2.82. Maybe that has something to do with it?
How do I get me displacement map to stick out more like in CG Geek's video?
Here it the reloaded Blender file (with images).

your node organization seems weird but anyway you didn't pack the image in the blend file so it doesn't appear, could you please reupload the file with the image packed?

@moonboots I reuploaded the whole folder with the Blender file. I think the Blender File needs the Blend1 file to be downloaded with it for the images to appear. I placed the PNG image in the file as well.

@moonboots
On a separate note, for the nodes, I believe I just followed along with CG Geeks tutorial. Although it may be slightly different. However, whenever I mess with nodes, I just kind of plug and play to see what works. Any tips or links that could help with organization?

SMH, you need to pack the image called "Depth_4.exr", the one you use as a Bump, in the UV Editor you need to select it and go to Image > Pack so that it gets packed in the blend fil itself.

He seems to be using true (both) displacement, are you doing that as well? (Disclaimer: didn't really watch the tutorial)

@moonboots When I opened the file, Depth_4.exr was in there, but I repacked the image into the file and reuploaded in the link above. I also added a separate folder with all of the displacement maps in case it goofs again.

@Leander I actually didn't have both selected. Although, when I do select both Displacement and Bump under the Settings tap under Materials, it really messes up my side texture. I tried adding a Subtract node with my Multiply node like in the video, but that didn't seem to work.

@moonboots converting it to a JPEG actually did help. The only problem is that when I set the Displacement (under the Settings Tap on the Material settings) to Displacement and Bump, it distorts the texture way too much. Do you think it could be a problem on how I UV unwrapped the mesh?

Actually I'm not sure if what I said is true  ;)  I'm going to test again

Ok so the problem was not the format but your node organization, it's a bit messy, choose one of those below. Also make sure that you've correctly unwrap your object and that the different parts have the right material.

Still no such luck unfortunately. The top one node arrangement doesn't really make the texture pop out, and the bottom one displaces the texture too much. I tried redoing the UV unwrapping for the parts of the mesh that are using the texture, but that didn't seem to help.

Mmh weird because it works fine with me

damn. Are you using both bump and displacement on your material settings?

here is my file: https://pasteall.org/blend/414f5b92f11c43fabf51e8189837ea18

To switch from a solution to the other just click on the Material Output you want to test

Note that when you are using "bump" as normal you are not altering the geometry, but changing (faking) the shading, whereas if you use displacement, and set the displacement to "real" you can generate real geometry, that will be more "pronounced"

Yes as Susu says you can generate real displacement if you activate the option in the Properties panel > Material > Settings > Surface > Displacement and choose Displacement Only or Displacement and Bump, but you don't have enough topology and it would not be a good idea in your case, so keep it fake

@moonboots  So basically it's better if I just leave it as bumps (fake), right? Sounds like there's no way around it.

Would you agree, @susu ?

Yes fake works fine  ;)  for this kind of object a real displacement would need a huge subdivision, it's not interesting


text:
How to make one clear object invisible inside of another clear object?
So for my animation, I have water draining out of a clear sphere. Unfortunately, through the sphere, the flow of water is visible when I don't want it to be. I only want the flow to be visible when it exits the bottom of the sphere.

I still want the sphere to be translucent to the point where the viewer can see over to the other side, I just don't want to hide the part of the inflow inside the clear sphere.
Does anyone know a way of using a translucent object to hide a section of another object while keeping the former object see-through???
I'm trying to avoid masking it out in post.
A link to my project can be found down below.

please use imgur for pictures (there are tools in the question editor to do this.  MS is very slow to load and I don't want to be redirected there just to look at a picture.  Also you can upload blende files to blend-exchange

Hello :). Please make it easier for others to help you, and upload your Blendfile without unnecessary images and geometry. That way you can easily cut down the size from 400+ to 3 MB.

Sorry it wouldn’t let me upload images larger that 2 MB.

Hey I just updated my post. I attached the file to blend-exchange and I attached the picture directly to my post.

There is a trick that worked very well for me:
You can make the object "invisible" inside of the clear sphere by adding another sphere just slightly smaller inside of it, adding a Boolean modifier to both the water inside the sphere, and itself. Then set the Boolean sphere to fully transparent so you do not see it. Now the water inside of the sphere should have disappeared. Make sure you do not apply the modifier at all, as that would apply it to the vertices, and change the simulation.

Now that's a smart way to do it.

Do I set the boolean sphere to difference or intersect?

You set it to difference

You can also play around with the settings to get an appealing result

You can use Light Path > Is Singular Ray to "mask" inside object out of main object.
Node setup below should be assigned only (!) to the object you want to hide. Sphere has simple Glass shader.
Another crucial thing here is Glass Roughness. You must add "something" (more then 0.017-0.18) not to break refraction. I've added 0.033.