text:
How to get the value of face area using python
I know how to display face area using 3d view port. However, I could not find a way to return the value of the surface area. Does anyone know where Blender stores face info? Thanks so much in advance!

#

Thank you, Lemon! Sorry, I cannot leave comments because of low reputation. I actually tried bm.face.calc_area() before, however, what it gives me is different than the area value showed in 3d view port when I choose a non-flat face. It works if I choose a flat face. Does bm.face.calc_area() returns face area on uv map?

#

Thanks for all the replies! Martin and Lemon, you're right, I ignore the triangulation. When I calculate the face area of a quad face, it's 0.0002683, which is different than the value given by face info 0.0002705. Then I convert quads topology to triangles, I saw the sub tri areas of the quads are separately 0.00014476175 and 0.0001255185, which can be added up to 0.0002702. If I keep dividing my quad face, I think I will the value very close to 0.0002705.  Thanks so much for solving my problem. And sorry for my bad wording, I'm working on a human face model, the flat face can be considered as the forehead area, while the non-planar face can be found in nose area.
Can I ask another question? Since the 'calc_area' gives me the face area in 3d view, how can I get the face area in uv mapping. We know that there is distortion caused by unwrapping a 3d object to 2d. If I get the areas before and after uv unwrapping, I can calculate the distortion. Any idea on calculating face area in uv mapping?
I also tried 'ob.data.polygons', which gives me the same result as 'bmface.calc_area'.
Thanks a lot in advance!!

#

[What I'm trying to do is to calculate the face areas before and after uv unwrapping and see the distortion from 3d to 2d. I know blender provides a visualization tab to display the distortion degree, which is 'stretch' in uv panel. After applying 'stretch' on uv map, I can see colors from dark blue to red, representing the distortion between uv and 3d coordinates. However, I cannot get the data deciding these colors, that's why I want to get the areas before and after unwrapping. Thanks a lot in advance!!]
#
I decided to calculate face area on uv mapping according to the vertices on this face, I share my code here:
import bpy
me = bpy.context.object.data
uv_layer = me.uv_layers.active.data
uv_area_ls = []
for poly in me.polygons:
coords = []

for loop_index in range(poly.loop_start, poly.loop_start + poly.loop_total):

    uv_coords = uv_layer[loop_index].uv

    coords.append((uv_coords[0],uv_coords[1]))

if len(coords) == 4:

    coords_new = [coords[1],coords[0],coords[3],coords[2]]

if len(coords) == 3:

    coords_new = cords

area = PolygonArea(coords_new)

uv_area_ls.append(area)

(Note that: I used PolygonArea function in this post
https://stackoverflow.com/questions/24467972/calculate-area-of-polygon-given-x-y-coordinates)

Use bmesh module https://docs.blender.org/api/current/bmesh.types.html#bmesh.types.BMFace.calc_area

I wonder, what exactly should be considered to be the area of a non-planar face... It's kind of hard to imagine. The surface illusion defined by the normals? The sum of triangles that make it up? Triangulation of non-planar faces can be done in at least 2 ways - maybe that's why you can sometimes see different results?

I think triangulation is the problem (even if not tested for area). Though have tested for volume and triangulation has influence on it @MartinZ (https://docs.blender.org/api/current/bmesh.ops.html#bmesh.ops.triangulate)

To calculate it by yourself from ABC a triangle this is half length of AB cross product AC.

related: https://blender.stackexchange.com/a/47676/30849

You can use bmesh to do that.
The code is fully commented below.
Using mesh triangulation
The only non intuitive part about bmesh and uv access is you need to get it using face loops.
Face loops are elements that can be indexed by the corresponding bmesh loops layer so that you can get the corresponding value in the loop (last line in the code before the print).
Note also that uv 2D coordinates are converted to a 3D vector so that tri_area function can work. This is a facility. You may want to write a more specific calculation for 2D tri area.
import bpy
import bmesh
from mathutils import Vector

# 3D tri area ABC is half the length of AB cross product AC
def tri_area( co1, co2, co3 ):
    return (co2 - co1).cross( co3 - co1 ).length / 2.0

# Get the object
obj = bpy.context.object

# Construct bmesh
bm = bmesh.new()
bm.from_mesh( obj.data )

# Triangulate it so that we can calculate tri areas
bmesh.ops.triangulate( bm, faces = bm.faces )

# Ensure faces access
bm.faces.ensure_lookup_table()

# Get the uv map
uv_loop = bm.loops.layers.uv['UVMap']

# enumerate the faces
for face in bm.faces:
    # Get the face area (can also be 'face.calc_area()')
    face_area = tri_area( *(v.co for v in face.verts) )
    # Get corresponding uv area
    uv_area = tri_area( *(Vector( (*l[uv_loop].uv, 0) ) for l in face.loops) )
    print( face.index, face_area, uv_area )

Using triangulation on the fly
The interest is to have the final result at the polygon level so that areas can be directly compared to the mesh as it is.
The principle is nearly the same but we use bm.calc_loop_triangles() which gives us several loops of tris each referencing the initial faces.
As the areas for each face will be obtain by part (one tri at a time), we use a dictionary to cumulate the results (nothing gives a guaranty that each face is cut continuously in the resulting loop).
import bpy
import bmesh
from mathutils import Vector

# 3D tri area ABC is half the length of AB cross product AC
def tri_area( co1, co2, co3 ):
    return (co2 - co1).cross( co3 - co1 ).length / 2.0

# Get the object
obj = bpy.context.object

# Construct bmesh
bm = bmesh.new()
bm.from_mesh( obj.data )

# Ensure faces access
bm.faces.ensure_lookup_table()

# Triangulate it so that we can calculate tri areas
triangle_loops = bm.calc_loop_triangles()

# Get the uv map
uv_loop = bm.loops.layers.uv['UVMap']

# Initialize face entries
areas = {face: (0.0, 0.0) for face in bm.faces}

# enumerate the loops
for loop in triangle_loops:
    # Get the face
    face = loop[0].face
    # Get current areas
    face_area, uv_area = areas[face]
    # Add tri surface area
    face_area += tri_area( *(l.vert.co for l in loop) )
    # Add corresponding uv surface area
    uv_area += tri_area( *(Vector( (*l[uv_loop].uv, 0) ) for l in loop) )
    # Set the result in the dictionary
    areas[face] = (face_area, uv_area)

# Print results
for face in areas.keys():
    face_area, uv_area = areas[face]
    print( face.index, face_area, uv_area )

Note: triangulation calculation is not trivial and several algorithms may give different results, so for coherency in all cases we need to ask Blender apis how the triangulation must be done.

Thanks so much for your elegant solution and detailed explanation! It works, many thanks!!


text:
My normal map isn't coming out right on my mesh
I'm following Blender Guru's tutorial on the anvil, and I'm stumped.
https://i.sstatic.net/j70j2.jpg
As you can see, the normal map just isn't coming out right.  It looks like a flat image on the mesh.  I followed everything to a T, I'm not sure what could be wrong.
  Possibly my mesh?  Also, I noticed my anvil is a lot less... "metallic" looking than his if that's the right word.  Even though our settings for the material are the same, mine feels like its made out of clay still.  If anybody could help in either regard, that would be amazing.
File:

hard to say, please share your file: https://blend-exchange.giantcowfilms.com/

Ah, didn't know you could do that.  Cool!  I uploaded the file, but I had to delete the sculpted anvil because it took too much space:

I figured it out!  It turns out I needed to set the empty section beneath 'tangent space' in my normal converter node to 'UV map'.  I'm unsure as to why I needed to do that, and the tutorial didn't, but I'm just happy it works.

source: Stack Exchange

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

sort: votes


text:
Shape key values saved as 0
I created a simple animation with shape keys. However exporting this animation not working properly. After I export it in gltf2 or fbx format, the shape keys are reset to 0 in exported file. What causes that? Probably this is a bug, but I wonder if there is a working workaround.
This is the animation I created:

This is the shape key value after exporting then importing:

Update: Using emackey's advice I switch my shapekeys to "relative". But also I had to change each shapekey's "relative to"'s to one previous shape key. Even though shapekeys and keyframes exported correctly, this time their relative to's exported wrong. All of the shapekey's "relative to"s set as basis.

There's an example of shape keys round-tripping (glTF to Blender to glTF) in the glTF-Blender-IO test suite, which is a collection of .blend files and .gltf files that are used by an automated process to put new versions of the Blender glTF importer/exporter through most of its paces.
The tests/roundtrip/01_cs_morph folder contains a glTF file that is imported and then re-exported, and is expected to preserve the glTF "morph" animation via Blender's shape key animations.
There is also a tests/scenes/01_cs_morph.blend file that is tested via the exporter.  This is a Blender 2.79 project, but the test suite loads it into 2.82 beta (currently) and expects it to export correctly.  You can download the blend file to see how these shape keys look in any recent version of Blender.
It's not clear from the OP screenshots what the problem is there, but start by taking a look at the examples from the test suite to see how it's supposed to work.  If you still have a case where it's broken, please file an issue and include a sample project for testing.

So, the blend file you shared has shape_key with relative checkbox checked. So it has no problem. There is a problem when that box is unchecked. When it is unchecked, shapekeys are reset to zero.

Interesting.  glTF stores "morph targets" as deltas from a base position, so Blender's "relative" shape keys are probably a better match for what glTF does internally.  Even so, relative values should be easy to compute given absolute values.  You could add an issue to the tracker requesting support for non-relative shape keys.  (They would still round-trip to be relative ones of course).

I found a workaround solution. When "relative" checkbox is unchecked, the shape keys are not exported properly. If "relative" checkbox is checked and "relative to"s of shape keys are set other than basis, it will be reset to basis. So I adjusted my animation to dodge those bugs. I kept "relative" checkbox checked and left "relative to"s as "basis".  I wrote a script that puts keyframes in timeline and iterates through shape keys and keyframes, sets value of current shape key as 1 and others as 0 on current keyframe.

If you want shape key animation to be exported with an FBX or GLTF format the shape key needs to be driven by a bone, otherwise the shape key will have to be animated programmatically. The shape key is still there you are just not seeing the animation.
If you were to bring this cube into Unity as an FBX the shape key will show up as a Blendshape but won't be animated I believe it may be similar for GLTF format.

Actually glTF should support animated shape keys.  It's in the test suite and should survive round-trip.

I would recommend checking out emackeys Blend file example, export using Blenders default GLTF settings ( change the format to GLTF embedded or GLTF separate) and you can drag and drop the files in a viewer like this  https://gltf-viewer.donmccurdy.com/

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


text:
Simple Python script: errors
import bpy
def driver_func(val):

if val < 5:
output = val * val

else:
output = val + 20

return output

# add function to driver_namespace
bpy.app.driver_namespace['driver_func'] = driver_func

I try to run this script in Blender 2.8 to add the function to the driver
but it constantly fails. Why?

My second problem is to get this working:
    import bpy
    activeobj = bpy.context.active_object
    def driver_func(val):

       if activeobj.name = "A":

            output = val * val

       else:

            output = val + 20

      return output

#add function to driver_namespace
bpy.app.driver_namespace['driver_func'] = driver_func

The error message is:
SyntaxError: invalid syntax

location: <unknown location>:-1

Error: Python script failed, check the message in the system console

This works, except for indentations. What is the error message?

The error message is: AttributeError: 'IndentationError' object has no attribute 'msg'
Error: Python script failed, check the message in the system console

Try indented like this https://i.sstatic.net/i4Szf.jpg (use tabs) It is the way python interprets things.

Thanks, this works. I have another problem - I want to base the condition in a second script on the name of activeobj = bpy.context.active_object. But the line If activeobj.name = "x"  ... fails.

Can you edit your question and explain that a bit more?

There is problem with indentation. As, in python indentation does matter.

Hi. Please only ask one question per post. If you need to ask multiple questions, ask them separately.

I would recommend that you use a proper IDE (Integrated Development Environment) that supports Python. This will allow you to check for syntax problems. The correct indentation of the code is important for Python because it is used to determine what part of the code belongs to, e.g. an if, else condition or a function.

Correctly formatted your first code should look like this:
import bpy

def driver_func(val):
    if val < 5:
        output = val * val
    else:
        output = val + 20

    return output

# add function to driver_namespace
bpy.app.driver_namespace['driver_func'] = driver_func

Note that everything that belong into the function is indented by four spaces. What belongs inside the condition is indent by another four additional spaces. This is necessary in Python, because unlike for instance C, it doesn't use curly braces to determine the scope.

Your second script is problematic for two reasons.

The syntax is invalid. If you want to perform an equality check you have to use == instead of =. The latter is only used to assign a value to a variable.
You're declaring a variable outside the function, but are using it inside without passing it as an argument. This is bad because a) you don't want to create global state b) in this particular case the driver will not be able to access the variable because it has gone out of scope. The bpy.app.driver_namespace['driver_func'] only contains a reference to the function, but not the variable you're trying to use.
You cannot access the active object like through bpy.context.active_object when using the code in a driver. It should be bpy.context.view_layer.objects.active.

The correct script would therefore be:
import bpy

def driver_func(val):
    active_obj = bpy.context.view_layer.objects.active

    if active_obj.name == "A":
        output = val * val
    else:
        output = val + 20

    return output

#add function to driver_namespace
bpy.app.driver_namespace['driver_func'] = driver_func

The indentation error msg has been reported as at bug here: https://developer.blender.org/T67295
There is an add-on which can show indentation guides and whitespace markers:

Download: https://github.com/K-410/blender-scripts/blob/master/2.8/code_editor.py
Additional add-ons for enhancing the Blender Text Editor can be found here: https://blenderartists.org/t/how-would-you-show-some-love-for-the-blender-text-editor/1163857


text:
How do I resize nodes in the node editor?
How do I make my nodes smaller? My nodes currently look like the top one, but a node from someone else's .blend file look like the bottom one. How do I make mine look like the bottom one? I can resize them horizontally, but not vertically.

I figured it out, click top right icon which looks like material icon. This will collapse render layer preview thumbnail and make node smaller.

What you want is Ctrl + H that will hide any unused sockets

Hi, thanks for the post. This site is not a regular forum, answers should be substantial and thoroughly explain the solution and required workflow. One liners and short tips rarely make for a good answer. If you can [edit] your post and provide some more details about the procedure and why it works feel free to restore it, otherwise it may be deleted or converted into a comment. Perhaps add a few images illustrating the workflow and final results. See How do I write a good answer?

While a useful tip, answer already present above is the solution to that given question since it will collapse node's thumbnail and make it smaller without removing any node output sockets. Ctrl+H will do nothing in this case since no output sockets should be removed from the node (before and after screenshots showcase that)


text:
How to shift the animation and make it play on a different y-value?
I'm new to Blender, so I'd really appreciate a detailed answer to my question.
I downloaded an animation for a moddable game with a low y-value, how can I shift the whole animation (The whole frames) so it can play in the center? Because in-game, half of the animated object appears to be below the surface.
I tried to transfer it using Delta Transform, but whenever I export and re-open it, it returns to its default location (low y-value), so is there a simple solution for this?
I also would like to know, how can I import multiple animation files to the same timeline (use 2 short animations to make a long one)?

It works best to ask one question per topic. You can create another topic for your question about importing multiple animations.

Select your object, open the Graph Editor, unfold the track on the left panel, select the Y Location track, press ShiftH to hide the others (AltH to unhide) then move the curve on the editor's Y axis:


text:
Blender python script to select an existing geometry nodes group
Very noob question here, I am probably missing something and can't get my code to work properly. I want to create a new object, cube or whatever, add a Geometry nodes modifier to it and select from a drop down menu an existing, 'Fake user' group named 'Mygroup'. This last part is not working properly, I cannot get it to select that group even though if I go manually I can see it and select it normally.
Most recently I tried answers from this post and modified it to correct name but id doesn't work. I am using Blender 3.31 and as I write 3.4.
My code looks like this:
import bpy

bpy.ops.mesh.primitive_cube_add(enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))

