text:
Capture object properties to use in a Cycles material
I made a simple material that uses the 'object info' location to drive the color of the object. But when i animate my object now it, obviously, changes color while the objects moves through space.
How can i set the color to a fixed value using the INITIAL location of the Object info node?

Tnx
RDG

Are the objects particles? If yes you are out of luck. If not and they are objects there is a way.

To achieve this you essentially need to be able to do two things :

Capture the location of each object at a point in time and store it
Access the stored data efficiently from within the Cycles material

The first task is relatively straight forward using a Python script to capture the object's location as follows :
import bpy

num_objects = len(bpy.data.objects)

for x in range(0,num_objects):
    object = bpy.data.objects[x]
    object["initial_location"] = [object.location[0], object.location[1], object.location[2]]

This script runs through each object in turn, determines its location, and stores it in a Custom Property on each object.

While this is useful to demonstrate the capture of a property of each object, the Custom Properties aren't the best place to store the details since Cycles materials cannot (easily or efficiently) access the contents of the properties. Future Cycles enhancements may well provide a mechanism for reading object properties but for now we need a different method - we can use an Image Texture.
Cycles can very efficiently read the value of a pixel within an image using the Image Texture node and this provides an ideal method of passing the data into the material - encoded as the color of each pixel within an image. A normal 8-bit RGB image will not be sufficient - so we need to use a format that allows full 32-bit floating point values to allow it to hold the location vectors.
The following script will take the location of each object (as in the previous script) and will create an image 1 pixel high and wide enough to hold one pixel per object. Each pixel will be set with its RGB values set to the XYZ vector of the location of the corresponding object.
import bpy

width = len(bpy.data.objects)
height = 1

# Create the image
image = bpy.data.images.new("object_locations_"+str(width), width=width, height=height,float_buffer=True)

# Create an empty array of pixel data (each will hold R, G, B, A values as floats)
pixels = [None] * width * height

for x in range(0,width):
    y = 0
    object = bpy.data.objects[x]
    pixels[(y*width)+x] = [object.location[0], object.location[1], object.location[2],1.0]
    object.pass_index = x

# 'flatten' the array - so [R1,G1,B1,A1], [R2,G2,B2,A2], [R3,G3,B3,A3],.... becomes R1,B1,G1,A1,R2,G2,B2,A2,R3,G3,B3,A3,....
pixels = [chan for px in pixels for chan in px]

# Store the pixels in the image
image.pixels = pixels
image.update()

The script runs through each object and captures the location in a pixel in the image. Note that it also sets the object's 'pass_index' to the 'slot' corresponding to that object's pixel in the image - this will be used in the material to retrieve the correct pixel for each object. Running the script on my test scene produced the following image. Dragging the mouse over the pixels shows that each pixel relates to the XYZ location of each object in the scene.

The image needs to be saved - either as an image file or 'packed' into the blend file. However, this causes a potential problem. 'Normal' images are stored as a set of R, G, B, A values in the range 0.0 to 1.0 but our object locations will likely be well outside that range. To prevent this corrupting our stored values we need to ensure it is saved in a format that can store full float values (rather than a PNG). Saving and packing the image as a 32-bit float image is covered in this question. This produces the following final script to capture all object locations into a 32-bit float packed image :
import bpy
import os

width = len(bpy.data.objects)
height = 1

# Create the image
image = bpy.data.images.new("object_locations_"+str(width), width=width, height=height,float_buffer=True)

# Create an empty array of pixel data (each will hold R, G, B, A values as floats)
pixels = [None] * width * height

for x in range(0,width):
    y = 0
    object = bpy.data.objects[x]
    pixels[(y*width)+x] = [object.location[0], object.location[1], object.location[2],1.0]
    object.pass_index = x

# 'flatten' the array - so [R1,G1,B1,A1], [R2,G2,B2,A2], [R3,G3,B3,A3],.... becomes R1,B1,G1,A1,R2,G2,B2,A2,R3,G3,B3,A3,....
pixels = [chan for px in pixels for chan in px]

# Store the pixels in the image
image.pixels = pixels
image.update()

# Save image to temporary file and pack it (from answer by @sambler)
scn = bpy.data.scenes.new('img_settings')
scn.render.image_settings.file_format = 'OPEN_EXR'
scn.render.image_settings.color_mode = 'RGBA'
scn.render.image_settings.color_depth = '32'
img_path = bpy.path.abspath('//')
img_file = image.name+'.exr'
image.save_render(img_path+img_file, scene=scn)
try:
    # Remove the scene (pre-2.78)
    bpy.data.scenes.remove(scn)
except:
    # Remove the scene, (Blender 2.78+)
    bpy.data.scenes.remove(scn, do_unlink=True)

bpy.data.images.remove(image)
bpy.ops.image.open(filepath=img_path+img_file)
image = bpy.data.images[img_file]
image.pack()

os.remove(img_path+img_file)

# Add a fake user to ensure the image is retained
image.use_fake_user = True

Once we have the stored 'initial' locations of the objects, we can use an Image Texture node and some simple maths to use the Object ID to calculate the location of the associated pixel to extract the color (to use as a vector) from the image as follows :

To convert the Object ID into a pixel location we need to add 0.5 (so that we sample the middle of a pixel) and then divide by the total number of pixels across the image. This will result in a value between 0.0 and 1.0 corresponding to the middle of the relevant pixel. Passing this into a Combine XYZ node with Y set to 0.5 produces the required vector. The Image Texture node should be set to 'Non-color Data' to prevent any color conversion (by default Blender will convert from sRGB colorspace into Linear colorspace).
To demonstrate this in action, here's an animation moving the blocks and using the 'current' location to generate the color (ie, not using the stored 'initial' location) - notice the blocks changing color as they move.

And here using the captured 'initial' location extracted from the generated image using the above script and material.

Tnx, it's complex but works very well.

Is this technique still the most straightforward?  Will the same technique work with (Blender Render) not (Cycles Render)?  I currently use Pass Index in a different way.  Blender users may want to know if improvements in nodes exist on this date May 13 2018.  Different Node systems have different capabilities.  Have Blender improvements affected this answer?

@atomicbezierslinger I’m not aware or any new functionality in the ltest release (2.79) that would allow this to be achieved in a different way. Consider raising a new question (possibly referencing this one) to see if anyone else is away of anything.

@RichSedman Merci


text:
Collision is not working with multiple object
I want to roll ball soft balls down a slide or chute but the soft body balls are passing through the surface.
Here are screenshots at a point in the animation showing the soft body objects passing through the surface

What could be causing the collision not to work as would be expected?

I think you need to add more detail. Remember that anyone trying to help you needs to know exactly what you’re experiencing and what you’re trying to achieve. Please describe what each screenshot shows and in what way it isn’t doing what you require - and exactly what you’re trying to achieve. My best guess from those images is that you’re trying to roll apples out of a cart...?

Yes I want to roll ball soft balls through slider

So the balls are Soft Body. Check the direction of the normals of the chute (cube.001). If those are pointing inwards (which they will be if you started with a cube and just removed some faces) then that could be the start of your problems as the soft bodys will behave as if they are inside a surface rather than bouncing off it.

For soft body collision to work correctly the normals of the collision mesh need to be oriented in the right direction - ie, in the direction of the collision. For example, in the case of a simple chute created from a cube by removing some faces you would need to Flip Normals to ensure that they are pointing 'inwards' as shown :

Note how the normals (the light-blue lines) are pointing 'inwards'. To 'flip' the normals you can simply go into Edit mode (Tab), select all (A until all mesh is selected), press Space and type 'Flip Normals' and Enter. To display the normals, press N and scroll down to 'Display' and activate display of the normals (when in Edit mode).
This can produce the following result :

Note : It's usually good practice to have 'solid' (manifold) meshes - rather than having single faces with no width (eg, a cube with some faces removed). For a manifold mesh the normals would all point 'out' of the surface, meaning this problem would not occur as collisions would only occur from the 'outside'.
Blend file included

source: Stack Exchange

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

sort: votes


text:
Is it possible to get the length of a ray inside an object with nodes?
Is it possible to get the distance a ray travels inside an object with cycles material nodes?

Then map it to a 0-1 range to create a map:

E.g. to adjust the color of a Glass node to make it more transparent where there is less volume between the camera and light:

How can I do this?

The example images above were rendered with the Layer weight node. This only works on spheres.

It is always the way you ask. Ray length is the distance from previous bounce or refraction.
What might be a bit confusing - you have to apply toning to the inner side (backfacing) of your object, because outside rays return distance from other objects - as ray begins from camera, not from light source.
As far as mapping goes - approaches are different - for instance: http://lesterbanks.com/2012/10/using-blenders-raylength-node-to-create-a-re-usable-custom-absorption-shader/

I watched that video a while ago, but I never was able to get satisfying results..

I have been playing around with this technique and also this one from blender cookie, and I think I have better idea how to use these techniques now. Thanks

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


text:
Vertex slide for curves?
Is there a vertex/edge slide like tool for curves?
In other words, I'd like to be able to edit the curve in the same way I can with a mesh, by sliding a vertex along a connecting edge:

Is this possible?

Straightforward way, no (currently). But possible to make it in another way.
If the cuve is as simple as a poly spline, I think you can try converting it to a mesh first, tweak it with Vertex Slide tool, then convert back to curve, but the original paramters on curve may lose then. Or:

Select the target curve point, CtrlH > Hook to New Object;
ShiftD to duplicate, then AltC2Convert the curve in to mesh object;
Tab in to the Edit Mode, select the target vertex, CtrlRMB to select the hook (a empty object) while still in Edit Mode, CtrlP > to make vertex parent. Then you can slide that vertex in the mesh to control the target curve point.

Another way is to use the handle orientation as transformation reference:

Be sure to switch Spline Type to Bezier, then set handle type to Vector;
Switch Transformation Orientation to Normal, then select the handle control point, create transformation orientation from it;
Now select the curve point, you can move it along Z axis of the new orientation.
When finished, you may want to delete the created orientation(s).

I guess this is a close as one can get currently.. Not as fast as I might have hoped (I think I can manually position it with G before I finish setting up the custom orientation :P). But thanks for the answer :D

I'm also wondering if there are any other ways to do this, and I do believe someone can make addon for it, even to support sliding along curvature, but would be even better to implement indeed, since it brings more convenience for those who are taking topology workflow by using curves first. (similar to BSurfaces)

