text:
Create tube from two edges
I have two edges that represent the top and bottom parts of a tube:

I would like to be able to create a tube from that which fills in the rest of the data automatically, interpolating between the two on the up/down axis so that the sides are properly merged at the halfway point.

Here's an example of what the finished product should look like, created manually.
In other words, a script (or clever set of built in functions) that would:

walk through each top and bottom pair of vertices
create two cylinders from them on the XY axis, using the distance between the vertices as the diameter of the cylinder
interpolate between the two cylinders using the Z axis as a weight to create the final geometry

In the case of mismatched vertex pairs, I don't mind fixing them up manually so that quads can be nicely generated from them; it's the rest of the steps that would otherwise involve a huge amount of manual labor as these objects can be thousands of vertices long. I also looked at using NURBs curves instead of edges, but am not familiar enough with NURBs to know if what I'm looking for can be done with them.
Does something like this exist? If not, what is the most efficient pipeline to create models from this type of input data?

I'm not totally sure what you mean to do, couldd you post an example image of what you want to achieve?. From my current understanding, the word you might be looking for is lofting. Look into the BSurfaces add which allows doing that using curve guides. NURBs are indeed the correct geometry type for this sort of thing, though Blender's NURBs tools are severely lacking and inappropriate for production use.

I've added a 2nd picture to clarify that. I'll take a closer look at NURBs in the meantime, but further guidance in using them to accomplish this goal would be appreciated if it is indeed the optimal choice.

how is your input data coming in? how are you generating these sets of polylines in the first place? the two polylines don't have matching vertex counts..

You only need one edge to use the spin tool, you could also use a screw modifier

Blender NURBS probably won't help much in this case, maybe something like MoI but it is a commercial application. As far as I know Blender has limited built in native tools for this sort of geometry, nothing adequate for lofting. Your best bet is really probably the BSurfaces Addon mentioned above. I'll try to think of something else in the meantime and post it here if I get anywhere.


text:
Pin an object onto a character
I have an animated character, and I would like to pin a separate object onto its belly. The object is made up of a couple parts: a soft body and a cloth hanging from a shape key'd mesh, all parented to an empty so I can move it around easily.
I'd like to pin this empty to the character mesh, so the object moves with the character and stays on its surface as it animates. How can I do this?
[edit]: I've seen a few similar questions that are answered by simply parenting the object to a bone in the model. As the surface of my character's belly deforms as it animates, I don't think this will work for me.

If the objects you wish to pin to the character are not under some other constraint I can't see a reason why they couldn't just be placed where they're to be and simply "parent" them one at a time to that character.  Select one of the objects, hold SHIFT down and select the character or perhaps the bone/armature that's controlling it's belly, then press CTL-P , select "Object".  This will force that object to go wherever the character goes and stick to it's belly.  I've not yet done this when shapekeys are involved however.

I've just confirmed that previously installed shape keys don't affect the parenting process.  The add-ons just follow the parent about and stay put on it's "Belly".  Remember, you may have to parent to one of the character's bones, but try it's torso first.  (Blender vers 2.77a with W10)

Unfortunately this method breaks when the character's belly deforms under the influence of multiple bones, such as when it's bending over. Parenting the objects to the bone cause it to move with the bone, but not with this kind of complex deformation.

Parenting to the character's vertex was what I was looking for. To do so:
1) Select everything.
2) Enter Edit mode (tab), and select the vertex you want to pin to.
3) Exit edit mode.
4) Select the object(s) you want to pin.
5) Shift-select the character.
6) Enter edit mode. The vertex should still be selected.
7) Press Ctrl-P to parent to vertex.
The objects will now follow around that vertex as it deforms.

source: Stack Exchange

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

sort: votes


text:
Is there a way to know (programmatically) how many objects are visibile in a rendering?
i'm new here, i browsed a bit before posting but i haven't found any solution yet. I'm writing a small script to create several random
images with spheres of different sizes and i'm looking for a way to know
how many of them are visible in a render. The final idea is to have a dataset to test some computer vision algorithms such as that i have the number of objects present in each image.
I'm attaching the script so far.
#!/usr/bin/python2.7
import bpy
import bpy_extras
import random
import math

def makeMaterial(name, diffuse, specular, alpha):
    mat = bpy.data.materials.new(name)
    mat.diffuse_color = diffuse
    mat.diffuse_shader = 'LAMBERT'
    mat.diffuse_intensity = 1.0
    mat.specular_color = specular
    mat.specular_shader = 'COOKTORR'
    mat.specular_intensity = 0.5
    mat.alpha = alpha
    mat.ambient = 1
    return mat

def setMaterial(ob, mat):
    me = ob.data
    me.materials.append(mat)

def createSphere(loc, siz, material):
    origin = (0,0,0)
    bpy.ops.mesh.primitive_uv_sphere_add(location=loc, size=siz)
    #bpy.ops.transform.translate(value=(1,0,0))
    #bpy.context.object.location = location
    setMaterial(bpy.context.object, material)

def createScene():
    #Cleaning the scene
    bpy.ops.object.select_by_type(type='MESH')
    bpy.ops.object.delete()

    #Create a material
    materials = (makeMaterial('Red',(1,0,0),(1,1,1),1),
                 makeMaterial('Green',(0,1,0),(1,1,1),1),
                 makeMaterial('Blu',(0,0,1),(1,1,1),1))

    rand = random.randrange(50)
    print ("Number of spheres %s" % rand)
    for i in range(rand):
        location = (random.random()*10-5, random.random()*10-5, 0)
        size = random.random()
        createSphere(location, size, materials[int(random.randrange(3))])

def render():
    step_count = 32

    for step in range(0, step_count):
        cam.rotation_euler[2] = math.radians(step * (360.0 / step_count))

        bpy.data.scenes["Scene"].render.filepath = '/home/daniele/VR/vr_shot_%d.jpg' % step
        bpy.ops.render.render( write_still=True )

#Set a seed to make reproducible
random.seed(32)
cam = bpy.data.objects['Camera']
createScene()

render()

You mean you want to count how many spheres are actually within the rendered frame? Or how many are really visible, that is not occluded by other spheres?

@aliasguru actually, if i could have both information it would be perfect

You can give each object a unique object ID ("pass index" in the object properties).These can be output as render pass; each pixel will have the ID of the object that's visible there. This will not only give you a count of the number of objects (just count the number of unique values) but also a ground truth for segmentation & shape recognition.
This Python script will give each selected object another ID:
import bpy

for nr, obj in enumerate(bpy.context.selected_objects):
    obj.pass_index = nr + 1  # reserve pass index 0 for "no object".

For more info, see the ID Mask Node section of the Blender manual.

I found a way to figure out which objects are seen by the camera. It might be a clumsy one, as I do something manually which maybe Blender hast a better function for already, but it is unknown to me at least. My way uses the following approach:

first, get the location of the camera in world space. Then, get reference points in 3D which describe the boundaries of the render border. Then, segment the view in slices of a length of n pixels (in regards to render resolution), and cast a ray from the camera in this direction. If there is an Object hit, add it to a list. Later on, I can iterate over this list and select all of the objects which were hit by the ray.

This will only collect objects which are not occluded by other objects.
The following script has a few parameters to play with: n is the step size in pixels, if you set it to 1, every pixel receives a ray, setting it to 50 fires a ray every 50 pixels, etc. maxDist is the maximum length of the ray in Blender units. showEmpties is a debugging parameter. Only set this if n is bigger than 50, otherwise you'll wait forever. If you look through the camera, an empty will be placed on every spot where a ray is fired.
My script uses the current renderable camera to evaluate the scene, so make sure there is one set. Copy the following script to your script editor and run it:
import bpy

C = bpy.context

# fire a ray every n pixels
n = 50
maxDist = 100

# for debugging, the ray direction can be visualized as empties
showEmpties = False

# get the origin to fire a ray
startingPoint = C.scene.camera.location

# get the direction to fire a ray to
# the corners of the render border are:
#
#  y1    x1
#  y2    x2

x1, x2, y1, y2 = [C.scene.camera.matrix_world * x - C.scene.camera.location for x in C.scene.camera.data.view_frame(C.scene)]

print(x1, x2, y1, y2)
bpy.ops.object.select_all(action='DESELECT')

# iterate over the render resolution in x and y, using every nth pixel
hitObjects=[]
for x in range(int(C.scene.render.resolution_x / n) + 1):
    newVecx = (y2 - x1) * ( x * n / C.scene.render.resolution_x)
    # print (newVecx)

    for y in range(int(C.scene.render.resolution_y / n) + 1):
        newVecy = (x2 - x1) * ( y * n / C.scene.render.resolution_y)

        # fire the ray and see what is hit
        res = C.scene.ray_cast(C.scene.camera.matrix_world.to_translation(), x1 + newVecx + newVecy, distance=maxDist)
        if res[0]:

            # an object is hit, add it to the list if it is not present yet
            if res[4] not in hitObjects:
                hitObjects.append(res[4])

        if showEmpties:
            bpy.ops.object.empty_add(radius=0.001, location=C.scene.camera.matrix_world.to_translation() + x1 + newVecx + newVecy)

for x in hitObjects:
    x.select=True

authors: Дмитрий Тобис

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


text:
Help with Shadow(s) in Blender (Cycles)
Hello Blender community,
I ran into a problem.... What I want is to exclude the shadow that is cast by object 1on object 3. But the shadow from object 1 on object 2 must remain. How do I Fix this problem?
Hope someone can help

And I guess object 3 should receive the shadow from object 2? Or should it receive no shadow at all? The latter would be easy to achieve.

When the floor plane should receive no shadows at all, you could use this quick fix:

Remove all shaders from your ground material, and plug an RGB node directly into the Surface Pin of the Material Output. This way, only the color of the plane will be displayed, but there will be absolutely no shading (shadows, reflections, etc.) without BSDFs.
If you also want the Sphere to cast a shadow on the ground, things get rather complicated, as Gordon Brinkmann already mentioned.

I think you need to use view layers and the compositor. It's a bit messy but very powerful.
EDIT:

In the example below I created three collections (RMB -> New over
Collection in the outliner editor) then moved each object so it was
in its own collection.
I then created a new view layer, called ViewLayer_001 (click on
the    overlapping square logo right at the top of the outliner
editor)
With the original ViewLayer selected, I disabled the collection with    the vertical plane casting the shadow. For this
view layer there is    just the icosphere casting a shadow onto the
horizontal plane.
With ViewLayer_001 selected I set the collection with the horizontal    plane to holdout. (It's easier to see what's going on
if you select    the filter at the top of the outliner and add the
holdout column, but    you can set these with the RMB menu) This
layer then renders the    icosphere and vertical plane but the
horizontal plane is transparent.    (alph = 0)
I then opened a compositor editor, toggled 'use nodes' at the top,          then duplicated the render layers node and changed the duplicate to ViewLayer_001. I then added a color -> alpha over node to composite    the two.

You might be able to follow the video for my chapter 13 in get-into-blender.com - the video is rather quick without the book, and doesn't answer your question exactly, but the view layer stuff starts after the first minute or so!
Here's a simple blend file with three objects that does what I think you want.

While files, images, and external videos or links may be helpful additions they should not be the only way to solve the problem. Don't make understanding your answer dependent on downloading a file or watching a video on an external site. On this site it is favoured to at least give a basic explanation rather than just saying to watch video and also you can upload files on this site https://blend-exchange.com and follow the instructions there to embed them in your answer. Links to external sites will render the answer here useless if those links expire one day or the content gets deleted.

Oh, and by the way - if the scene contains an object maybe half hidden by the floor like it seems to be the case with the icosphere in the screenshot, simply disabling the floor collection like in your example file will not give the desired result - you have to set it to Holdout.

@GordonBrinkmann yes to both comments. I will add some more description to the answer and fix the holdout in the example!

@all, Thanks for the input.! I will look at it.

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


text:
Changing image sequence in compositor with multilayer (EXR) files using python does not show any layers
I have a compositor setup where I have an image sequence made of EXR files.
I then use the separate layers and connect them to some other nodes later.
Now I want to use a python script to use different images.
With my current code it somehow removes/collapses the layers from the node.
Is there some variable I need to change so that it properly registers the imported images as multilayer files?
def get_image_files(image_folder_path, image_extension=".exr"):
    image_files = list()
    for file_name in os.listdir(image_folder_path):
        if file_name.endswith(image_extension):
            image_files.append(file_name)
    image_files.sort()

    print(image_files)

    return image_files

def add_compositor_nodes(image_sequence, duration):

    scene = bpy.context.scene
    compositor_node_tree = scene.node_tree
    image_node = bpy.context.scene.node_tree.nodes['base_layers_image']
    image_node.image = image_sequence
    image_node.frame_duration = duration
    image_node.frame_start = 1
    image_node.frame_offset = 0

def import_image_sequence_into_compositor(image_folder_path, fps):
    image_files = get_image_files(image_folder_path)

    file_info = list()
    for image_name in image_files:
        file_info.append({"name": image_name})

    bpy.ops.image.open(directory=image_folder_path, files=file_info)

    scene = bpy.context.scene
    scene.use_nodes = True

    image_data_name = image_files[0]
    image_sequence = bpy.data.images[image_data_name]
    duration = len(image_files)
    add_compositor_nodes(image_sequence, duration)

image_folder_path = image_folder_import_path
import_image_sequence_into_compositor(image_folder_path, fps)

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


text:
Add the suffix "_low" to all selected objects
There is a certain number of objects and it is necessary to add the suffix "_low" to all selected objects.

The screenshot shows an example of how this is implemented in a blender and what I tried to get.
I found a similar script, but the current works with the active object.. I didn't manage to make it work for all the allocated
import bpy
suffix = "_low"
act_obj = bpy.context.view_layer.objects.active

if suffix not in act_obj.name:
    act_obj.name = act_obj.name + suffix

import bpy
suffix = "_low"

for ob in bpy.context.selected_objects:

    if suffix not in ob.name:
        ob.name = ob.name + suffix

Hope that helps!
Happy blending!


text:
need to obtain this embossed geometry
I need to obtain a geometry similar tho this in picture. I am a beginer in Blender 3, looked in help files but could not figure out a way to obtain this geometry. It's a kind of a sketched emboss with constant depth in a curved surface. Tried to obtain it from mesh plane but couldn't. Please help.

Begin with this shape:

Bevel the edge:

Cut some edges with the knife (K to activate, A to cut orthogonally, C to cut through):

Extrude these faces (AltE > Extrude Faces Along Normals):

Bevel the corner:

Add these edge loops with the knife:

Correct the topology like this:

Give a Bevel and a Subdivision Surface modifier to your object:


text:
Can't get 'modifier_apply()' to actually apply the modification
I'm looping through the .stl files of a folder to perform a boolean modification on them. Once the boolean modification is performed, I want to delete the boolean operand object (modif_obj) to save the modified .stl alone, and then go to the next .stl file.
The code below shows the part where I'm performing the boolean modification itself.
The problem that I have is that when I delete modifier_obj, the boolean modification also disappears, and the original .stl file doesn't show any modification.
        print(f"APPLYING BOOL MODIF {index}!!")
        bool_mod = tile_obj.modifiers.new("Boolean", "BOOLEAN")
        bool_mod.operation = 'DIFFERENCE'
        bool_mod.object = modifier_obj
        bpy.ops.object.modifier_apply(modifier=bool_mod.name)
        bpy.data.objects.remove(modifier_obj, do_unlink=True)
        print(f"MODIFICATION FINISHED!!\n")

PS: I checked what happens when I comment the line bpy.data.objects.remove(modifier_obj, do_unlink=True) and I observe that the boolean modification was correctly performed but it was not applied, so when I remove modifier_obj, the boolean modification also disappears.
Any idea of what's going on here?
Thanks!! :)

This is a curve. I don't think you can define a boolean modifier on a curve, even if bpy seems to allow it.

No, it's not a curve. The model I'm performing the boolean modification to (tile_obj) is a tile-shaped model. Also as I said, the boolean modification actually works, it just only disappears when I delete the boolean operand. Therefore it means that the modification was done but not applied.

ok, What are these objects? If I try it with two cubes, that seems to work fine.

The objects are two .stl meshes: the mesh to modify is a tile (like very flat cube) and the boolean operand is also like a cube. The goal is to make a cavity at the base of the tile.
If I check what the script did after modifier_apply(), I see that the modification was correctly performed. The problem comes when deleting modifier_obj as it also deletes the boolean modification.
When doing boolean modifications manually, you first make the boolean modification and then you have to apply it if you want it to remain on the model.

is the boolean modifier working well when applied manually ?

if yes, you can try to get the evaluated object instead of applying the modifier.

yes it is working well when applied manually