bpy.ops.object.modifier_add(type='NODES')
bpy.data.node_groups['Mygroup']

Hello, could you elaborate on what exactly doesn't work ? It throws an error ?

So just that last part, after creating an object and adding a geometry nodes modifier I cannot get it to select an existing node group from the drop down list.

It doesnt create an error, it just doesnt sellect a group

Make sure to have a Node group already in the scene.
import bpy
bpy.ops.mesh.primitive_cube_add()
bpy.context.object.modifiers.new('geometry','NODES')
bpy.context.object.modifiers['geometry'].node_group = bpy.data.node_groups['Mygroup']

That's it, solved! I get it. Thank you Muzammil.


text:
Create/Remove View Layer and give it names
How to create ViewLayer and set name for it using Python? And don't do this if the layer already exists. My code removes the active layer, but it needs to be removed by name. And after this need be active first layer. In this case I create an blank layer (type='EMPTY').
In the end it should be this

Create an empty layer if it doesn't exist
Give it a name
The main layer should remain selected

My not finished code:
import bpy

context = bpy.context
scene = context.scene

bpy.ops.scene.view_layer_remove()
bpy.ops.scene.view_layer_add(type='EMPTY')
bpy.context.window.view_layer.name = 'Sample'

I suggest ditching the operators which are notoriously hard to use and override, and deal directly with the data.
import bpy

if "Sample" not in bpy.context.scene.view_layers:
    bpy.context.scene.view_layers.new("Sample")
    layer_collections = [bpy.context.scene.view_layers[-1].layer_collection]
    # Here we exclude all the view layer collections so it mimicks the "BLANK" option
    while layer_collections:
        l_c = layer_collections.pop(0)
        layer_collections.extend(l_c.children)
        l_c.exclude = True

If you want to use an operator you can use this
import bpy

if "Sample" not in bpy.context.scene.view_layers:
    previous_view_layer = bpy.context.view_layer
    bpy.ops.scene.view_layer_add(type='EMPTY')
    bpy.context.view_layer.name = 'Sample'

    # Restore the previous view layer since the operator changes the active view layer
    bpy.context.window.view_layer = previous_view_layer

Link to bpy.types.ViewLayer docs.
Link to bpy.types.Scene.view_layers docs and the definition.
How to change the active view layer

Okay, let's say 6 lines is better than 1 line.
But why immediately remove the newly created layer in the second part of the code? Need delete named Blank Layer if it exits(where is If?). It is logical to assume that there should be a main layer, and a Blank Layer should be added to it, provided that it does not exist, and the main one should remain selected.
In addition, the code throws an error if a non-existent (or already deleted) layer is entered on the layer to be deleted.

Well you say it's logicial but there are as many workflows as there are people using Blender, so I simply answered your question based on your code snippet and your explanations. If that doesn't fullfill your need, feel free to discard of fill in the blanks, otherwise sorry but I just don't understand what you're trying to do :)

Create an empty layer if it doesn't exist
Give it a name
The main layer should remain selected

I have given an example of my code as wrong, because it deletes the current (Blank) layer and nothing happened. But need delete blank layer by name(if it exists of course) while remaining on the first layer and create again(for my variant "delete>create"), or another option in which at the end I will be on the first layer and blank will be created.

@M.Gordon okay, I think I got your three steps, I don't really get the end of your comment but that should get you started. :) Please see my revision.

Thanks for attention

do you can help me select view layer by name?

bpy.context.scene.view_layers["name"] or bpy.data.scenes["scene_name"].view_layers["name"]

Thank you very much!


text:
How to make image panel
The forum member Blunder helped me a lot, but I still don't understand how to choose the right context and image buttons. I went through a lot of options from the documentation related to images and nothing fits.
I need to make an image panel with Image Browser, New+Open/Image name(if selected). For Node named "Sample". How can this be done using this code?

import bpy

class SelectImagePanel(bpy.types.Panel):
    """Creates a Panel in the World properties window"""
    bl_label = "World Image Panel"
    bl_idname = "OBJECT_PT_select_image"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "world"

    def draw(self, context):
        layout = self.layout

        **Context here?????**

        row = layout.row()
        row.label(text="Select an image", icon='WORLD_DATA')

        row = layout.row()
        row.prop(context.scene, 'select_image')

def register():
    bpy.utils.register_class(SelectImagePanel)
    bpy.types.Scene.select_image = bpy.props.PointerProperty(name='Image',type=bpy.types.Image)

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

if __name__ == "__main__":
    register()