Found something very close. Within addons, turn on experimental, go into Add Curve: Simple Curve. Turn on addon. Go into miscellaneous tab of the tool shelf. Click divide. Go down to the tool settings panel below on the same side. Change percentage value.
This is the closest I can get trying to find an intersect of 2 curves. Blender is in need of various CAD tools specifically for curves.

This might help : as seen on this post,
you can use the curve tools addon shipped with Blender to subdive along path:

Nice solution! But this only works when the Spline Type of  curve is Bezier, not Poly (a Path Curve). You can however often convert to a Mesh here, but in my case I need the tilt values (and my curve has also geometry so the result after converting to Mesh will be a 2D or 3D mesh) :(

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


text:
Is it possible to set all texture nodes in a node tree to a specific vector?
Is there a way to automatically set selected nodes to use a specific vector input?
E.g. If you have a larger node setup with a lot of texture nodes, it can be a pain to go back through and connect each texture node's vector input to a texture coordinate node individually.
Is there a way to automate this process?

Add a Reroute node with the desired value and select it. Then, you can use this script.
# First, define some stuff
# mat: the material; tree: the node tree; nodes: the node list
mat = bpy.data.materials['Material Name'] # or index
tree = mat.node_tree
nodes = tree.nodes

# We'll find the source node and store it in src
src_socket = None
if nodes.active:
  if len(nodes.active.outputs) == 1:
    src_socket = nodes.active.outputs[0]

if src_socket is not None:                       # only work if node found
  for node in nodes:                             # check each node
    if node.type.startswith('TEX'):              # only operate on textures
      for input in node.inputs:                  # check each input
        if input.type == 'VECTOR':               # only operate on vectors
          tree.links.new(src_socket, input)      # set up the link
          break                                  # only do the first vector
else:                                            # fail if no valid select
  print('No single-output node selected')

Tested on Blender v2.69 r60995.

Instead of that first loop to assign src to the node, could you instead use src = nodes['CopyVector']? (using a try/except incase it doesn't exist)

@GregZaal Good point, thanks - but see my edit; this is easier anyway.

Well there's always a better solution isn't there ;)

There is a reference to an undefined variable src on line 13. I changed it to src_socket and it worked beautifully. Also, if anyone copy/pastes this they won't import bpy, you might want to add that. Thanks :)

@gandalf3 fix'd.


text:
How to Control Length of mesh line by percentage - Geometry Nodes
This may be a bit complicated to ask but hopefully this makes sense.
I have a geometry node creating horizontal blinds for a window. I would like to control the opening of the blinds by a percentage. So 0% would be fully closed, ie. the length of the mesh line would equal the needed count divided by the window height (controlled by the Mesh Line Offset). At 100%, the blinds will be fully opened with the slats completely horizontal and the mesh line would equal the count times the thickness of each slat.
Maybe I have been working on this for too long and I am making it more complicated than it needs to be  but what can I do to achieve this function? I can see the math to get the right lengths but I don't know how I can create a functions that allows me to change the percentage to something like 35% open. Any thoughts?
https://blend-exchange.com/b/mOGOENa2/

This image shows what I am looking for.  As the bottom rises, then the slats stack and follow each other.

it would have been nice if you would have shown us what you tried so far - because now it just "looks like" you are looking for someone who does your work. So providing a blend file how far you have been would be great for 1) showing you tried really something 2) make it easier for us to help to just extend that instead having to build everything on our own

and second comment: instead of describing with hundreds of words, most often a good sketch with some annotations is much more worth.

and third comment: this site allows exactly one question. This makes sense because "normally" you could only summarize a title for one theme. But you are allowed to open as many questions as you like

Sorry about that. Still new to this platform. The one question rule makes sense. My biggest issue is really the first main one.  For the line mesh control I am looking for something like this picture here
https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.homedepot.com%2Fp%2FHome-Decorators-Collection-White-Cordless-Faux-Wood-Blinds-for-Windows-with-2-in-Slats-36-in-W-x-48-in-L-Actual-Size-35-5-in-W-x-48-in-L-10793478184576%2F206300994&psig=AOvVaw2gb8P0dvM9xUUgKR0cBYxD&ust=1697599002977000&source=images&cd=vfe&opi=89978449&ved=0CBAQjRxqFwoTCJDNmaGP_IEDFQAAAAAdAAAAABAD

This is mathematically a very simple task (and i only answer that one specific question, please open other questions for your other problems, thx):
so by this node tree:

you will get this:

The only "challenge" you might have here is, that you have to know, that Blender internally in most cases uses radians to calculate, not degrees. But mapping values can easily be done with the map range node.
In this case map range node maps between percentage and radians (0-100/0-pi/2)

Oh crap. I thought I had pasted in the link to my file.  My node tree is a bit messy and it was hard to get all the right nodes I wanted to check.  Here is my Blend file. I definitley am not looking to mooch from other people. I just have a complicated problem with a complicated mind that can't figure this out.

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


