text:
"Walking" the parent/children hierarchy tree
I have trouble understanding the usage of the hierarchy tree in BPY.
As I understand, Blender doesn't offer such a tree in the API so how can I deal with parent/children relations?
Consider the following example:

The node "Ground" is the first node above the actual meshes but it's name is not known.

How do I find out which is the first node directly above the mesh nodes? (The first parent)
How do I know how many nodes are above the Ground node? (It's name is not known.)
How can I get rid of all nodes above the Ground node?

In other software, walking the tree is simple but without a relationship tree I'm lost.
bpy.ops.object.parent_clear on the meshes would remove Ground also and this is not what I want.
Are there any best practice methods in BPY to work with hierarchies?

This probably won't get any flashiness points on CodeNinja.com but it does the trick.

import bpy
from bpy import data as D
from bpy import context as C
from pathlib import Path

object = C.object

# get the object above
# if object is root then p is None
p = object.parent

# only children parented directly to this object
direct_children = object.children

# all children below this object in the hierarchy
all_children = object.children_recursive

def get_parent_info(obj):
    num_child = len(obj.children)
    next_obj = obj.children[0]
    return num_child, next_obj

# How do I find out which is the first node directly above the mesh nodes? (The first parent)
def get_ground_object(root_obj):
    num_child, next_obj = get_parent_info(root_obj)
    while num_child == 1 and next_obj.type == "EMPTY":
        num_child, next_obj = get_parent_info(next_obj)
    return next_obj.parent

# How do I know how many nodes are above the Ground node? (It's name is not known.)
def get_parents_above(obj):
    parents = []
    par = obj.parent
    while par.parent is not None:
        parents.append(par)
        par = par.parent
    parents.append(par)
    return parents

# How can I get rid of all nodes above the Ground node?
def clear_parent_keep_transform(obj):
    parents = get_parents_above(obj)
    # this assumes you want to keep the object where it is in WS
    obj_loc = obj.matrix_world.translation.copy()
    obj.parent = None
    obj.matrix_world.translation = obj_loc

    for p in parents:
        D.objects.remove(p, do_unlink=True)

if __name__ == "__main__":
    # I'm assuming you at least know the root object
    root_obj = D.objects['Level1']
    go = get_ground_object(root_obj) # -> <bpy_struct, Object("Ground") at 0x000002674F266B08>
    parents = get_parents_above(go) # -> [bpy.data.objects['Level2'], bpy.data.objects['Level1']]
    np = len(parents) # -> 2
    clear_parent_keep_transform(go)

```

Wow! That's a great tool box! Thanks a lot! A bit more complex as walking a tree but you helped me a lot understanding this topic! And a big thanks also for your comments referring to my example!


text:
Can you make custom seams "between" faces?
The only way I know of how to make seams are along edges and vertices. But is there a way to create "custom" seams between faces without adding geometry to create ID color maps for texturing purposes? Hopefully the question makes sense.
For example, left is the default geometry, right is where I would like to add a seam for a utility belt.

I'm aware I could probably just add an edge loop there without much consequence, but there are other examples where that isn't an optimal solution so I'm exploring my options here.

To be a seam, it must be an edge.

source: Stack Exchange

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

sort: votes


text:
How do I save a pose in 2.8?
I'm trying to figure out how to use the pose library in 2.8 as I never learned how to use it in the last version. For some reason the "+New" icon is grayed out and I can't select it. Any help?

is it still grayed when you switch to Pose mode?

Choose the tab at the top of the screen that says "Animation". This will put a narrow "Timeline" panel at the bottom. Change the Timeline panel to "Dope Sheet"
The "Dope Sheet" panel has another drop-down menu near the panel-changing menu you just accessed. From this drop-down menu, change it from "Dope Sheet" (or whatever it may be) to "Action Editor".
This next step assumes your model is rigged to its intended armature. Select that armature and press CTRL + TAB. This will put you in "Pose" mode and the armature will turn a light blue color. In the top-middle of the Action Editor panel, there is a button that says "+    New". Click that to create a new action. You can also rename it.
Now, This is important, click that little icon near that button that looks like a gray shield. The program does not indicate this (and they should have, sine at least 2.79) but this is the button that saves your animations. I am telling you to press it now because if you don't, you will start posing your character, save your scene, exit the program, and be startled to find it's gone when you return. You don't have to save the animation immediately, but you have to before you change Actions or close the program, so be in the habit of doing it immediately.

Excellent response, thank you. I'd just like to reiterate the part about selecting the  entire armature because I missed it and it only saved the pose for my selected bone.

when you have a single bone selected in pose mode and you have the cursor in the "Modeling" viewport, and press the "i" key, keyframes are only added for the selected bone. However, if the cursor is in the "Timeline" panel or "Action Editor" panel, you will get a prompt to set keys for only the selected bone or the entire armature. You will get smoother animation if you only set keys for the specific bones you pose (the bones' parenting takes care of the rest automatically). Otherwise animation will be stiff when you set new keys.  Setting keys has nothing to do with saving an Action.

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


text:
How to compare small changes made in the graph editor?
If I make a small change in the graph editor, is there a way I can compare the change made from before and after I edit a channel in the 3D viewport? Like a before and after view or something.

I'd just make a copy of the object/armature and parent it to an empty and move the empty aside:


text:
Spine003 keeps stretching book in undesirable way
I'm trying to fix this rig so that it all bends together, but for some reason the vertices selected below keep stretching in undesirable ways. I've tried a couple different things to no avail. Can anyone help?

If you grab the spine.003 and rotate it in any direction, you will see what I mean.
https://drive.google.com/file/d/1neePPk9PlKjhpp8AIbUOF94m1KHws7hX/view?usp=sharing

If you look at it in edit mode and show the item properties, you'll see that the vertices are linked to several groups and two of them corresponds to two bones.

Depending on what you want to do, you may remove the unwanted bones influences from all the vertices of the book.
If the book is not supposed to be bent maybe you should keep only one bone influence for it (all its vertices).

Thanks for that. But I've changed every vertice on the object to the same thing, spine.002@ 0.4 and spine.003@ 1.00, and it still bends in an uneven way.

@LuckyCOINNNN, you have to keep only one bone influence if you don't want the book to bend.


text:
Is it okay to move green bones from the armature layer?
When you pose your base armature and generate the rig, it populates the controls and the "green bones" that control them in hidden layers. Now, is it okay to move these green bones to move the controllers for the rig in more fitting areas for the mesh? It's a lot easier than undoing the rig, editing the base mesh, and generating the rig over and over again but I'm not sure if this will cause problems later on.
And side question, why are the bones in these layers green while others are the regular gray color?

Green means the bone has some sort of constraint on it, so other bones can interact with it. This is useful because it means the animator does not need to animate every single bone and instead just animate a few main bones.
You can always move the green bones, just make sure you are in Edit Mode. You might not be able to transform them in pose mode because it might conflict with the constraints.


text:
Why are the materials of my objects not rendering?
I'm having some trouble while trying to render a scene; what happens is, when I render it in Cycles, everything in the picture is orange instead of its material. When I render it in Blender Render nothing shows up at all except for the sky background.
Orange room in Cycles:

When rendered in Internal Render:

Living room.blend

It looks to me like your lighting is giving the orange color to your cycles render.

@cegaton I'm making a scene of a living room, there are various materials throughout and I added them through the Cycles Render materials area. the lighting is through a sun lamp and it is placed right outside the window. Because i am so new to blender i used mainly simple shapes to create the furniture and the room.

@David I thought that at first too, but no matter what type of lighting I use it doesn't change the type of coloring you see in the picture

It seems you have an official answer below.  Please mark the answer as accepted if you agree.

You will laugh when you see how simple this is.
You have the material for your table leg set as the render layer material override. What that does is override all your materials with that one (and because only the books have a UV map you don't see that texture expect on the books.)
Simply clear the Material Override, switch back to cycles and it will render normally. (All your materials are for cycles, so none of them will work in the internal render.)

EDIT:
Newer versions of blender don't use layers, but "collections" so the override function is in the scene>View Layer section.

Additional info:
Where is the Layers panel in Blender 2.8?
2.8 - Is it possible to assign (override) a material to a whole collection?

glad to help! PS you will need to UV unwrap the floor and table legs, or use generated coordinates

Though Davids answer is a bit more detailled, you should consider UV Georges' answer down below as well as he actually did give the right answer just two minutes earlier ;-)

It happened to me once, turned out to be that I accidentally assigned a material to the Render Layer, Go to the Render Layer and check it out, if there's an assigned material, remove it by clicking the X button next to it.

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


text:
Scale with snap to grid messed up after scaling
I've got a - probably - very basic question.
I put a basic cube on a scene, resized it in one dimension to 18 units (so it is a long bar now), then used "Apply Scale". Now when I try to use scaling with snap-to-grid feature, the snap works but snaps not to the grid lines but some arbitrary values inbetween.
Also, I've noticed that snap works only for some directions, I've got a hunch that it is only for the longest one - in my case it is Y. Can I make it snap in other directions too?
example of messed up snap

You applied scale after making object to be a bar but didn't after scaling it once more (notice scale value by Y axis - 0.8). Apply scale once more. See http://blender.stackexchange.com/questions/7298/why-is-it-important-to-apply-transformation-to-an-objects-data

Thanks. This is an example of already broken scaling, which is why scaling values are not 1,1,1. Unfortunately, in this case, even after re-applying scaling, it doesn't snap to grid.
I am pretty sure what it does has nothing to do with actual grid, the snap increment seems to be 10% of direction between rescaling... this also exaplains why it seems snap doesn't work for short dimensions - it works, but the increment is so small I didn't notice it. Ultimately - I still don't know how to scale with a real snap to grid :|

This is because you scaled that bar to its origin; it became a bit shorter and doesn't fit grid as for now. To snap it to grid use appropriate function, see http://blender.stackexchange.com/questions/7368/how-to-snap-part-of-a-mesh-to-the-grid

Hm, I know what you mean (snap->snap selection to grid), but that I can fix.
What I do have problem is how to apply snapping during scaling, so the scaled object fits to the grid. For example, I have my 18-long bar, and the grid is set to 1 unit. Now, after one "tick" of scaling it becomes 16.2 long, and this is why it doesn't fit the grid anymore. As I expected scaling increments are 10% of the original dimensions. And this is where I am stuck - how to have increment of 1 during scaling, regardless of original dimensions? And btw, thanks for help! Thats huge for a newbie! :)

You could substitue snapping to grid with snapping to a subdivided plane where cells would be roughly of the same size (make sure enabling snapping to vertex while scaling). If you want to model with precision take a look at this - http://blender.stackexchange.com/questions/274/how-to-model-effectively-using-exact-measurements

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


text:
How to check if Blender is installed on computer
I am writing a WinForms .NET program and I want to check whether Blender software has been installed in the local computer.
How to check if Blender is installed on a computer (32 bit & 64 bit)?
At the moment, I only can think of checking if Blender folder exists in the Program Files (for 32 bit) / Program Files x86 (for 64 bit).
However, I would prefer other methods of checking if Blender is installed instead of checking the Blender installation folder in Program Files.
Thank you

@R00t What do you mean "blender doesn't have an installer"?

@R00t There are both versions - Blender with installer and portable Blender.

You are talking about windows machine, I suppose.
The answer is here: Detecting installed programs via registry
The only thing specific to Blender is what to look for in registry:

HKEY_CURRENT_USER\Console\paths_to_blender_executables - you will find here entries for ALL Blenders (versions installed or only executed from .zip archives). There is no assurance that Blender is still on the system though, just that it was in some point in time
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.blend - here is the Blender reference to .blend file. Also can be misleading if Blender was not uninstalled properly.
HKEY_LOCAL_MACHINE\SOFTWARE\BlenderFoundation\ or HKEY_CURRENT_USER\Software\Blender Foundation\ - both are what you are looking for

I do not have HKEY_LOCAL_MACHINE\SOFTWARE\BlenderFoundation, instead I have:
HKEY_CURRENT_USER\Software\Blender Foundation\ or
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\blendfile\shell\open\command.
Would that be alright for me to perform the registry test using any of the registry above? Thank you.

@hunterex Yes, indeed you should check both the local_machine and current_user registry keys. I'll add it to the answer.

for Blender 2.81 on Windows 10:
"HKEY_CURRENT_USER\Software\Blender Foundation\Blender"
did not provide the installed location, I ended up retrieving it from:
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\blendfile\shell\open\command"
and then programmatically removing the %1 part.

The only way to be sure blender exists is to search the HD.
On windows, if a user downloads and runs the installer, then you can find registry entries. If a user downloads the zip version of blender then the copy of blender they extracted, which may be on the desktop or somewhere in their home folder, could be the only trace that blender exists. After extracting they may optionally set the registry entries to associate .blend files with the blender binary so that a registry entry exists.
You can also end up with multiple versions of blender installed, the newest version that the user wants to use may be the copy extracted on the desktop, not the one in program files.
I would suggest searching a few possible locations for blender such in program files and the desktop for the initial default path but ask the user to choose the blender location.

Blender in a folder downloaded from a .zip is not installed. When a program is installed it leaves a trace in registry and you don't have to search the whole hdd for it. Since the question is about finding installed Blender, I object that finding non-installed Blender does not answer the question:)

Many users don't distinguish the technical difference between using an installer and unzipping, if it is on the computer then it has been "installed" on the computer and is available. Also if the installer is used you have more than a 90% chance that it is in program files and easily found without checking the registry. Mostly I wanted to highlight the fact that checking locations and registry entries does not mean that blender doesn't exist, even if you do find it - it is best to ask the user which copy to use.

Searching the hdd for a file can be a long process - it may take dozens of minutes. So I woulnd't find it as an option. I would just say that blender is not installed if it is not in registry, which is actually correct statement.

Either use the Windows Installer COM interface or query WMI information from the Win32_Product class.
Windows Installer
        static void GetBlenderInstallationFromMsi()
    {
        Installer installer;

        installer = (Installer)Activator.CreateInstance(Type.GetTypeFromProgID("WindowsInstaller.Installer"));
        var products = installer.Products;
        foreach (string productID in products)
        {
            string productName = installer.get_ProductInfo(productID, "ProductName");

            if (String.Compare(productName, "Blender", StringComparison.OrdinalIgnoreCase) == 0)
            {
                string blenderPath = installer.get_ProductInfo(productID, "InstallLocation");

                Console.WriteLine(productID);
                Console.WriteLine(productName);
                Console.WriteLine(blenderPath);
            }

        }

    }

WMI
    public static void GetBlenderInstallationFromWmi()
    {
        // Create a query
        SelectQuery query =
           new SelectQuery("SELECT * FROM Win32_Product WHERE Name LIKE 'Blender'");

        // Initialize an object searcher with this query
        ManagementObjectSearcher searcher =
           new ManagementObjectSearcher(query);

        // Get the resulting collection and loop through it
        foreach (ManagementObject product in searcher.Get())
        {
            Console.WriteLine(product["Name"]);
            Console.WriteLine(product["Version"]);
            Console.WriteLine(product["InstallLocation"]);
        }
    }

I installed blender via Microsoft store, this makes it hard to find the file location. The file location in this case is for me was in C:\Program Files\WindowsApps\ folder.
And was a very long file name starting with BlenderFoundation.

An option might be to check how windows search feature works. Since you can type in Blender and it returns the possible matches. Could check to see if it's type application and return true if it's found.


text:
How to Generate surface from points

Hi Guys,
I have a set of points in 3D. How can I convert this into a surface ?

You can use meshlab to turn the pointcloud into a mesh. There is a filter called: Poisson Surface Reconstruction. The paper can be found here: http://hhoppe.com/poissonrecon.pdf

Does this answer your question? Mesh generation from PointCloud? or Wrapping a mesh around point cloud with cavities

A vertice-only cluster is to be wrapped in a 'skin'.  The cluster has no edges or faces, just a host of vertices on their own.

A plane was laid on top that was large enough to accomodate the vertice cluster in the X/Y axis' and raised to be comfortably above the highest peak in the cluster.
It was then subdivided with at least as many subdivision/vertices as the vertice cluster.  I subdivided all four edges with the value of 100.  If that's not enough subdivide all four edges by 2 (or more), then again by 100 to produce 200 x 200.
Both the subdivided plane and the vertice cluster have their respective 'scale'  "Applied" with CTL-A.
The Shrinkwrap Modifier was used on the plane to in essence, lay a 'skin' over the cluster, citing the cluster as the target and  choosing "Nearest Vertex" option.

The settings can be tweaked to suit and  once satisfied, the modifier can be 'Applied' to convert the generated skin into hard mesh.
This is then 'smoothed' in the tools panel which can still leave it a trifle 'blocky' so the "Smooth" modifier was also used, it's own settings tweaked to give the final result.  That modifier was also 'Applied', leaving the shape in it's finally meshed form.
Not sure if this is exactly what you're seeking, but it should be a start at least.

This solution has very limited application to only flat terrain like meshes.


text:
How to animate cutting of a curve?
I have an array of molecules along a curve which makes the DNA model.
How can I show the cutting of the DNA like what is shown below.
I want to show the DNA get cuts and moves apart like this.

I would do 2 arrays and where they meet there is obviously already a cut. Then just animate the curve seperating.
If you want the ends of the curve being connected you can give the ends vertices a hook and place the 2 hooks on the same spot. Then you can set one as a parent and if you now move the parent hook it will seem like they are connected.
Hopefully I could help you.


text:
How to generate spherical gradient volume
I have an object which represents an atom.
I want to show a spherical gradient where the cloud is intense in the centre. It fades away to the edge.
I tried emission but not getting the desired output.

Volumetric shader with Gradient texture type Spherical. But any volume  even without texture will looks like dense in center and light on edge since volume absorption.

Volumetric Emmision

add Emmision shader plugged into volume socket of material Output
add Transparent
add Mix shader - with Emmision up
add Gradient texture > Spherical as factor

Volumetric Absorption
Instead of Emmision use Volume Absorption node.
3D Illusion
In some cases it's quite efficient to fake it by simple circle object with Spherical Gradient texture assigned to alpha. Circle orientation Tracked to Camera, so moving object is always facing to camera that make in illusion of 3d object.
(In case you don't care about shadows.)


text:
How to highlight intersection of meshes?
I am making an animation of a molecule.
How can I highlight the intersection of spheres as shown in the below animation???
I tried volumes, but it is not showing the intersection prominent like this.
(Can we do it with Boolean)
Thank you so much in advance. :)

Sure you can use boolean. Just duplicate the model and copy the transforms of the original with a copy transforms consraint. Add a boolean modifier and choose an other material for it.

Yes, booleans can be used here. It should be noted that booleans can be rather glitchy in many cases. There are ways to mitigate them, but the methods I know of won't apply very well to the type of animation you're looking for.
Create a large cube that encompasses all of your objects. Then, apply two Intersect Boolean modifiers, one for each of the intersecting objects.
The first boolean will cutout the cube into something that resembles one of your objects (I say resembles simply due to the glitchy nature of booleans), and the second intersect will take the cube (that now is one of your objects), and cuts out whatever is not touching the second.
Here's a quick demo of that:

Thank you, Just to clarify, We  have 3 objects here, 2 spheres and 1 cube. what will be the exact order of modifiers to be added on the objects with which objects.

The order doesn't actually matter. This solution is essentially the same as FFeller's comment on your question, except instead of duplicating one of the intersecting objects and applying the the boolean modifier to that, I'm creating an all encompassing cube and using the first boolean modifier to transform the cube into one of your objects. Now since the cube is one of your objects, the intersection between that and the other object is the area you're looking for.

This might point the way to a Cycles Shader approach.

The 'Transparent' cluster sets up a transparent material with no refraction, but some gloss on the surface, which does not cast shadows.
The 'Inside' cluster returns 1 if the number of transparent surfaces a ray has passed through is odd. i.e. The shading point is 'inside' a transparent solid
... But we don't want to catch the backfacing faces of the transparent solid itself.

I can't immediately think of a simple way to set up the gradated 'alarm' colors.. but if this way isn't suitable for some other reason....

Genius! it worked!!!


text:
Particles converted but materials are linked
I converted a particle system with sphere objects.
I want to individually change the colors of objects.
It is linked, when changing the color of an instanced object it changes all others to that color.
Help?

You need to assign different materials to those you want to change.

The material 'assign' option is not coming in the object mode. It comes in edit mode

You can select them and make them single user: object mode, menu "object/relations".

Or click on the number right next to the material name, to make a copy of the materia, that you can then modify to suit your needs.

A quick workaround would be to utilize the Random output of a Object Info node in the shader graph, plugging it into a Hue/Saturation node input. In this way you could randomly vary the hue or the saturation or both. I personally utilize a Bright/Contrast node in between to get the hues I need.

But I think the real issues is to be found in where exactly this material information is stored. You can conveniently decide weather to store it in mesh data or in object data opting in this drop-down menu in the material property panel.

If materials are assigned in mesh data ("Data") every instance (meaning linked copy) of that object will have the those materials and if you change them they will change over all objects. Otherwise if materials are stored in the object data-block different linked object will be able to have different materials.
If you prefer proceeding this way you'll have to change this property before converting the particle system, in the original sphere.


text:
How to make irregular Honey Comb
I tried to make this pattern using metaball particles inside volume.
But couldn't acheive this pattern.
DO you know how can I generate a mesh with this porous structure ?

The tissue addon may be helpful for you.l

Exactly what I wanted. Thank you so much..

In a regular triangulation of a regular quad topology, vertices connect six edges, and its Dual is a hexagonal mesh..
So as @Leander has hinted in the commentary ..

Install the shipped 'Tissue' Add-on
CtrlT or use the modifier to triangulate the mesh
Use one of the Add-on's 'Dual' operations.

The regions of the mesh which were quad grids will become hexagonal grids.

You could do it this way:

Start with a 6 vertices circle to create this module.

Duplicate it with the Snap and Auto-Merge options activated.

Begin to twist and scale it in Edit mode withe the Proportional Editing option on.

Also sculpt it, the SculptDraw brush seems good, with an Autosmooth value of 1.


text:
Curve from a set of points
I want to make 3D visualisation of a neuron. How can I plot curves from a set of points ? The data is shown in the image.
I found an artist created a mesh with this data. Same posted below.

Data is from this website.
http://neuromorpho.org/neuron_info.jsp?neuron_name=211-6mt

Very close to this recent question https://blender.stackexchange.com/questions/153717/generate-geometry-using-geometry-shader/153727#153727 (about creating curves) From that should be just matter of reading the file and follow the links between data lines.

From the provided data file, you can obtain this kind of rendering, with (for example) either creating splines (curves) or creating a mesh with skin modifier.

The script allows to:

Load the data from the indicated site
Convert it to inner objects (NeuronPoint class below)
Optionally add some random intermediate points between the loaded coordinates

And

Either convert them to curve, creating a new curve for each data ramification
Or create a mesh from this point and add a skin modifier in order to obtain the neuron branches

Here is the commented code and blend file:
import bpy
import random
from mathutils import Vector

# Store the information from the SWC text file
class NeuronPoint:
    def __init__(self, id, type, x, y, z, radius, parent_id):
        self.id = id
        self.type = type
        self.x = x
        self.y = y
        self.z = z
        self.radius = radius
        self.parent_id = parent_id
        self.parent = None
        self.children = []

    @property
    def coordinates(self):
       return Vector( (self.x, self.y, self.z) )

# Read data from the file
def read_neuron_points( file_name ):
    file = open(file_name, "r")
    points = {}
    for line in [l for l in file if l and l[0] != '#']:
        string_data = line.split()
        if string_data:
            id = int(string_data[0]) - 1
            neuron_type = int(string_data[1])
            x = float(string_data[2])
            y = float(string_data[3])
            z = float(string_data[4])
            radius = float(string_data[5])
            parent_id = int(string_data[6]) - 1

            neuron_point = NeuronPoint(id, neuron_type, x, y, z, radius, parent_id)
            points[id] = neuron_point

    for point in points.values():
        point.parent = points.get( point.parent_id )
        if point.parent:
            point.parent.children.append( point )

    return [p for p in points.values()]

def random_vector( random_amount ):
    return Vector( (random.uniform(0,1), random.uniform(0,1), random.uniform(0,1)) ) * random_amount

# Cuts the data to have additional random points
def make_intermediate_points( points, point, min_distance, random_amount ):
    point_co = point.coordinates
    parent = point.parent
    parent_co = parent.coordinates
    vector = point_co - parent_co
    distance = vector.length
    # Do it only if distance is above the parameter
    if distance > min_distance:
        # Cut in half + random
        intermediate_co = parent_co + (vector * 0.5) + random_vector(random_amount)
        intermediate_radius = (parent.radius + point.radius) * 0.5
        # Insert the new point in the hierarchy
        new_point = NeuronPoint( len(points), point.type, *intermediate_co, intermediate_radius, parent.id )
        points.append( new_point )
        point.parent = new_point
        point.parent_id = new_point.id
        parent.children.remove( point )
        parent.children.append( new_point )
        new_point.parent = parent
        new_point.children.append( point )

        # Cut around this new point
        make_intermediate_points( points, point, min_distance, random_amount )
        make_intermediate_points( points, new_point, min_distance, random_amount )

# Cuts the data to have additional random points
def subdivide_points( points, min_distance, random_amount ):
    for point in [p for p in points if p.parent]:
        make_intermediate_points( points, point, min_distance, random_amount )
    return points

def mesh_from_neuron_points( context, name, points, scale_factor = 0.01, radius_factor = 1 ):

    # Gets vertices and edges from the points data
    verts = [p.coordinates * scale_factor for p in points]
    edges = [(p.id, p.parent_id) for p in points if p.parent]

    # Create a mesh
    mesh = bpy.data.meshes.new(name)
    mesh.from_pydata(verts, edges, [])

    # Create an object with this mesh
    obj = bpy.data.objects.new(name, mesh)

    # Add a subdivision surface (smooth the edges)
    subdivision = obj.modifiers.new( "subdivision", 'SUBSURF' )
    subdivision.render_levels = 1
    subdivision.levels = 1
    # Add a skin modifier in order to have thickness
    skin = obj.modifiers.new( "skin", 'SKIN' )
    skin.branch_smoothing = 0.5
    skin.use_smooth_shade = True
    # Smooth again with another subdivision
    subdivision = obj.modifiers.new( "subdivision", 'SUBSURF' )

    # Associates the radius to each skin vertex
    for s, p in zip( obj.data.skin_vertices[''].data, points ):
        radius = p.radius * radius_factor
        if not p.children:
            radius *= 0.1
        s.radius = (radius, radius)

    # Link the object to the scene
    context.scene.collection.objects.link(obj)
    return obj

# Cuts the point set into continuous spline parts, creating a new part for each ramification
def splines_points_from_points( points ):
    result = []
    base_points = [p for p in points if not p.children]

    while base_points:
        next_points = []
        for point in base_points:
            current = [point]
            result.append(current)
            while point.parent:
                point = point.parent
                current.append(point)
                if len(point.children) > 1:
                    next_points.append( point )
                    break
        base_points = next_points

    for spline in result:
        spline.reverse()

    return result

def curve_from_neuron_points( context, name, points, scale_factor = 0.01, radius_factor = 1 ):
    # Create a curve with some bevel depth
    curve = bpy.data.curves.new(name=name, type='CURVE')
    curve.dimensions = '3D'
    curve.bevel_depth = 1

    # Create an object with it
    obj = bpy.data.objects.new(name, curve)

    # Calculate splines parts
    splines_points = splines_points_from_points( points )

    for spline_points in splines_points:
        # Create a spline for each part
        bezier_curve = curve.splines.new('BEZIER')
        bezier_curve.bezier_points.add(len(spline_points)-1)
        # Set the points
        for bezier, point in zip(bezier_curve.bezier_points, spline_points):
            bezier.co = point.coordinates * scale_factor
            bezier.radius = point.radius * radius_factor
            if not point.children:
                bezier.radius *= 0.01

    # Link object to the scene
    context.scene.collection.objects.link(obj)
    # Toggle handle type (faster than doing it point by point)
    obj.select_set( True )
    context.view_layer.objects.active = obj
    bpy.ops.object.editmode_toggle()
    bpy.ops.curve.select_all(action='SELECT')
    bpy.ops.curve.handle_type_set(type='AUTOMATIC')
    bpy.ops.object.editmode_toggle()

    return obj

# Get the file name relative to this blend file
file_name = bpy.path.abspath("//test.txt")
# Read the file into points
points = read_neuron_points( file_name )

# Some parameters to handle result scale
scale_factor = 0.1
radius_factor = 0.1
# Subdivide the model with some random (optional)
points = subdivide_points( points, min_distance = 4, random_amount = 1 )
# Create the object as mesh with skin modifier
#obj = mesh_from_neuron_points( bpy.context, "test", points, scale_factor = scale_factor, radius_factor = radius_factor )
# Create the object as curve
obj = curve_from_neuron_points( bpy.context, "test", points, scale_factor = scale_factor, radius_factor = radius_factor )

# Set a material on it, if defined
mat = bpy.data.materials.get( "Material" )
if mat:
    obj.data.materials.append(mat)

Wow great work. Thanks alot lemon. Where in the code I should add the coordinates?

@RafeequeBinUsman, if you mean where the coordinates are read from the file, it is in the function called "read_neuron_points( file_name )"


text:
How to parent animated object to animated object

I want to show bond 2 rotating and the bond 1 also rotating.
So basically parenting 1 to 2 is what I want to do. But when I animate in a particular axis using local axis it is rotating in all axis. How can I solve this ?

so basically you want to animate the rotation in local space

I'm not sure I'm totally following you. What tool are you using to rotate? Are you using the axis shortcut keys? For instance, the cylinder you have selected in the image, you would press R to enter rotate mode and then press Y to restrict the rotation to the Y axis. Without restricting to a certain axis, the rotation will appear to be rotating like you are in global orientation.

Make sure your local axes are oriented orthogonally to the objects. You might have rotated the meshes in edit mode, meaning that the local axis of each object is not where you need it.

the origin of each segment must be on its rotation axis, then parent each segment to its parent, and use RXX to rotate (or RYY, RZZ). You can also parent each segment to an empty, it can be convenient.


text:
How do I disconnect two points of a bezier curve?
I am fairly new to Blender and I would love some help with this problem. I modeled a bezier curve a couple of days ago, and then wanted to change it.
I know how to connect two vertices of a bezier curve by pressing F to fill it, but how unfill two vertices, such as to disconnect them?
Here are some pictures to help out with my scenario. Picture 1 shows the two vertices I want to fill. Picture 2 shows both the vertices I wish to disconnect. Thanks!
P.s. What is this red line that showed on my curve? (picture 2)

You can select two or more consecutive vertex and press X to delete a segment between them. Red line seems to be just an additional separate segment of your cruve


text:
How do I use albedo, heightmap and normalmap on a material?
I've been going through a couple of tutorials on applying textures using the node editor, but I can't seem to get it right. I downloaded some 3d images, they include (albedo, heightmap and normalmap) but that's as far as I can go. I don't know how I should apply them. While following a tutorial it seems so easy but now that I'm trying it by myself, things get a bit tricky :p. I've already UV unwraped my mesh, now I just need some sort of guideline. Thanks in advance.

See here: https://blender.stackexchange.com/questions/55232/how-to-properly-hook-up-various-maps-types-together-in-cycles   and here: https://blender.stackexchange.com/questions/80695/how-to-apply-normal-gloss-occlusion-specularity-and-displacement-map-on-o
This question should probably be marked as a duplicate unless you can post a specific file/set of textures, then I can answer you on how to use that particular combination.

@Drudge you can flag it as a duplicate by clicking on flag

I've just gone through the links. There are so helpful. Thank you!! You are actually right. This question is actually a duplicate now that I've seen the two links above. I'll go ahead and flag it as a duplicate.


text:
Track light to Empty - with ability to rotate Light or Empty
I would like to point a Sun Light to the World Center.
Track To with -Z & Y up does the job nicely... but I would need to rotate the sun around Z and also around Y. (Azimuth/Elevation)
If I track the Light to the Empty, I'm no longer able to rotate the Sun.
I thought if I rotate the Empty, the sun might follow but that's not the case.
How can I aim the sun to the Empty but still be able to manipulate it's position by two rotation values? (I'm using the setup in an Add-on, therefore the rotation.)
Thanks for any Help.

You can parent Sun Light to the Empty so that the Empty will rotate it. To do that, select Sun Lamp than Empty with holding Shift, and then press Ctrl+P
Start like this:

And track to is not necessary for this setup
To change Elevation press R, X, X (rotate in local X):

Azimuth  R, Z (Global Z)
I'm not sure about that add-on you are using, but a built-in "Sun position" add-on already directs the sun in center:

Thanks for the Answer. I have not thought of parenting... but it makes sense. You still need to Track the Light to the Empty though because the sun light also need a direction from which it shines. Parenting only will retain the light ray direction regardless of the rotation by the Empty. Combining the two (parenting and also Tracking to the Empty) solves the problem perfectly. Fantastic. Thanks! (I write an Add-on myself where I need this setup.)


text:
Blender Sverchok - Finding the projection of a vertex on another mesh
I need some help in Sverchok.
I have a mesh plane (A) with a vertex (V) on it.
I would like to find the point on another mesh (B) where the "projection" of the vertex in the normal direction would hit that second mesh.
I was looking trough all the Sverchok nodes but I couldn't find an obvious solution.
Is there a way to do this?
Thanks for any suggestion.

Thanks bstnhnsl and also thanks to Erindale! Both of you pointed to Analyzers -> Raycaster and this works quite nicely. I just placed Susanne to the calculated point:


text:
Is there a way to disable the left-right arrows beside a numeric UI property?
I have a portion of my Add-On with limited space.
I would like to display an Integer number but if it's a 3 digit number, it get's cut away by the two arrows left and right.
Is there a way to disable these arrows?
Here 200 is shown as 20

Because of the +- arrows on the side

The real value is only shown when edited.

It is defined as a grid and it should stay like that. (The size of the 3 parts should be the same.)
Any way to get around this? Thanks.

It's not a perfect answer but I hope it will be helpful.
use slider = True
import bpy

class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_category = "TEST"

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

        layout.prop(context.scene, 'slider', slider=True)

def register():
    bpy.utils.register_class(HelloWorldPanel)
    bpy.types.Scene.slider = bpy.props.IntProperty()

def unregister():
    bpy.utils.unregister_class(HelloWorldPanel)
    del bpy.types.Scene.slider

if __name__ == "__main__":
    register()

Thank you for the suggestion. Unfortunately even with a slider, only two digits are displayed. (Also, the field is then colored according the slider value which looks odd.) I was using a grid scale of 2x2 as I wanted to have quite large buttons. After I reduced the scale to X=1 and Y=1.5, the three digits are displayed. But the buttons are of course smaller. It's a workaround but not really a solution.


text:
Switch Material based on object's position to another object but in relation to the camera view
I would like to switch the material of one object (A - blue square) to transparent if this objects is between another object (B - gray sphere) and the camera.
(It's a complex object so switching by "facing normals" are not working).
There are examples with the Texture Coordinate node but these examples are only show the relation of two objects.
I have two objects but the material must be also dependent on the camera view direction.
How can I achieve this?
Also, what is the meaning of the Camera option in the Texture Coordinate node?
The documentation states: "Position coordinate in camera space."
I thought it means, the position of the object the Texture Coordinate node refers to in camera space. This would be great, because I could compare them directly (A closer to the camera than B or the other way round, depending from which side I look) but I'm not able to get it to work.

I think, I completely misunderstood the camera option. As it's a camera projection, the select object field is not applied even if there is still a name in it. So texture coordinates will not help to solve this. Is there any other way of achieving this? Maybe with geometry nodes combined with material nodes? If comparing to another object is not possible, how about comparing to global 0 coordinate position? Any idea?

Finally I was able to find a solution. It is based on an example and a fantastic explanation of how Vector Transform works from Rich Sedman from this post:
How is the vector transform node used
Thank you Rich for your help!
I added conversions from Object to World space at the beginning which is essentially an apply transform within the material node. This way if the objects are moving, the effect moves with them.
I also added a check if the obscuring object is in front of the target or behind. This is needed as otherwise the effect would be also visible from the the other side. (Where the obscuring object is actually behind the target.)
Seems to work but maybe there is possibility for optimization.
Here is the node setup:


text:
How to remove sound completely from Blender
I have a Python script that generates a .wav (externally) and places it in the sequence editor. Then, I would like to be able to remove the .wav later. So first I remove the sequence from the editor and then I try to remove it on the filesystem. This works except once I play the sound inside Blender. Windows says that it's being used by another process and I can't remove it. I tried to unlink the sound by doing:
bpy.data.sounds.remove(bpy.data.sounds['wav_name.wav'], do_unlink=True)

But it has no effect. This line removes it from bpy.data.sounds but I can't get Blender to let it go.
I'm doing the same process with a .avi video and I don't have this problem.
Any advice?


text:
Issue with Blender export to Unreal
I seem to be having an issue importing an FBX from Blender to Unreal 4, as you can see from the images below. I'm not sure what is going on here. I've tried limiting bone influence, Normalizing weights, applying location, rotation, and scale. I am lost. Any help would be greatly appreciated. Thanks in advance.
I'll upload the .blend if someone can tell me how to do it.

Please use http://blend-exchange.giantcowfilms.com for .blend upload. As for your problem, did you check non-manifold faces with Ctrl-Alt-Shift-m?


text:
How to compose a rotation matrix with Euler Data?

The picture is my current set up. From the data set of Euler angles in the text editor, I would expect the object to rotate ~10, 20, 30,... degrees around the X axis, but it rotates noticeably larger than the input angles. Does anyone have any ideas as to what I am doing wrong? I am currently using AnimationNodes.

As mentioned by Duane It probably has something to do with your units.
The Combine Euler node supports composing eulers from degrees as well as radians, check the documentation:

It is worth mentioning that parsing can be easily done in Animation Nodes as:


text:
How to control object's path follow speed based on its position
I am trying to animate a rollercoaster. For now I have a cube following the Bezier path of the track. I need the cube to change its follow speed based on its height. (the higher it is, the slower it is).
How do I control follow speed based on the height of the object? Keyframing is not an option as the relationship is too complex.
I tried this with animation nodes, however height is affected by position on curve, which is affected by speed. Trying to control speed by height creates a paradoxical loop. Is there a way (in animation nodes or otherwise) to use the cube's current height, to determine its rate of change of position on the curve in the following frame?
Sidenote:
I have an expression for speed (from physics energy formulas):
speed = (200 - (2 x height))^0.5

One way to do it is to use a discretized implementation instead of a parameterized one. We store the parameter (location along spline) of the object in a custom property. At each execution, we increment that parameter by the velocity that we can compute from the relation you provided above.

The divide node is a unit conversion which you can replace with whatever you need. Note that Uniform has to be used when sampling the location for obvious reasons.
A useful addition is to add a condition where the parameter is set back to zero whenever the frame is equal to or less than one so that you can play the animation as much as you want.

A similar condition can be added to cube location.

Your answer seem good but I don't have the level to fully understand how to replicate your method. What is "parameter" in object attribute nodes ?


text:
Remesh modifier with keyed physics
So I'm trying to morph between three objects: Object A, Object B, Object C. Object is a UV sphere while B and C are meshes created from text. The animation is supposed to start from sphere to Object B. So I've applied keyed physics on Object B which starts from the sphere to Object B. The second morph is from object B to C so I've applied keyed physics on C so that as B disappears C appears from C. The issue B is not seen since it immediately starts morphing to C. Changing the lifetime of the particles doesn't work because it also affects the duration of movement from A to C. When I tried to use the timing settings in the keyed panel, it doesn't affect the remesh modifier on the text. Both object B and C have the explode modifier so that text breaks nicely as they morph. Is there any way to add duration to object so that object stays for a while before it starts breaking into C?
particles for B:
start : 215
stop: 265
lifetime: 100
particles for C:
start : 315
stop: 365
lifetime: 100
Modifiers for B: Remesh, explode (alive checked)
Modifiers for C: Remesh, explode (alive, dead checked)

So i figured out how to do it. The keyed physics has a checkbox marked use timing. Once that is checked to sliders are enabled. Adjusting the time slider sets how long the particles will move. By setting it to a value of around, the particles move for 40 frames leaving 60 frames for the display of the object. So in my situation. I had to set the time for object B and it worked.
For a more detailed explanation check this tutorial.


text:
Animation Nodes v2 not working with Blender 2.79
I installed Animation Nodes v2 and installed it on Blender. The moment I tried to enable it, this popped-up.
Any idea how I can fix this? Is it because Animation Nodes v2 is not "yet" supported in Blender 2.79?

is it a daily build?

Nope, the latest and official release of Blender 2.79

maybe related https://blender.stackexchange.com/questions/96721/addons-failing-in-2-79-daily-builds-here-is-the-error

I downloaded AN v2 from this link and worked just fine:
https://github.com/JacquesLucke/animation_nodes/releases

You sure you're running it on the official release of Blender 2.79? @BertVdB

Yes I'm sure it's the official release!

try installing the visual c++ 2015 library as indicated in the error message

also check if you have downloaded the Windows release of Animation Nodes

What python version does this version have?

No idea bro, @OmarAhmad

@BouzaziWessim Go to the blender console, it will be written there. It will either be 3.6 or 3.5, which one is it?

version 3.5.3, @OmarAhmad

When I tried installing  this same addon I also couldn't run it (though my error-message looked different), in my case it turned out that there were multiple folders in my Blender/2.79/scripts/addons folder named Animation_something like nodes; when I manually deleted all these folders and installed again it worked fine (the exact location of this folder may differ from system to system, but it  should be listed if you click the little white arrow next to the box you check to turn the addon on)


text:
Blender shuts down when rendering.
Gonna make it brief. Every time I try to render a specificscene, the software crashes (shuts down with no pop up or anything, it shuts down one second after I click render). As for others blend files, the rendering goes smooth and fine.
GPU I'm using: GeForce 920M.
Download link: http://www.mediafire.com/file/20i72axrfqctyd0/tut11_%282%29.blend

Your are probably biting more than you (your hardware) can chew, the scene is likely too heavy for that card and crashes Blender, or at best it is a bug and should be reported to the bug tracker. Adjust your scene to match your hardware capabilities.

You have Subdivision cranked up to level 10 on two different objects.  It's causing your memory to fill up and crash the process.  Just set it to a reasonable number like 2.

From the blender manual:

Performance Considerations:
Higher levels of subdivisions mean more vertices, and more vertices means more memory will be used (both video memory for display (VRAM), and system RAM for rendering). Blender could potentially crash or hang if you do not have enough memory.

Oh, that's the problem. Thank you for clearing that out, must've increased it by mistake when I was tweaking others settings. Appreciate the fact response, thank you.

@BouzaziWessim - Hey, no problem at all.  With subdivision, each step is an order of magnitude.  I.e. it increases exponentially.  So a big difference can be seen even even with small numbers.  Smooth shading takes care of a lot of the visual smoothing anyway.


text:
I'm getting the skin/cloth overlap. What i'm doing wrong?
I'm making a GTA style game (I KNOW IS IMPOSSIBLE TO MAKE A GTA BY MYSELF, BUT HEY, I'M YOUNG, HAVE NO FRIENDS, NO GIRLFRINED, WHY NOT SPEND MY FREE TIME DOING WHAT I LIKE THE MOST? :D) and i have a character that constantly change clothes via Menu, what i want is to attach a police uniform (SWAT like) to my character, all animations are done perfectly, until is time to make the Aiming animation, when i do AIMING animationS the skin overlaps the SWAT uniform as you can see on the screenshot

This is the normal aim, frankly, you don't want to see the Top aim animation LOL
I tried everything, weight transfer, data transfer modifier, automatic weight (instead, this is the best i can get, automatic weighting) and i don't want to use alfa mask, becasue the character will be changing clothes during the game and believe me, THERE IS NO TUTORIAL ON HOW TO CHANGE ALPHAS FOR DIFFERENT CLOTHES FOR UNREAL ENGINE 4, ALL INTERNET, NO LUCK, so, alpha is not an option, i ask on all Unreal forums, no answer, search on youtube, no tutorial. How does game modelers animate a clothed character (with changeable clothes)??
I don't know where else to ask, hope you guys can give me a hand, i'll name you on the game credits as helpers!!! I just attached the .BLEND so you guys can check what's wrong with my model.
Here's the blend file
https://mega.nz/#!WFNG0ICY!caklH2v5fP4gSYQNiz-MWpTLibcXXanng2nUMGP90Qs

this is more of a suggestion but, does your character need his skin? overlayed clothing is always problematic, and while you can fix it with proper weighting, I feel it would be simpler to just do away with the double layered approach.
If you need different clothes you could have different game models for a few cases, long sleeves, short sleeves, and change the model based on the type of clothing, model data footprint is really low, tough you will have a few contact points where you "weld" the clothing, those can be properly weighted without much effort.
On the topic of alpha masking, not sure if I undertsnad correctly, but changing the alpha of a material at runtime shouldn't be too difficult, provided you are using blueprints/c++.

Actually he needs, but, thanks for your suggestions, you know how to do that on Unreal? If you know and can teach me, yours will be one of the best answers i ever got. YOU ROCK MAN!!!

If I'm understanding right and you want to change the alpha values at runtime have a look at this question: https://answers.unrealengine.com/questions/44139/texture-change-with-blueprint.html
I can vouch that it works.

You are most likely getting this problem because the body and the clothes have different topology and weight values for deformation. Open the clothes in weight paint mode, then add weight on parts where the body is sticking out.


text:
Cleaning inner self-intersections
I'm making a model of curved tube which have some self-intersections and wondering how to clean inner mesh in this area.
Inersect(Knife) tool with Self Intersect Source highlights the outer vertexes but they are non-closed so still need some work.
Maybe there is some semi-automatic way to clean it and leave only the outer shell?

The reason it doesn't cut clean is because this kind of curved tube has self-reverting faces in the corners :

You can fix it by using the knife, adding vertices and merging the closest vertices in those areas until you get this kind of result :

Then you should be able to select the self-intersected part of the tube with Ctrl+L :

I don't think there's any automated way to do this.


text:
Make a Low-Poly Object with an equal balanced number of Vertices
I'm trying to model a Low-Poly sky island but I can't get the mesh to have an equal number of vertices at each side.
If i try to model it it looks somthing like this:

I want the vertices to be equally distributes across the whole mesh. My model has much more vertices at the bottom than at the top (technically both sides have an equal amount of vertices but the top side has more area)
My model doesn't really look like the Low-Poly models currently used in games e.g.:

It would be very helpful if anyone can show me how to model a good looking Low-Poly floating island. (The top shouldn't be too uneven, because I will create houses on top of the Islands in a game)
I'm not very experienced in texturing models, so I don't know how to texture Low-Poly models correctly. Should I use Vertex-Paint or UV-Mapping? How can I Import the textures correctly into Unity? What should I do to achive a texture and lighting like picture 2?

Thanks in Advacne,
Sebastian

For redistributing the verts try the remesh modifier.
To make your model look more like the picture you posted, you have to lower your polycount, which you can do by editing parameters in the remesh modifier I mentioned or by retopologizing manually.
As for good low poly modeling, there are plenty of tutorials, and that's not something I can answer here. It'll take practice and patience, as low poly is harder than it looks.
For texturing, since it's done on a face-by-face basis, do not use UVs or textures, but instead use multiple materials and assign different materials to different faces.
Lighting like that is decently simple. Flat shading, a directional light, and some global illumination. If you're using Unity, also look into the image effects standard assets, like screen space ambient occlusion or color correction. After that, just iterate.

Which mesh would you recommend me to start with? An upside down cone, a circle which i extrude and merge at the bottom or something else?

@BlackThunder I'm not sure what you're asking. For tutorial topics, go with whatever interests you the most.


text:
mirror modifier for animations?
I'm a bit new so maybe this feature exists but i couldn't find it.
But while i'm trying to animate simple things such as a walk or run cycle i find myself frequently ctrl-c, ctrl(-shift)-v-ing the first frame of the animation towards the end of the animation.
Is it possible, maybe somewhat like the way you use modifiers to mirror meshes to
 use something like modifiers to mirror/copy your keyframes as well, so you don't constantly hace to copy and paste to update the second half of your animation?

Its not exactly what you're asking for, but you can save a specific pose to a library of poses and set the rig to any of those saved poses: https://docs.blender.org/manual/en/dev/rigging/armatures/properties/pose_library.html

OP here cant comment because i dont have enough reputation and i used a guest account to post the question but Nghillaz answer solved my issue

@paul37 if my answer helped you, please mark my answer as "correct"

You can use F-Curve modifiers in the graph editor. Specifically what you would want is a cycles modifier with the cycle mode set to repeat mirrored.
Here is the documentation

When you're animating a run cycle you can set the end of the whole animation to the end of your run cycle in the timeline. Then press Alt + A in order to start the animation. At the end it will repeat, so you don't have to copy all the keyframes.


text:
Transform mesh to line up with empties, based on other child empties
This is a bit of a difficult one to explain, but I'll try my best. Essentially I have a mesh, generated by photogrammetry. I also have a 3D tracked camera exported from After Effects. Along with the 3D tracked camera from AE I also have some reference points I've put in the world in AE.
I need to line up the photogrammetry mesh so that the position, rotation and scale matches the original footage relative to the tracked camera. The only way I can think to do this is to put reference points on the tracked footage in AE (which get imported as empties in Blender), create empties at the same places on the photogrammetry mesh and then attempt to manually rotate, scale and position the mesh so that its child empties line up with the reference empties.
Here's a simulated picture for reference. On the left, the sphere represents my photogrammetry mesh with the empties added. On the right are the reference points added in AE:

And then when the process is complete, this is how it would look:

The problem is, doing this manually is extremely difficult and time-consuming. For one, the scale of both photogrammetry (using Meshroom) and AE's tracking is arbitrary, so the scales tend to be vastly different. It's also just straight up really hard to get everything lined up by hand.
So my question is this. Is there a way to do this automatically? Obviously the relative positions of the empties that I place by hand on the photogrammetry mesh, and the empties that come from the nulls I've added in After Effects won't be exactly the same, so any automatic solution would have to be a "best fit" sort of thing. But does this exist? Or is there perhaps a simpler way to achieve the same thing?

In the end I decided to just learn how Blender's scripting works and wrote a script. I know there would be simpler ways to calculate the transformations but I'm no maths expert and I wanted to spend my time debugging my logic errors rather my maths errors.
Basically what this script does is take 3 input points (in the form of empties) relative to the photogrammetry mesh and 3 input points in the same position relative to the tracking data, then attempts to line them up with each other, bringing the photogrammetry mesh along with it. This actually works pretty well in my testing. It's obviously not the fastest workflow but it does work and that's the important part.
import bpy
import bmesh
from mathutils import Matrix

#####################################
# TO USE:
#
# 1) create empties at three easily-identified positions in tracking data, called ea1, ea2 and ea3
# 2) create empties at the same three positions but in photogrammetry data, called eb1, eb2 and eb3
#    NOTE: eb1, eb2 and eb3 must be positioned IN THE SAME ORDER as ea1, ea2 and ea3!
# 3) name the photogrammetry mesh "photogrammetry"
# 4) run the script and be amazed
#
#####################################

# from https://blender.stackexchange.com/a/118783/41192
def createLookRotation(forward, up):
    rot = Matrix.Identity(3)
    rot[0] = up                 # x
    rot[1] = forward.cross(up)  # y
    rot[2] = forward            # z
    rot = rot.transposed()
    return rot.to_quaternion()

def doMeshThing(obj, mesh, empty1, empty2, empty3):
    bm = bmesh.new()
    bm.verts.new(empty1.location)
    bm.verts.new(empty2.location)
    bm.verts.new(empty3.location)
    bm.verts.ensure_lookup_table()
    bm.faces.new([bm.verts[0], bm.verts[1], bm.verts[2]])
    bm.normal_update()
    bm.to_mesh(mesh)
    bpy.ops.object.select_all(action='DESELECT')
    obj.select = True
    bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
    bm.faces.ensure_lookup_table()
    normal = bm.faces[0].normal
    guide = empty2.location - empty1.location
    quatRot = createLookRotation(normal, guide)
    obj.rotation_mode = 'QUATERNION'
    obj.rotation_quaternion = quatRot.inverted()
    bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
    obj.rotation_quaternion = quatRot
    bm.free()

ea1 = bpy.data.objects['ea1']
ea2 = bpy.data.objects['ea2']
ea3 = bpy.data.objects['ea3']
eb1 = bpy.data.objects['eb1']
eb2 = bpy.data.objects['eb2']
eb3 = bpy.data.objects['eb3']

mesha = bpy.data.meshes.new('mesha')
meshb = bpy.data.meshes.new('meshb')

obja = bpy.data.objects.new('obja', mesha)
objb = bpy.data.objects.new('objb', meshb)

scene = bpy.context.scene
scene.objects.link(obja)
scene.objects.link(objb)

doMeshThing(obja, mesha, ea1, ea2, ea3)
doMeshThing(objb, meshb, eb1, eb2, eb3)

bpy.context.scene.update()

# position and rotate objb (photogrammetry) to match position and rotation of obja (tracking)
photogrammetryMesh = bpy.data.objects['photogrammetry']
photogrammetryMesh.parent = objb
photogrammetryMesh.matrix_parent_inverse = objb.matrix_world.inverted()

objb.location = obja.location
objb.rotation_quaternion = obja.rotation_quaternion

# calculate average dimension difference here and scale
scaleDiffX = obja.dimensions.x / objb.dimensions.x
scaleDiffY = obja.dimensions.y / objb.dimensions.y
scaleDiffZ = obja.dimensions.z / objb.dimensions.z
#averageScaleDiff = (scaleDiffX + scaleDiffY + scaleDiffZ) / 3
averageScaleDiff = (scaleDiffX + scaleDiffY) / 2 # seems to be in local space, so z is useless
objb.scale.x = averageScaleDiff
objb.scale.y = averageScaleDiff
objb.scale.z = averageScaleDiff

bpy.context.scene.update()

parented_wm = photogrammetryMesh.matrix_world.copy()
photogrammetryMesh.parent = None
photogrammetryMesh.matrix_world = parented_wm

bpy.ops.object.select_all(action='DESELECT')
obja.select = True
bpy.ops.object.delete()
bpy.ops.object.select_all(action='DESELECT')
objb.select = True
bpy.ops.object.delete()


text:
Named variable or remote connection?
In some graph-based systems it's possible to have a "remote" connection between nodes to reduce spaghetti. In other words, the output from one node goes into a named pin. If you then have an identically-named pin somewhere else in the graph, those two pins will be internally connected. Think EDA or PCB design software.
Reroute nodes help, but sometimes I calculate a value near the start of the graph and then need it at various points along the graph, and it's very messy and confusing to have one very long wire going all the way along the graph. It's easy to forget what value the wire represents. As a programmer, I'd love to be able to just pipe a value into a named variable and then reuse that variable whenever needed.
Is it possible to do this in geometry nodes?
I've looked at named attributes but I don't think this is the intended usage for them. Named attributes store values alongside geometry, but what I'm looking for would just be syntactic sugar and exactly equivalent to dragging a wire between two nodes.

There are no "remote" connections between nodes. But you can create nested node groups, and you can add multiple group input nodes to create "shortcuts" of inputs. Not sure if that helps you.

@Blunder I use nested node groups frequently. Multiple copies of the Group Input node (along with Ctrl+H) is my best friend. But sometimes that just isn't a good solution. I was really just hoping for named sockets :( The internal implementation would also be incredibly simple: just don't draw the wires between named sockets (or I guess it would be more like named Reroute nodes).

This feature has been discussed for several years. Progress unknown. https://devtalk.blender.org/t/portal-links-exploration/21306

@quellenform Ah, thanks. If you convert your comment to an answer I'll accept it.


text:
Problem with shadow catcher and a question about alpha blending
I have a model of an object and a ground

and I need to separate the two into two different render images. First image -- object with a transparent shadow, second image -- ground without an object. Then I need to place the resulting images in Unity on top of each other so that they would look the same as the render of an object unseparated from the ground.
I managed to make a render of the object with a shadow using render layers and a "shadow catcher" feature. But when I try to combine it in Unity or Photoshop with a render of a ground, the shadow looks too dark (much darker than in a combied render). Surprisingly, when I mix an object with a ground in a Blender compositor, the shadow looks exactly right:

So here are the questions:

Is it possible to make a shadow lighter using shadow catcher? I tried to make a shadow catcher material semi-transparent, but the shadow stayed the same. I also tried to fix the issue with adding a third render -- a render of object without a shadow: I placed it on top, the layer of an object with a shadow in the middle (with the opacity of 50% for a lighter shadow) and the render of a ground in the bottom. Unfortunately it renders some artifacts on the fringes of an object. I also tried to make shadow dimmer in Blender compositor using object ID mask, but again it renders some artifacts on the fringe of an object. The same goes with the method of dividing image with a shadow on the image without a shadow and then placing object on top.
Why does blender overlaying method differ from method in Photoshop or Unity? (I tried to convert renders from standard to premultiplied and from premultiplied to standard, but it did not change much).
Is it possible at all to simulate Photoshop blending algorithm in Blender compositor, so that I will have an idea of how the blending would look in Photoshop or unity without using them?

Would be grateful for any advice.

What file format was used for exporting images into Photoshop/Unity? What options were used for the export?

@ Mr Zak , I Used Png format for export in Photoshop and Unity with RGBA, 8 bit, 15% compression
I tried to apply PremulToStandard and StandardToPremul transform before export

@cegaton , I can merge two layers in Blender compositor, but there is no point because I need those images to be separate layers in Unity. And I only mentioned Photoshop because it has the same overlaying algorithm as Unity.

@  Mr Zak , I kind of solved the issue thanks to your and @cegaton advises. I just found a way to make Unity blend images in linear space, the same way Blender apparently does it. Not shure yet if it will backfire somehow, but at least I know what direction to look further.

Remember, as I said below in @gez's absolutely accurate answer, you cannot encode a shadow into an alpha channel. Alphas are strictly linear ratios, and as a result, shadows will never be correct when rendered using a physically correct linearised reference. The only hacky quackery you can do is to nonlinearly encode the shadow, which is an absolute gong show.

1) It is possible with the compositor. You need to pull a pass with the shadow catcher object only, modify its alpha and composite it. However, compositing back the foreground object with the shadow catcher pass might be tricky, specially in the edges where the solid object meets the shadow.
A useful tip in this case is to work with both alphas (solid foreground's and catcher's) and make sure they are combined properly rather than working with RGBA. Check whether those alphas are correlated or uncorrelated, depending on your setup.
2) As cegaton pointed out and you realized already, the reason for the difference is blending images in a linear space (blender) vs. blending images in a non-linear space (photoshop and others).
Blender works with linear images all the way. What you get from the compositor is linear, even though the display transform makes the final composite non-linear and also saving as byte-images (like PNG, JPG, etc. does ,as 8-bit images need to be gamma-corrected to avoid artifacts.
So, even when images are converted to non-linear in the end, all the blending operations inside the compositor are performed on linear data with associated alpha (also called pre-multiplied).
Photoshop does it completely different, for a number of reasons, being legacy the main one: Back in the day when it was only possible to edit 8-bit images, it made sense to work with gamma-corrected sources with unassociated alpha (like PNGs).
Things have changed since, but Photoshop kept the non-linear editing and a lot of graphics applications followed its lead doing the same.
It's good to keep in mind that linear blending works closer to reality than non-linear blending, so take Blender's result as the right one (which means that you should try making Photoshop look like Blender, not the other way around).
3) Yes it is!
You need to turn your linear associated images to non-linear unassociated ones.
With the alpha convert node, you have to make the buffers unassociated (premul to straight), then with a gamma correct node "bend" the linear image to 0.4545 (1/2.2).
The result will be merged with an alpha-over node (make sure you mark the convert premul checkbox, as the input is unassociated), and right after that node a gamma node set to 2.2 will take the result back to linear (which is necessary as Blender colour management expects linear to apply the display transform and the output gamma-correction.
Check the following image, it comes with a bonus: Did you see the ugly dark fringe around the foreground? That's one of the nasty effects of alpha blending non-linear images ;-)

Pretty much nails it all. One caveat: Remember you can't encode a shadow into an alpha channel. ;)

I tend to agree, but the shadow catcher object is rendered to RGBA when you render a beauty pass, and the OP asked about how to composite that over a background.

It's important to keep in mind that the shadow catcher is a hack to simplify the process of producing a shadow pass that can be used with the beauty pass.
A proper shadow can't be composited with alpha blending and as @troy_s pointed out, it can't even be properly encoded into an alpha channel.

@Gez This alpha thingy keeps backfiring :)

@aliasguru Yes, but the alpha-team never sleeps. :-D

Short answer is that one should change Unity render mode to "Linear" (Edit -> Project Settings -> Player -> Other Settings -> Linear rendering), then all the shadows appear as light as in Blender (no similar option in Photoshop though).
Long answer: as far as I could understand, the problem is that all the images stored on any computer undergo a certain transformation called "gamma transformation" before being shown on a screen. Blender mixes images before applying gamma transform (it applies gamma transformation to the result of the mix), and Photoshop / Unity (in default mode) mix images only after each image is being transformed.
Blender way is physically accurate, but Photoshop way is widely used as well.
Here is a good article abount linear vs gamma space:http://filmicworlds.com/blog/linear-space-lighting-i-e-gamma/
Here is an article abount linear space rendering in Unity: https://docs.unity3d.com/530/Documentation/Manual/LinearLighting.html
Thanks for @cegaton and @ Mr Zak for pointing me to linear space problem.
Although I am now able to recreate accurate shadows in unity, I still dont know how to control the intencity of shadows in blender shadow catcher, should I need to do so in a future (according to my research there is not such a way).
Also there appears to be no way to overlay images in Blender using "gamma space". I think Blender is lacking in this regard -- "linear blending" is physically accurate, but gamma blending is used in many programms, so it would be useful to have one in Blender.

This is utterly false and confuses the issue. The issue is the encoding of alpha when used as a shadow; you cannot encode a shadow via the alpha channel hack in any nonlinear manipulation reference. It is impossible.

I had similar issue - what fixed it for me was to adjust the alpha of the material on the shadow catcher object

If changing the alpha doesn't work, try changing the transmission slider also


text:
How to make a complex selection of an image over a cylinder top/bottom face and extrude to make a coin
Right now I'm trying to sculpt a cylinder face that I have made with 200 vertices and a very subdivided triangle fan cap top, but this gets too laggy for my PC and it's still very ugly.
I wonder if there is a way to make a selection of an image like in photoshop and just bring out that part. I'm trying to make a coin with a logo on it to 3D print.

can you show an example of the coin face "texture" that you could use, just to aknowledge the complexity? eg: this could be done with displacement.

@m.ardito - http://imgur.com/a/jYnWa ; this is the image i want on the top of the cylinder. It

And you want it to be extruded like in real life coin?

As said in comment above, this could be done with texture displacement, like this:

of course the provided texture is probably not trimmed enough but you get the idea.
Note: I used a default circle, then filled with about 500 vertices, then subsurfed 5 times... which brings you about 1000x vertices, otherwise your coin face will be much more rough than this... of course it's damn slow.
Another way could be to vectorize the b/w image to svg (eg: use inkscape), then import svg into blender and then extrude... then add a cylinder "body", refine, and try exporting to .stl and similar.
eg., it could end like this

Note:the vertices count could be somewhat smaller in this case, but as usual, the more detail, the best results. In this case you can't easily smooth using subsrf, though... you could need a lot of mesh adjustment to correct (very) bad topology.
You have to find the best settings, it also depends on 3d printer resolution, of course...

Perfect! this is exactly what I wanted. I spent 2 days finishing it up to my needs and it came out perfect, but I couldn't have done it if it wasn't for you. Thanks a lot dude!

Good! And in the end which method you used? DId it print well?

Sorry for such a late response. I used the 2nd method, because it allowed me to modify everything a lot more! Here is the end result after the 3D printing (newer models are more detailed)
https://scontent-sof1-1.xx.fbcdn.net/v/t34.0-12/20030952_1712828935424483_1221814463_n.jpg?oh=6fc4962db5e32a44d0b9af6ba2605848&oe=597C0B21
Sorry for potato quality


text:
Invisible object after motion tracking
After tracking the camera and adding a scene (invisible plane, camera and light) I used a cube to check my camera track and everything rendered fine.
I added a rig, but after rendering, the rig appears to share the properties of the plane that makes the shadows happen (the rig is invisible and only shows the shadows of itself).
Does anyone know how to solve this?

Are you able to upload your blend file?

An armature doesn't render and doesn't cast shadows, there must be another object doing it. Did you add a mesh for the rig to deform? or is it moving the invisible plane you mention?

Make sure the rig is in the right layer, it has to be in the visible render layer


text:
Refresh Viewer Node's image data when pass index of ID Mask node has changed in python
I followed the answer of this question in order to get a bounding box of visible area of an object in a rendered image. Since I have multiple objects that I add in the scene dynamically through script, and assign each of them a different pass_index, I use the following function (again, adapted from here) to get the bounding box of each object:
def getVisibleBoundingBox(objectPassIndex):

    S = bpy.context.scene
    width  = int( S.render.resolution_x * S.render.resolution_percentage / 100 )
    height = int( S.render.resolution_y * S.render.resolution_percentage / 100 )
    depth  = 4
    #set the index to the object's pass index
    bpy.context.scene.node_tree.nodes['ID Mask'].index = objectPassIndex

    #render.render is very slow, try to find alternative to update the Viewer Node
    #bpy.ops.render.render()

    pixels = np.array( bpy.data.images['Viewer Node'].pixels[:] ).reshape( [height, width, depth] )
    # Keep only one value for each pixel (white pixels have 1 in all RGBA channels anyway), thus converting the image to black and white
    pixels = np.array( [ [ pixel[0] for pixel in row ] for row in pixels ] )

    bbox = np.argwhere( pixels )
    (ystart, xstart), (ystop, xstop) = bbox.min(0), bbox.max(0) + 1
    return xstart, xstop, height - ystart, height - ystop

The problem is that the Viewer Node image data does not update when I change the index of the ID Mask node with:
 bpy.context.scene.node_tree.nodes['ID Mask'].index = objectPassIndex

and it contains stale data from another object's pass index, so I get the same result all the time for different objectPassIndex when I try to take the pixels with:
pixels = np.array( [ [ pixel[0] for pixel in row ] for row in pixels ] )

This is not the case if I change the pass index in the GUI, where the Viewer node updates immediately. A workaround I found is to call bpy.ops.render.render() after changing the index and before taking the pixels, however, this operation is very slow and therefore not applicable for my use case. I also tried calling bpy.data.images['Viewer Node'].reload() without success.
So, the question is, is there a faster way to refresh the data of the Viewer node?
If not, another alternative that might work for me is to get a combined image containing in each pixel the pass_index of the particular object. I noticed that this image can be generated in the GUI by rendering and selecting the pass to IndexOB (image attached). But I do not know if it is possible to change the pass to IndexOB from python and grab the rendered image.

So the alternative question is if there is a way to get access to the pixels of this image in python?

The answer to this question is the answer to the alternative question: "How to get the image where all pixel values are set to the pass_index of the particular object". Instead of using "ID Mask" node, the IndexOB output of "Render Layers" node can be connected directly to the Image input of "Viewer" node. Then the function can be modified like this to get the bounding box for particular objectPassIndex:
def getVisibleBoundingBox(objectPassIndex):

    S = bpy.context.scene
    width  = int( S.render.resolution_x * S.render.resolution_percentage / 100 )
    height = int( S.render.resolution_y * S.render.resolution_percentage / 100 )
    depth  = 4

    pixels = np.array( bpy.data.images['Viewer Node'].pixels[:] ).reshape( [height, width, depth] )
    # Keep only one value for each pixel (white pixels have 1 in all RGBA channels anyway), thus converting the image to black and white
    pixels = np.array( [ [ pixel[0] for pixel in row ] for row in pixels ] )

    bbox = np.argwhere( pixels == objectPassIndex )
    (ystart, xstart), (ystop, xstop) = bbox.min(0), bbox.max(0) + 1
    return xstart, xstop, height - ystart, height - ystop

Sadly this wont work when running blender as background process

I finally got the answer after long hours of research!
Just add:
for vl in self.scene.view_layers:
        vl.use_pass_object_index = True

For a more complete solution:
for vl in self.scene.view_layers:
    vl.use_pass_object_index = True
index = 2
mask_outputs = []
for obj in object_to_mask:
    obj.pass_index = index
    maskid = node_tree.nodes.new('CompositorNodeIDMask')
    maskid.index = index
    node_tree.links.new(renderNode.outputs['IndexOB'], maskid.inputs[0])
    node_tree.links.new(output, self.outputNode.inputs[mask_name])
    index += 1


text:
Particle system, hair curves, or geometry nodes for grass to get lowest processor strain?
I'm starting my environment for an archvis project that will be animated in EEVEE. Later I'll be creating environments for other animated projects with characters. I've been trying out different grass generators, which seem to use a particle system, as well as the hair curves feature in 3.6. The hair curves give me better control and I'd have to create a shader to correctly color, not a super big deal there but, as I am animating the project, which would put less strain on a processor; particle system, hair curves, or geometry nodes? I have a pretty healthy desktop, i7, 64gb RAM, multiple SSD's, and a RTX 3090...I just don't want to stretch out rendering any longer than necessary. I haven't tried geometry nodes for grass yet and spend an entire day working with various addon generators and am wondering at what point I'm chasing my own tail and need to focus on one...just which one?

I think it's secondary how much of a load it puts on the CPU. Primarily, I would ask myself how I can get the animation done. It depends on the scene, the animation, and the GN experience. The (old) hair particle system supports Dynamic Hair with physics simulation, meaning you can use a wind force field and create grass swaying in the wind relatively easily. The simulation data can be baked.

In contrast, the (new) curves can only be animated with GN so far (Blender 4.0) and only with Simulation Nodes the data can be baked. I have no idea how this affects render time, but I think animating grass in GN is more challenging than with the old particle system for now. In the long run, Curves+GN are the future, while the old particle system is basically at the end of its life.

Thanks, So, with 4.0 around the corner, we stand with one foot in the past and one in the future....like most software. I took a scene, added a yard with grass made with curves and my render time, in EEVEE, was about three and a half minutes for a frame...a bit longer than I want. Of course, I hadn't baked it, just a quick test. I'll keep running some experiments.


text:
Mirror modifier not applying shader on mirrored item
I'm having an issue with mirror modifier on a characters eyes. I created a shader for a character eye but it does not carry over to the mirrored eye. The eye I created the shader on is the one on the right. I applied the mirror modifier, went in to edit mode and selected all the vertices for the left eye, separated it as a new object so, I have a left and right eye in the object tree. The shader also copied to the left eye but still won't activate. I'm thinking it's right in front of me as it has been awhile since I made eyes, maybe a switch I didn't throw. Now, here's another odd thing; when I click on each of the eyes, they both show the exact same location, even though you can see they are obviously separated from each other. That's a new one on me.

Hey this could be because of the Texture coordinate Node. If you set it to UV and UV unwrap the eye it could fix the problem but im not sure. Can you share a blender file so i can check?

You are using Object coordinate. If the original geometry for example sits at an X value of +1, the mirrored geometry is at -1. So the texture is set up to show a pupil at +1, but not at -1. To achieve this, one way would be to place a Vector Math node set to Absolute before the Gradient texture.

I was trying to keep everything procedural but I'm going to drop back and use an image for the pupil. Putting the Absolute Math node on it drove it crazy. I'll come back to it another time. Working at doing as much procedural to keep some processing time down and give a little more future modifying option there but the image won't be any big drain on processing

I wanted to keep the sphere intact, a node should be able to cover it so, I tried putting the Absolute Math node in and it striped the thing but after manipulating the Mapping rotation and Y location awhile I was able to get the correct result. I did zero out the value in the Math node so all my adjusting was in the Mapping node.


text:
Vertex on character have frozen
I make copies of my projects as I progress, to keep things safe in case a job gets destroyed. I came into this project I'm working on and all the vertices on the characters body are frozen, I can't move them at all. It is only the body, everything else I can edit, as you can see I have moved a vertices on the characters tunic. Everything is up to date, Blender 3.4.1, OS updated, drivers updated. I had this happen  about a year ago and ended up going back three revisions and building back, a real time consumer. The selection operator is enabled in the outliner, it just will not let me move any vertices on the character itself.

Hello, maybe share your file?

Thanks but, I figured it out. I opened both the older version on one screen and the frozen one on the other and went parameter by parameter through the menus and settings and saw where the vertex edit mode was enabled in Vertex Groups. Turning that off fixed the "problem".

I found the issue. Under the Vertex tab in Shape Keys, I had left the edit vertex button on, that froze all the vertices on the body. Turned it off and everything freed up.

wow what a hard to find one   :p

Yah, but I get very stubborn sometimes and refused to quit digging for the reason I make dumb mistakes...and fix them. "I'll find the thing if it kills me"


text:
Procedural geometry or bump map for stitching?
I'm working on an outfit on a character and am going back and forth on stitching for the fabric. I am rendering in EEVEE and will be baking for animation. I found a frame from the movie Ratatouille that shows the king of stitching I am doing. Would using geometry nodes to add stitches to the cloth then baking be the best way to go or, bump maps on images?

Hello ! Unfortunately these kind of open-ended questions are off-topic on this site, because there is no objective answer. It depends on your workflow. You can use a bump map stencil texture, actual geometry, a baked map, an overlay in compositing, etc. Would you mind rephrasing your question so it is more self-contained and easier to answer canonically ? In case you don't feel like it, you can go on https://blenderartists.org/ which encourage back and forth open ended discussions. Cheers

Bump or Normal map are probably the easiest ways to do it

Edit: It's NOT procedural or geonodes but in case, you can use a Normal Map (or height maps):
Unwrap your object, create an image that has a background of Hex:8080FF (default normal map color), plug it into the Output of your material. Prepare a stitch normal map image that you'll use as stencil. Switch your 3D scene to Texture Paint, open the N > Tool panel, switch your Draw brush to Stencil, select your stencil image:

Paint on the surface of your object (right click to move the stencil, Ctrl right click to rotate, Shift right click to scale):

Once you're good, give your object back its material, plug the normal map you've created into a Normal Map node that you plug into the Normal input of your Diffuse or Principled BSDF:

That looks like the best way to go. Thanks!


text:
How do I compare to a custom property list?
I created a custom property group with a list of strings (populated with the name of image textures). How do I compare the list of textures in my scene to this custom property list?
import bpy

class CustomPropertiesGroup(bpy.types.PropertyGroup):
  customString: bpy.props.StringProperty()

bpy.utils.register_class(CustomPropertiesGroup)

bpy.types.Scene.customLists = bpy.props.CollectionProperty(type=CustomPropertiesGroup)

bpy.context.scene.customLists.clear()

# Filling up the custom list with the texture names
for m in bpy.data.images:
    if len(m.filepath) != 0:
        newCustomItem = bpy.context.scene.customLists.add()
        newCustomItem.customString = m.name

Later in the code I  would like to modify the texture path of those textures which are on my list but I don't know how to iterate over the scene textures and over the custom list at the same time to see if there is a match.
This code below doesn't work as it only has the last item in the custom list and therefore it's only true for that last item:
for m in bpy.data.images:
    if m.name in customPropertyGroup.customString:
        print("Something...")

How can I compare the actual m.name to all of the items in the custom list?

if m.name in [pg.customString for pg in bpy.context.scene.customLists]: ? It's called a list comprehension if you want to look it up :)

Just to close the question with the super answer from Gorgious:
for m in bpy.data.images:
    if m.name in [pg.customString for pg in bpy.context.scene.customLists]:
        print("Something...")

works perfectly. (Never heard of list comprehension but now I know. Thanks.)


text:
Specular highlight on a mesh with a normal map becomes squarish at a certain strength
Can someone explain me why the specular highlight becomes more and more square shaped when the strength of the corresponding Normal Map is increased? This is very annoying and I don't understand why it happens and what can I do about it to eliminate this effect.
On the following image the specular reflection of the HDRI on the right is nicely round. It has a strength of 0.02. In the middle with a strength of 0.3 it is already a square.
The mirror image shows the HDRI used. It should create a nice round specular highlight from the sun but instead it looks like it was created by a rectangular area light.
It doesn't matter what form of mesh or what HDRI is used.

I tried other noise textures and it turns out that the shape of the specular highlight is dependent on the texture:
While a Noise texture produces a round higlight

The White Noise texture creates an even sharper rectangular highlight as the Voronoi.

It shouldn't be like this but I can't find a way to solve it.
Maybe a Blender developer would know what is causing this.


text:
Geometry Nodes - Collection Info: turn off visibility of input collection
Here is a simple collection info example:

Blue cube is the original cube in the collection named Test, red is the one modified trough the collection info node acting on the Test collection.
Is there a way to turn off the visibility of the original (blue) cube both in the viewport as well as in the rendered image from within the geometry node?

You can make a driver

Brilliant idea! In deed you can put a driver on an objects "Hide Viewport" attribute. Unfortunately this doesn't work on collections. Now I have to find a way how to script bpy.data.collections["Test"].hide_viewport = True/False into another driver...

Geometry nodes can only change the objects they're modifying.
If your geometry nodes are on the red "plane", it can only change the "plane".
You can always click the buttons to make the original object invisible (it will still work int the "collection info" node).

Thanks, I know that but that means I can't automate a task based on Collection Info as the user needs to manually turn off the visibility of the collection. It's a half baked solution. :-(  The Collection Info node refers to a collection and modifies it's content and it could also "see" the collection's properties. (These properties are available in BPY so the programmer of the node could also have added this functionality. It would have been a logical step.

No, it's not logical. The collection info does not modify its content.  Nothing in geometry nodes is intended to modify anything that is not the object containing the modifier with the nodes.

"Geometry nodes can only change the objects they're modifying." - more specifically, it modifies the data of the object. It's the mesh or curve data, or pointcloud... Geometry Nodes won't modify constraints, transformation matrix, Line Art settings etc.

I think it is logical. The Collection Info is referring to objects which have otherwise no relation to the object which actually has the GN modifier. From a user's point of view  it is entirely logical that I want to do something with the objects in that referred collection and that might mean that I don't want to see the initial state of those objects. A simple "Hide Source" checkmark in the Collection Info node would be sufficient to achieve that. That's what I meant with half baked.


text:
Sculpted mesh reverts to original shape upon exiting sculpt mode
I sculpted a mesh but when I exit sculpt mode the sculpted information gets lost and the mesh looks exactly like before I sculpted it. If I go back into sculpt mode the information reappears. How can I apply that sculpt information to the obejct, so it always stays?

This seems to have been a display error. I entered edit mode once, which fixed it. It was a fairly big mesh, so I could imagine that the display error happened due to insufficient power.

Thanks for following up with the answer once you figured it out.


text:
Change of the color of the hair in a render video
I am working in blender and planning to create a character where the hair changes from black to white. I want to make an animated video which shows the change happens from the beginning of the hair, gradually to the end. I took the idea from the Disney animated movie, Tangled, when Rapunzel’s hair glows in a gradual way.Thanks for every help;))

You can get a MixRGB node, plug it into the color of your shader, slap a color ramp on the factor of the MixRGB and put a gradient texture on the factor of the color ramp. Slide the colors around in the color ramp and you get a nice transition. :D

Thanks.. just wanna ask, I don’t want the change happens from all the sides of the hair in the same time ... like to begin from the roots to the middle of the hair till the end?

You can try using a color ramp. I'm kinda lazy to do it right now so I'll see if I can make one later.

Hi Rogue, how have you progressed in your research? I would really like to the see the effect of the color ramp, since this would answer the question.

@Leander oh damn i forgot about this, it's edited now.


text:
Trying to apply Occlusion physics to an object
I'm running v2.79.
I'm self taught, very new, and trying to learn everything about 3D modeling. One of the things I'd love to learn is Occlusion.
And I've watched plenty of videos on how to do it, but I'm unable to even find something remotely close in my own version of Blender. In the videos, the area (circled in the picture) is usually a drop-down menu which has the "Occlude" option.
Even the premade file that Blender has on their wiki for Occlude just opens just the default starting cube with nothing else.
Was this feature removed in newer versions??

Occlusion physics only exists in the Blender game engine not blender render or cycles. It's for preventing unnecessary rasterization in real time. Are you trying to make a game?

Ohh, that would make sense. Not a game, but I am learning to develop Snapchat filters, and one of their options is to have a "window" to another world. Which is basically just a tube with an Occlusion object wrapped around it, so it looks like its part of the ground (Augmented Reality)