This is a simple example.
import bpy
from bpy_extras.io_utils import ExportHelper,ImportHelper
import os

class Select_PT_Image(bpy.types.Panel):
    """Creates a Panel in the World properties window"""
    bl_label = "World Image Panel"
    bl_idname = "OBJECT_PT_select_image"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "world"

    def draw(self, context):
        layout = self.layout

        if not context.scene.set_up_world == True:
            layout.operator('object.setup_world',icon='WORLD')
        else:
            row = layout.row()
            row.label(text="Select an image", icon='WORLD_DATA')
            if context.scene.world.node_tree.nodes['SAMPLE']:
                row = layout.row(align=True)
                row.prop(context.scene.world.node_tree.nodes['SAMPLE'], 'image',icon_only = True)
                row = layout.row(align=True)
                row.operator('image.new_custom',text='New',icon='ADD')
                row.operator('image.open_custom',icon='FILE_FOLDER',text='Open')

class Setup_OT_World(bpy.types.Operator):
    bl_label = "Setup World"
    bl_idname = "object.setup_world"

    def execute(self,context):
        context.scene.set_up_world = True
        w_tree = context.scene.world.node_tree
        w_image = w_tree.nodes.get('SAMPLE')
        if not w_image:
            w_image = w_tree.nodes.new('ShaderNodeTexImage')
            w_image.name = 'SAMPLE'
        w_bacground = w_tree.nodes['Background']
        w_tree.links.new(w_image.outputs[0],w_bacground.inputs[0])
        return {'FINISHED'}

class Simple_Open_OT_Operator(bpy.types.Operator,ImportHelper):
    bl_label = "Open Image"
    bl_idname = "image.open_custom"
    filter_glob: bpy.props.StringProperty(
        default="*.png;*.jpg")
    def execute(self,context):
        bpy.data.images.load(filepath=self.filepath)
        bpy.context.scene.world.node_tree.nodes['SAMPLE'].image = bpy.data.images[os.path.basename(self.filepath)]
        return {'FINISHED'}

class Simple_NEW_OT_Operator(bpy.types.Operator):
    bl_label = "New Image"
    bl_idname = "image.new_custom"

    name: bpy.props.StringProperty(name='Name',default='YourName')
    width: bpy.props.IntProperty(name='Width',default=1024)
    height: bpy.props.IntProperty(name='Height',default=1024)
    color: bpy.props.FloatVectorProperty(name='Color', subtype='COLOR')
    alpha: bpy.props.BoolProperty(name='Alpha',default=True)

    def execute(self,context):
        bpy.data.images.new(name=self.name,width=self.width, height=self.height, alpha=self.alpha)
        bpy.context.scene.world.node_tree.nodes['SAMPLE'].image = bpy.data.images[self.name]
        return {'FINISHED'}

    def invoke(self,context,event):
        return context.window_manager.invoke_props_dialog(self)

classes = [Select_PT_Image,Setup_OT_World,Simple_Open_OT_Operator,Simple_NEW_OT_Operator]

def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.Scene.set_up_world = bpy.props.BoolProperty(name='Setup World')

def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)
    del bpy.types.Scene.set_up_world

if __name__ == "__main__":
    register()
```

Thank you! You wrote a very useful script, even a mini addon!

I have two examples of doing this. One is a pre-built Blender operator and another is a manual operator. I like to work with manual operators that's why I also created it for you.
Pre-built Operator Code:
import bpy

class SelectImagePanel(bpy.types.Panel):
    """Creates a Panel in the World properties window"""
    bl_label = "World Image Panel"
    bl_idname = "OBJECT_PT_select_image"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "world"

    def draw(self, context):
        layout = self.layout

#        **Context here?????**

        row = layout.row()
        row.label(text="Select an image", icon='WORLD_DATA')

        row = layout.row(align=True)
        row.prop(context.scene, 'select_image',icon='IMAGE_DATA')
        row.operator('image.new',text='New',icon='ADD')
        row.operator('image.open',icon='FILE_FOLDER',text='Open')

def register():
    bpy.utils.register_class(SelectImagePanel)
    bpy.types.Scene.select_image = bpy.props.PointerProperty(name='Image',type=bpy.types.Image)

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

if __name__ == "__main__":
    register()

Manual Operator Code:
from bpy_extras.io_utils import ImportHelper
import os
class SelectImagePanel(bpy.types.Panel):
    """Creates a Panel in the World properties window"""
    bl_label = "World Image Panel"
    bl_idname = "OBJECT_PT_select_image"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "world"

    def draw(self, context):
        layout = self.layout

        row = layout.row()
        row.label(text="Select an image", icon='WORLD_DATA')

        row = layout.row(align=True)
        row.prop(context.scene, 'select_image',icon='IMAGE_DATA',icon_only=True)
        row.operator('image.new_custom',text='New',icon='ADD')
        row.operator('image.open_custom',icon='FILE_FOLDER',text='Open')

class Simple_Open_OT_Operator(bpy.types.Operator,ImportHelper):
    bl_label = "Open Image"
    bl_idname = "image.open_custom"
    filter_glob: bpy.props.StringProperty(
        default="*.png;*.jpg")
    def execute(self,context):
        bpy.data.images.load(filepath=self.filepath)
        bpy.context.scene.select_image = bpy.data.images[os.path.basename(self.filepath)]
        return {'FINISHED'}

class Simple_NEW_OT_Operator(bpy.types.Operator):
    bl_label = "New Image"
    bl_idname = "image.new_custom"

    name: bpy.props.StringProperty(name='Name',default='YourName')
    width: bpy.props.IntProperty(name='Width',default=1024)
    height: bpy.props.IntProperty(name='Height',default=1024)
    color: bpy.props.FloatVectorProperty(name='Color', subtype='COLOR')
    alpha: bpy.props.BoolProperty(name='Alpha',default=True)

    def execute(self,context):
        bpy.data.images.new(name=self.name,width=self.width, height=self.height, alpha=self.alpha)
        bpy.context.scene.select_image = bpy.data.images[self.name]
        return {'FINISHED'}

    def invoke(self,context,event):
        return context.window_manager.invoke_props_dialog(self)
def register():
    bpy.utils.register_class(SelectImagePanel)
    bpy.utils.register_class(Simple_Open_OT_Operator)
    bpy.utils.register_class(Simple_NEW_OT_Operator)
    bpy.types.Scene.select_image = bpy.props.PointerProperty(name='Image',type=bpy.types.Image)

def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)
    bpy.utils.unregister_class(Simple_Open_OT_Operator)
    bpy.utils.unregister_class(Simple_NEW_OT_Operator)

if __name__ == "__main__":
    register()
```

Many thanks for the detailed answer! In this article, I asked the question how to make an Image Panel for a specific node, and I underlined it with a red line and write in question. That is, I need a link to the image options in node "Sample"(as far as I understand the code structure). I will be very grateful if you answer, @Muzammil


text:
How do I make this model of a digital camera?
I want to make a Black Magic pocket cinema camera model in Blender

but I am unable to make the portion shown in picture. My picture looks like this

It looks nowhere near what I intend to do, can anyone tell me how to make this model?

Do you have the physical camera? More photos of it?

I do not have physical camera, but I can get more pictures from Internet.

That's where you should start. An experienced modeller would struggle same as you without popper reference. Get as many photographs from all sides as possible so you understand the shape.

Always try to search for high resolution images you might get lucky like with this one: https://sydneydesign.com.au/2014/wp-content/uploads/2014/06/Blackmagic-Pocket-Cinema-Camera-1.jpg It should be a lot easier when you have this for reference.

Personally, I would start with a cube. Make the cube the approximate dimensions of the camera, then start subdividing, adding loops, moving faces, until you have the shape, then go and add the smaller details.
Starting from an extruded shape as you have there will not make it easy to get a nice smooth end result, and you will find adding the details is more difficult.


text:
Video Transition? 3 Parts of a Pic?
first of all sry for my bad english. :/
I want to know if there ist any tutorial for Blender to made an Transition VideoSequence or something for a Twitch/Stream Szene change, dont know if Transition is the right word for it..
i have 3 parts of a pic (made by hand in gimp) and Blender have to put them together, for example the upper part from the top down, and the two lower parts from the bottom corners up, so that the picture is complete after the slide in.
i hope u guys understand what i want. :/

EDIT:
this is my current state:

so i dont know how to set the keyframes to the coordinates!?
i think i have to set the coords to zero @ frame 30 f.ex.
and then set the coords like in the picture? But how does that work?
And after that i think i have to click on 'Render -> Render Animation' right?

You will probably have a hard tome doing this in the Vide Sequence editor alone. Do it with textured planes in the 3D view.

There is no automated transition effect for that. I think the easiest way is to the use import image as plane addon, then cut the plane into pieces and animate the pieces coming together and add that to the VSE.

You can do this with 3x VSE Transform effect strips and masks.


text:
I can't access the bones

I'm want to animate this, but I can't access the bones, already turned on the "X-Ray"
This came from this site. In the description says it was rigged.
If you want to download the file. (You have to create an account to the site in order to download it, so I upload it on Google Drive if you want to download it. The size is 2 MB.)

The rig is on a layer you have hidden.  Layer nine. Right now you have X-ray on for the model; you may need to turn X-ray off of it before you will see the rig.
You need to have all layers you want to see visible. If you hold shift while selecting, you will be able to make multiple layers visible.

Thanks, I see the bones now. Problem is, if I go to layer 9 it only shows the bones (see image ). I want it to look like this(mesh & bones shown)