text:
When rotating arms or wings away from each other, wing mesh deforms towards arms. How do I fix this?
(EDIT: Here's a copy of the file, the only difference is that I had to remove the cloth simulation to fit the file size limit.)

I'm new to Blender, and I've been struggling with this for a while. Everything else seems to be working fine, but whenever I rotate the bone joints to reposition the arms or the wings, a large area of the wing mesh gets pulled toward the arms. I don't know what I did wrong or how I can fix it. I originally parented with automatic weights, then tried with envelope weights, then tried with empty groups. I've tried with and without weight painting, which I honestly don't understand in the slightest.
Setup notes: the bones for the wings are in a separate group from the rest of the armature. The model itself is divided into separate objects; hair, body, sweater, and wings. The sweater has cloth simulation on it, though I'm not sure how that would affect it. (side note: if anyone knows how I can make just part of the sleeves and bottom of the sweater loose and floppy without changing the rest, in a way that would work with a playable character in Unity, let me know please!)
CONTEXT: The character's wings should be able to flap, and this character is intended to be playable in a Unity game.
Without moving:
After moving:

The answer is probably weights.  But this is a question where we'd really need to see the file.  Preferred hosting here is https://blend-exchange.com/ .

Thanks for the tip Nathan, I'd wanted to upload the file but couldn't figure out how. It's now been added to the question.

If we enter weight paint mode on the wings, in vertex masking mode, and actively select a vertex that is deforming incorrectly, we can see why:

This part of the wing has acquired weights to hand.Fr.001.L, which is an arm bone, not a wing bone.  When we rotate the arm, the hand follows because of parenting, and the wing moves with the hand bone because it is weighted to it.
These look like automatic weights.  The wing gets weighted to the hand simply because it is close to the hand bone.  I'm not sure exactly how a left leg doesn't get weighted to a right leg bone, it may be because there is intervening mesh that blocks the bone heat, but here, there is no intervening mesh (only the frontfaces of the wings, which don't block bone heat.)
To get good autoweights, lets weight it first to an edited armature, and reparent it to the original armature.  We'll start by duplicating the armature and editing this duplicate such that it contains only wing bones-- we'll delete everything else.  And we'll delete all vertex groups on the wings:

We'll autoweight to this duplicate armature to generate weights, but only from the bones we want.  After that, we'll unparent the wings object with keep transform and delete the armature modifiers on it, then parent to our original armature with "armature deform" (only armature deform, not automatic weights!)

Now we can see that the wings are properly weighted, deforming with the wing bones, but no longer deforming with the hand bones:

Thanks so much!!! I've got it working now :)
Do you have any suggestions for what I said about the sleeves? I'd really like them to be floppy and loose, like the sweater's too big, but I don't even know where to start with that.

@MagicDawn You would probably want to implement physics, but you'd want to set that up in Unity.


text:
Getting and using the selected Color Attribute
Fairly new to blender python, though have some experience with python outside of blender, I'm trying to work out why this bit of code is only ever working on the first color attribute and not the currently selected one.
def paint_map(self, mesh, map, color):
    i = 0
    for poly in mesh.polygons:
        for _ in poly.loop_indices:
            map[i].color = color
            i += 1

def paint_mesh(self, mesh, color):
    if len(mesh.vertex_colors) == 0:
        mesh.vertex_colors.new()
    self.paint_map(mesh, mesh.vertex_colors.active.data, color)

def run(self, context):
    objs = context.selected_objects

    if len(objs) > 0:
        for obj in objs:
            if obj.sollum_type == SollumType.DRAWABLE_GEOMETRY:
                self.paint_mesh(obj.data, self.color)
                self.messages.append(
                    f"{obj.name} was successfully painted.")
            else:
                self.messages.append(
                    f"{obj.name} will be skipped because it is not a {SOLLUMZ_UI_NAMES[SollumType.DRAWABLE_GEOMETRY]} type.")
    else:
        self.message("No objects selected to paint.")
        return False

    return True

how this code currently behaves https://i.sstatic.net/oEix4.jpg
Whilst researching the online documentation I noticed that mesh.vertex_colors is depreciated and its best to use color_attributes moving forward. I've played around with it a bit and can't wrap my head around it.
I did notice if I do the following
print(bpy.data.meshes["Mesh.001"].attributes.active_color)

within the python console it does indeed return the selected color attribute, I can't however work out how to rework the current codebase to use it however.
Python console tests https://i.sstatic.net/G9f1q.jpg
If someone could help me work out how to get and use the currently selected color attribute of the selected meshes I'd be very grateful!
Thanks in advance!
CuppaT

I can confirm this is a bug introduced in Blender 3.2. I'll file a bug report (edit: done).
In the meantime, if you want to continue using the vertex_colors API, you can get the active vertex color with mesh.vertex_colors.get(mesh.attributes.active_color.name). Warning: this may be None!
If you want to move over to the color_attributes API instead, read on...

Here's the main differences between the old and new APIs.
Vertex colors

Create with v = mesh.vertex_colors.new(name).
Always stores one color for each mesh corner (loop) ie. len(v.data) == len(mesh.loops).
Always stores colors as byte colors, with one byte for each of RGBA.
Accessing the color with v.data[i].color returns the color converted to float in sRGB space.

Color attributes

Create with v = mesh.color_attributes.new(name, type, domain).
domain can be either 'POINT' or 'CORNER', depending on whether you want to store a color at each vertex, or at each face corner.
type can be either 'FLOAT_COLOR' or 'BYTE_COLOR', depending on whether you want to store each RGBA component as a float or as a byte.
Classic vertex colors correspond to color_attributes.new(name, type='BYTE_COLOR', domain='CORNER'). In fact the mesh.vertex_colors endpoint now just exposes the subset of color attributes that are BYTE_COLOR + CORNER.
Accessing the color with v.data[i].color returns the color converted to float in linear space. In 3.4 they added v.data[i].color_srgb to access the color in sRGB space instead.

With that in mind, your code is really easy to update.
def paint_map(self, color_attr, color):
    for datum in color_attr.data:
        # Uses color_srgb to match the behavior of the old
        # vertex_colors code. Requires 3.4+.
        datum.color_srgb = color
    # (You could also use foreach_set here instead.)

def paint_mesh(self, mesh, color):
    if not mesh.color_attributes:
        mesh.color_attributes.new("Color", 'BYTE_COLOR', 'CORNER')
    self.paint_map(mesh.attributes.active_color, color)

(Note that due to a bug it's actually possible to have color attributes but no active_color right now.)

This works perfectly! thank you so much for you help <3


text:
Does PNG files size affect video output file size?
I’m creating 15 second animations with approx 500 frames (1280x720) at 24FPS resulting in 20Mb file size. Similar videos online are well under 5Mb even under 2Mb. I’m currently video editing using the default blender settings for 720p MPG4 H264 with no audio. I tried various video output settings to reduce file size but there is a noticeable drop in quality.
My initial PNG renders are at blender’s default settings but with 100% compressed RGB (no alpha) with each image about 1.2Mb. Would compressing these images further in blender or using other programs etc reduce the video output of these images? Or is there no correlation between the PNGs and MPG4 file size?
Either way, what are the ideal PNG and video output settings within blender to reduce the final video file size whilst maintaining the same quality? Or should I be compressing the videos further using an external program?

Yes...and no.
First of all, I would 100% recommend that you render at the same resolution that you plan to make your video unless you're planning on using AI Upscaling. Doing otherwise would result in the same effect that zooming really closely into an image produces - you start seeing the individual pixels.
Video files will always be smaller than the summation of the frame outputs. That's because videos don't actually store every single frame as an image, they instead use algorithms to store some frames and record what changes between different frames. Rather than trying to explain this myself here's a good short video explanation for this by Tom Scott on Youtube.
From my experience (and it should be noted that I've done some video editing using Adobe Premiere in the past, but nothing professionally), you shouldn't need to further compress the video - MPG4 will already compress the output to be much much smaller.

thanks for your comments. I am using the final resolution of 720p throughout the whole process to avoid issues later on as you mentioned. Also using MPG4 because of the expectation of lower file size and widespread accessibility on more devices. So somewhere from initial render to final video output I’m not achieving the smaller files size that other similar videos have.

What file sizes are you dealing with, and for what length videos?

File sizes and settings in original post

Huh, yeah those file sizes are rather large. You said you're using the default export settings? Mind adding a screenshot of them? But here's a suggestion that might help - the Encoding Speed setting can drastically affect output size. Setting it to Realtime will result in significantly larger files, and Slowest will result in the smallest file. It might seem a bit counter-intuitive, but I reckon that it's describing how much time Blender is spending to compress the images without losing quality. By spending more time, it can pack all the data more efficiently.

Haha I tried the very slow encoding speed which was just as quick as the default medium speed and reduced file size by a whopping 0.1Mb :o I’m currently rendering some PNGs so I’ll send video default settings SS later hopefully

video settings added to post

Hm...the settings look fine to me. You could also try increasing the keyframe interval by a bit to 24, but I don't think that it'll reduce file sizes by much

I tried a few different settings there for no real change. Also the above default settings give me a bitrate of 8500 while the comparable videos with smaller files are 1500 which makes a lot of sense but if I drop my bitrate setting below 5000 the quality is awful

Hmm sounds like you've got alot of stuff going on in the video that can't be compressed well. Whatever the case may be, I'm unsure of any solution

A partial answer to my own question for others to add or clarify...
I undertook a small sample test to compare a few variables without resulting in a noticeable reduction in final video quality of 65 frames at 720p.
Original PNGs 32 samples, 720p, 100% compression
Video output settings default
video file size 2.68Mb
Comparisons (all settings as above unless stated)
a) @128 samples 0% compression = 1.92Mb
b) @32 samples, 1080p, 0% compression = 1.97Mb
c) @128 samples, 1080p, 0% compression = 1.82Mb
That gives about 30% file size reduction by increasing the source PNGs sampling/resolution and outputting to 720p video.
My theory here is that lower quality rendered stills will have minor imperfections or variations (eg: slightly mis-shaded pixels) not obvious to naked eye but requires a higher bitrate to process these variations than higher quality stills with fewer variations between frames.
Additionally, having higher quality original PNGs allowed a reduction in video processing settings without significant loss in video output quality which wasn’t possible with original lower quality PNGs. For example I reduced video output quality to “low” instead of the default “medium”, increased keyframe intervals above the number of actual frames and used the slowest encoding speed.
Final video file size = 0.99Mb. An amazing 37% of the original file size.
The biggest downside to achieving this unfortunately was initial rendering of each frame rose from slightly over 1 minute for lowest quality PNGs to just under 10 minutes per frame. As with many things in this field there is often a trade off somewhere depending on where your priorities lie.


text:
How can I model pagoda roof rafters arangement in blender

I want to model pagoda roof like this picture by using modifier, not by manually placing each rafters one by one.
anyone have idea about this?
P.S : don't recommend array, curved array, object offset.

For the moment, this is just an 'in principle' suggestion, to create a mesh, proportionally edit it to shape, and extract the relevant edges from it to be converted to a curve.
The curve's native bevel can be adjusted to the width of the ridges.
How you construct the original mesh, its topology, will depend on whether the ridges should splay, or be parallel, whether they are allowed to curve along their length, etc.
If you want help with that, maybe you could put up a reference image.

What you could do is use Instancing (Duplifaces in 2.7), a bit different from a simple Array + Curve as it won't distord your object:

Create a curve that follows the roof shape, put its origin at its beginning.

Create a plane, scale it as necessary, apply scale and rotation, make it follow the curve with Array + Curve modifiers.

Keep your plane selected and in the Properties > Object > Duplication (Instancing in 2.8), choose Faces. It means that the object that will be parented to the plane will be duplicated on its face.

Create your trunk, put its origin on one of its extremities, then put it on the exact same point as the curve origin, parent it to the plane, it will duplicate along (in my case it would need more plane to stick to your example though).

It's called Instancing in 2.80

You can use an Array Modifer to help place most of the rafters by creating a curve that the rafters can array onto.
First, add a curve to the scene and shape it the way you want. Second, build a rafter. Third, add an Array Modifer to your rafter. Next, add a Curve Modifer. Select your "object" as the curve you added to the scene. The rafters should array onto your curve now. You will probably need to have multiple different curves to achieve the structure shown in your photo.
Starting at 4:45, this video shows the process: https://www.youtube.com/watch?v=YQ8chdrYn-8

you can't. it will distort mesh. and rafters in pictures are not arranged in same distance.


text:
Blender 2.8 - Weird experience with smoke domain
I hope someone can help me with this weird issue.
I'm trying to create a sphere that emits fire, like the sun.
I've followed this tutorial.
This is what it should look like:

However, as soon as I copy the object (sphere, forcefield and domain) into my other project, the sun's flames start to look like this:

When I copy the object out into a new project, (after baking of course) it again looks good.
What could this be? I've spend dozens of hours trying to figure it out, recreating it etc, but it always comes down to this.
I would greatly appreciate anyone's help! :)
I'm using Blender 2.8 and rendering in Cycles.
EDIT:
I re-created the sun following the guide, using a new General blender project. This is the result (which is good):

Now, I've copied that object into my other project.
I didn't change the position or size, and simply rebaked.
After bake, this is the result:

Puzzled as to which settings leads to those blurry, small flames.
At best my end result is this, which seems pretty low res compared to the earlier creation:

As far as I know, I haven't changed anything special with regards to the project settings, but I'm more than happy to try some suggestions / check some settings if anyone has an idea :)
Thanks in advance!

So you're saying that sun looks problematic when copied into the project you're making, but has no problems when it's copied to a new project. i.e. the problem is only when it's copied to your project.