In my case, I see that `modifier_apply()' performs the modification but it doesn't apply it...
This apply action is what I'm missing, or that's what I think that I'm missing to make the modification remain even after deleting the boolean operand...

could you provide a sample file with the concerned meshes and the relevant part of the code?

the file is not directly accessible. could you make it public or use https://blend-exchange.com/ ?

When you call bpy.ops.object.modifier_apply, the tile object is not the active object. Add the line commented below to you code.
Additionnaly, for the code as it is, as you have several tiles (I presume) but one modifier object, you should import this last one from outside of the loop (and remove it from outside of the loop too).
bool_mod = tile_obj.modifiers.new("Boolean", "BOOLEAN")
bool_mod.operation = 'DIFFERENCE'
bool_mod.object = modifier_obj
bpy.context.view_layer.objects.active = tile_obj           # <<<< add this
print(f"active object is {bpy.context.active_object.name}")
bpy.ops.object.modifier_apply(modifier=bool_mod.name)

Thanks @lemon, it works!
Before I was trying a similar solution (bpy.context.scene.objects.active = tile_obj) but I got an error.
I'll investigate what's the difference between .view_layer and .scene.
The reason why I open and close the modifier object inside the loop is because I want to export the modified tile once the modification is done. If I have the modifier object open at the time of saving the tile, it will appear in the exported model, which I don't want.
Is there a way of opening and closing the modifier object outside the loop and don't have it in the exported tile?

bpy.ops.export_mesh.stl has a parameter use_selection=False (False by defaut), if you select_set(False) the modifier obj and use_selection=True, that should do.


text:
best way to rotate a sphere on a follow path
i need the best way to precisely have a ball rotate on a nurbs path.
in the sample provided, i have the ball enter the scene and bounce, then go to the nurbs path (circle) and rotate for several rotation.
i tried adding a value on the rotation but the ball deforms into an egg shape.
is there someone who can help with this issue.

new file with deformed ball

there is no sample ....

trying to add sample, didn't work

It deosn't seem to deform like an egg in my case

i removed the rotation which allowed for the ball to return to normal size. If you try adding rotation to it, you will be able to see it deformed. i will add new blend file with deformation

Apply the scale of your curve (CtrlA), it deforms your ball when the ball rotates


text:
Cloth issues, going through other cloths
I'm attempting to make a dress in blender 3.4.1 and I have multiple layers of cloth material. When I test my simulation, the cloths fall through each other and I am looking for an answer to why that happens. All I have is 4 meshes, each with the cloth physics applied and a mannequin with the collision physics applied. I have a simple animation that runs a quick twirl just to see the results. I tried to upload the file but it was too heavy for Blend-Exchange but here is a video of what I have so far.

If your clothes are separate objects, do each one have Collisions enabled? If they are one unique object, enable Self Collisions

@moonboots When I add collisions they seem to float upwards and not fall down like it should. Is there a reason that happens?

Maybe tweak the margin, or share your file so that we can test?

@moonboots https://drive.google.com/file/d/17oudo6C0zoX8mW00vasXX3NsTQsoid1S/view?usp=share_link

maybe, to begin with, simplify the meshes (Ctrl E > Un-Subdivide), join them, remove the Collisions physic simulation, enable the Collisions option in the Cloth panel, enable Self Collisions as well?

@moonbots Thank you so much, this helped a lot and fixed my issues :)

oh ok i was not sure that it would be enough but great then  ;)

@moonboots I have another question, I would like to pin the skirt to the mannequin so as she spins the cloth moves with her and doesn't slip. Do you know how this can be done?

You need to create a vertex group that will be the part that stick to the body, and choose this vertex group in the Cloth panel > Shape > Pin Group, is it what you want? @nick nikolaidis

@moonboots when I tried that it pinned the cloth to the general space in the world so if I were to move the body the cloth would not follow

You need to parent the cloth to a bone of the armature

@moonboots If I don't have an armature would it still be possible to pin it because I am currently just using a mannequin with no bones

In that case simply parent to the mannequin object?

@moonboots Thank you again :)

Maybe you should delete some parts of the dress that are hidden, it will help to calculate and they won't go through the layers, and also increase a bit the Distance of the Self Collisions?

@moonboots it turned out great thanks again

Simplify the meshes (CtrlE > Un-Subdivide), join them (J), apply the scale, put a Subdivision Surface below the Cloth modifier if necessary, remove the Collisions physic simulation, enable the Collisions option in the Cloth panel, enable Self Collisions as well, tweak the margin and other parameters.


text:
appearance of rotation not natural
is there a way to make a rotating sphere roll along a surface and look more natural?
Attached is my blend file with a sample. The sphere is rolling along a surface however, due to the fact that its not at 0 on the X on 0 on the Z it rolls lopsided.*presently, both X & Z are at 30 degrees and must remain there.
I would like the X & Z to remain at 30 Degrees and have only the Y rotating.
https://blend-exchange.com/b/ljNDbR4M

Here might be a more general solution to any (straight) path.
I added a Curve::Path, put it at Z=.5m, and rotated along Z to the desired orientation. Add a constraint to the parent sphere to Follow the path created:

Align or copy the Z axis of the parent sphere to the rotation of the path.  This means you now only have to animate the rotation along a single axis, so you will not have to calculate any x/y/z combination to get it correct:

Here's the solution:
And then the coffee break that gave me the eurika moment....
Here's another example where I edited the path to add a curve, and changed only two settings in Follow Path (forward axis is now "-X", and enabled "Follow Curve" so that the Z axis will turn:

and the example with the curving ball:

"might use..."... is it a teaser?

@james_t thanks a bunch. i will try both approaches and get back to you when i'm done.

It took a while for me to catch on to what you were saying, as your file (and no screencaps in your question) didn't make the material markings obvious.  The more time you spend on getting your question clearly posted, the faster and more help you'll get.
You want to keep the relative rotation of the sphere's X & Z:

What I did was to make a duplicate of your sphere, with un-rotated X & Z keyframes.  I then cleared keyframes for the original sphere and parented it to the animated, un-rotated, "sphere.001", hidden and masked from rendering (i.e., invisible).   I think this gets you to what you desire.

An alternative to parenting would be to add the "Child Of" modifier to the rotated, renderable sphere with keyframes cleared.
The explanation.... uhm, well... ?

after following your advice, I was able to resolve my issue. In addition to this, I attempted to have the same sphere roll diagonally across the plane. This does not have the desired natural look as the sphere rotates in forward motion while sphere advances diagonally. Can you provide a fix or direction?

@nicknikolaidis -- i'll try to take a look later today as I have to prep for visitors here mid-day.  I believe that the trick is to get the animation rotation on the parent correct, and so set up the child (renderable) sphere at proper angle to the parent...?

@nicknikolaidis -- I added another approach to help out (?) below.


text:
How change scale text
in command bpy.ops.object.text_add scale not worked    #scale=(0.005, 0.005, 0.005)
import bpy
bpy.ops.object.text_add(enter_editmode=False, align='WORLD', location=(2, 1  ,0), scale=(0.005, 0.005, 0.005), rotation=(1.5708, 0, 1.5708))
ob=bpy.context.object
ob.data.body = "test" #row[0]

one the one hand it appears to be a bug.  However if I use a method like primitive_cube_add(...scale=(2.0,1.0,0.5)...) the resulting objects ends up with a scale of (1,1,1) but with Dimensions changed to accord with my desired scale, i.e., Object:: apply :: scale.  The question is whether you want to report this as a bug (perhaps you should try), or ask the question in this forum: "If I apply scale of a text object, the result is not as expected" (try this yourself).

use radius=0.5

the scale has 3 axes ...


text:
Blender 2.82 - How to get Cycles' motion vector from current-to-next frame, in addition to current-to-previous?
I looked at the doc:
https://docs.blender.org/manual/en/latest/render/layers/passes.html
It says that the Vector pass outputs:
"Motion vectors for the Vector Blur node. The four components consist of 2D vectors giving the motion towards the next and previous frame position in pixel space."
However, it looks like the XYZ component of the speed vector. This is also what I get when using a file output node with .exr format (I get the XYZ in the RGB and no A channel)
My question - is it possible to get the output as stated in the docs? that is, two 2D vector fields, one from current frame to previous and the second from current to next frame?
This can be good since in general the motion transformation might not be invertible (e.g. several pixels in one frame become one in the other frame).
Many thanks!

In order to "see" the Alpha channel populated, you need to turn on the Use Alpha check box of the composite or viewer output.
See this for further details:
Incorrect Vector Pass output (No Alpha & Zero Values)

Thanks! that did the trick in a much simpler fashion!

If it helps anyone, I ended up using the "Nonlinear animation" panel to duplicate and reverse my animation, and then after rendering I can use the 2nd half of the vector field as the motion field from current-to-next frames of the original animation.


text:
transfer weights across separated Meshes?
Not sure how else to phrase this question. and maybe Im not understanding Transfer weights.
My issue is i have this model

I have the armature automatically weighted across each individual mesh, but Im trying copy the weights from where the meshes connect at intersecting vertices.
As you can see with this closer image, the intersecting points don't have the same weights and its causing the mesh to deform incorrectly.

I have tried Transferring the vertex groups using
Source layers selection>by name.
Destination Layers material>all layers.
and mix mode> Mix/Replace.
but its not working the way i expected it to. I'm guessing I'm not understanding how this tool works, and I'm not sure where to go from here.
TL:DR is there a way for me to get the intersecting vertices to have the same weight across all the meshes so they deform as if this were one solid mesh?
Ill keep trying things and looking around for other ways to accomplish my goal and if i figure it out ill be sure to post what i was able to do here.
Thanks for reading!
Edit: I should add that i have also tried making all of the meshes a single object, weighing the armature and then making the segments again and i still had the same issue.

Found the answer to my question, It was something i had already done but didnt do it quite right.
In object mode>Select all Meshes>Join
Move to Edit mode>Select all Vertices>Vertex>Merge Vertices>By Distance

Apply Automatic Weights as normal AND THEN start seperating the parts you want to.


text:
Limit to number of parents an object can have?
I have an object with multiple parents to control it. I have a problem though: if I add one more parent object to it, another parent stops controlling it. Is this normal? This is my model:
Each eye is parented to its own empty that rotates it. The reason I did this is because I have a hooked empty on each eye that allows me to change its expression. If I rotated the eye itself, it would distort because of the hooked empty. I parented the eye and the hooking empty to one axis below the sphere so that I can rotate it around the sphere without moving the sphere itself. Now I can only control one empty, or the other. Not both. Is there a better way I could do this?

I think you'll have to add some explanation of what you mean, because objects can only have one direct parent.

A certain object can only have 1 parent in Blender. You don't need to worry about not being able to control the object the way you want to, because you can also control the parent objects, and so on and so forth. In my example I parented the hooks of the eyes, in which case if both are moved together at the same time will move the entire eye, to a single empty that will move the eye. I did this for both, and parented those empties to a third empty that rotated them around the sphere. Then I parented that empty to the sphere itself so that when I move the sphere, everything moves. I thus solved my own problem.


text:
Animating sphere squash and stretch
I am trying to animate a sphere for a small project I am making that involves the sphere "talking". I know it sounds weird, but I need help on this. My problem is that I am trying to animate the spheres to scale down on the zed axis, but also move downwards to the floor at the exact same time. I could just move the sphere downwards while scaling it, but that is time-consuming. Is there an easy method for scaling the sphere while moving it downwards at the same time? Here are some pictures.
What I want to be able to animate quickly:
Normal resting position

I actually discovered a way to fix this: moving the origin point of the sphere to the bottom. Now it moves up and down on the origin point.


text:
Create a Cube in Blender from Python
I can't quite figure this out, so I am hoping someone can help.
In Python, I want to create an empty object, and add a Cube primitive to the object. After that I want to create a new material, and set the object to use the material.
# Create an empty object.
basic_cube = bpy.data.objects.new("Basic_Cube", None)

# Add the object into the scene.
bpyscene.objects.link(basic_cube)
bpyscene.objects.active = basic_cube
basic_cube.select = True

# Add a Cube primitive to the empty object.
bpy.ops.mesh.primitive_cube_add(location=(0.0, 0.0, 0.0))

basic_cube_mesh.update()

But this does not add the cube primitive to the object. It adds it directly to the scene.
Any suggestions on how to get this to work?

The Add New Object python script template, in the text editor, creates an operator "Add New Mesh" which adds a cube to the scene,

You have to create the object with an empty mesh first, as you cannot assign a mesh to an empty later.
Further: primitive_cube_add(...) is supposed to create an object, since it is the same operator called by Add->Mesh->Cube from the menu.
So you can use BMesh to create your cube later and assign it to the empty mesh:
import bpy
import bmesh

bpyscene = bpy.context.scene

# Create an empty mesh and the object.
mesh = bpy.data.meshes.new('Basic_Cube')
basic_cube = bpy.data.objects.new("Basic_Cube", mesh)

# Add the object into the scene.
bpyscene.objects.link(basic_cube)
bpyscene.objects.active = basic_cube
basic_cube.select = True

# Construct the bmesh cube and assign it to the blender mesh.
bm = bmesh.new()
bmesh.ops.create_cube(bm, size=1.0)
bm.to_mesh(mesh)
bm.free()

import bpy

# Clear existing data
bpy.ops.wm.read_factory_settings(use_empty=True)

# Create a simple human-like model (a basic UV Sphere as a placeholder)
bpy.ops.mesh.primitive_uv_sphere_add(radius=1, location=(0, 0, 1))
human = bpy.context.active_object
human.name = "Man"

# Create a simple TV model (a basic cube)
bpy.ops.mesh.primitive_cube_add(size=2, location=(3, 0, 1))
tv = bpy.context.active_object
tv.name = "TV"

# Create a floor
bpy.ops.mesh.primitive_plane_add(size=10, location=(0, 0, 0))
floor = bpy.context.active_object
floor.name = "Floor"

# Set up the camera
camera = bpy.data.objects['Camera']
camera.location = (7, -3, 3)
camera.rotation_euler = (1.1, 0, 1.1)

# Set up lighting
bpy.ops.object.light_add(type='SUN', location=(5, 5, 10))
light = bpy.context.active_object
light.name = "SunLight"

# Animate the man (simple head turn)
bpy.context.view_layer.objects.active = human
human.rotation_euler = (0, 0, 0)
human.keyframe_insert(data_path="rotation_euler", frame=1)

human.rotation_euler = (0, 0.3, 0)
human.keyframe_insert(data_path="rotation_euler", frame=50)

# Set the animation end frame
bpy.context.scene.frame_end = 100

# Save the file if needed
# bpy.ops.wm.save_as_mainfile(filepath="/path/to/your/file.blend")

Hi, thanks for the post. This site is not a regular forum, answers should be substantial, stand on their own, and thoroughly explain the solution and required steps. One liners and code only posts rarely make for a good answer. If you can, [edit] your post and provide some more details about the procedure and how it works, perhaps add a few images illustrating some steps and final result. See How to write a good answer?, otherwise it may be converted to a comment.

Also please use proper code formatting when posting code snippets.

This is GPT generated, and doesn't actually attempt to answer OP's question, because it adds a cube object, not cube primitive inside the object.


text:
Set background color: always black despite horizon color?
The documentation here says

So I followed, setting mine as follows

However, the rendered background is still black instead of white, as below.
What might've gone wrong here? Many thanks in advance.

@cegaton Thanks for the prompt help! I did (http://imgur.com/a/hdlKE), but still black background unfortunately.

Have you tried changing all three colors to white?

@CyberBurst Changing ambient color to white makes the object white-ish, and meanwhile the background is still black...

@MrZak Sorry for being unclear. I've updated the screenshot so that you can see the background isn't really white. What I care most is the final rendering generated by clicking the "Animation" button. In that rendering, the background is pure black.

Do you mean that if you render using F12 (not animation) it renders with white color ? And is that rendered model and the background on the screenshot (because it looks like it is in Solid shading mode) ?

Thanks! This is the rendering in Blender after clicking the "Render" button: http://imgur.com/a/UQgVm, and this is the .png image (viewed outside of Blender) I got after clicking the "Animation" button:  http://imgur.com/a/XDIfE. My apologies for causing the confusion. Thanks again.

So you are using alpha in Shading rollout in BI (you might want to edit question with that). In that case you won't see the background in BI (it's considered as transparent). As to 3rd party viewer - can it preview alpha channel ? In anyway that .png (despite of quite bad interpreting alphas by .png) is transparent in black areas. The animated output should be rendered into image sequence (preferably not png) and overlayed with Alpha Over, not rendered into video directly.

If you would like to view the background in the viewport, in the Properties Tool Shelf (Shown by pressing the "N" key) and under the "Display" tab, check "World Background"

Hold down Shift and press Z
This switches to Rendered Viewport shading and Shift+Z is the hotkey that toggles it on and off.
If this does not work, try uploading the .blend file?

In shading section of the render tab in the Properties panel, change the Alpha from Transparent to Sky (little camera icon).
I faced the same problem in Blender render.

Please avoid using multiple exclamation marks and punctuation in your answer. This makes your answer look messy and not like a serious answer. Also make sure your grammar is good enough for non-native English speakers to understand, and screenshots added to your answer can really help others out in finding what you're talking about. Click the "edit" button below your answer to make the proper changes.

Change to the cycles render,  I'm using blender 2.79b. Only changing the render works for me.


text:
Imported .obj planes are all the same?
I have a simple planes.obj file that specifies three different planes as follows.
o Plane.001
v 1760.196289 415.064117 4.388165
v 1873.999268 475.749756 4.069328
v 1774.738525 408.389893 4.310055
v 1658.910156 367.099365 4.609004
usemtl None
s off
f 1 2 3 4
o Plane.002
v 1873.999268 475.749756 4.069328
v 2020.038696 542.020508 3.850709
v 1908.386230 464.870331 4.095686
v 1774.738525 408.389893 4.310055
usemtl None
s off
f 1 2 3 4
o Plane.003
v 2020.038696 542.020508 3.850709
v 2064.233643 566.508362 3.762149
v 1948.476562 485.951721 4.011188
v 1908.386230 464.870331 4.095686
usemtl None
s off
f 1 2 3 4

When I imported it into Blender, the three planes are all the same. The demo below shows the three planes were stacked perfectly into one plane until I moved them apart.

Am I defining the planes wrongly?

you have 12 vertices, but are only using 4...
'f 1 2 3 4' is your first plane, so edit second one to read 'f 5 6 7 8' and third one to 'f 9 10 11 12'

Ah, I feel so stupid! Thanks a lot! (I thought the ordering numbers are local)


text:
Corner case of BVHTree's ray_cast(): ray hitting thru a vertex (not face) of the geometry?
I'm playing around BVHTree's ray_cast() method.
I pick a starting point, s, and compute the ray direction as e - s, where e is a vertex of the object. Then, I construct a BVH tree from this object and cast the ray.
obj_tree.ray_cast(s, e - s)

There's no other obstruction from s to e, except e itself.
According to my experiments, strangely, there are two outcomes for different vertices being e.

ray_cast() reports an intersection, and the intersection is just e (numerically; difference within, say, 1e-7);
ray_cast() reports no intersection.

Both make sense to me, but I'd expect only one of them happens.
Is this a bug from this corner case, or does ray_cast() have its reasons to report different results?

Relevant snippet of the code:
world2obj = obj.matrix_world.inverted()
start = world2obj * v1 # in world coordinates
end = world2obj * v2
direction = end - start
_, _, face_idx, dist = obj_tree.ray_cast(start, direction)

Please post more code than  obj_tree.ray_cast(s, e - s)  Have you, for instance, put the arguments to BVHTree.ray_cast in object space?

Never used obj_tree.ray_cast but it can make sense if you take the computation errors into accout.(vector operations precision)

@batFINGER Thanks! I've supplemented the relevant part of my code. Yes, I did transform coordinates into the object space.


text:
Only the text shows in rendered view
So I've been having this problem in Blender 2.79. Every time I go to the rendered view. This happens:

When it should look like this:

Is there any way I can fix this? Thanks!

Hello,please give more info : share your whole screen

or even better...show us your blend file

With no further information there could be two main reasons:

If the object is visible in the Viewport, but invisible in the rendered image, you've set Disable in Renders for the object.
If it's already invisible in 3D Viewport when you set the mode Viewport > Rendered (as your question sounds like), you probably disabled Camera Visibility under Properties > Object > Cycles Settings > Ray Visibility


text:
How can I make a polished granite texture in Blender Cycles?
Basically I'm trying to make a realistic polished granite texture to apply to my 3D model of a countertop... The granite resembles glass, as it's glossy... The countertop looks like this:

The granite inspiration looks like this:

What have you tried as far and what are you struggling with?

Does it need to be 3D relief or just a procedural material?

Easiest way is to follow a tutorial! https://www.youtube.com/watch?v=bPaZYBFE8dY for instance.

Here's a first shot, trying to keep it as simple as possible, in 2D:

It uses one softly quantized Musgrave texture for the main features, slightly stretched, for the grain direction, and another mixed to 'Darken' it, introducing sporadic, more isolated speckles. That branch also enriches the background a little..

On the left, your reference. On the right, the procedural texture. I'm sure you could tweak it a little further.
This does not go as far as attempting to simulate the crystalline transparent features. I personally think,  to do that, you'd have to go down the road of parallax mapping or somesuch.. a lot more node.,, but I could be wrong, there..

In my estimation, any attempt to do transmission and other components in the same shader leads to the problem of rays that enter the mesh and don't necessarily exit at a point that 'accepts' transmission, if that makes sense.  Perhaps it's a problem in general, but nowadays my theory is that a geonode system to distribute a manifold mesh for those elements would be better.  Haven't tested it.

Hi, @AllenSimpson! Sounds like a reasonable estimation to me. I've seen parallax with partial scattered transmission.. but glinting and internal reflection? Seems like fakery on fakery, and a miserable time figuring out how to make one fake compensate for another fake. But that might be pessimistic.. it's Rich Sedman territory ..:D


text:
How to correct stretching of the texture in curve?

I want to apply this texture to the curve. But the scaling of texture stretches (right end) whenever I extrude the control points.. And If I add subdivision, it is affecting the other segments of the curve texture... How can I apply the texture uniformly to the curve? I didn't convert the curve into mesh.
Resources:

The solution would be to subdivide but you say that you don't want to, there may be another solution...

And the other solution is?

I meant maybe someone knows another solutionbut I don't   ;)

Should be possible to do it with geometry nodes. I added the tag for geometry nodes experts to spot it easier.

As mentioned before, the solution could be to subdivide. Another ways will be to convert to mesh, use the looptools to space the vertices and convert back to curve, but you will basically add subdivisions after that Here is an example

really Means a lot Thank you

Since you also asked for a solution based on Geometry Nodes, here is a suitable answer:

It may look a little complicated, but essentially I just use the Curve to Mesh node here.
All other nodes are only used to create the UV mapping correctly.
I use the spline length of the base spline for $U$, and the factor of the profile curve for $V$.
However, in order to avoid the common problem of incorrect mapping when using cyclic splines, I also use a few math nodes to check which value should be used here for the end of the spline.

PS: If it doesn't work well in your case and you actually have to resample the curve, you can also use the Resample Curve node:

...And you can of course use a lot of other solutions for this, such as this one, but in this simple case the solution shown here should work well.
(Blender 4.1.0+)


text:
How to get the 3D cursor to align with an edge when using Cursor to Selected
I swear this used to be a feature by default and maybe my preferences got screwed. When using the option of cursor to selected with an edge selected how do I make the cursor copy the rotation as well like in the image?

Snap Cursor to Selection operator never used to do that as far as I can remember. Maybe you used some add-on for that?  It's definitely possible to write an operator for that using Python.

You can interactively position the cursor using  Shift  +  RMB  dragging. It's also possible to use snapping functionality while in that operation by holding  Ctrl   as well. So if you set snapping options to Edge Center together with Align Rotation to Target, you can do that.

I am holding  Shift  , then hold  RMB  and start dragging and then press and hold  Ctrl  for snapping in the GIF.


text:
UV map desasterously misplaced
I hope you can help me with this model. I try to texture paint some shading on it but I seem to have destroyed the UVmap.. I checked the normals orientation and tried using smart UV unwraping or Unwrapping, I made a new texture, checked overlays.. When I used the grid texture I saw that the whole thing is horribly distorted and looks nothing like the uv map on the left. Even if I try to correct the left side map nothing changes on the model.. Now I'm left wondering why they differ and what I just don't seem to understand.
If somebody can help me out it would be highly appreciated!

Hello maybe you have 2 UV maps? Check the Data Panel > UV Maps?

You got a "pinned" UV map/image there. Maybe you're not looking at the correct UV map after all.

If you happen to have a disastrously misplaced UV map a good solution for that is to just create a good one instead.
You can delete the UV map and create a new one:

All UV maps the mesh has are listed there, so if you for some reason expect the mesh to have a different one, it could be there as well. You can have multiple UV maps and choose which one to use for specific textures with UV Map node in the Shader nodes.
In any case, if you create a new UV map it's empty and you have to create the UVs in it. The most common way is to unwrap. That workflow consists of 2 very simple steps:

Select some edges in edit mode and mark them as seams. It's very important to think well about how the surface will be unwrapped and where you want the seams.

Select all(or just the part of your model that you want to unwrap) and unwrap. In current Blender version 4.3 there is now a choice of 3 unwrapping algorithms that use seams:

Try all 3 algorithms, see what works best for your case. There is no single algorithm that works best for absolutely everything and in different situations you may want to use different ones. Choose one based on your model and circumstances.
After unwrapping you can adjust the UVs in the UV Editor and lay out the islands in a way that makes sense to you for the texture. It's always a good idea not to waste texture space and try to fit them in a way that they take up as much of the area as possible. You can also pin UVs in the UV Editor( P  with some UV points selected). Pinned UVs will not be altered if you unwrap again and the unwrap algorithms will try to adjust everything else to the pinned UVs remaining in place.  Alt  +  P  unpins selected UVs. There are a few other useful features in the UV Editor:

You should really get yourself familiar with all of them. There aren't that many anyway. Don't forget you can use proportional editing and even some sculpting brushes as well:

Woah, I didn't know that one object can have several UVs! That helped so much!! I have selected the correct UV now and it is shown on the model. Unfortunately I have another problem now. When trying to paint on the 3D Model in the Viewport nothing is visible in the material vp, but the paint shows in solid mode ... on the other hand I can paint on the UV and it shows on the model, but I have to paint on the model itself to make small shading edits.. Also the paint I trial painted on the UV doesn't show in rendered view in Cycles .. do you have an idea why that is? Thank you for the help! :)

If you have more questions, ask them as separate questions. Search if they have been asked before though. I am sure there must be answers about texture painting here already.

okay, thank you!

Mind the terminology as well. The term "UVs" usually refers to UV vertices. Objects may have multiple UV Maps that have many UVs each.

@AnimBlenderino if Martynas' answer was correct, mark it as such

Thank you guys! The double UV maps you mentioned were the first problem and I also didn't know I have to save the texture image before switching views. Now it shows in all and everything works awesome! I marked the message as correct now, as it was my first post I didn't see I could and I will mind the difference between UV and UV maps. Thanks a lot!


text:
How to use bl_label inside an operator?
How do I reference the bl_label inside operators? I want to know the name of the operator based on the bl_label to be precise.

Hi. I hope you don't mind my edit. If you meant something else please edit the question and correct it.

@MartinZ it is a slippery slope to answer, and then edit question based on answer. Recommend asking, via comments,  for clarification first.

It wasn't formed clearly. I believe this was the intended question and encouraged yarun can to correct me if I am wrong. You might be right though. I will try to keep this in mind.

You define bl_label inside the operator's code as a variable so after that you can reference it as any other variable inside the operator. It would be self.bl_label:
import bpy

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    @classmethod
    def poll(cls, context):
        return True

    def execute(self, context):
        print(self.bl_label)
        return {'FINISHED'}

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

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

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.simple_operator()


text:
Why could a material look different in rendered result and in viewport Rendered shading mode?
This is my first node group and I can't figure out why the material showing up in the viewport looks different than what is rendering. Please, can someone help?
Rendered material:

Viewport material:

Here is the .blend file:
https://www.dropbox.com/s/psnl2vj0j4vvc4s/blenderMetal_mat.blend?dl=0

Wow, that is really interesting.  I couldn't find anything obvious.  I wonder if it's a bug with Pointiness, or maybe they optimize some calculation in the viewport to make it faster at the expense of accuracy?


text:
How create a collection instance with python
Hi how create a collection instance with Python code example (How to avoid operator `collection_instance_add`?) this code does not work I not can link this instance to the collection
Error
Python: Traceback (most recent call last):
File "C:\Users\xxxxx\script.blend\Text", line 13, in <module>
RuntimeError: Error: Object 'my_new__obj_instance_name' already in collection
'the_name_of_the_collection_to_use'

code not work
source_collection =   bpy.data.collections["the_name_of_the_collection_to_use"]
instance_obj = bpy.data.objects.new(
name="my_new__obj_instance_name",
object_data=None
)
instance_obj.instance_collection = source_collection
instance_obj.instance_type = 'COLLECTION'
parent_collection = bpy.context.view_layer.active_layer_collection# not work
parent_collection.collection.objects.link(instance_obj) # not work

I need an alternative command bpy.ops.object.collection_instance_add

Hello, please post your script in its entirety, this error is most likely caused by you already linking the object to this collection previously. Also, it doesn't make sense to put a collection instance in the collection it is instancing. You risk breaking the fabric of reality and creating a black hole because of an infinite recursion

I want to create a collection instance bpy.ops.object.collection_instance_add

As stated in the second part of my comment, you can not link a collection instance in the collection it is instancing, that would create an infinite recursion loop. Click on another collection in the outliner to make it active before executing the script


text:
Problem with flatbed cameras
2]2I am new to blender, I am currently doing a camera tracking on a bezier. But the problem is that when I choose the target for the camera constraint it becomes flat. And the view does not render anything. Knowing that before applying the constraint it works and that I apply 0 location and 0 rotation before constraining it. Thank you for the answer.

Hello could you please share your file (only keep the useful objects)?

What do you mean, the camera becomes flat? Apart from sharing your file the least you could have done would have been to show some screenshots of your constraint setup for example...

Hello, first of all thank you for your answer. I have just added a screenshot with the camera, the view from the camera and the constraint. And I said that the camera is flat, it's to explain what the camera looks like in the left part of my screen.

please share the file, only the camera and curve

Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.

https://we.tl/t-LjYdn0cgIu this is the link in wetransfer, is the.blend with just curve and the camera. Thanks

You need to apply the scale of your curve (CtrlA). Once done, don't forget to bring back the curve vertices radius to 1 (in Edit mode select all and right click > Set Curve Radius > 1)


text:
Can't find the name of my Vertex Group
I am encountering a very strange problem. I have assigned a vertex group in my shrinkwrap modifier some time ago. Then I worked with my rig that has a lot vertex groups for my deformation bones. I can see that the vertex group "NoShrink" of the object is assigned in the Shrinkwrap modifier. But I could not find it in the vertex groups of the object data properties. The modifier accepts this non-existing group and works properly. Now I want to change the weights of the vertices in the vertex group but I can't find it. What could have happened? Is it hidden? I have never heard of any way to hide the name of the vertex group in object data properties window. I searched it by typing the name in search box, also I scrolled down manually through all those vertex groups carefully a couple of times and still its missing. But the shrinkwrap modifier has this vertex group assigned to it and shows no error. Please help.

The vertex group must be in the object that has the Shrinkwrap modifier, not the target object, is it the case here?

No that is not the case here. Its actually the same object. The target object 'head' does not have any vertex groups. Moreover this modifier is on the 'body' object so I will not be able to select any vertex group of the 'head' object. The thing is: The modifier works normally as long as I don't erase the vertex group name in the modifier. Once I erase it I can't add it again. Which means that it does not exist. If I delete all the vertex groups of the object then the modifier shows an error. I do not understand why it does not show its name in the Vertex groups of the object data properties.

Could you please share your file? Only keep the useful objects https://blend-exchange.com/

I have shared the file. I have to delete the target 'head' object too because its huge. But you don't need it. The problem is still the same.

So what object is supposed to shrinkwrap onto what object?

The 'body' object is supposed to shrink wrap on an hi-poly model named as 'head' which just the hi-poly version of this 'body' object. I deleted it because its over 300mb. I made the 'NoShrink' vertex group to exclude the inner mouth and eye area from shrinking into the hi-poly model. The problem is: You can see the "NoShrink" vertex group in the modifier but you can't find the name in the vertex groups of the object data properties.

Yes that's weird but what about creating a new vertex group in the vertex group list then select it in the modifier?

Yes that will work. I am just wondering where my 'NoShrink' vertex group is. It shouldn't just vanish like that. If the modifier is able to accept the vertex group then it must be somewhere. So where can it be? why is it not listed in the vertex groups?

You must have deleted it accidentally, you can test it yourself, select a vertex group in the Shrinkwrap, then delete it in the Vertex Groups lists, the vertex group will still be displayed in the modifier

You are right. I created a new vertex group and added it to a new shrinkwrap modifier. Then I deleted the vertex group but it still appears in the shrinkwrap modifier. It only shows a error in the shrinkwrap modifier if I delete all the groups. Seems like the modifier is not taking a reference, instead it is taking a copy of the vertex data, which is  strange. Because then in that case it should not show an error even if I delete all the vertex groups. Anyway I don't know what to make of it.

in any case since the modifier is somehow holding that vertex group data even after deleting it from the vertex groups of the of the object data properties, is there any way to get that vertex group back?

No you need to recreate the vertex group in the Vertex Groups list and reassign to the vertices, the blend file has not kept the vertex group somewhere

You must have deleted the vertex group accidentally but it still appears in the Shrinkwrap modifier nevertheless. You can test it yourself, select a vertex group in the Shrinkwrap, then delete it in the Vertex Groups list, the vertex group will still be displayed in the modifier. You can't recover this vertex group, you need to recreate it in the Vertex Groups list and assign the vertices you want.


text:
How to change the color of the material depending on the camera view angle?

The wings of an insect produces a rainbow of colors at certain viewing angle. How do we replicate this kind of effect in a game character?
I know how to bring that effect within blender but if I want to export the model games, is this effect possible with some texture maps?
I have attached a gif image of a game character for reference. I am concerned with its wings that changes its color according to the camera view angle. Its gives a rainbow kind of color or like an oil reflecting... (I don't know the correct term). How do I bring this kind of an output for a game character?
Are these shaders in-built in game engines? or are there any texture map that brings these effect? Please tell me about this.

Hi. Please use a title that matches the content of the question. It should be descriptive but succinct, unique and identifying, summarizing the issue so that anyone searching for a similar problem is likely to find it. Remove anything superfluous, avoid using words like "this", "help with", "issue" or "question about", instead describe what "it" is. Remember, your title is the first thing potential visitors see, answers you get depend heavily on how insightful it is. See What is the problem of asking “How do I do this?"

Not sure if this is relevant to Blender SE.  The shaders have to built in-engine.  But, those shaders may use textures (for example, to specify the colors at certain angles-- maybe, here, a sphere map aka matcap.)  It's not shaders or textures; most of the time, it's shaders and textures.


text:
How to close a hole in a model?
I've watched several tutorials but I'm still struggling with what should be a simple task. I would like to modify a mesh imported from STL file for 3D printing it. The model has a solid surface with a pass-trough hole that I'd like to close. I selected the upper border of the hole and closed it by pressing F, then I did the same on the lower border. This effectively closes the hole but it leaves the inner walls of the hole. Hope the picture explains better.
This is what I obtained (section):

I'd like to get to this:

What is the right procedure?

As it stands it's difficult to understand exactly what you're asking. Post an image of your object in Edit mode showing the problem. You can use Blender's Window > Save Screenshot to do that, then edit your question and add the image. You can also share your Blend file via https://blend-exchange.com/ following the instructions on that page to add the link to your question.

Hi, @DeadMeat. Since you hinted you might not be particularly happy with your English, I attempted to improve it a bit by editing in hopes this would make the question a bit easier to understand. I hope you don't mind my edit. Please, edit it again if you feel I changed what you meant to say.

Hi @MartynasŽiemys you perfectly summarized , thank you very much. That is exactly what I am trying to achieve. The only difference is that the "hole" has an irregular shape (i.e. not circular) but I'd assume the procedure is the same...

F hotkey is for Make Edge/Face operation and it does just that - only fills whatever is selected with a face, but it does not remove any geometry so if the hole has walls, you still have to remove them after making the faces that cover it. You need to select the faces that make up the walls of the hole and delete them with X or Del.

Thank you, got it. what was confusing me is that if I first close the hole it becomes quite difficult to properly select the internal faces.  Deleting the faces before like @laserlars suggested made things a lot easier and I managed. I now need to understand how to properly select the internal faces in case of irregular shapes, but in any case manually selecting solved the problem.

You should first delete the inner 'tube' and then fill the holes, since selections are easier this way.
Go into Edit Mode and select a face inside the hole, then Select > Select Linked > Linked Flat Faces and increase the 'Sharpness' threshold until all inner faces are selected.

Then delete the orange 'tube'

Alt+Leftclick one edge segment to get the whole ring and hit F to fill the Face.

Repeat the last 2 steps for the bottom side.

Thank you @laserlars, this actually did the trick. Only problem the selection of flat faces didn't work. I assume it depends on the shape of the "hole" that is not regular but selecting individual faces one by one and deleting did exactly what I needed. I now need to practice with the select tools.

to do this you have to switch to edit mode and right next to it, select face select at select mode. Now you can only select the inner walls of the through hole and press del.
in the appearing delete popup choose faces.
Greetings


text:
How to make glossy material reflect spotlights into volume?
I want to be able to create a nice spotlight effect with a spotlight being shone on a mirror or some sort, and be able to see these reflections through a volume scatter, I've tried a few times to get this to work but it just doesn't reflect and will just scatter once hitting the ground

I've done lots of things like make it have 0 roughness but that reflects everything above

and I've tried in other scenes and attempted disabling the original light sources volume scatter visibility and that just shows a scatter effect

What I was wanting is something like

I don't really want to have to create more lights under the glossy surface to mimic the effect.

For that effect to work you would need to enable Reflective Caustics, which Cycles doesn't excel at. Even if you enable them I'm not sure the current engine supports reflection caustics over volumetric materials, but I may be wrong

interesting, I seem to remember trying to enable caustics as I remember using them before, is there any workaround, I don't really want to have to create more lights under the glossy surface to mimic the effect

https://blender.stackexchange.com/questions/39663/laser-beam-pathway-with-reflective-mirrors https://blender.stackexchange.com/questions/1096/making-a-laser-in-cycles-straight-beam-of-light https://blender.stackexchange.com/questions/53548/using-nodes-for-laser-line https://blender.stackexchange.com/questions/150277/how-to-visualize-reflection-of-a-beam-or-ray https://blender.stackexchange.com/questions/62750/laser-scanner-shadowing

You can either use try blender-octane-edition(free/paid), or check out this video https://youtu.be/Sbfj7A7jqTo. I know this video is weird but, I think it suits for the purpose


text:
Blender Menu, Panel and Operator
There is a lack of clarity in where to use Blender menu, panel or the operator. I am familiar with inheritance in Qt where QDialog, QWidget, QMessageBox, QMainWindow are used as required. As a matter of fact ncurses library and wx also has similar inheritance pattern.  I know there is no relation between Blender and Qt, or wx or ncurses but I was trying to learn from the Blender Python documents and information is very sparse. Is there any secret manual available somewhere? Also I'm not keeping any other library as a template to compare against Blender types, I'm just new to the whole of Blender.

To be honest, I do not understand the purpose of this question. Why don't you just use them where you need them?

I could have framed the question better if I did understand the topic as well as you do. Sorry for the noob jargon. My problem is I want to know about creating native ui elements by inheriting the bpy.types.<menu, panels or operators>. I am confused where to use what.

The templates are in the Text Editor's Templates menu, by the way. A panel is an area in the UI, a menu is ... well, a  menu, and an operator is sort of a function/feature of Blender that performs some action so they are very different and I am a bit confused, what exactly might not be clear about when to use them... Use a panel, when you need a piece of UI, a menu where you need a list of some operators to pop up, and operators where you need some actions/operations performed...

Also well covered here https://docs.blender.org/api/current/info_quickstart.html


text:
How do I show the preview image in the background when compositing?
I am compositing in Blender and although I have my backdrop on, I am unable to see a preview of what I am compositing. How do I preview my composite in Blender?

Add a Viewer output from Add Menu(Shift+A) -> Output and connect something to it.

Use V and Alt + V to zoom out and in and Alt + MMB to drag the image around.


text:
How do the H.264 encoding settings work in blender?
When encoding videos with H.264, I'm used to the constant rate factor compression setting. However I don't see anything like it in blender's options:

Is there a way to set the constant rate factor from the GUI? If not, what do these settings do? I can only assume they are for the two-pass method, but I'm not sure which ones correspond to the descriptions in the wiki.

Further down the page you refer to you, under additional information you will find ABR (Average Bit Rate) where you will find the -bitrate, -minrate, -maxrate and -bufsize that correspond to blender's settings.
The bitrate is the target rate (average over the length of video) that you want to achieve. The minimum and maximum define how far from the average it is allowed to deviate.
Video compression works by only updating areas of video that change and compressing those areas. Like jpeg the amount of compression can vary depending on the quality you want in the final image. If high quality compression pushes the bitrate higher than the maximum limit then it needs to lower the quality to stay in the range.

Prior to version 2.79 blender did not support CRF-style encodings.  2.79 added this, although the mapping from labels to numbers isn't obvious.  Hopefully an answer to What numerical CRF values do the assorted output qualities correspond to in the ffmpeg video encoding options will clear that up.


text:
How to select different bones while in weight paint mode?
I seem to remember being able to select different bones of a rig while in weight paint mode.
However, now when I try to do this I end up selecting a face (used for masking) instead of the bone:

How did I change this and how can I select bones while in weight paint mode?

Upon further investigation this face selection is used for masking, and bones can be selected with ⎈ Ctrl RMB.
However, I can't figure out where this behavior came from.. I've tested it in blender 2.69 through 2.73, and in every version blender defaults to selecting bones with plain  RMB and there seems to be no way to select or enable selection of faces while in weight paint mode. I couldn't find any settings regarding masking while in weight paint either.
So the real question is: What did I enable to allow this face selection masking feature?

Wow! I never came across this before! Could be handy once we figure it out . . .

@NoviceInDisguise Indeed, I actually quite like the face masking feature. But I'd like to know how I enabled it.. I vaguely remember reading about something like it in some release notes or something somewhere, however no amount of googling as helped me find where I read it. I even manually re-read all the release notes since 2.67 or so, but didn't see anything. A real puzzle :P

In Weight paint mode, Face masking can be turn on and off by M, vertex masking is V, if that's what you are wondering.

@LeonCheung Thanks, that's exactly it. Feel free to write it in an answer ;)

Although the officially-suggested workflow is to select face mask by switching to Edit mode (since more powerful selection tools there), you can also quickly select faces or verts for masking In Weight Paint mode by toggling the two  buttons located on the headerbar, or simply press M or V to toggle them on/off.


text:
How to control the direction a bone rotates?
I rotated the upper arm bone of my armature approximately 180° by hand (with R and the mouse), but it goes around the wrong way:

I tried going to the problem keyframe, rotating the bone ~-360° (i.e. the opposite direction it rotates in the gif above, but so it's roughly in the same position), however this didn't seem to help.
How is the rotation direction defined in such cases? How can I control it predictably?

I think shortest path plays a part, one or two degrees can make it go the other way. I think the easiest solution is to add a middle keyframe, key start, key half way in front, then final pos. To fix after would be to change the curves in the graph editor. Care to share?

@sambler I actually just tried deleting the keyframes and re-animating, being absolutely sure I rotated it around the right direction after pressing R. I'm not sure if that's what did it, but it worked. Unfortunately I only now realized I don't have a backup with the old keyframes, but I could make a fresh test file if you want.

If you have a working copy make a backup, and if you can re-create the error then compare the curves in the graph editor and see how one rotates different to the other.

I guess if you use quaternions you could just invert all components signs of one keyframe to get the opposite rotation. But a full 360 degree rotation might still need intermediate steps.

Experiencing this kind of rotation interpolation problems are not common in your case because you are using Quaternion Rotation. But similar problems can be found easily in the shoulder-like joints if you are using Gimbal rotation (any of the Euler XYZ combinations). Anyway, there is a similar approach for both cases.
First, you need to know what kind of rotation is being used. It's simple: under rotation axes you'll find Quaternion or Euler (in this case means Gimbal).
The common solution for both rotation types is adding one (or many) inbetween keyframe to "force" the rotation to go through your desired way (like @sambler told in the comments). If you are working with Quaternions, doing that is a must in big rotation changes.
Why does it happen? In Quaternion, the WXYZ axis are defining a point in a 4-dimensional sphere. For better understanding, we can imaging the same applied to a circle in this image:

So the rotation is actually a point traveling through a circle but not only through the edge. In your case, I think that your rotation was more than 180 degrees, so the interpolation went by "the other way" of the circle.

Note that the spacing of the rotation is not linear, so it's always recommended inserting inbetween keyframes specially in big rotations.
In Gimbal that's caused because of the gimbal lock. Gimbal axes are parented between themselves. So if you're working on a Euler XYZ setup, X is the child of Y, which is the child of Z. If you rotate 90 degrees the Y axis, then the X axis will align with the Z resulting that two axes are doing the same rotation and you have lost a rotation axis actually.
So there's another solution if you are working with Gimbal: Euler Filter. Euler Filter is located in the F-Curve Window in the Key Menu:

There is plenty of material in the Internet about Gimbal lock. If you want to know more about Quaternions or Gimbal in Blender, are pretty well covered in Nathan Vegdahl's Humane Rigging DVD (you can check Quaternions video here). Actually the two circle images are from that video (under a CC Licence).


text:
Dot matrix display in Cycles?
Is it possible to make a dot matrix look with cycles?
I attempted this with the following node setup:

However, the dots should be round, and each dot should only have one color. As you can see, this is not the case:

This was possible in BI with a technique described on the wiki.
How can I achieve this?

How about something like this?

Or, even more fun:

Or a ball:

Or a tribute to the question author:

(I am having way too much fun with this)
The dot aspect ratio depends on your UV unwrap, so you can customize it as you want. I have gotten them to be square on a non-square image, but having a square image makes it a lot easier.
Workflow:

Identify the nearest hole.
Find the distance to the hole.
If the distance is greater than the radius, use transparent. Otherwise, use the central color of the center of the hole.

EDIT: GitHub user @JayFoxRox has kindly
suggested some helpful simplifications to the below node
setup. Instead of computing distance by taking the square root of the
sum of the squares of components, simply compute squared distance by
taking the dot product of the two inputs via the Vector Math node.
(Then, of course, compare this to the squared radius instead of the raw
radius.) And the “Combine Vector” and “Separate Vector” node groups now
exist as first-class “Combine XYZ” and “Separate XYZ”, anyway. Thanks!
Blendfile: Dropbox, Blend-Exchange.
Usage:

Main node setup (right-click → Open Image in New Tab to see larger):

Separation (top) and combination (bottom): (would be nicer if it were built-in)

Distance: (Pythagorean theorem/Euclidean norm)

@Mentalist: Thanks for rehosting the link.

Great job, very useful could I ask a question? How can change the number of dot matrix?
Thanks in advance
france

@france Have you tried playing with the "spacing" and "radius" inputs?


text:
How to bake vertex colors to texture in purely the python API?
Trying to write a python script using only the blender API to convert vertex colors on a mesh to a texture so I can eventually save it to an .mtl file.
How should I go about it? I'm running bpy version 3.4.0
Currently loading the mesh, creating the uv-map and unwrapping it seems to work, but it crashes when trying to set the image to the uv map.
This is what I tried so far:
texture_size = 1024 # arbitrary choice

# delete the starting cube
bpy.context.scene.objects['Cube'].select_set(True)
bpy.ops.object.delete()

# import mesh
import_mesh(temp_mesh_path)

# select the mesh
# here load the vertex colors to the mesh
set_vertex_colors(vertex_colors)

# make a UV map and unwrap it
uv_layer = bpy.data.meshes['temp'].uv_layers.new(name='MathTextureUV') # if 'MathTextureUV' not in blendermesh.uv_layers.keys() else blendermesh.uv_layers['MathTextureUV']
uv_layer.active = uv_layer.active_render = True
# unwrap
bpy.ops.uv.unwrap()
# new image to lay over the UV map.
image = bpy.data.images.new('MathTextureImage', texture_size, texture_size)

# creating a new mesh UV https://b3d.interplanety.org/en/how-to-create-a-new-mesh-uv-with-the-blender-python-api/
bpy.ops.object.mode_set(mode = 'OBJECT')
for uv in uv_layer.data:
    uv.image = image      # <-- HERE ERROR: AttributeError: 'MeshUVLoop' object has no attribute 'image'

ob = bpy.context.active_object
VLayer = ob.data.vertex_colors.new(name='MathTextureVColor') if 'MathTextureVColor' not in ob.data.vertex_colors.keys() else ob.data.vertex_colors['MathTextureVColor']
VLayer.active = VLayer.active_render = True
#  bpy.ops.object.mode_set(mode='VERTEX_PAINT')

bpy.ops.object.mode_set(mode='EDIT')
bpy.context.scene.render.bake_type = 'VERTEX_COLORS'
bpy.ops.object.bake_image()

Currently it crashes at
for uv in uv_layer.data:
    uv.image = image

with error AttributeError: 'MeshUVLoop' object has no attribute 'image'
When checking the available attributes to this object with dir(uv) I indeed only get the following: ['__doc__', '__module__', '__slots__', 'bl_rna', 'pin_uv', 'rna_type', 'select', 'select_edge', 'uv'] and not 'image'

Hello and welcome. What have you tried?

Thanks! I've edited my question with code and extra descriptions


text:
Python: AttributeError: 'MeshUVLoop' object has no attribute 'image' in 'object.data.uv_layers.active.data'
I'm trying to add an image to the UV faces. But it seems it's not working in Blender 3.4.0. Maybe I'm doing something wrong?
image = bpy.data.images.new('MathTextureImage', 256, 256)

uv_layer = bpy.context.object.data.uv_layers.active.data

bpy.ops.object.mode_set(mode = 'OBJECT')
for uv in uv_layer.data:
    uv.image = image      # <-- HERE ERROR: AttributeError: 'MeshUVLoop' object has no attribute 'image'

I'm getting the error: AttributeError: 'MeshUVLoop' object has no attribute 'image'
uv only contains ['__doc__', '__module__', '__slots__', 'bl_rna', 'pin_uv', 'rna_type', 'select', 'select_edge', 'uv']

You cannot add images to UV maps. UV Maps are used to map images to object's surface in materials. It's unclear what you want to do, but if you wanted an image to be displayed on an object, you would have to make a material and use that image in it with UV image coordinates of your UV map and some shader.

This is how that would look with material nodes. You could use Python to create materials and material nodes and connect them.

Ah makes sense. I'm trying to set Every UV face to an Image datablock. Just found out: Before Blender 2.8 this was possible with my code snippet because it used bpy.context.object.data.uv_textures , but now it is bpy.context.object.data.uv_layers . This is why my problem occurred. Now trying to find the right python syntax to implement your solution

previously it was like this https://blender.stackexchange.com/a/7870/162261

I did not know that.


text:
Geometry Nodes Boolean difference between mesh and boundary box
I have been racking my brain on this topic but I am trying to create a ceiling generator and I want to remove extra geometry if I have an irregular shaped room. The only thing I have been able to work out is using the mesh geometry itself and somehow utilizing the bounding box node, but then I get stuck on how I can get the difference between these two elements. How can I get the mesh I need to remove the exess geometry?
Below are the picture examples I am working on.

please don't ask "bonus questions" - this site has some "rules". One of them is: Ask only one questions. If you have more questions, just open up a new one. Thx.

I think you'ere going to have to tell us in more detail what your generator does.. why the ceiling can't be generated from the room, directly. Is it tiling, or something?

Yes, it is tiling. This is an exercise I wanted to do to see if I can create a realistic model that included all the physical elements. I found the solution down below.

I figured it out! At least one way of doing it. The reason for this question was so I could remove any areas of the ceiling that I don't want to show. Like for a room that is shaped like an "L".

This shows the raw geometry before the modifier. I just took the edges from the walls I created for the room and used this mesh as my foundation for the ceiling.
This box is what I want to cut from.

I will try to explain what this does. The top half of the group creates a plane from the original mesh. This means I have a workable face to extrude from. The nodes below uses the bounding box node to create a plane that is the overall size of the mesh. I then used the boolean node to remove the portion of the bounding box mesh which leaves me with only the object that I will use to remove parts of the ceiling.
This Idea came from Blender Bash's Youtube video which explains what I did in the top portion and why iit works.
https://www.youtube.com/watch?v=45O51Up5qxw&t=585s
Hope this will help other people. I will even leave a link to this exact file for those who want to go deeper into what I did.  Is the practical, maybe not, but its been a fun project.


text:
Stencil Image low resolution
I am trying to texture paint a mesh using a pretty high resolution stencil image..
But when I try to zoom into the image to paint the details...it appears as if it was very low res...
Is there any way to make it appear highres in the viewport??

Can you add a screen shot.? What's the resolution of the painted texture?

choose any image higher than 2k...it appears blurry..

Can you show us a printscreen of your UV map and tell us what is the resolution of the texture you paint on?

it paints perfectly on the mesh, its just the stencil overlay preview that is low res.

I haven't found a setting yet that changes this - I am hoping that with the 2.8 viewport project that this kind of thing will be answered.

The resolution of the painted texture depends also on the resolution of your image texture (the one you paint on) not only on the stencil image so of course it's going to be pixelated when you zoom in too close.

Try Shift+RMB and then move your mouse to zoom in to the image.

On the right side of the screen there should be a tab for Viewport Display properties. Go to Viewport Settings and change them however you need them.

As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.


text:
Rigging issue in single object
I am facing a problem while rigging this cushion, If I click on Automatic weight, it is not working, If I click on Bone only one vertex is controlling the whole body, Kindly guide me how to fix it

File :

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

here it is

Your object is too small, which makes the mesh too dense, therefore the parentage failure. To fix that, scale up both the armature and mesh (like x10), then parent again and it will work. Then you can scale down if needed. Also don't forget to apply the scale.

Thankyou it's working, but hair aren't moving it with

put the Armature modifier above the ParticleSystem modifier @Huzaifa Rafiq


text:
How to get a 2D silhouette of a 3D mesh in Blender 2.8?
I would like to just take a 2D silhouette outline of a side of one of my 3D meshes. I located the question How to extract side-view outline (e.g. top view) of a 3D object to 2D surface? but since it was made over a year ago, and I am using Blender 2.8, the script does not work for me. Any advice on how to update it? It seems to error out around this part:
copy = ob.copy()
sil = bpy.data.meshes.new("silhouette")
copy.data = sil
scene.objects.link(copy)
scene.objects.active = copy
copy.select = True
bm.to_mesh(sil)

Also, more importantly, how would I export the silhouette? Like it wouldn't save as an stl file.

... and what is the error message?

Traceback (most recent call last):
File "<blender_console>", line 1, in
AttributeError: 'bpy_prop_collection' object has no attribute 'link'

It would be best for others reading, if you edit your question to include that error message.

The answer is in the duplicate, it is a side-effect of Collections being added to blender at the scene level.  I'll let you digest and post the answer yourself as I hope you'll find that more satisfying.

@Forrest  Edited original.  When you get the 15 or whatever rep required to comment feel free to comment on answers re updates.  Welcome to bse.  Re error messages https://blender.stackexchange.com/questions/46903/how-to-view-python-error-messages


text:
How do I attach a few cubes via script. Blender 2.79. Pic =>
How to attach a lot of cubes to the nearest vertices of a certain object using a script?
I want to attach red cubes to the nearest vertices of yellow objects using a script.
Suppose red cubes belong to the group "GroupA". And these cubes need to be attached to the nearest vertices of the yellow object
I need your help.Thanks!

what is your meaning of "attach"?  as parent? as join?

Cubes must follow the vertices as join

Download the blend file and test the script (updated)
in order to parent the cubes

import bpy

def conectando(vertice, objeto):
    cd = main.data
    cd.vertices[vertice].select=True
    bpy.ops.object.mode_set(mode = 'EDIT')
    bpy.context.scene.objects[objeto].select_set(state=True)
    bpy.ops.object.vertex_parent_set()
    bpy.context.scene.objects[objeto].select_set(state=False)
    bpy.ops.object.mode_set(mode = 'OBJECT')
    cd.vertices[vertice].select=False

print("*"*50)

#get active object
main = bpy.context.active_object
mat = main.matrix_world

bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode = 'OBJECT')

vertices = [v for v in main.data.vertices]

conectar=[]
for ob in bpy.context.scene.objects:
    if ob.type == 'MESH' and not ob.name == main.name:
        # select object in order to join at the end
        #ob.select_set(state=True) # select object in order to join at the end
        distance = []
        for c in vertices:
            v = c.co
            loc = mat @ v #matrix world of vertex co
            distance.append([(loc-ob.location).length, c.index, ob.name])

        distance.sort()
        conectar.append(distance[0])

for c in conectar:
    conectando(c[1],c[2])

import bpy

print("*"*50)

#get active object
main = bpy.context.active_object
main_coords = [(main.matrix_world @ v.co) for v in main.data.vertices]

#move other mesh objects to nearest location in active object
for ob in bpy.data.objects:
    if ob.type == 'MESH' and not ob.name == main.name:
        ob.select_set(state=True) # select object in order to join at the end
        distance = []
        for c in main_coords:
            distance.append([(c-ob.location).length, c])

        distance.sort()
        ob.location = distance[0][1]
        print(distance[0][1])
            #$print(ob.name + str(tuple(ob.location)))

#join all objects
bpy.ops.object.join()

Maybe ob.matrix_world.translation since ob.location is a local coord in relation to its parent. Would also loop thru context.scene.objects rather than all objects in file to avoid complications of using objects  unlinked or linked to other scene.

Okay thank you. And how to make them follow without combining into one object. I need a function like "vertex_parent_set". Sorry i was wrong yesterday :(

@RenBenPBR test new script

@yhoyo I try to run on version 2.79 and the console points to line 37, in <module>  Type Error: unsupported operand type(s) for @: 'Matrix' and 'Vector'  https://imgur.com/a/daAKxqE

@RenBenPBR test in 2.8

@yhoyo yea, it's working in 2.8, thanks you!
I'm upset that it does not work on the old version :(


text:
Is it possible to only show particles that collided and stick to an object?
(version 2.80)
I would like to only show particles that have collided (and stick) to some object. I do not want to show the particles that are still travelling to an object.
I am thinking this can be done if I only show the dead particles, that died in the collision with the object. And to not show all the travelling alive particles. Therefore I ask whether it is possible to only show the dead particles. And if so, how?
This has to be done in an animation, accumulating showing particles sticking to the object during the animation.
A different solution to obtain this result is also greatly appreciated.
So I want the following animation, without showing the particles that fly around and did not collide...
https://ibb.co/CpyvW1H
still frame:

If you only want particles on such object why not simply add a particle system directly on it?

@DuarteFarrajotaRamos it is important for the visualization that I simulate the emitting of the particles from a central point. So I don't know before hand on what surface the particle will collide, this is found during the animation.

You add proper explanation of all the constraints and illustrations of the desired effect and what you have so far to your question

@DuarteFarrajotaRamos did what you asked, hope it is clear now

Dynamic Paint seems like what you're describing.


text:
Soft Body Object-Collision Object Interaction Not Working
Thanks in advance to this wonderful community that has helped me a ton on the way.  With that preface, here is my problem.  I am trying to get the most basic of simulation to work correctly.  The top cube is a soft body and the bottom cube is a collision object.  I can't get these two objects to interact at all.  I have tried adding a collision modifier to the soft body cube (in addition to the soft body modifier).  The soft body cube also doesn't have the soft body goal (as I am trying to get a bouncing effect where the cube bounces off of the plane).
The normals of both objects are facing the right direction.  I have also played a ton with the inner and outer settings of the collision object to no avail.  What're your guys' thoughts?
Below is the beginning of the animation and the end of the animation (where the cube just falls through the surface of the collision object).
Also do you have to bake it before it will interact correctly?  I already tried that as well and nothing happened.
I also thought it might have to do with the fact that I had no vertex groups specified on my soft body object.  I did, however try subdividing the cube a bunch and still nothing was happening.

You need to add the Collision physics to the object that yhe soft body should be colliding with, not to the soft body itself. Also, check your normals to ensure they’re pointing ‘outwards’ (otherwise the collision won’t work).
Another issue can be where the Soft Body/Cloth collision ‘Inner’ setting (on the non-soft body mesh) is set too large - it ahould never exceed half the thickness of the mesh or it can have undesired consequences (drawing the soft body through from the ppposite side).
Also, fast moving collisions can potentially get through the surface before they are detected. To address this, increase the Min steps (and Max if you need to increase Min even higher) in the Soft Body Solver settings.

After reviewing the Blend file I noticed that the collision object and the soft body are actually on different layers. For the collision to be active (in fact, for any physics effects) the meshes must share the same layer. To move objects to a different layer you should select them, hit M and click on the desired 'target' layer on the popup panel, holding Shift to select multiple layers if desired. Note that moving layers doesn't necessarily invalidate the soft body cache but this can be triggered by simply selecting the Soft Body object and going into and out of Edit mode (TabTab).

I already tried all of those things and none of them worked unfortunately

Yeah I already did that as well:(

Upload your blend file to blend exchange and add a link in to your question and I can take a look later.

Here it is:

Spotted the problem - the soft body was on a different layer to the 'floor'.

thank you so much!  That totally makes sense. You just saved me a ton of frustration haha

No worries. Of course, next you’ll want to tweak your Soft Body settings - try enabling Stiff Quads or increasing the Bending spring to stop it collapsing on itself.

Hey sounds good.  Have a good one man!