text:
Why Can't I see the light in the Animation tab?
I am trying to create my light source in the animation tab but it is not showing up no matter how high the light power is. What is going on and how do I fix it?[
I have look up everything I could.  (this is blender 3.4)
I was watching a video tutorial to create the sword and they managed to get light. https://www.youtube.com/watch?v=s-XhO3OOPxQ&t=918s17:35

Are your Scene Lights enabled? https://i.imgur.com/LY71jYh.png

Yes they have been.


text:
How to make arched cabinet door with bevels
I want to make arched cabinet door like this one:
I tried creating the inner arched part first and then using boolean on a plane but everything became a mess and bevel doesn't work.
Here is my .blend file:

at first i recommend adding an edge here: [1]: https://i.sstatic.net/oVGHF.png -> just select both vertices and press F, then try again ;)

you also have the problem, that you have missing faces:  [1]: https://i.sstatic.net/DzrVZ.jpg

i would recommend watching some very basic beginner tutorials about modelling. So that you are sure what a face, an edge and a vertex is and how you can connect and build them.

basically a bevel works only if the geometry "underneath" is clean and if there are missing faces, it won't work, like e.g. here : [1]: https://i.sstatic.net/IOhzG.png

I tried with filling the mising faces with F but it didn't help, still the bevel doesn't work on this side @Chris

then pls upload your updated blend file again, so we can check it out

 Here it is with filled face

there are still faces missing....[1]: https://i.sstatic.net/1xXag.png

and here as well: [1]: https://i.sstatic.net/nmHFR.png so still two faces missing. i would recommend using viewport shading solid and move the model a bit, so you can see missing faces easily. But honestly: i don't have the patience now to show you all missing faces, maybe someone else does. You should watch beginner modelling tutorials and practice more...

Don't do it with with a Boolean modifier. I would recommend starting all over again and do it like this (all I'm doing is just eyeballing it since I have no measurements for the object, but you can enter values for the operations as well). Okay, this will be quite long but I'm trying not to skip any steps that might be unclear:

Create the basic cuboid you need for the door. Make sure you've applied the scale with Ctrl+A > Apply > Scale if you adjusted the scale in Object Mode instead of Edit Mode.

Tab into Edit Mode. Select the top face, press I to inset it to the size of the outer border of the panel. Maybe scale or move on Y axis to get the correct offsets.

Create a loop cut in the center of the long side of the mesh with Ctrl+R.

Select the two edges on that side where you want to create arch. Right-click and choose Subdivide from the context menu.

For the next step it's easier to see in Vertex Select mode, so switch to it in the top bar menu or press 1 to switch. Select the new vertices in the middle of the subdivided edges. Scale them further apart with S > X, depending on how wide the arch should be.

Go back to Edge Select with 2 and select the two short edges towards the corners, then move them with G > Y to make the "bottom" of the arch.

Now press 3 for Face Select mode. Select the two inner faces and inset them again with I to the size of the inner panel.

Switch back to Edge Select with 2, select the center edge at the at the tip of the arch.

Bevel this edge with Ctrl+B, scroll the mouse wheel to increase the number of segments - I would suggest an even number to kepp the center edge (I use 16 here) and left-click to confirm.

The bevel will create unevenly spread segments if you are working with the default Width Type > Offset, so open the tool options in the bottom left of the editor window and switch it to Percent. At first the bevel seems to disappear since the amount jumps to 0.000%, but increasing this number will make it reappear again. I found a value of 90-92% quite fitting.

Select the top left faces and press F to merge them into one n-gon.

Repeat this for the other "quadrants" of the split faces so that you have 4 new n-gons. Although everyone says n-gons should always be avoided, they make a much cleaner geometry and are unproblematic in this case.

Now use Face Select again and select the face loop of the arch, an easy way is  to Alt+Leftclick on the edge between two faces of the loop.

Press E to extrude the faces downwards to the desired depth of the groove.

With Edge Select you can now select the top rim edges of the inner panel and the outer door leaf. Use Shift+Alt+left-click on the edges to create all connected parts.

Bevel both edges with Ctrl+B. This might look strange and incorrect because the Bevel tool uses the options from the last bevel. Just bevel a bit and left-click to confirm.

Open the tool options at the bottom left (if they are not already open). Switch Width Type back to Offset and make sure you enable Clamp Overlap. This way you can make the width very large but it will stop at the bottom edge with overlapping.

Now set the Profile Type at the bottom of the options menu to Custom instead of Superellipse. There you can set any profile you like (or some real profile which you want to recreate), maybe you have to increase the number of segments to get the best resolution for it.

Press A to select all and then M > Merge > By Distance to make sure no double vertices remain from the clamped beveling.

Tab back into Object Mode, right-click on the object and choose Shade Auto Smooth to get a smooth looking surface.

You could also create a plane, mirror it, draw the lines:

Then extrude twice to give it thickness:

Select the edges that are in the depth:

Then bevel with the Custom option, tweak the Width and the Segments values, create the custom profile:

Add some support edge loops in order to prepare your mesh to a Subdivision Surface modifier:

Oh, of course you had to make a more beautiful custom profile... you swank :D Just kidding. Nice approach +1

Not so easy to use though  :p