Hello Manu,
So it seemed at first, yes. I also tried with another guide who supplied a .blend file (https://blender.stackexchange.com/questions/71461/make-flames-stick-close-to-the-surface-instead-of-rising-upwards).
When opening that example, it looks nice and sharp. So, I copied my 'defect' sun from my project into that one, and it looked nice and sharp as well.
I even tried copying the example (the blueish fireball) into my own project, and again, it is blurry.
I don't change anything on the position or size, I simply rebake.

Just to be sure, I'm recreating a new General blend file as we speak, and following the 'sun guide' once more. I'll edit this comment and place examples in the main thread once the bake is done.

I've posted the results. Again the weird blur.

I 'solved' this by doubling the resolution of the domain. Still puzzles me why I have to for a same-sized object, and only in this project.


text:
3d reverse masking of volumetric
Is it possible to create a volumetric cube but mask only the space of that volumetric cube by a mesh?
Hence if I put Suzanne inside the volumetric I only see her?
The effect I am looking for is how at night with a torch if you shine it in smoke you only see the smoke as it passes through the light ray. I want to make shock wave torus rings that mask a volumetric cube with a random noise, so that the torus rings only expose the smoke.

I hope you do not mind my edit. I think it will be easier to read this for people who might be willing to help. The title says "3d reverse masking of volumetric" Could you clarify?  What do you mean by "reverse"?

How about using a spot light?

I'm not sure if I understood the reason, why don't use Torus directly with Volumetric material? Can you post some reference?

Volumetric Cube catching Torus Light
Is this what you are looking for?

Cube with Principled Volume Shader
(Density 0.1 / Anisotropy 0.95)
Torus with Emission Shader
(Properties editor > Object > Visibility > Ray Visibility > Camera OFF)

So what you see is only light rays catching on Volumetric

Something more colourful ... Torus with Noise texture and Displacement Modifier.


text:
How can you make a scratched metal procedurally?
I want to use a type of scratched metal thing to use for a robot I'm working on, but I want to know how to do it in a procedural way, just using nodes and math, is there any way I can do that? This is a picture of what I want it to look like, but, just less scratches, so if anyone has a way, please tell me.

What are the parameters you would like to control?

https://blender.stackexchange.com/questions/21283  https://blender.stackexchange.com/questions/18348 https://blender.stackexchange.com/questions/32166

scratch amount, size, and how deep

If we take a Voronoi Texture set to Distance to Edge, and do a Math -> Less Than operation we get this map:

We can use another Voronoi Texture set to F1 to generate a map that lets us subtract out most of the corners.

Note that we are using the same scale for both Voronoi Textures, and we are clamping the Math -> Subtract operation to prevent our values from falling below 0.

The Less Than threshold controls the thickness of scratches, the Greater Than threshold controls how much of the initial map we remove.
You can stack up as many layers of this as you want:

And then plug it into a Bump node with distance set to -1 to sink it into the mesh instead of pushing out.

Here's a setup attempting to resemble your reference image.

Use texture paint.
Press U on the keyboard-in order to texture paint as you'll need to UV unwrap the object (probably just use simple UV project unless You know specifically what you want).
Then go into the texture paint tab and go into edit mode. If you want depth to the scratches just create extra faces around the color using F.

The question asked specifically how to this procedurally. What you are describing isn't a procedural workflow.


text:
Render Layers in the 4.3 Multipass Viewport Compositor
Does the 4.3 multipass viewport compositor support render layers? When I try to combine two render layers (in this example, to always show an object in front), it doesn't seem to preview both layers correctly, or at all.

Cannot find anything official about it, but viewport compositor does not support passes, so I think it's logical to assume it doesn't support layers as well.

As of 4.3 the viewport compositor does support passes. https://developer.blender.org/docs/release_notes/4.3/compositor/

Sorry, missed EEVEE in the screenshot. Cycles does not yet support passes in Viewport Compositor.

It doesn't seem like support for View Layers in Viewport Compositor was planned.
Post by Omar Emara who is a developer working on the Compositor answered this question in July 2024:

And a question - will it be possible to have access to view layers?

There are no plans for that at the moment.

So it seems there were no plans to work on that at that time and it's not supported currently. It doesn't seem like there are currently any plans to work on that.

You never know if that may change, but thinking logically, View Layers might not be a feature ideally suited for real-time viewport compositing anyway since View Layers are not really rendered simultaneously. It would probably be reasonable not expect this feature any time soon because of practical reasons - how would that even work real time if you can have arbitrary number of View Layers?.. It would hit hardware limits very fast anyway if at all possible. I wouldn't be surprised if it doesn't get implemented at all in foreseeable future.


text:
How to read Auto Keyframing state in Python?
I want to create keyframes with Python, when a custom control changes. How do I check the state of the Auto Keyframing button?

Tip turn on developer extras and tooltips in Edit > Preferences > Interface > Display
Then mouse over the button and will see that it is boolean property to turn on off.  https://docs.blender.org/api/current/bpy.types.ToolSettings.html#bpy.types.ToolSettings.use_keyframe_insert_auto
scene.tool_settings.use_keyframe_insert_auto

Use in conjunction with the enum  https://docs.blender.org/api/current/bpy.types.ToolSettings.html#bpy.types.ToolSettings.auto_keying_mode
scene.tool_settings.auto_keying_mode


text:
How do I change the color on the lighting in different frames
Hi this is my first post on this website so sorry if there are any problems with this but let’s get into my question.
I have a scene where a character falls and I want a scene where there’s a light and then there are a bunch of colors flashing on the camera until it stops on one like a spin the wheel with colors but I don’t know how to change the colors in the frame so can anyone help?

Hello, you can create a keyframe (i) on the color of your light, then move the playhead in the timeline, change the color, keyframe again

You can change the color by adding a keyframe in the frame where you want to start the color change and then going into the World Properties tab like this:

Then you can just go to the frame where you want the color change to end and press the keyframe button again as shown in the picture. then you click the color (in the picture I set it as a blue) and customize it to whatever color you want. You can do this a few times if you want it to flash through a bunch of different colors. If you put the start and ending keyframes right next to each other they will not fade and it will be an instant color switch.

You missed a part.
If you want an instant switch in different times, _
select all keyframes,
Right Click > Interpolation mode > Constant

yes but its easeir just to put the frames right next to each other so theres no real reason to change the fashion of it

What if they don't want it to be instant??

i already explained that at the beginning of the post

that would slowly change the color, not instantly change it when the keyframe comes

I know but if you want to put a fade then you can put them far away from each other and if you want it to be no transition you can just put the keyframes right next to each other and it would be pointless to go the extra step

If you want it to be no transition + change every 0.5 second rather than immediate?


text:
DXF Importing error
I received this mess when trying to import a dxf file. How can I fix it?

Python: Traceback (most recent call last):   File
"D:\Blender\3.6\scripts\addons\io_import_dxf_init_.py", line 521,
in execute
read(self.report, self.filepath, merge_options, self.import_text, self.import_light, self.export_acis,   File
"D:\Blender\3.6\scripts\addons\io_import_dxf_init_.py", line 98, in
read
do = Do(filename, obj_merge, import_text, import_light, export_acis, merge_lines, do_bbox, block_rep, recenter,   File
"D:\Blender\3.6\scripts\addons\io_import_dxf\dxfimport\do.py", line
86, in init
self.dwg = dxfgrabber.readfile(dxf_filename, {"assure_3d_coords": True})   File
"D:\Blender\3.6\scripts\addons\io_import_dxf\dxfgrabber_init_.py",
line 44, in readfile
return readfile_as_asc(filename, options)   File "D:\Blender\3.6\scripts\addons\io_import_dxf\dxfgrabber_init_.py",
line 59, in readfile_as_asc
return read_encoded_file(filename, options, encoding=get_encoding())   File
"D:\Blender\3.6\scripts\addons\io_import_dxf\dxfgrabber_init.py",
line 55, in get_encoding
with io.open(filename) as fp: OSError: [Errno 22] Invalid argument: 'T:\01-Phong-Ban-XN\04-XN TK Ha Tang\12-Lê Thái Nam\Zalo
Recived Files\nut hang Dieu\'

There is likely something wrong with the DXF file, or it may be in a version that is not supported.

Thank @MartynasŽiemys i saved my file in 2018 format so let me try to save the CAD file to an older version


text:
Model parts stretching when moving armature
I just made a human model and rigged it, but its body parts are stretching unnaturally when I'm moving these bones (images provided):

upper arm
forearm
hand (palm)

Should I do retopology, weight repainting or something else? Thanks in advance
The model on blend-exchange:

It looks as if you haven't parented the object to the armature correctly. If you share it via https://blend-exchange.com/ following the instructions there to copy the link and then edit it into your question we can see what's going on.

What you show generally comes from bad orientation of the normals, so maybe recalculate the normals, if it doesn't work please share your file: https://blend-exchange.com/

@JohnEason done

@moonboots done

posting an answer. short version: weights

As you see you have inverted normals. To recalculate the normals, select all in Edit mode and press ShiftN. Now if you parent again it will work fine.

The issue is that your weights are not assigning the mesh parts to the right bones.
First, in object mode, select the armature object. In Properties Editor > Armature tab > Viewport Display enable "Names" so that we can see the bones names in the viewport:

Select the mesh object, ↹ Tab into Weight Paint mode.
You can Shift RMB a part of your mesh to see the list of vertex groups present where you clicked, and select one to paint:

If you check your upperArm or foreArm vertex groups, you will see that they barely affect the arms meshes:

These should be mostly yellow - orange or even red for the corresponding bones.
Before correcting that, make sure to enable auto normalize and multi-paint:

This is so that painting weights automatically "takes" the weights you add in one group from the others. This is an easy way to avoid issues.
Then, select the draw brush and paint the weight on the right bones. First paint the areas that should only be moved by that one bone in red, then use the smear brush to do the transition areas, and make fine adjustments with the draw brush by setting a different weight:


text:
Mesh/Faces disappearing when symmetrize mesh
I found this answer, which I cannot comment on, so need to ask it again(sorry): Mesh disappearing when symmetrize it
I also am having the issue when trying to symmetrize, that faces disappear. At first I just thought maybe vertices were that bad out of alignment, so I refilled all the faces that deleted. However, when trying to symmetrize again(in the same spot) the faces will delete again. I then checked each vertex, and they were all exact mirror positions from 0. The origin itself was also at a perfect 0, working on an X-axis. I tried what that post answers, by setting the meshes origin to geometry. Still same effect, of faces deleting.
I also confirmed, then when using a X-mirror(editor option, not modifier), both vertices that mirror each other do move as expected, so technically they are symmetrized. Why then does symmetrize still delete faces(only on one side of X-axis)?

I have no shape keys
I do have vertex groups, which I think this area is locked(unlock did not change result)
I am only selecting and symmetrizing a few vertices
Any other questions on details, please ask

hello, maybe apply the rotation in Object mode? Oe please show some screenshos or share your file: https://blend-exchange.com/

All scale, rotation, and positions have been applied multiple times, as this project has been re-worked many times. And normally symmetrize does exactly what I need, it just after trying to re-do the mouth area, I am getting faces to delete when trying to symmetrize

@moonboots I do however notice the median x is somehow 0.00001. is that the reason? as somehow maybe one of the vertices is just off a hair?

The best would be to share your object or at least a part of it in order to test

@moonboots I think I uploaded the mesh - link should be under the second screen shot

I think you're not using the tool the way it should be used, you're selecting the same vertices in both sides (-x and +x) in order to replace the vertices of -x on +x, but actually it won't "replace" the +x by the -x, as you may expect, it will delete the vertices of +x and symmetrize the vertices of -x (and they will be floating as they are not automatically connected to the other vertices).
So what you need to do, if you plan to change the vertices on -x and see the result on +x, is either use the X mirror option (top left), which will move the vertices on the opposite side if the mesh is perfectly symmetrical, or make your changes on -x, select all and symmetrize.
Actually, as long as you're modeling a symmetrical object, it's easier to work with a Mirror modifier, only use the Symmetrize tool if, once the modifier has been applied, you realise that it needs some changes and it would be more tedious to re-use a Mirror modifier...

I'm just trying to make sure any knife cuts I do get symmetrized, so that X-mirror works. But now that you say it, I normally do select the whole mesh and symmetrize it, not sure why I'm only selecting vertices at the moment, lol. But true, I thought symmetry just moved vertices, not replace them. I will test quick to see if it was because I was only choosing select vertices.

Got to be kidding me..... lmao, thank you so much, this problem was driving me crazy!

I always use X-mirror(after mesh was finished, and decide to make changes), the problem I found is, that sometimes when using knife cuts the mesh will become un-symmetrized. So I've gained the habit of always symmetrizing before I move onto another area, or section. But as you adequately explained, symmetrize doesn't move vertices, it replaces them. So if you don't select all, then Blender won't know to re-make faces where they are needed. again, cheers!

As I say in my edit, when you model a symmetrical object, use the Mirror modifier until you're about glad, because operations like knife or join or loopcuts won't be symmetrized with the Mirror option only


text:
Boolean Subtract Modifier Help!! Trying to 3D print my skull after surgery
New to Blender, tried to search for this issue but I think because I am new I am missing something. I am 3D printing my life sized skull in resin and want to recreate the surgical plates as well, only I want them to be metal. I found a place that can print metal (the manufacturer of the plates will not sell them to me) BUT I am having issues.
I am using images from a PDF of the companies catalog for sizing/scaling, which I created as an AI file, then converted to SVG for import into Blender. I was able to set the plates to the correct thickness, so they actually look decent.
To get the plates to look more like (see below), I need to do the following:

Use boolean modifier to cut cylinder indents into the plates
Bevel edges of the plates

What am I doing wrong for the first thing?? Is it something to do with my layers? It keeps adding my cylinder to the plates!!! SOS!! Here is my Blend file.
I have also included an STL of the plates that I already built from the scan of my head... pros of that are that I do not need to hand bend anything, but I am not happy with the way they look.

EDIT: The end product should look something like this (I don't have this big large one but anyway...)

EDIT 2: This is all that I need to do, forget I said anything about beveling because I think it is causing you confusion (I will put screws here, you wouldn't see a bevel anyway). The bevel I mentioned for step 2 would be for the OUTSIDE edges of the plates but I haven't gotten to that step. I've done like you've showed and made a shape for boolean subtraction but for some reason it is still not working on my existing shape. :(

The problem I see in your file is a lot of messy geometry, if you enable Face Orientation in the Overlays for example almost every face shows a red and blue artifacts pattern because there are loads of overlapping faces which are really hard to clean up automatically. The best would be to just select the outlining edges and create completely new faces.
Okay, now technically this question turns out to be two questions which should be asked separately: 1. How to clean up this messy geometry? and 2. how to create the chamfer screwholes?
How to clean up the messy geometry?

In Edit Mode go into Wireframe mode or enable X-Ray to make sure you can select all hidden vertices/edges. Make sure you are in Edge Select mode (press 2) and go into side view Numpad 3. Then box select only the bottom row of edges by dragging your mouse over them.

This is how it should look like afterwards:

Looking at it from below to see what is going on next: with all the edges selected, go to the Select menu and choose Select Loops > Select Boundary Loops.

Now only the outlining edges are selected. Now these need to be separated from the rest of the mesh. To not destroy the original, duplicate the edges with Shift+D and immediate right-click so that they stay in the original position. Then press P > Separate > Selection.

Now you can go back into Object Mode and hide the original object by either selecting it and then H to hide, or you select the new object and go into Local view by pressing Numpad /.

Tab in Edit Mode. As you can see in the previous screenshot, I have enabled the Statistics overlay which shows that there are 10,008 vertices. Apart from duplicates I don't think that much is necessary. So select all with A, then hit M > Merge > By Distance. The default Merge Distance value of 0.0001 removes 20 vertices (they are definitely duplicates), but I reduced the number even more by setting a distance of 0.001 which removes 1,065 vertices. This is of course my personal taste, but you have to at least get rid of those 20 duplicates.

The next step is also optional, I tried to reduce the vertex even further: I press X > Limited Dissolve and left the Max Angle at the default value of 5°, now the mesh is down to 5,282 vertices.

Now come the annoying tedious parts of cleaning up. To create new faces, first of all the inner circles which will become the holes need to be connected to the outline. A face cannot have an unconnected hole, this means all holes need two edges that connect them with the outline. To make those connections, select a vertex on an inner circle and one vertex close to it on the outline edge, then press F to connect them.

This has to be repeated until all inner circles are connected by at least two edges. It is okay if those edges just connect to another circle, as long as in the end they are all connected to the outline. Unfortunately I don't know a better, easier way to do this - maybe someone else does.

Now you can select all edges/vertices formed by one connection to the enxt connection. In my case, the way I created the edges, this is one half of the shape.

Depending on how you connect the vertices or how the shape of the part is, this can also be like this... how you do it is quite arbitrary:

With this selection you can now create a new face by pressing F to fill it. Sometimes there can be problems if it forms a concave face, maybe you then have to select less vertices to make smaller faces.

Then you can select the remaining vertices and press F again to create the rest of the shape. You should enable Face Orientation in the Overlays to see if the faces are oriented correctly. If they are blue, the face normals are oriented correct. If they are red or some blue, some red select them all and either use Shift+N > Recalculate Normals to change them or if that doesn't help you can use Alt+N > Flip to switch faces that are still red.

At last, with the faces selected, press E to extrude them upwards. You can either do it by eye or enter a value or maybe snap it to the height of the original part (if you make it visible again if it's hidden or return from Local view with Numpad /).

How to create those chamfer screwholes?
When you cleaned up the geometry like described above, it should be no problem to do it with the Boolean modifier. But anyway, here is an alternative method to do it:

Select the edge loop around the hole.

Use the tool Rip Vertices And Fill and immediately Scale to create an outer ring. To do this, press Alt+V, S and drag to the desired size, left-click to confirm.

Select the ring of faces around the hole, then press Alt+E > Extrude Manifold.

This way you can extrude the faces downwards without creating duplicate geometry, left-click to confirm.

Now select the edge loop around the hole again.

Press Ctrl+B to bevel the edge to create a chamfer (scroll mouse wheel if the bevel has more than one segment).

If you don't want a small step on top of the chamfer, you can bevel the edge until it reaches the border. To make sure it doesn't overlap by going too far, you can hit C while beveling, this toggles Clamp Overlap on/off.

If you've done it like this with the bevel reaching the outer edge, to remove duplicate vertices select all with A, then press M > Merge > By Distance.

By the way: all the steps I described above also work on multiple holes simultaneously if you make sure that the Transform Pivot Point is set to Individual Origins:

This is literally SO helpful., thank you THANK YOU! I am having slight issues with the filling step (you have to manually select the edges, correct? And I assume this is why you wanted to decrease the vertices as much as possible?? To make it cleaner to work with?)  I think I will redo the Illustrator file without the holes to begin with (idk why they aren't even round...), then do as you said to get them 3D because I did follow that quite easily!! :) Then hopefully the boolean method works for my holes, though, I would like to try to learn the 2nd way too.

@Connor Yes, most of the edges have to be selected manually. Of course you can use Circle Select (C) or things like Pick Shortest Path (Ctrl + left-click), but it's still a lot to do. Learning the second method will definitely be worth a try, since everything you learn might be helpful in future projects.

first make it look like this one  clean and okay to work with

now select the edge of the circle and press ctrl + B  to add a chamfer
like this

now  all you need to do is to press ctrl+R on this face to make a loopcut  select the top of the loop cut faces and scale the z axis to 0 so that it will be flat

to do that all you need to do is press s and then z and then 0 and now you have yourself a ring around your circle

now select everything and press gthen z and drag it down so u can have a hole

another easier way is to make a cylinder like this one and just intersect it with your 3d model
here is the boolean file you could use and change
here is the file

Yes I know the geometry is a mess haha but before I fix it nicely I want to make sure I will be able to get my details (otherwise I will print the STL I already created which will not print as nicely but will work):
What I need is the circle to be indented into the existing mesh plates. See how I had It only partially into the surface? It won't let me attach another picture so let me edit the original post.

if you had a final product image  it would help alot

check now, I added it :) Thank you so much!!

edited my post, see if it helps!

unfortunately the whole boolean thing is just not seeming to work, I edited again.... thank you for your time!!! Not an easy program to self teach... Do my layers have anything to do with it??

what are your boolean settings? do you put it at intersect and choose the base model as the target object?

Sorry, but to help a new user you should re-consider some of your explanations. For example: "now select everything and press g then z and drag it down so u can have a hole". If he would just drag the selected part down, there would not be a step remaining at the top. The other thing is creating the ring beforehand: if you simply scale the sloped part to 0 on Z, the edges will be placed at a height centered between the higher and lower edge. Which means, the surrounding top faces will slope down towards the hole as well, especially since they are n-gons this creates even more messy geometry.

uploaded the file on my main boolean procedure in the first  post so you could download it and use it as a reference


text:
Cloth physics/clipping
I've added physics to my objects but the cloth clips on the cube's edges. Why is that?
https://gfycat.com/GoodIcyAustraliancurlew

Try increasing the cloth steps for a more accurate simulation - https://i.sstatic.net/NNzWY.png - or failing that, increase the Outer on the collision on the cube.

The cloth simulation is produced by way of calculating how the points will move over a number of discrete 'steps' each frame. If the steps are too large (and the cloth moving quickly) then it is possible for the cloth to move through a surface before it can be stopped - this is what is occurring in this situation. Once one vertex has moved below the surface of a mesh it can become trapped, unable to break free of the surface, and it can then exert a force that can drag neighbouring vertices below the surface depending on your collision settings.
There are a number of solutions to this problem. The simplest is to increase the number of 'steps' per frame. This will result in reduced motion of the cloth vertices each step, resulting in a much higher chance of it bouncing off the surface rather than passing through. Note that this will also increase the time taken to run the simulation (ie, 50 steps per frame will take 10 times as long to calculate as 5 steps per frame).

Another solution is to amend the Collision properties of the mesh to increase the 'bounds' at which the cloth interacts. The 'Outer' setting sets a boundary on the surface of the mesh which will repel the cloth. With this set too high there will be a noticable gap between the surface and the cloth - although this should not be a problem except with extreme situations or settings. The 'Inner' setting sets the boundary below the surface of the mesh that repels any intersecting cloth vertices back 'out' of the surface. Where possible you should always 'Apply Scale' to the cloth mesh any any mesh it interacts with.

In addition, it can help to increase the subdivision of the cloth mesh to give it more freedom to bend around any colliding surfaces. This will reduce the 'force' of any cloth mesh edges that will be interacting with the surface and reduce the chance of it pushing through the surface. Again, this will affect the time required to run the simulation (and may require even further increase of 'steps' to ensure the finer cloth simulation is processed at a fine enough scale).

there is defrent ways you can fix this problem :
first one is to try to increas the steps witch means basically the quality of the simulation
the second is give the cloth some thinckness
in the cloth colision tab try increasing the quality and the distance.


text:
OSL distortion effect
I have a simple math function that produce a saw-like pattern. The question is - How to apply a distortion effect to it?
Here's an example of the code:
shader basic_function(
point Pos = P,
output float f = 0)

{float x = Pos[0];
float y = Pos[1];
float z = Pos[2];

f = (z + 0.5 - floor(z));}

PS
Honestly, Im a new one in osl shader writing so it possible that I dont understand what im doing.

You can use the same methods as you would use to apply distortion to a node-based material - ie, distort the input coordinates.
For example, change the script to include a DistortFactor and DistortScale as follows :
shader basic_function(
point Pos = P,
float DistortFactor = 0.0,
float DistortScale = 1.0,
output float f = 0)

{

vector distortion = noise("perlin", P*DistortScale)*DistortFactor;

float x = Pos[0]+distortion[0];
float y = Pos[1]+distortion[1];
float z = Pos[2]+distortion[2];

f = (z + 0.5 - floor(z));
}

This will give you two additional inputs on the script node to allow you to adjust the amount of distortion and its scale. The 'noise' function is used to generate distortion based on the point vector (P), scaled by the input DistortScale and multiplied by the input DistortFactor - and added in to the coordinates used to generate the "stripes".

This can produce the following result :

EDIT : As @LarryGritz pointed out, the above solution is generally only of use for static objects - any object using this shader which is moving through the scene (whether location, rotation, or scale) will move through the distortion and the pattern will change as it moves. To address this we need to transform the World coordinates of 'P' into Object coordinates so the OSL code becomes the following :
shader basic_function2(
point Pos = P,
float DistortFactor = 0.0,
float DistortScale = 1.0,
output float f = 0)

{

point Pobj = transform("world","object",Pos);

vector distortion = noise("perlin", Pobj*DistortScale)*DistortFactor;

float x = Pobj[0]+distortion[0];
float y = Pobj[1]+distortion[1];
float z = Pobj[2]+distortion[2];

f = (z + 0.5 - floor(z));
}

Note the use of the 'transform' function to convert from 'world' to 'object' coordinates (similar to the Vector Transform node in node-based materials).

Note that it's almost never wise to compute noise(P), because P is a world space quantity so if he object moves, it will move through the noise, rather than having the pattern stick to the object. Much better to: point Pobj = transform("current","object",P);   blah = noise(Pobj);

That’s a very good point @LarryGritz - thanks. I’ll update my answer to include this.

@LarryGritz this almost worked - I needed to change "current" to "world" and now the above example is working as it should. Thanks.

Typo on my part. It should have been "common", not "current". This is the common shading space. It's equivalent to "world" in most renderers, but doesn't have to be, so the most portable way to express this is to use "common".

Additional note for those who appreciate the gory details: the use of object space coordinates for the noise lookup will solve the problem for  rigid objects. But if the mesh deforms, it still isn't enough to make the pattern stick to the surface -- for that case, you need to use an "undeformed reference mesh" or "Pref" (I don't know what the proper Blender terminology is for that).


text:
How to change the pattern of a texture for each tile in a shader?
I'm having trouble making the direction of the textures seperate in each tile so now it looks like one giant texture slapped on these set of tiles. Is there a way to make the texture inconsistant with each tile so that they look like separate mixed-up tiles?

In order to make each 'tile' different you need to change the 'noise' used to generate the pattern to be different for each tile. For your texture you are using a Brick texture to generate the 'tiles' - the Brick texture produces two outputs - the Factor and the Color of each 'brick'. Since the Color is consistent over each whole 'brick' - and is random for each brick (a random mix between the two supplied colors) - we can use this to generate a unique 'brick id' for each 'brick'.
The 'brick id' can be used to offset the Noise texture used for your texture by a different amount per 'tile' so as to generate a different pattern.
For example, I have tried to mimic your setup from your image (I think it's fairly close) and have added the highlighted nodes to adjust the texture per 'tile' :

Note the Brick Texture node set to the same values as the one used to generate the tiles. Color1 and Color2 are set to wildly different values to generate a large range of randomness.
The Color is passed to a Multiply node to increase the 'distance' of each random identifier (to increase the amount of difference in the noise) which is then used as the Z-coordinate of the Vector used to generate the noise.
This can produce the following results :

Blend file included


text:
I can't use the 3d manipulator
I can't use the 3d manipulator - whenever I attempt to drag the handles Blender simply repositions the 3D cursor.

In my experience (my laptop has this issue) it's a problem with OpenGL implementation affecting the selection. This causes dragging the manipulator to result in repositioning the 3D cursor instead of manipulating the object.
To resolve this you need to change the Selection option in the System tab of the User Preferences :

In my case, changing from 'Automatic' to 'OpenGL Select' resolves the issue.

I had the same issue on my laptop, and managed to fix the issue by turning off "Proportional Object Editing Mode" which looks like a little blue circle in the toolbar at the bottom of the page. (Shortcut O)
I discovered this because whenever I started a new 3D model with factory settings, the 3D manipulators would work perfectly fine, so I simply went through and copied all of the factory settings onto my project (I messed with a few things trying to fix another problem) and this was legit the last change I fixed and it was the only thing that made a difference for me.
EDIT: I know this post is old, but I thought I'd leave this here for anyone else experiencing the same issue.


text:
Cycles 'vector' pass meaning of W, X, Y, Z
I have a scene with moving objects and I want to extract the optical flow (apparent motion as seen by the camera). I am using Cycles. I include the 'Vector' pass and save the result as 'OpenEXR MultiLayer'. When I open the resulting file in Python I get the following channels:

RenderLayer.Vector.W
RenderLayer.Vector.X
RenderLayer.Vector.Y
RenderLayer.Vector.Z

What is the convention here? Could you provide a source for the information?

R: pixel displacement in X from current frame to previous frame
G: pixel displacement in Y from current frame to previous frame
B: pixel displacement in X from current frame to next frame
A: pixel displacement in Y from current frame to next frame. – From https://blenderartists.org/t/nuke-and-blender-speed-vector-pass-in-nuke/622902  - Maybe the info in this thread is helpful to do more research. RGBA might map to WXYZ or XYZW. (Not a real answer, so just commenting here.)

@micaelh Thank you, this information helped me to build the experiments that led to the actual answer.

Guided by @micaelh in the comments, I ended up doing some experiments moving objects in a controlled way, the results are below.

Vector.X - X displacement from previous frame to current frame
Vector.Y - Y displacement from previous frame to current frame
Vector.Z - X displacement from current frame to next frame
Vector.W - Y displacement from current frame to next frame

Values are in pixels. X displacement is positive to the left, Y displacement is positive downwards.

Is there a way to obtain optical flow between frames t and t + k where k > 1? Thanks!


text:
Can I project 2nd camera view onto a plane?
I’ve created a cellphone, with hands holding it… Then I created a scene, sort of like a small video game world. So picture this all in 1st person view.
What I’d like to do is have the cellphone screen show what my second camera (which is located on the back of the camera) is looking at. As though I’m using the cellphone to take video of the scene in front of it.

you could make a first render (cellphone filming) then import the movie and use it as Image Texture on the screen?

I’m going for a real-time type of thing. That is a good answer though. But not quite what I’m looking for.

I think it’s quite similar to https://blender.stackexchange.com/a/115868/29586 but it would be complicated by the change in size of the screen compared to the “camera” (which would be a surface rather tan a real camera. That might get you some way towards a solution.

Thanks. I’ll check that out and get back to this post.

@RichSedman it only works in cycles. That’s exactly what I’m looking for but I need a solution for eevee rather than cycles.

You’re right - cycles only. I’ve edited the question to include an Eevee tag. Possibly you could setup a multicamera scene and use an ImageTexture as an image sequence picking up the previous frame’s output. It would be one frame behind but could work. Similar to this technique - https://blender.stackexchange.com/a/213312/29586

I’m not sure of how to apply this… I guess I’d need a “for dummies” explanation. But I think I follow what’s being achieved here. What has definitely escaped my understanding is… whether or not this produces a real-time projection in eevee, or is this achieved by rendering to get the result?

Btw, thank you for you help thus far.

Yes - it is a quite complicated setup and happy to try and explain it further if it’s a suitable solution. However, it wouldn’t be ‘realtime’ as in instantly viewable in the viewport as the cycles solution would (with Eevee not being raster rather than a pathtracer renderer) - but also wouldn’t need a separate render pass or additional compositor steps. It all depends on your requirement and definition of ‘realtime’ I guess.


text:
How does the bend tool work?
How does the bend tool (⇧ ShiftW) work? I couldn't find any mention of it in the wiki or in the new documentation.
When I tried to use it, I failed:

It seems to use 3D cursor position, as well as the angle and distance from the mouse cursor.
What do the Radius and Bend Angle do? How do they affect the result?
What is an example use-case of this tool in action?

I remember Campbell himself made a feature video about this on youtube. fyi

@LeonCheung Wow, thanks. That explained everything :D

Here's the link in case anyone else is reading this.

The Bend Tool rotates around the 3D cursor and bends the selected parts of a mesh toward the mouse cursor position.
The tool is explained in this video.
Start position (white cross indicates position of mouse cursor)

End position and effect:

For predictable results use the bend tool in the orthographic modes.
Start position with 3D cursor at center:

Similar result:

Related:

Which tool allows bending a mesh?

Is there way to accurately set mouse curor location for the usage of Bend tool?

Yes. Press Shift + S for setting 3D Cursor Position.

@LeonCheung unfortunately no, that is why I prefer the spin tool.

@LeonCheung Precisely move the 3D cursor

@David I think Leon Cheung wants to precisely set the mouse cursor location, e.g. via keyboard inputs.


text:
How to connect nodes to node group inputs and outputs in python?
How can I connect nodes in a node group to the input or output sockets?
This connection here:

I can't figure out how to access the group node_tree, and the Group node as well as the Group input/output nodes seem to be different than normal nodes.
My script so far:
import bpy

for area in bpy.context.screen.areas:
    if area.type == "NODE_EDITOR":
        override = {'screen': bpy.context.screen, 'area': area}
bpy.ops.node.select_all(override, action='DESELECT')

tree = bpy.context.object.active_material.node_tree
nodes = tree.nodes
links = tree.links

node = nodes.new(type='ShaderNodeMath')
node.operation = "ADD"
node.location = (100,0)
node_add = node

node = nodes.new(type='ShaderNodeMath')
node.operation = "GREATER_THAN"
node.name = "greater"
node.location = (-100,100)
links.new(node.outputs["Value"], node_add.inputs[0])

node = nodes.new(type='ShaderNodeMath')
node.operation = "LESS_THAN"
node.name = "less"
node.location = (-100,-100)
links.new(node.outputs["Value"], node_add.inputs[1])

bpy.ops.node.group_make(override)
bpy.ops.node.tree_socket_add(override, in_out='IN')
bpy.ops.node.tree_socket_add(override, in_out='IN')
bpy.ops.node.tree_socket_add(override, in_out='OUT')

As a rule of thumb, you should try to avoid operator calls in scripts and use api functions directly as much as possible (if you do this, no need to override). So the snippet below is not needed.
for area in bpy.context.screen.areas:
    if area.type == "NODE_EDITOR":
        override = {'screen': bpy.context.screen, 'area': area}
bpy.ops.node.select_all(override, action='DESELECT')

Through some experimenting, I found it's easier to not use group_make as the default GroupInput and GroupOutput nodes it creates can be a bit unwieldy and adding a Socket to a tree creates a template rather than an actual socket (the lists displayed in Interface panel).
Rather, it's easier to create a new node group with bpy.data.node_groups.new and work with that.
import bpy

group = bpy.data.node_groups.new(type="ShaderNodeTree", name="testgroup")
group.inputs.new("NodeSocketFloat", "Input One")
group.inputs.new("NodeSocketFloat", "Input Two")
input_node = group.nodes.new("NodeGroupInput")
input_node.location = (0, 0)

group.outputs.new("NodeSocketFloat", "Out")
output_node = group.nodes.new("NodeGroupOutput")
output_node.location = (600, 0)

gtr_math_node = group.nodes.new(type='ShaderNodeMath')
gtr_math_node.operation = "GREATER_THAN"
gtr_math_node.name = "greater"
gtr_math_node.location = (200, 100)
group.links.new(input_node.outputs["Input One"], gtr_math_node.inputs[0])

lss_math_node = group.nodes.new(type='ShaderNodeMath')
lss_math_node.operation = "LESS_THAN"
lss_math_node.name = "less"
lss_math_node.location = (200,-100)
group.links.new(input_node.outputs["Input Two"], lss_math_node.inputs[1])

add_math_node = group.nodes.new(type='ShaderNodeMath')
add_math_node.operation = "ADD"
add_math_node.name = "add"
add_math_node.location = (400, 0)

group.links.new(gtr_math_node.outputs["Value"], add_math_node.inputs[0])
group.links.new(lss_math_node.outputs["Value"], add_math_node.inputs[1])

group.links.new(add_math_node.outputs["Value"], output_node.inputs["Out"])

tree = bpy.context.object.active_material.node_tree
group_node = tree.nodes.new("ShaderNodeGroup")
group_node.node_tree = group

The above gives you

Thanks NodeSocketFloat is the key that I was missing.

I figured a way to get this to work. It still uses the override as we add the group to the material and put the group into edit mode to use the tree_socket_add operator. Ideally we should be able to do this without using operators to visually edit the group. I'm using the operator usage to separate this from your other group question. As mentioned in that question the api change in 2.67 means this won't work in blender <=2.66
It should be improved by testing that we have an active material or even an object to add a material to.
Note that tree_socket_add adds the sockets to test_group.inputs where we can name them but to make connections we need to use group_inputs.outputs
import bpy

for area in bpy.context.screen.areas:
    if area.type == "NODE_EDITOR":
        override = {'screen': bpy.context.screen, 'area': area}

# create a group
test_group = bpy.data.node_groups.new('testGroup', 'ShaderNodeTree')

# create group inputs
group_inputs = test_group.nodes.new('NodeGroupInput')
group_inputs.location = (-350,0)

# create group outputs
group_outputs = test_group.nodes.new('NodeGroupOutput')
group_outputs.location = (300,0)

# add group to active material
bpy.ops.node.add_node(override,settings=[{"name":"node_tree", "value":"bpy.data.node_groups['"+test_group.name+"']"}], type="ShaderNodeGroup")
# put group into edit mode
bpy.ops.node.group_edit(override)

# create group input/output sockets
bpy.ops.node.tree_socket_add(override, in_out='IN')
test_group.inputs[0].name = 'in_to_greater'
bpy.ops.node.tree_socket_add(override, in_out='IN')
test_group.inputs[1].name = 'in_to_less'
bpy.ops.node.tree_socket_add(override, in_out='OUT')
test_group.outputs[0].name = 'out_result'

# create three math nodes in a group
node_add = test_group.nodes.new('ShaderNodeMath')
node_add.operation = 'ADD'
node_add.location = (100,0)

node_greater = test_group.nodes.new('ShaderNodeMath')
node_greater.operation = 'GREATER_THAN'
node_greater.label = 'greater'
node_greater.location = (-100,100)

node_less = test_group.nodes.new('ShaderNodeMath')
node_less.operation = 'LESS_THAN'
node_less.label = 'less'
node_less.location = (-100,-100)

# link nodes together
test_group.links.new(node_add.inputs[0], node_greater.outputs[0])
test_group.links.new(node_add.inputs[1], node_less.outputs[0])
test_group.links.new(group_inputs.outputs[0], node_greater.inputs[0])
test_group.links.new(group_inputs.outputs[1], node_less.inputs[0])
test_group.links.new(node_add.outputs[0], group_outputs.inputs[0])


text:
How to use Halftone Python Shader node?
I've found this rad looking halftone shader but as I'm pretty new to blender I don't know how to implement it. I've put it in the text editor then tried to get a script node to run it but it hits an OSL error.
Here is where I found the code https://blenderartists.org/forum/showthread.php?125741-PyNode-cookbook/page8&p=1234519#post1234519
Here is the code itself:
from Blender import Node
import math

sqrt_2 = math.sqrt(2)

class DotsNode(Node.Scripted):
    def __init__(self, sockets):
        radius = Node.Socket('radius', val=4*[1.0])
        grid = Node.Socket('grid', val=10.0, min=1.0, max=100.0)
        fg_color = Node.Socket('fg_color', val=3*[0.0]+[1.0])
        bg_color = Node.Socket('bg_color', val=4*[1.0])
        color = Node.Socket('color', val=4*[1.0])
        sockets.input = [radius, grid, fg_color, bg_color]
        sockets.output = [color]

    def nearest(self, coords, grid):
        """Return the nearest grid coordinate to coords."""
        x, y = coords
        gx, mx = divmod(x, grid)
        gy, my = divmod(y, grid)

        x = gx * grid
        y = gy * grid

        if gx % 2 == gy % 2:
            if grid - mx > my:
                return x, y
            else:
                return x+grid, y+grid
        else:
            if mx > my:
                return x+grid, y
            else:
                return x, y+grid

    def __call__(self):
        input = self.input
        coords = [self.shi.pixel[0], self.shi.pixel[1]]
        grid = input.grid # pixels
        radius = (1.0 - input.radius[0]) * grid

        # Get the square distance from coords to nearest grid point
        nearest = self.nearest(coords, int(grid / sqrt_2))
        sqdist = (coords[0]-nearest[0])**2 + (coords[1]-nearest[1])**2

        # if sqdist is less than the scaled radius squared than color one
        if sqdist < radius**2:
            self.output.color = self.input.fg_color
        else:
            self.output.color = self.input.bg_color

__node__ = DotsNode

Here is a sample image from the original post :

How can I produce this effect?

With the code selected press the Code Sample button in the tool bar, or  press ctrl + K . More info here.

Thanks David that will definitely help with any further questions I have!

Hello @aokayprice :). Could you please mark the answer as accepted, if it solved your problem? Thanks :).

The post you reference in your question is almost 10 years old and appears to rely on Blender features and APIs that are no longer available.
The code is definitely not for an OSL shader - so using a Script node will not work - it's actually a python script.
The first 'import' statement attempts to import 'Node' from package 'Blender' - as far as I understand it, this was the old package for API calls to interface with Blender that has since been replaced with package 'bpy' (blender python).

It is possible to create such an effect in the compositor using a similar technique to that apparently used in the original script.
To achieve this in the compositor we need to be able to determine the location of each pixel in the image so that we can determine how far each pixel is from the a grid used to position each of the halftone circles, scaling the circles based on the brightness at that point. The pixel location isn't directly availabel to the compositor nodes but we can use Blend Textures, which vary across the image, and feed those into the compositor to derive the X and Y location.
Start by swapping to the Texture properties panel and click 'New' to create a new texture. Give it a meaningful name (such as 'HorizontalBlend', set the Type to 'Blend' and set the direction to Horizontal. Ensure the Progression is set to Linear.

Repeat for 'VerticalBlend' (click the '+' to add a new texture), setting the direction of this one to Vertical.

These textures can be accessed in the compositor to determine the X and Y location in the image.
In order to create the halftone pattern we need to be able to split the image into a series of grid cells. Each cell will represent one 'blob' of the halftone pattern whose size will depend on the brightness of the rendered image at that point.
The following nodes can be used to generate an array of 'blobs' that we can use for the halftone :

This will produce something like the following :

The position in the image is split into a series of bands by the Modulo function (smaller values produce narrower bands). This is then multiplied up to the range of 0.0 to 2.0, 1 is subtracted (so the range is -1.0 to 1.0) and the Absolute node reverses the sign of the negative values. This results in a value that starts at 1.0, reduces to 0 at the grid line, and increases back to 1 - ie, the distance from the grid line. The same is done in the other dimension and the results combined (with pythagoras - a^2 + b^2 = c^2) to give the distance from the centre of each circle.
We can turn this into the halftone image by simply comparing the distance to the nearest centre with the brightness at the current point in the image. This produces the following rudimentary halftone :

To refine this a bit we can slightly change the pattern by offsetting each alternate row - this will produce a hexagonal arrangement of blobs that produces a more pleasing result :

Adding Mix nodes we can add a splash of colour for the two halftone shades and the background (set to black by setting Environment Ray Visibility to disable visibility to the camera) and the foreground (drawn using Freestyle as white lines) and nodes to allow fine tuning of the halftone (the Divide and Subtract nodes).

To finish this off we can add nodes to allow the horizontal and vertical dot pitch and better adjustment for the colours, brightness and contrast as well as Blur nodes to allow the effect to be softened (blurring before the halftone removes hard edges and fine detail that would interfere with the pattern, whereas the blur after the halftone softens the 'blobs' themselves) to produce the following nodes :

By unchecking the camera visibility of the environment (so it appears black) and by adding pure white edges using Freestyle we can achieve the following result :

Blend file included

EDIT
I've extended this to produce a colour halftone by simply splitting the image channels, duplicating the nodes, and re-combining the result. You could potentially change the dot pitch on each channel for different halftone effects.
Here's the node tree (apologies for the scale but it's included in the blend below) :

The coloured original :

And the coloured halftone :

Blend file included
You can also experiment with the dot pitch to use different pitch per channel. For example :

Thanks rich I will try to figure out how to ask my question and then post something!

@aokayprice Your question got me interested in producing halftone effects in the compositor. Please see the edit. Hope this helps.

Wow rich this is incredible! Thank you so much for the hard work that must have gone into making this node structure. I'd been obsessing about it too and found some other much less robust solutions that I posted on my reddit thread here (https://www.reddit.com/r/blender/comments/7t06w3/halftones_in_blender/) I will post a link there of your solution too for anyone interested.

Thanks @aokayprice - I've really enjoyed working on this. I've extended it to produce a coloured halftone - please see the edit. I think this could produce quite interesting effects, particularly with different dot pitches for the different channels.

Wow it keeps growing! Thanks for the blend file it would take me a lil while to reconstruct it for sure. Definitely very interesting results, I have a lot of friends working in 2D animation / indie comics and I'm really excited to bring some of that aesthetic to 3D animation. I'm still learning the basics but they're going to be jealous when I can make a cartoon without drawing a million frames.


text:
Cloth collision with an object
I have two chairs, a cloth piece falling on it and then a helmet falling above the cloth on one of the chairs. Whatever the setting I'm trying I cannot get the helmet fall nicely on the chair and interact naturally with the cloth. Right now I have following:

the helmet is falling down
the cloth is falling down
the cloth is interacting with the chairs naturally
in the process of falling the helmet gets pushed by the cloth piece far away (as if it would be very hard surface).

https://youtu.be/zmyO6NA9R1U

I also read that soft body physics might be a solution, but it didn't work in my case and the rendering times are getting expanded.
The cloth has settings: 5/M, 10/s, 15/b, (here I tried almost everything)
rigid body is off,
Collision physics is off
Helmet settings:
Right body active, mass 10,
all other physics are off.
Right now almost all the other settings (except cloth physics) are default.
Would be glad to get some help!

Edit : Amended the Rigid Body Collision shape to 'Mesh' and this helped with allowing the helmet to collide with the cloth but now the cloth is being forced through the chair.

Can you post an animation of the motion - this might give some clues as to what’s going on.

Okay will try it tonight and will send a link

@RichSedman can I upload the video on this website? this is my first question here and I don't know how to add the files to the thread. Thanks for helping

https://youtu.be/zmyO6NA9R1U

Thanks for the link - you can use Edit on the wuestion and add it there also. If it’s in animated GIF format and is less than 2Mb they can be added directly into the question as an image. I see what you mean about it bouncing off. Are you sure it’s the cloth? What does it do if you remove the cloth? Are the chairs set as rigid body ‘mesh’ collision?

I shifted the cloth aside to see whats happening. The helmet is not changing its trajectory and falls the same way as if there were obstacles.

Most likely it's a problem with the collision bounds of the chair. In the Physics panel of the chair, check the Rigid Body Collistions 'Shape' - it defaults to 'Convex Hull. If it is set to that (or anything other than 'Mesh') then try changing it to 'Mesh' and see if that helps.

Ok it worked, thanks! Now the helmet is just going through the cloth, how I can get them to contact with each other? When I'm switching on the collision physics on the Helmet, the cloth is starting to behave even more strangely. Will add another video in a minute

https://youtu.be/hxDob4ebb8g

This is just a guess, but have you tried 'Apply Scale' on the helmet?

didn't work in my case...

Can you upload your blend file to https://blend-exchange.giantcowfilms.com and paste the link into your question so I can take a look?

Will do it asap.

@IraKonyukhova the two YouTube videos are unavailable.

For rigid body and cloth/soft body simulations there are a number of things you need to be careful of.

For the Rigid Body simulation you need to ensure you select the correct 'Shape' for the Rigid Body Collisions. The default option is 'Convex Hull' which if fine for objects which are rolling over a flat surface but since it doesn't allow for any concave surfaces (such as the indentation at the seat of the chair) it is not good for smaller objects colliding with the body. Therefore, in this situation ensure you set the Shape to 'Mesh' to allow the actual mesh shape to be used for collision. This is less efficient (since the engine needs to calculate collision for all surfaces, not just an outer 'shell') but produces more accurate results. Note that you should set this for each rigid body.

Ensure to set sufficient 'steps' in the cloth simulation. More steps will result in more time to calculate the simulation but will produce much more convincing results - especially where objects are hitting the cloth at high speed. Using a larger number of steps should avoid problems such as the fast moving object passing through the cloth or the cloth getting forced through the other geometry.

Ensure to carefully set the Collision Settings - it's very tempting to just add the 'Collision' and forget about what the actual settings mean and leave them set to the defaults or inappropriate settings. For interacting with cloth the key settings are obviously the Soft Body and Cloth settings and these consist of Outer and Inner thresholds. The Outer dictates how close to a surface the cloth can get before it is pushed away while the Inner controls how elements of the cloth that have been pushed into the surface are repelled back out of the surface. Note that you should generally avoid setting the Inner to more than 50% of the minimum depth of the mesh - ie, if the thinnest part of the mesh is 1 Blender Unit in width then do not set this to more than 0.5 - otherwise problems can occur where cloth that penetrates below the surface is effectively pushed through to the other side rather than being repelled. The 'Outer' should be kept fairly small to prevent gaps between the surface the the colliding cloth.

Note that your first issue was caused by the Rigid Body 'Shape' - set this to 'Mesh' to allow the rigid bodies to react to the actual shape of the mesh (rather than a simplified convex hull).
From the second animated example, it appears that the helmet's collision 'outer' is such that it is repelling the cloth before it even gets close enough to touch it. The 'inner' collision of the chair is then presumably repelling the cloth through the surface. You should reduce the 'Outer' of both the helmet and the chair to close to '0' and adjust the 'inner' of each mesh's collision settings to a value that is not more than 50% of the thinnest part of the associated mesh. This should then produce a more stable simulation, similar to this :

Blend file included

EDIT: Note that @Ralf and @James_t pointed out that the attached Blend file doesn't actually work with later versions of Blender. This is due to a change in behaviour related to the Rigid Body simulation and how/when it is evaluated with respect to other modifiers. See How to combine Hair and Rigid Body physics? and this developer report.
The rigid body is now evaluated in a different order - previously it would be after all other modifiers but now - under certain circumstances - it can be before other modifiers. By setting the Rigid Body Source to 'Base' or by changing the collision Shape to something other than 'Convex Hull' or 'Mesh', the old order of simulation is applied - otherwise the rigid body is ignored in the cloth simulation.

Wow thanks a lot. I will try to do it on Monday and will notify you about the results.

Thanks again it worked! For even smoother result I just animated the helmet and didn't apply active rigid body to it. If you like I can post the video of the result

@IraKonyukhova Brilliant - glad to help. Yes - I'd love to see the result.

@RichSedman see "answer" by Ralf, below and my followup answer.  I would need more input from a better expert because "Deform" and "Final" aren't working for me in 3.0.0, whereas "Base" works.  Do I need to Bake Rigid Body World or some other process to get these to work?

I agree with @Ralf and found the problem.  In the blend file from @Rich : he mentions setting from Convex Hull to Mesh, but his version of the file did not have this change (perhaps he uploaded the wrong version).
However, even this did not solve the problem for me!   The solution (not yet making full sense) is to use either "Hull" or "Mesh", but to set the Source to "Base" instead of "Deform", and oddly "Final" didn't work...  But that means that if I have a deforming (eg, softbody) object, I will get inaccurate results for the cloth simulation!

Note also that setting Shape to "Sphere" worked in Deform or Base Source mode.  Okay uhm...
My solution:

I've just downloaded my original file and opened in Blender 2.78 and it works fine - the chair is correctly set to Mesh collision and everything works fine with the cloth and collision with both the chairs and the falling ball. I wonder if the problem is with opening on 3.0.0 and the same settings aren't being preserved. I can't load it into 3.x.x at the moment so will try it later.

Actually, I just realised with your comment about "setting Shape to 'Sphere'" that this is a completely different problem to the original post - your problem is that the falling rigid body isn't affecting the cloth whereas the original post was that the rigid body wasn't falling into the cavity of the chair. The change in my answer was to change the collision properties of the chair, not the ball. This should be asked as a separate question rather than on this answer since it's different to the original question and also likely cross-version related. By all means link new question to this one.

This did seem familiar and I've located a related answer that explains the change in behaviour - see https://blender.stackexchange.com/a/196320/29586 regarding other simulations (in that case hair but it applies to cloth too) taking notice of the rigid body simulation. Your solution of setting the Source to 'Base' is mentioned and the actual Blender developer change is described here : https://developer.blender.org/rB342a6b5f9339c31931f4d2c87d9f47b88307e8cc

@RichSedman -- thanks for your findings and analysis.  It's unclear from Fix T77685 and "Partially Fix T77685 (Closed)" whether they are still aware of the problem with Deform and Final.   I'll consider this tomorrow and perhaps and perhaps post a question in one of these issues.