text:
How to set an objects location and rotation to individual particles in a system
I have a particle system representing a school of fish, my goal is to render a cryptomatte of each fish in view of the camera individually so I can generate a masked dataset from it (index/semantic labeling doesn't work with particle systems). This has led me down a rabbit hole of blender particle system api docs and currently, my solution is this: do not render the particle system, spawn an identical fish at the location/rotation of each particle, then render in between positions. When testing this, however, the spawned fish "testFish" does not move to the proper locations or rotations within frame in the output renders.
import bpy
import mathutils
import os

ob = bpy.context.active_object
dg = bpy.context.evaluated_depsgraph_get()
ob = bpy.context.object.evaluated_get(dg)

# should print out all particles in selected system
#print(ob.particle_systems[0].particles[0].is_visible)

bpy.context.scene.render.engine = 'CYCLES'
bpy.context.scene.render.filepath = "insertdatadirectoryhere"

#Output open exr .exr files
bpy.context.scene.render.image_settings.file_format = 'JPEG'
bpy.context.scene.cycles.samples = 1

# Switch on nodes and get reference
bpy.context.scene.use_nodes = True
tree = bpy.context.scene.node_tree
links = tree.links

## Clear default nodes
for node in tree.nodes:
    tree.nodes.remove(node)

# Create a node for outputting the rendered image
image_output_node = tree.nodes.new(type="CompositorNodeOutputFile")
image_output_node.label = "Image_Output"
image_output_node.base_path = "insertdatadirectoryhere"
image_output_node.location = 400,0

# Create a node for outputting the index of each object
mask_output_node = tree.nodes.new(type="CompositorNodeOutputFile")
mask_output_node.label = "Mask_Output"
mask_output_node.base_path = "insertdatadirectoryhere"
mask_output_node.location = 400,-200

# Create a node for the output from the renderer
render_layers_node = tree.nodes.new(type="CompositorNodeRLayers")
render_layers_node.location = 0,0

# Link all the nodes together
links.new(render_layers_node.outputs['Image'], image_output_node.inputs['Image'])
links.new(render_layers_node.outputs['CryptoObject00'], mask_output_node.inputs['Image'])

#we have the information we need to mask out individual fish
particle_system = bpy.context.object.particle_systems[0]
particles = particle_system.particles
masknum = 0
fish = bpy.data.objects.new("testFish", bpy.data.collections[1].objects[0].data)
bpy.context.collection.objects.link(fish)
fish.scale = (0.1,0.1,0.1)
print(dir(fish))
for particle in particles:
    image_output_node.base_path = "insertdatadirectoryhere"
    mask_output_node.base_path = "insertdatadirectoryhere"+str(masknum)
    masknum+=1
    fish.location = particle.location
    bpy.context.scene.cursor.location = particle.location
    #fish_euler = euler_from_quaternion(particle.rotation.x,particle.rotation.y,particle.rotation.z,particle.rotation.w)
    fish.rotation_euler = particle.rotation.to_euler('XYZ')
    bpy.context.scene.cursor.location = (0,0,0)
    print(fish.location, fish.rotation_euler)
    # Render the particle
    bpy.ops.render.render(write_still = True)

fish.location = (9999,9999,9999)
bpy.ops.render.render(write_still = True)
objs = [bpy.context.scene.objects['testFish']]
bpy.ops.object.delete({"selected_objects": objs})
'''

Wow, after looking through the docs there was literally a to_euler() function in the Quaternion class. Here's what worked for me:
fish.rotation_euler = particle.rotation.to_euler('XYZ')
fish.rotation_euler[2] += math.pi/2


text:
How do I animate my object with empties without breaking all of my other animations?
I am having an issue with this model. It has to be a functional technical model (meaning all of the doors and flaps must be able to move). I have done that but now that I need to animate moving the entire object, I am struggling because it seems that no matter what I do my other animations break. I have tried parenting everything to the main body of the aircraft, that breaks my stuff that doesn't have the mirror modifier. If I parent everything to an empty, it breaks a lot of my animations on other empties. If anyone is able to help here is the link to my .blend file
UPDATE: OK sorry for the late reply. After doing what you said, I realized what was happening. I was overwriting the parented objects. So by following what was suggested here, I was able to fix my issue.

Hello, it seems like you haven't chosen a solution, you first need ton choose how you want everything to be parented, will you parent everything to the main body, to an empty, to an armature? etc

welcome to Blender SE.
Parenting isn't too hard if you are willing to try out some things.

create an empty (i call it master)

Then you should be clear about what you have to parent, and what you must not parent.
All meshes/objects which will be moved/animated by the armature you must not parent to that master, because they already will be moved by the armature.
If the armature has no parent, parent it to the master.
If the armature's parent has no parent, parent that to the master (and so on).
So don't change existing parents. Parent armatures (without parent) to your master.
I would use ctrl-P -> keep offset to parent all (of course not all, only that things, which should fly with your airplane) to your master.
Then you will get:

Note: some animations weren't working in your uploaded blend file, so they won't work in mine.
repaired blend file:

Hint: you should use https://blend-exchange.com/ to upload your blend file.
Happy blending!

I was waiting for some Geonodes, what's happening Chris, maybe a bit of covid?

I will try this and update later today on whether I was able to get it to work.


text:
Inverse Kinetic constraint is behaving wildly
I'm following the instruction from Introducing characters animation from Tony Mullen and I just rigged my first leg and it's behaving wildly. If I move my mouse just a little the leg goes off in a random direction. How can fix this? The target for the C_D_Leg bone(the one at an angle) is the disconnected bone in the lower right. And to apply the constraint I selected the target, shift selected the C_D_Leg and press shift+I.

Likely dependency loop.  What is the parent of C_D_Leg.001?  It cannot be a bone involved in the IK.

You're right! I cleared the parent and parented C_D_LEg.001 to root and now it works! Thanks!


text:
ColorRamp on 3D Array
How can I apply ColorRamp shader on an Array to get this effect?
Each corner has different color. White - Red - Green - Blue - Magenta - Cyan - Yellow.
Thanks.

Hello ! Please add more information about your setup, there are many ways to achieve this effect.

@Gorgious I tried this one https://snipboard.io/2cIiOm.jpg but when I apply it to an arrayed object it does not have the same falloff https://snipboard.io/KxmriB.jpg do you know why that is?

@Gorgious. I am running a MacStudio M1 Ultra with 128GB.

Array is one object. Texture Coordinate node gives you object space vectors that can be displayed as color:

Colors can be remapped by simple Color Mix nodes:

The issue is that its a gradient and every array element is not solid color but a part of a gradient as well. You could get stepped gradient by rounding the coordinate values. Blender's Math node in Round mode is a bit funny - it only rounds to integers without the possibility to specify precision for rounding so you need to multiply and then divide the value by the same number to control precision to which you want to round, but that's OK:

So you could match the steps to the number of array elements if you wanted each element to have solid color you would probably need to shift the gradients a bit so the steps do not happen in the middle of your array elements by simply adding some value with math node.

Hi @Martynas I also tried my version https://snipboard.io/2cIiOm.jpg where it has this nice falloff but when I tried applying it on the entire array object it doesn't have the same gradual fade falloff from one color to the next https://snipboard.io/KxmriB.jpg Do you know why? Isn't it supposed to be the same since I used Object as texture coordinate space in both cases

@HarryMcKenzie it looks like your objects are way bigger than the ones in the answer (see the grid subdivisions) so you reach the color limits immediately. Try scaling your cubes in edit mode way down or playing with the scale of the mapping node

That's weird. Exact same nodes work for me in Blender 3.4.0 on Windows. It's Object space so scale should not matter. A bug maybe?

@MartynasŽiemys wow so my setup worked? i guess coz im running blender 3.4 on Windows 7. Hi \Gorgious yeah it is huge i think, i forgot but size shouldnt matter i think.

Very weird issue. I don't imagine any likely explanations to be honest.


text:
weight paint falloff acting like its full red
I'm making a ballista kind of weapon and for the string, I use bone and weight paint to pull it back.
But when I paint it the mesh doesn't register the falloff so it acts like the whole gradient is red
I hope this help with seeing the problem.

with bones on
What can I do to fix this?
UPDATE: BlenderFile: https://drive.google.com/drive/folders/1aK0xTaL3XNXggw6F0KdVbHLpXWArTnfO?usp=sharing
Video: https://youtu.be/jvdLWzFbRTw

If I understand your question correctly, try subdividing the string a few times. If you only have vertices at each end and in the centre of the string, you won't see any falloff over its length.

i think without a blend file we can just guess and it's hard to tell what the reason is.

Not quite clear, to me.. if the string is the short, currently straight line at the center of your illustration, a gradient is visible on it.

@Chris I put a google drive with the blend file! and a youtube video for more explanation

@JohnEason it got subdivisions and it worked with an earlier armature but because of some other problems I did it over and now this

@Dadarius1996 I got it the wrong way round. - You should try dissolving all ten edge loops along the string to remove the subdivisions and see if that fixes it. You also currently have Auto Keying turned on in the header of the Timeline which may be confusing the issue.

@JohnEason Thank you! That worked, so simple a bit ashamed that I didn't think about that

Good! Glad that it worked. I was a bit confused about all the talk about weight painting until I saw the blend file.


text:
Rendering Line Art modifier from a distance Bug?
I tried importing the same assets to a new scene and it worked just fine? Whats the problem here... I also heard of using freestyle which does kind of solve it but also adds 20 seconds to the render which I want to avoid.

Try to increase your camera clipping distances.

i tried that, it didnt fix anything.


text:
Get coordinates of object following curve using follow path constraint
I have an empty and a curve with locations both set at the origin (0,0,0) of my scene. The empty precisely follows the curve using a "follow path" constraint with the curve having "Path Animation" checked and key frames set on the timeline. I would like to know the coordinates (global) of the empty as its position is modified by the curve along the timeline. As I scrub the timeline and visually watch the empty follow the curve path, I can't find anything in the properties panels to indicate the transformed coordinates of the empty, its location always reads (0,0,0). How would I find this info to use say in a driver?

When you chose the objects transform channel for the driver there are 3 options available. Local Space, Transform Space and World Space. The latter takes the effect of constraints into account.

Thank you, thats what I needed! I wish there was a display option to view "modified" coordinates in the properties panel so you didn't have to get in to driver expressions to view this info.

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


text:
How to create a straight tube shape into a circle animation in blender?
I'm learning Blender, so I can use it to make electricity animation videos. I have been trying to turn a straight line with one end into a circle.
Who knows how to achieve this animation effect?

it has already been answered and bendy bones seems to be the answer

Move the origin of a cylinder to one end like this:

give it enough subdivision/loop cuts.
add simple deform modifier bend like this:

animate angle value and....
result:


text:
How to start modeling headlights of an Audi r8 v10 plus
Hey guys i´m currently working on an model of an r8 v10 plus, eventhough i´m
a beginner i managed to make it look quite good but for now i only have realy easy place holder lights. I tried a few times to model the proper head and braking lights but i just have no idea how to start. Would you use a texture for most of it? How would you make the material? I just have no idea, it would be great if you could give me an push in the right direction.
Here is an picture

What is an r8 v10 plus? Could you some images to your question showing what you got and what you are unhappy about?

@DuarteFarrajotaRamos the op forgot the most important bit in the title of that car the brand: Audi R8 V10 plus

thought everybody knows what an audi r8 v10 plus is, btw. it´s the 2016 version


text:
unusual rotation of particle
I was following Andrew Price's tutorial on making dynamic rain. I followed the tutorial till a point where I found that there's something wrong with my particle settings....
This is what Andrew did

This is what I got

My particles aren't dying like his. So please help me friends. I can't get his starter file also as there's something wrong with it :(
Here are some pics about my particles setup :

I don't understand what is going wrong, you need to explain more.

you don't have the full screenshot, so can't see if you've set the particles to end at the same time or not. right hand corner of the screen, in particle settings, make sure you have the particle system start/end values set correctly, as well as the 'life' of the particles.

You need to add a Collision in the physics panel of the plane and check Kill Particles


text:
My roblox model and character are not showing
I install the blender and open it, work on a model and forget to save and closed the blender. I reopen the blender now my model and character are not showing in blender than I reinstall the blender than also my model are not showing , when  I open my blender a cube is showing but my model and character are not showing

Is the file empty? Have you checked all the layers? What happened, when you lost your models?

Related and Related 2

Sorry to be the one to bring you the bad news, but if you did not save your file your work is gone. Reinstalling blender will not change that. What you are seeing now is the default scene.

@David They would have a quit.blend, and possibly an autosave lying around still (related: https://blender.stackexchange.com/q/3026/599)

Try all these possibilities:

Check all the layers
Try pressing the "/" division key
Try Pressing Alt + H key - HIDE/SHOW Feature
Hit "A" key twice and the press "." (Period key) - OUT OF FOCUS ISSUE


text:
how to rotate along a row of edges
I need to to rotate these faces inwards, towards the back of the guitar, along the line of selected edges at the back

I cant seem to find a way to do this.
Thanks!

You can add custom orientations. Select an edge you want to rotate around, then on the 'N' (right panel), navigate to the 'transform orientations' sections and click on the + button. That will add a custom orientation you can select and use the same way as builtin orientation. From that in your situation, place and use the 3D cursor as pivot (on the edge) and rotate the faces.

Look at the right bottom part of the guitar body, the topology is much better there... To later help yourself also with texturing, have you tried to retopologize that part? the quad flow is not good...

Related  Follow instructions in answer, edge select mode and select an edge on axis of revolution last. Your screenshot pivot point is in "median point" and transform in "global", need to change to "active element" and "normal" respectively.

thanks a lot, that has really helped! P.S m.ardito, I'm planning to just make the body one solid colour so the topology shoulden't matter. Tell me if i'm wrong


text:
Beginner here, How do i re-enable transform handle dots? Version 2.8
The little dots attached to the handle lines are gone completely. The dots in node editor are missing also, I'm sure I've hotkeyed them away by mistake. Can anyone help me get them back? Thank you.

What dots are you talking about exactly? Please edit your question and add a screenshot or something. Also, Blender 2.79 or 2.8?

In the Overlay menu of the 3D view, make sure "handles" is checked : https://ibb.co/fGT0Gxx . However, I can't see how this could be related to the node editor.


text:
How can I get pixels from multiple render passes through Python and store them to generated multilayer image?
First of all I know that the easiest and probably the most efficient and the fastest way would be to add File Output with different inputs, but as far as it is possible I'd like to avoid writing unnecessary files on disc. For my addon I'd like to store all pixels from all render passes to numpy array and then move the results to the generated multilayer image without writing it on disc.
Pixels can be gotten from bpy.data.images['Viewer Node'].pixels, and with Python it is possible to reconnect Viewer node in Compositor to each pass and got particular pass's pixels from there. It starts to be complicated when you have not just a single View Layer but dozens of different Render Layers in Compositor, and worse - Viewer node gives only 4 channel RGBA image, while the passes may be of other types: some of them are values (depth, mist, ao), some are vectors (normals), etc.
Of course I could write a couple hundreds more lines of code to find out node.outputs[0].type for each Render Layer output, write for each type an algorithm to convert its RGBA Viewer result back to its original type and store them to array. This seems to be unnatural and weird way (comparing to something like ...nodes['Render Layers'].output[0].image.pixels) which takes additional memory, processing time and effort. But we all know those unexplainable limits in Blender's API and from time to time each of us has to do weird things. (Still hope there's more straight forward way of doing this which I've missed).
But how can I store pixels from an array to different image layers? I can generate an image in Blender and set its type to "MULTILAYER", but I haven't found any additional options like image.layers[0] appear after that. More to say, I've tried to find a path to existing Open EXR Multilayer file's different layers through API - and failed. And of course multilayer's self pixels, size, channels, resolution and other parameters are returned as 0, which is very similar to what we've got from 'Render Result' image.
To summarize.
The best and more obvious way would be if there was something like bpy.data.images['Render Result'].passes[0].pixels and the same for multilayer images.

Is it true? The problem to get an access to render results in Blender is actual for almost 7 years and yet we still don't have a solution in 2020?
There's no way to access/change individual multilayer image's layers' data through blender API?

UPDATE.
This is a known feature. At the moment there is no access to multilayer images' pixels through API. But the thread is not closed, so still there is a hope this will be improved.

The task for the API improvements is T54272.

@robert-gützkow thank you! You mean, this is a good idea to leave a request there, or this is just to be in the known what is currently in work? I am still very new to all this.

Adding comments with feature requests is usually frowned upon, but poking for an update is probably ok.


text:
How to get which object from the collection is used as particle instance in the particle system via bpy?
If particle system uses Collection as particles in the Render tab of the Particle System settings is there a way to get exact object which each particle is assigned to via bpy? I know that other particles attributes can be obtained with the depsgraph, e.g.:
import bpy

emitter = bpy.context.object  # assuming it is a particle emitter
dg = bpy.context.evaluated_depsgraph_get()
eval_emitter = emitter.evaluated_get(dg)
for ps in eval_emitter.particle_systems:
    for p in ps.particles:
        print(p.location)

But I can not find anything related to which object is assigned to particular particle among the particle attributes. Is there a way to get this info directly from the particles or maybe to somehow reproduce exact random distribution of which object is used as an instance for which particle?

This script lists the evaluated instances, which correspond to a particle system, giving the ps name, original object name and particle location.
import bpy

dg = bpy.context.evaluated_depsgraph_get()

for o in dg.object_instances:
    if o.particle_system:
        print(o.particle_system.name, \
            o.instance_object.name, \
            o.matrix_world.translation)

Output
ParticleSystem Sphere <Vector (-0.1024, -0.4825, 0.0000)>
ParticleSystem Cube <Vector (-0.4588, 0.2148, 0.0000)>
ParticleSystem Cube <Vector (-0.2058, -0.0513, 0.0000)>
ParticleSystem Cube <Vector (-0.8368, 0.3390, 0.0000)>
ParticleSystem Cube <Vector (0.5467, 0.7251, 0.0000)>
ParticleSystem Cube <Vector (-0.0770, -0.9534, 0.0000)>
ParticleSystem Sphere <Vector (0.8253, -0.9243, 0.0000)>
ParticleSystem Cube <Vector (0.5836, -0.0743, 0.0000)>
ParticleSystem Cube <Vector (0.2153, 0.2062, 0.0000)>
ParticleSystem Sphere <Vector (-0.4823, -0.7403, 0.0000)>

Thank you! Taking object instances and their settings directly from the depsgraph seems to be even more useful than iterating through particle systems!


text:
Constraints Fail when Using Input Variables in Drivers
I'm encountering an issue in Blender where constraints stop working properly when input variables are used in drivers. Here's the setup:
I have a camera and a cube (scaled to 0 on the Z so it looks like a plane) to represent the camera's focus point. The cube's scale is calculated using drivers so it matches the projected "size" of the camera. Additionally, I have constraints set up: "Copy Rotation" on the cube and "Track To" on the camera. This setup allows the cube to always face the camera, and the camera to track its movement. This way, the cube is a representation of what is being rendered by the camera.
Individually, both the drivers and the constraints work as intended. However, when I introduce ANY variables inside the drivers, the constraints fail to update correctly.
Video (you don't have to download it)
Blend file (1.1 MB)
Is there a workaround for this issue, or am I missing something in my setup? Any help would be greatly appreciated.

Response:
I've "fixed" it. The problem was indeed a dependency loop, so I used an intermediary empty. Here is the link for the updated blend file (<1 MB).
What I did feels like a workaround, and I would prefer to have something cleaner. If you have any ideas on how to do this more efficiently, please share them with me.

did you check the log? you have a dependency loop. This might be the reason. Dependency cycle detected:
OBCamera_FocusPoint/TRANSFORM_CONSTRAINTS() depends on
OBCamera_FocusPoint/TRANSFORM_LOCAL() via 'ObBase-> Constraint Stack'
OBCamera_FocusPoint/TRANSFORM_INIT() via 'Transform Init'
OBCamera_FocusPoint/DRIVER(scale) via 'Driver -> Driven Property'
CACamera/PARAMETERS_EVAL() via 'RNA Target -> Driver'
CACamera/PARAMETERS_ENTRY() via 'Entry -> Eval'
....

Stupid question: what is the Copy Rotation constraint for on the cube, because you can rotate the camera, which will rotate the cube - but this rotation will not necessarily match the alignment of the camera, because that is determined by the Track Axis and the Up axis of the Track To constraint... Another stupid question: is there a specific reason to use a cube scaled to 0 on Z instead of a simple plane?

Hey @Gordon, I'm having trouble understanding your comment, especially this part: "but this rotation will not necessarily match the alignment of the camera, because that is determined by the Track Axis and the Up axis of the Track To constrain...". The rotation of the plane in the "fixed" version sometimes stops working, and I'm still trying to figure out why. Could you elaborate a bit on this, please? Also, I chose a Cube empty instead of a Plane because I would have to create a transparent material for the Plane. Ideally, Blender would have a Square empty like the Circle.

@David.Rodrigues If your goal is using the Copy Rotation constraint to align the cube with the camera, this doesn't work, for example: a camera with rotation (120°, -50°, -80°) is pointing straight forward to the cuboid because of a Track To constraint with that Target, and the constraint says the -Z direction should be directed to it and the camera's Y should be pointing upward: track to constraint. The rotation gets overwritten by the constraint. But the cuboid with Copy Rotation constraint gets rotated and is not aligned with the camera.

For the "square empty": why does it have to be an empty? Just so that it does not get rendered? You can also take a Curve > Rectangle with Fill Mode set to None, or use a Mesh > Plane, go into Edit Mode and with everything selected press X > Delete > Only Faces so that just the edges remain...

@Gordon, the Copy Rotation constraint does align the cube with the camera and the Track To constraint isn't overriding its rotation.
If you download the "fixed" version you can see that the effect that I'm going for is working.

The problems I currently have are: That I can't append that camera to an already created scene without it breaking, and I can't rotate the camera like in portrait mode (putting the camera in a vertical position while still tracking).

@David.Rodrigues "if you download the fixed version you can see that the effect [...] is working" - that might be true, but when I wrote the comment I was talking about the not fixed version and you asked me to explain it. My new comment to that was just that explanation, not meant to take the fixed version into account or resolving the current issue...


text:
Problem with keyframes and IK
can somebody help me please? I just started animating in Blender and I've been walled hard by something I can't seem to be able to fix. I've looked and looked around forums and youtube to no avail, I still cannot fix it.
I created a rig, joined it to a mesh and set 4 IK bones (for hands and feet). Everything works perfectly so far. Until I try to animate it... I tried animating without IK first and it works perfectly, everytime I select all the bones and create a keyframe, it works. But when I use IK, the IK bones ALWAYS stay in the same place. They change the starting keyframe and everything, only the rotation of the bones will be recorded.
I'm attaching a screencap to demonstrate it.

See, the first keyframe had the model in a standing position with his arms down, then I jump a few frames, change his pose, press A to select all bones, I to create a new keyframe and suddenly the first keyframe pose also has the goddamn arm lifted in this position!!! As I said only the rotation changes, everytime I move the IK bone it affects every other frame and the model stays like that.
I've tried absolutely everything, still can't fix it and it's driving me crazy. When I disable the IK, it works, so I'm certain the root of the problem lies there.
GIF:
https://i.imgur.com/4T8kd9W.mp4
As you can see in the first frame his arm is down, when I create a second frame in a different pose and I go back to the first frame, his arm has changed...
If anyone can help me I would appreciate it a lot because I'm getting desperate :(
Thank you very much.

How are you setting the keyframe? (In order to key translation, you have to be in the 3d view, press i and choose Loc or LocRot.

That's what I do, I select the bones and press I twice. I've tried Loc, LocRot and every other option. The underlying problem is that everytime I move the IK bone, the model changes in every frame and sets that new position as the default/initial, even if I don't record the keyframe.

Upload your file to blend-exchange, this will make it easier to identify the problem.

Hey man thanks for your help. Blend exchange gets stuck while uploading... I uploaded it to WeTransfer instead. Here it is: https://we.tl/fbj1NRKEr2

you have two bones overlapping: your hand and the IK controller, so maybe you select the hand instead of the IK controller. Anyway your rigging is weird for different other reasons  ;)

I know man, it's my first one, it's probably horrible. The IK controller is a duplicate of the hand bone, it's overlapping because I set a Copy Rotation to it just as I saw in the Blender tutorial so it shares its position. Moving the bone itself does nothing, only moving the IK controller.

I tried to move the controller of your rig (called MANOIK) and it works... so, question: did you insert a keyframe for the controller on frame 0?

Yes, I always selected all the bones. Anyways I already found the solution. Thanks!

Turns out that you have to select the "Visual" options in the "Insert Keyframe Menu". As in, "Virtual Location", "Visual Rotation" or "Visual LocRotScale". I was just selecting all the bones and pressing "i" twice out of bad habit.


text:
How to set texture as active texture for projection painting on an object with multiple materials, and multiple textures that make up each material?
I am using Blender 2.83 and
I am working with a model that I unfortunately cannot share so please bear with me. The model is a character model and I am trying to make updates to the diffuse base color texture on the face.
The face has 3 materials on it. The first is a shader with a large node-graph with all of the usual image textures like a diffuse map, roughness, SSS, and normal maps all weaved together into different math, color, and mix shaders. the second two are smaller shaders for hair (taking up the proceeding two slots).
My issue is this,
If I open up the image editor window and open the diffuse texture, if I make changes to the 2d image, those changes appear in the viewport as expected. If I have the model selected in the 3d viewport, toggle to texture paint mode,  and start painting there ( say drawing white lines directly on the model in the 3d viewport) the model does change, but the image texture in the image editor does not change to reflect my brush strokes.
In the past, with other character models I have worked with, this was not the case, and changes made in the 3d viewport would be reflected back onto my 2d texture open in the image editor. I am curious what the issue could be, and how Blender knows which image I want to paint on when painting in the 3d viewport?
Any suggestions or insights?
Thank you

Make sure you have the correct image texture selected in your Texture Slots panel before painting - this will inadvertently mess you up if one is selected but then your intent was to paint on a second.

This solved it for me, thank you!


text:
My renders keep coming out all black despite having lights
I am trying to render a scene using cycles inside of a cave model. I have the camera and the lights set up (I believe it is done correctly?). I have also tried rendering with global illumination, and still, I just get a black square.
To be clear, I want to render the inside, and there are already two point lights inside, near the camera that I believe are configured correctly.

Try increasing your lamp strength a lot (click use nodes).

You beat me to it!!! xD

That makes a lot of sense, I have never used the use nodes for my lamps. I also did not know lamp strength could go to those high of numbers!

You're problem is your camera is positioned inside one of your walls! Move it out a little bit, and you should get the render you want.
I'm assuming the maze is the outer part, like a labyrinth cave thing, but if it's supposed to be on the inside, then what you need to do is add lamps inside, too. If the light can't reach the camera, nothing will show up.
EDIT (new information):
I've messed around with your file, and the issue seems to be something to do with your lamps. I can't figure out what's wrong with them, but the scene rendered properly when I simply added a new point lamp, at default values. Try replacing your lamps.

Sorry, that is something I should have stated in my question, I want to render the inside, and there are already two point lights inside , near the camera, as well.

I'll have another look, then, I missed the other point lights.


text:
Blender 3.3.0 Hair - How to use emitter's UV mapped texture for coloring hair splines?
In the regular Particle Hair system, before Blender 3.3.0, it was possible to use a texture UV mapped on emitter's surface to define a color of each hair strand depending on where it grows from. I mean the whole hair spline was using a color of the point on the emitter's surface where its root was situated at. So it was possible to paint a texture on emitter's surface and than to use it for coloring hair which was very useful for texturing fur. However I can not figure out how to recreate this option with the new Geometry Nodes hair system in Blender 3.3.0.
If I use Emitter's material directly on the Hair object it maps texture according to each hair spline's UV map instead of using Emitter's UV map:

Voronoi Texture with a bit of color correction here is used just as an example, it can be any other texture.
As far as I know it is impossible to exchange attributes such as UV Maps directly between Materials in the Shader Editor (I understand it would not make much sense but anyway). As well as it is impossible to store named attribute which could be transferred to another material right in the Shader Editor.
We can use emitter object's UV Map as Group Input in Geometry Nodes and then as Texture Coordinate for textures right inside Geometry Node Editor but the texture's color could be stored as Named Attribute only for Points, Edges, Faces etc., which means loosing any texture precision, at least without enormously increasing amount of geometry so it would start to be close to the image resolution.
Probably the key could be in creating custom UV map for hair via transferring UV map from the Emitter, and transforming it somehow, so the hair spline could took the exact color of the pixel on the emitter's surface it grows from, but I can not figure out how to do it.
So my question is - how to properly transfer a UV mapped texture from the Emitter's surface onto hair splines in the new Blender 3.3.0 hair system?

There is no way to transfer texture from shader to geometry and another shader, but there is a way to add same texture to geometry and achieve the result

Blend file here

Also, perhaps, there is more complex method with sampling texture from original UV, but it is still require to add texture to GN.

This helps! Thanks to your answer I've also found out that it is possible to directly store Emitter's UV Map as an Output Attribute for both Emitter and Hair Geometry Node. So then we can use it as an Attribute in the Shader Editor which gives a possibility to use the same material with the same UV Map for both objects. And this completely solves my problem. Thanks a lot!

authors: Вячеслав Кобозев


text:
How to move points of one mesh to point positions of another mesh in Geometry Nodes?
If two meshes have the same topology (the same number and order of points, edges and faces) but their points are deformed in completely different ways - how to put points of the first mesh onto positions of points of the second mesh in Geometry Nodes? Can it somehow be done using points indices? I am still not very familiar with Geometry Nodes. In Python it is really trivial task (pseudo-code):
for v1, v2 in mesh1.vertices, mesh2.vertices:
   v1.position = v2.position

But in the Geometry Nodes I've found only "Field at Index" node, but nothing like "Set Value at Index". Is there a way to do it?

Use the Sample Index node. Here is an example: https://blender.stackexchange.com/a/289403/107598. Just drop the Mix node and use the target positions.

You could also use the search. There are many examples showing how to transfer attributes from one geometry to another. In versions below 3.4 this has been done with Transfer Attribute and since 3.4 with Sample Index. With Set Position you can finally move the points.

you can use this node tree:

The transform + join just doubles and moves the geometry:

the noise texture with set position randomizes one suzanne a bit:

the nodes in the gray box do the setting of the points to the points of the other geometry via sample index. So these are essentially the nodes you are looking for. I just moved them on the x-axis (again) via transform geometry because else both suzannes would be on the same position and you couldn't see both:

of course you won't need the mix node in your case. I just inserted it for the purpose of animated visualization.


text:
How to transfer deformation from guides to hair in Blender 3.3 Geometry Nodes?
I have several deformed guide hair strands. Their Point Positions before and after the deformation are stored to the Named Attributes Original and Deformed. How can I transfer the deformation data from the nearest splines to another hair system? The ideal solution would include a smooth interpolation of the target hair between guide splines.
I have to use Blender 3.3 Geometry Nodes.

Wouldn't it be easier to use the hair guides and add interpolated children with a modifier? Blender 3.5 would be better suited for this purpose.

Thanks. It would, but for external reasons I have to find a way to make it in Blender 3.3 and use existing guides and hair. In the project I'm working with the hair strands shapes don't match guides shapes, and I need to transfer only deformation vectors, not shapes.

I see. What defines the area of influence that each guide has on the surrounding children? What do you mean by "deformation vectors"? Is it the difference between the original and deformed position for each control point?

Yes, by deformation vectors I mean the difference between the original and deformed position of the guides. The answer of @AndréZmuda shows very well how the system looks without interpolation between guides. The area of influence of each guide is not quite obvious. I see how to limit it by distance from each guide, leaving strands in between unaffected. But I think bilinear or trilinear influence interpolation between several nearest guides would do much better if it is possible. In Python it could be done fairly easily, but I can not figure out how to implement it in Geometry Nodes.

Interpolating Solution
This solution realizes the interpolation and is based on blender 3.3.8. It has still some drawbacks: All splines need to have exactly 8 control points, that are ordered in the same sequence in every spline. It is possible to adopt this solution to a different count of control points, but you would have to modify the node net.

The basic idea is, to use the nearest face interpolation of the Transfer Attribute node for the interpolation of the deformation. This interpolates an attribute on a face based on its value of the corresponding vertices. Thus, we need a mesh with one vertex at the position of each Guide.
As we have 8 control points per Guide and per spline, we need to interpolate 8 sets of displacement vectors – 1 displacement vector for each Guide. We could use 8 different attributes for it. I decided to use 8 different meshes, instead.
How does it work
The following image shows the main node setup. This processes each set of displacement vectors separately. This mesh uses two group nodes, that are explained below. The one on the left side creates an interpolation mesh, as mentioned above. The one on the right side modifies the position of the control points of the target geometry.

Interpolation Mesh
The following image shows the node setup of the New Interpolation Mesh group node. It takes two parameters as input:

Control Point Level -> This defines, which point of each spline should be modified.
Guide Splines -> The guiding splines.

The mesh will be generated in the lower frame. This creates a grid and places all its vertices on the nearest guide position. Finally, the mesh is reduced to the count of splines and the corresponding spline ID is transferred to each vertex of the mesh. There may be setups, where the grid needs a higher resolution. For this example, it was enough, to create a grid of Spline Count x Spline Count vertices.
The upper frame exposes the displacement vector of the control point, selected by the Control Point Level input for every vertex of the mesh.
The image below shows the Modify Control Point group node. It takes the splines, that should be modified, an Interpolation Mesh and a Displacement vector.

This group node iterates over the control points of all target splines, selected by the Control Point Level. Then it uses the Nearest Face Interpolation, to get the desired displacement vector and move the current control point.

Nearest Spline Solution
This solution does not interpolate; it only transfers the deformation data from the nearest spline. Furthermore, this solution expects all splines to have the same number of control points. Currently this is hard coded. But different from the Interpolating Soltion one may parameterize the number of control points and read it from a spline or add a group input for it.
Additionally, this solution is made in 3.5, so there is mapping to the old nodes left to be done. Mainly the new nodes need to be replaced by Transfer Attribute nodes. Currently I don’t have 3.3 installed.

How does it work
We start with saving the ID of the closest guide spline to every target spline.

Sadly Sample Nearest does not support Splines. Thus, we need to convert the splines to a mesh and capture the spline IDs before.
Now we can modify the positions of the control points of the target:

This is close, to what you did. Only, we need to calculate the index:

As already mentioned in the beginning, we expect every spline to have the same number of points. This allows us, to calculate the index of the corresponding control point of the closest guide. By multiplying the ID of a guide with the number of points in a spline, we get the ID of the first control point of this guide. Adding this to the local spline ID of the current control point, gives us the corresponding control point of the guide.


text:
Estimate the common center of mass of a group of objects with different densities
This question has received a continuous interest, has shown here. I am having trouble using the nice Python script @kuroi neko kindly updated. When running (with two or more objects with weights selected) under Blender v.3.5.1, I get the following error:
> Traceback (most recent call last):

>File "C:\Users...\twoCubes.blend\Text.001", line 90, in <module>

> File "C:\Users...\twoCubes.blend\Text.001", line 84, in cg

> File "C:\Users\twoCubes.blend\Text.001", line 79, in cg_switch

>  File "C:\Users\twoCubes.blend\Text.001", line 15, in cg_mesh

> TypeError: Object.to_mesh(): takes at most 2 arguments, got 3

Thanks in advance for any help!

Duplicate the objects, join them, apply the "origin to center of mass" operator, read the object's location, delete the temporary object.

Sorry, the initial version of my question was missing an important part: my objects have different densities (this should be already implemented in the script of @kuroi neko, but it's just that I can't make it run)


text:
Hand rig not rotating with IK bone
Rotating the hand IK only rotates the base hand bone, not any of the parented finger bones. Below is my best attempt at showing what I mean.
It may be worth noting that I parented the IK bone to the hand, rather than the conventional wrist, since I have unconventional movement in that bone.
Blend file here, I think.

without seeing your settings we can just guess around so i would recommend providing your blend file. thx.

@Chris Done, thanks.

File link shows "access denied".

Ffs. It should work now.

It doesn't rotate any of the fingers because none of the fingers are parented to the hand bone.  They're parented to the wrist bone instead, but the wrist isn't copying rotation, the hand is.  If you want the fingers to follow the rotation of the hand bone, parent their chains to the hand bone.

You’re kidding. That’s the oldest mistake in the book. Nonetheless, thanks.


text:
IK rig bending incorrectly
Specifically, the knees seem to be bending... Inwards? This is a basic, custom IK rig, based on this tutorial from Ryan King Art. You can see the issue below. Blend file is there too.

If you move the IK pole forwards further than the knee, does the knee still bend to the side?

hello please share the file: https://blend-exchange.com/

@AlexandreMarcati Afraid so. And adjusting the pole angle just makes the feet point the wrong way, or - in the best case scenario - make the leg bend in the correct direction, but wrong angle.

@moonboots Done.

You need to bend the knees a bit in Edit mode so that it knows how to bend it in Pose mode:

Also straighten the legs:

Damn it, I should've known. As an aside, is there seriously no way to directly edit joints in blender?

What do you mean by edit joints?

Like just locking the joint along an axis. I don't know how much good it would do me after export, but still.


text:
How to rig a spine?
Friends, I have been pulling my hair out for two days over this, even though it seems so simple. I just want a string of nondeforming objects, that follow a curve, and bend along with the armature. If you observe the below screencap, you can see the spine - an applied array of meshes - and the curve. I want the spine to attatch to the head, midsection, and pelvis. Most importantly, I want that to remain consistent when exporting to Cascadeur and/or Unreal. Any help is greatly appreciated, as ever.

If you carefully align the mesh spine, then you can Parent>> Automatic_Weights with your Armature.   It is with a common armature that all meshes will appropriately deform (bend) together.  If you want, edit your question to a blend file that includes some of your meshes along with the Armature and "spine" object using blend-exchange

@james_t Thats a good solution, but not quite what I'm looking for. See, that method distorts the mesh, which I'd rather avoid. If I gotta remodel it, oh well. Oh, also I did as you suggested. The file's got ten iterations out there anyway.

Not my area, so just a suggestion, not an answer.. deform an array of planes with your armature, on whose faces the non-deforming vertebrae are instanced?

@RobinBetts Thats a good suggestion. Unfortunately - and correct me if I'm wrong - instances and modifiers need to be made real and/or applied in order to export.

You have sixteen vertebrae, so we need 16 bones, parented in a chain.  Here, I made them by subdividing a single new bone:

You don't want them deforming, so we will weight them by parenting to the armature with empty groups, then manually assigning all of the vertices of individual vertebrae to vertex groups:

Now we want them to move in a curve, so let's make a bezier curve.  You want this attached to the pelvis, so we'll set its origin at the location of the pelvis bone and bone parent it to the pelvis bone, then adjust its shape to match our desired spinal shape.  (Note: because of this parenting, it is the pelvis that will control the "tilt" of the entire chain of bones.)  You want it additionally attached to two other bones, so we'll want a total of three controls, and we'll create hooks for the last two controls:

We'll bone parent those empties to appropriate bones.
Now we can make a spline IK constraint for our vertebrae.  We will put this on the last bone in the chain (vertebra.001 in my pic).  We have 16 bones, so we want a chain length of 16.  We don't want the bones to scale, so we will set Y scale mode to None.  We see that the vertebrae snap into place:

However, we also see that the vertebrae don't reach the end of the curve we've defined.  We can either say, no scaling, in which case we'll have to be careful not to position our armature in such a way that the length of the spine changes, not unless that's what we want to do, or we can allow scaling even though that's fudging it.  If we want to allow scaling, all we have to do is reset Y scale mode on the spline IK constraint back to "fit curve".
We could do further adjustment, to eye, on positioning the spine by moving/rotating/scaling our bezier curve or the hooks that control its upper portions.  That's fine, it's not going to break anything; the bones and the mesh will adjust with your changes.
Now, we want to use this in any arbitrary game engine.  These do not support curves or constraints of any kind-- no export format of which I am aware does.  So after we make animations, we may need to bake those animations to visual keyframes, which writes the constrained transforms to the actual transforms.  In order to do this, we would use a "bake action" operation, with settings like the following:

However, I believe that some exports will bake animations as part of the export process, using default export settings.  In case they do not, it is good to understand how bone constraints can be written into the animation data of formats like .fbx via baking.
Note that there are additional layers of complexity we can add on top of this, to deal with issues like bone roll throughout the chain or maintaining a consistent length (I'm fond of double IK, a spline IK first pass feeding into a regular IK with rotation enabled, copying rotation to "seed" the IK.)  But it's not worth getting into the more complicated stuff until you understand the less complicated stuff.  I almost wrote "the simple stuff" but of course none of this is simple :)

Just to be precise, it isn't that bone constraints can be written into formats like .fbx via baking, it is that you can bake the visual effect of constraints into keyframes, which can then be exported. You do not keep the constraints when exporting.

@Nathan Wow. This is the best possible answer I could have received. I'll put this to use, mark you.

@L0Lock So I've noted. but that then begs another question: how do you keep everything in line if you want to animate in Cascadeur or somesuch? Or - god forbid - make a ragdoll.

I would ask, however, would it not be more expedient to just seperate them all by loose parts, then parent them?

@CfrantzX You could potentially bone parent them instead of armature deforming them.  But that might have (negative) implications for performance in game engines.  My understanding is that each object with a different transform is a different draw call.  You might want to verify that with people that know UE or whatever, because I don't.  Still, you can see that I essentially separated by loose parts to organize my vertex group assignments.

@CfrantzX Aside from raw deformation rig, anything more complex is basically non-exportable, as there are no standards and each software has its own way of making mechanical parts of rig. You usually rig in the software you want to animate.

Thats a pisser, isn't it... Despite you guys' great help, I may have to rethink this entire design.


text:
What happened to my straight lines in 2.8?
I modeled these letters in 2.7 no problem. I just brought them into 2.80 and the straight lines have this "back forth" look along the geometry.
The normals are all outside, I tried to re-do the sharpening (to 100%) and I can't figure out what else could be wrong.

I'm guessing it could be something about the new subsurf options, but increasing the quality doesn't seem to help.

Ok, putting the subsurf first mostly fixes the problems. Not sure why though.

See if this isn't related: https://blender.stackexchange.com/questions/128254/2-80-subdivision-surface-issues. Might be a bug.

The bug got fixed today, starting from tomorrow (24.01.2019) you should not see those artifacts any longer.


text:
Randomize input of geometry nodes group
I have geometry node's group which creates building based on specified parameters. And I'm trying now to make grid of random buildings. I tried to do it like that:

But connection between random value and my group is red. What the correct way to do something like this? And maybe you can point me to some documentation because I think I didn't grasp some concept pretty well which causes this issue.
Inside of building group:

I'm not sure what's inside that group, but a guess, taking under consideration the basic GEo Node system is to connect a vector math node after the Random value, so it will be something like RANDOM VALUE >VECTOR MATH NODE > BUILDING

The output from this node is a field (diamond socket and dashed connector) and it needs to be connected to a field input (diamond socket). Could you show the inside of your node group too ?

@Gorgious Added image of what inside "building" group

@Emir adding math node doesn't fix it

Did you try change random to integer?

@Chris Yes, same result

Looks like the whole Group is one object, so, you can't radomize the size using the group sockets, but can randomize the Instances using the Instance on Point SCALE, but i'm also not sure if that's what you need or want

@Emir yeah, it's not gonna help. Because size of building influences amount of windows etc. And it's not just scale

Unfortunately it seems (?) we lost the ability to generate one random value per node tree instance, now all random values are evaluated as fields. Thankfully there is a hacky workaround :
We capture the attribute generated using a random value field on geometry with only one vertex to prevent the overhead of computing the fields on denser geometry, and then we get the mean (or max, or min... doesn't matter since there is only one value to compute) value and use it afterwards.

It can be reduced to a handy node group to be reused later :

Result :

Is it possible with this approach now instantiate this resulted cube on grid for example with each instance having it's own seed? To get grid of randomly sized cubes

Well then you don't even need to hack the random value, this is what the fields are for. https://i.sstatic.net/uNsZA.png

Yes I understand how to make different scales on grid as you shown. But in my case it's not just scale but parameters which control amount of house's floors, windows positions etc. And I cannot find way to make it with fields. And with random hack value I'm still getting same house on each point

I think, the root cause of your problem is, that the Instance input of the Instances on Points node is not a field.

I think you have to take a different approach to solve this type of problem.
Instead of generating a shape with random features, then trying to duplicate it.  You must generate ALL of your shapes first, then apply the random features to them all.
E.g.
This example makes a 'floor' shape and applies to cubes randomly to the outside of it, then instances that along the points on a line.

Trying to instance this mesh will give you the same mesh on every floor:

This example takes a curve, instances some 'floors' along it, then realizes those instances and applies the transformation to the instances, giving you a different pattern on each floor.

I think this class of problem can normally be modified in this way,  it just takes a different mindset.


text:
How to add a ghostly "Glow" effect?
I want to add an "aura" effect to objects. I tried adding blur nodes in the compositor but it didn't look right. I also thought about using layer weights and with fresnel to make the edges glow. Then after watching Coco for the bazillionth time — the scene where Miguel sees his dead family — I liked the way the light surrounds each person.

Looks like characters are rendered separately in a different layer or ID and a mask is extracted from their outline that is then used to add some sort of glow in post production

I like where  Duarte Farrajota Ramos is going... Definately some Post... but a glow layer and some emission materials in Cycles will come very close. I'm guessing the darks of the hair and eyes are composited over.

Create a Glow Layer
You separate your render into two, the normal render and a glow render, both layers with a transparent background, in the glow layer set all the objects to have the same material (use an emission shader with the color of the glow you want):

Then, you can use this Node Setup in the Compositor:

You have to take into account that, in this example, the lighting is lame, that's why the effect doesn't look realistic, but using the same lighting that your scene will give you great results