text:
Blender 3.1 lights burned-out on Ubuntu
I'm having a nice looking scene in Material preview (Blender v3.1.2).
So far looking good with the default HDRI (I'm not sure exactly how this works).

I then added a simple Sun light, checked Lighting > Scene Lights and now my whole thing is burned in both Material Preview and Rendered (Eevee) while totally black with Rendered (Cycles).

My textures are nothing special, BSDF + changed Base Color to green, blue etc...

I'm working with unitless values (Scene > Units > Unit System > None) so I thought it may be that (never had any issue before tho) but no success.
Of course, turning down the strength of either a Sun or an Area light does nothing.
Here is how it looks with a 30W area light, it's burned to crystal clear white.

Here are my Scene > World settings, nothing special neither

Nothing funky in the Color Management neither.

So, either I do have a convert 0.001 strength to 500k WATTS mode or I'm missing a setting somewhere.
Forgot to mention by my previous render went perfectly well (no burning like that).

Update: I just tried to render it, to see how bad it would look and it's actually perfect while rendering for some reason...meanwhile I cannot really spend my time rendering to see the actual result.
A real solution would be highly likable.

Here's my outliner, everything is shown in the same way (viewports or renders).

TLDR: relaunch Blender if getting out of Ubuntu's suspend mode.

While writing this question, Stackexchange recommended me to look at those 2 other questions so I gave them a read.

I finished on this Reddit answer, where the author talks about the real render in real life and how it looks.
This gave me the idea to try to render it out. It failed and I noticed a CUDA error on the bottom middle of the UI.
Double checked my GPU settings, everything was totally fine and nothing moved.
I gave Blender a reboot and everything is working fine now.
The culprit? Ubuntu and the way it handles the suspend mode, not the first time I do have an issue when getting out of it. Time to move to Arch I guess...


text:
Material displacement as (displacement) surface modifer
I have a model that relies on the displacement of the material to get the desired shape, but now I wanted to apply a remesh surface modifier after the displacement and I am having issues with how to proceed.
I know that the material is applied after all surface modifiers so I first tried to add a displacement modifier and remove the displacement from the material. The problem is that I cannot get the modifier to act the same since the available nodes are different. This is roughly how my nodes look like as part of the material:

Using texture nodes (for the displacement modifier) the Wave texture for example doesnt exist at all. I know it is possible to bake the displacement into a texture and then use it in the displacement modifier but if I want to animate the displacement this becomes a very tedious process.
So I was wondering if it is possible to use the animated displacement nodes from my material as a displacement surface modifier or alternatively if it is possible to first use the shader displacement before the surface modifiers get applied?

When you talk about surface modifier, do you mean the Displace modifier? The texture are not the same so I guess you need to use some tricks to use them

Yeah, ideally a displacement modifier but if there is another deform modifier that can keep the same result that would be fine as well.

You would have to bake the material displacement to an image and use that in the displace modifier

@AllenSimpson So if I want to animate the displacement I need to bake an image for every frame right?

I would say yes

source: Stack Exchange

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

sort: votes


text:
Create petals for cylinder flower in Geometry Nodes (3.1) (question 1)
I've been following a tutorial by Kaizen
I managed to get it to work the way he does it which is fine. Then I tried to apply it from the ground up step by step but doing it in a different way.
This is what I need help with:
#1 I want to spawn a flower heart or centre, as a cylinder with X faces. I've managed to do that okay, and I think I will add a reference to an Empty object in the scene so I can manually rotate the flower head.
How do I rotate the centre/heart so it faces up along the curves direction (or normal I suppose)? That way I can draw the curve to appropriately have the flower face a certain direction.
Also, is there a simpler way to just tell GeoNodes to spawn an object at the end of curve* (at the final vertex) without using the ColorRamp technique that he does?

please focus on one question, not two, else your question will be closed (these are the rules, i didn't make them), so just copy the 2nd part and open a new question and paste it there. thank you.

thanks for the response. could you point me to where it mentions that rule? the question was based around making a proper flower, i just split it into two to break down the steps i was looking to achieve. i would think that splitting it into two posts would dilute the question and response.

You could use the following setup:

Reverse the curve (if the start point is at the bottom).
Use the node Curve to Points and set Count to the value 1. This way only one top point remains and you also get the necessary rotation for the object to be instantiated.

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


text:
How to make a rigidbody on a curved plane?
I used THIS video to create a curved plane and then made a UV sphere. My plane is curved smoothly. However, when I try to give it a rigidbody and let the sphere slide on it, it acts as though the rigidbody was where the flat plane would be instead of the curved surface. How do I fix this?
Edit: I am using convex hull, and have attached a screenshot.

Other Edit: Thank you so much! It worked!

Please add screenshots to clarify the problem.

Without any information on your rigid body settings or screenshots of those settings, this is just blindly guessing: is the curved plane set to the default collision shape "Convex Hull"? Then the concave side of your plane will be treated as a flat plane - because that's as close as a convex hull can get on a concave surface. You have to switch to "Mesh".

For the ground, in the Physics panel, choose Shape > Mesh, Source > Deform:


text:
Using geometrynodes how can I store impact points of particles when they hit a mesh?
I am experimenting with doing different simulations in geometry-nodes. What i am trying to do now is store the impact points of the particles as they hit a mesh.
Is there a way to store those impact points in a vertex or weight-map on the mesh they hit?
For example if a particle hits a mesh and bounces along it i would like to see the impact points in the vertex or weight-map.

Could you share a demo Blender file including a piece of mesh and some particles using https://blend-exchange.com/ ? Do you want the impact points stored in the mesh or particle wise ?

Vertex or Weight maps store information for each vertex of the mesh. What if the particles hit the surface of the mesh instead. Or if multiple particles hit the same face. And example of what you are trying to achieve or a blend file with your progress may help getting a better answer.

Here's a simple setup:

The same split into parts for easier reading:

Start a simulation on the original geometry, which becomes the shooting Target. Also mantain a separate Geometry with points called Bullets. On each frame there's 50% chance to spawn a new ("bullet") point and join it with existing points. Spawn it randomly $2$ units away from the origin (Suzanne's ears are big; also consider improving the spherical distribution) and for convenience save the negated (opposite) and scaled down position as velocity, so all points fall towards the origin.

Raycast from the points, using the velocity, to find out if they're about to hit the original geometry (Target could be used instead of Group Input). Separate the points that are going to hit - they won't be rejoined, they are scheduled to be removed, but will be useful in a moment. Keep in mind the Ray Length is a result of scaling the normalized random position by 2, then by -0.01 plus 5% margin. Move the dying points to a $<i, i, i>$ position, where $i$ is the index of the nearest vertex of the target - this way a vertex will be easily able to find if a bullet has hit it on current frame.

Starting from the right: a switch looks at the dying bullets. If there are none, the number 0 converts to boolean FALSE and Target geometry is not changed; otherwise update the energy attribute by first multiplying it by $0.9$ (dissipate 10% energy), and then adding $1$ energy if a point is found on the position $<i, i, i>$. Consider how one of the flaws of this algorithm is that multiple points hitting in a single frame still count as one.

Update the target in the simulation, and update the remaining bullets by moving them towards the origin. Instance icospheres on bullets to display them, set the material on the Target (a simulation removes the material):

Obviously the effect is better for a higher density mesh:

Though you might want to e.g. blur it to make the dots bigger:


text:
With geometrynodes how do i rotate mesh so it follows the detected face angle
How do I rotate mesh so it follows the detected face angle or another mesh.
Detect angle of edges
Using the above method I can place either a cube or a sphere in the appropriate location. However if I have a 90degree inward facing corner piece and a 90degree outward facing corner piece the correct mesh is placed in the correct location but there rotation is not updates.
Im looking for a way to specify a rotation in radians for each mesh, that way if a have an angle of 15 degrees or -17 degrees etc I can specify which mesh to place and it will align correctly.
In the image i have three meshes, one interior and exterior 90 degree mesh and one example of a mesh with a random face angle.
Im working with the following


text:
Separate horizontal edge loops from a mesh and adjust the transform of each independently using Geometry Nodes
I have a subdivided cube into horizontal levels. With geometry nodes I want to separate all horizontal edges from the mesh and each other so I can adjust the transform of each level.
Here is an image of what i want to achieve.

In the image above, i have the horizontal edges/loops selected on the left mesh and the result i want is on the right. I want to separate the edges / loops and move them separately to the right and be able to adjust the transform of each edge loop

what do you mean with "i can adjust the transform of each level"?  can you show us the end result you wanna achieve?

So in the image above, I have the horizontal edges/loops selected on the left. The result is on the right. I want to separate the edges and move them separately to the right and be able to adjust the transform of each edge loop.

I don't believe geometry nodes has a conception of edge loops.  Additionally, "horizontal" isn't always well-defined for every mesh.  However, we can identify the loops in which you're interested, in the mesh in which you're interested, by a set of particular qualities: 1, the faces that they join are both perpendicular to the object up/down vectors; 2, the faces they join are coplanar.  We can select these edges and only these edges by capturing the face normal and the edge angle, and then separating edges that meet both of those criteria:

What we want to do with these edge loops is now up to us.  Different transformations are different operations.  Your picture suggests you're interested in shearing these edges, which we can do by translating in some axis on the basis of height times some constant:

Select the edges you want to manipulate, press P (Separate Elements Menu) > Selection.

Then in Edit mode for that new object, go into side or front view, and then Shear (Ctrl+Alt+Shift+S) to transform the loops like in the image.

i am not sure, but i think she wants a geometry nodes solution because of the tag...

@Jakemoyo Yes Chris is correct, sorry I should have added geometry nodes in my question instead of just that tag :( However i never knew you could use Ctrl+Alt+Shift+S to shear like that so thank you for that tip :D


text:
Rigid body's collision stays in place
Rigid body's collision stays in place even though the rigid body is moving. Because of this, the fabric catches on the void and rigid body passes through the fabric.

the trick is: set the rigid body source to "base" then it works:

Note: i raised cloth quality steps to 9 for that sample.

thank you very much for your help!

you are welcome! nice animation by the way... ;)


text:
Geometry nodes to distribute houses along edge normals
I need some urgent help to distribute these houses inside each block and rotate them accordingly to the edge normals of the block. All houses are already in a collection. The houses at the outside will face 90 degree with their front edges. For the ones inside the blocks I’m okay with any direction they might face, but preferably following 1 of the 4 of the edges normal like the outside ones so it won’t look weird. The houses should have a slight distance with e/o like on the image and randomize a bit in scale. I know only a (very) few geometry nodes so if anyone can help with the full steps to do this, I’d be very much grateful.
Thank you in advance!

It might be helpful to people trying to help you if you uploaded an example blend file of what you have to the site https://blend-exchange.giantcowfilms.com/ and add that link in the question.

Could you please upload your file? There are too many possibilities to solve that issue and i need to know what your specific situation is.

@quellenform this is the file, I tried with some nodes but the result is not so efficient as the houses keep clashing with e/o. I tried to fix that by adding verts to the block shape to randomize the geometry (seed doesn't work for all blocks at once, I had to do it manually). If you can take a look it'd be great, thank you in advance!

@RickT thanks for the headsup!

If I understand you correctly, it's not actually about aligning the houses along an edge (or not only), but primarily about avoiding that the houses intersect each other. Right?
Then I have bad news for you:
You won't get that easily with Geometry Nodes, because with this technique you can't manage a size-dependent distribution.
The main problem is that you can instantiate objects with GN, but you can't align the instances depending on their properties (dimensions). Currently there is the option Poison Disk in the node Distribute Points on Faces, but with this you can only get partially usable results, because your houses are of different length.
And exactly this length cannot be included in the distribution. Therefore, you will always get a halfway acceptable result with this technique by trial and error.
However, there is a way to make the whole structure a bit clearer and achieve a bit more influence on this distribution (and aligning as well):

First, convert your house plane to curves in the editor (right click on the object and then Convert to -> Curve) so you get rid of the inside edges, because they interfere here.

Then convert these clean curves into a mesh using the Fill Curve node. You will notice that the rotation is now better than before.

Add the Geometry Proximity node. With this you have the possibility to influence the instances that are further away from the edges (e.g. the rotation). Furthermore, you could also use it to calculate the alignment, which you currently calculate directly over the two points of your edge.

Subsequently, with the value that Geometry Proximity provides, it would also be possible for you to create a mask based on the distance to the edge, with which you could, for example, use objects of a different collection in the inner area of the faces, which would cause fewer problems with regard to the size.

However, one trick might be to construct your objects to be instantiated in a manner similar to a computer game. Think of Civilization, for example. There, all building blocks are divided into hexagons, so they can be lined up evenly on a grid.
For example, if you design your houses this way (e.g. combine two buildings into one object), and create your points more evenly on the surface, you may get a result with fewer intersections.
I'm sorry that I couldn't give you such a great help here, but this is Blender, not Houdini...
Here is your modified blend file:

Thank you so much for your help! I actually tried another temporary nodes but the result is not effective as the houses keep clashing with e/o. I made a temporary solution by adding verts to the block base so the geometry can be randomized until I got the least-clashing result and move on to other blocks, repeating the same steps. I need to make several more versions of this landscape (different houses) so it would be very time consuming to manually modify for each time.

Here's my file, I'd be grateful if you can take a look and help me with the clashing problem. I'll try your solution also, thank you again for your help!

Thanks a ton for your help! A bit of clashing is fine since the landscape is supposed to look at from afar, not up close anyway. I'm really a noob at geometry nodes so any instruction is absolutely helpful for me. I'll try your solution, again I'm very grateful for your help and explanation.


text:
Object's Children tuple index failed
In blender python console it work
>>> name
'table_TV'

>>> D.objects[name].children[0]
bpy.data.objects['table_TV_viewRec']

but if I packaged it into a function:
def a(group):
    for obj in group.all_objects:
        name = obj.name
        if Viewable(obj):
            bpy.data.objects[name].children[0] # error

            for obj_other in group.all_objects:
                if not obj_other.name == obj.name:
                    print(obj_other.name)

group = bpy.data.collections['group_TV']
a(group)

It won't work and show me IndexError: tuple index out of range
Function Viewable:
def Viewable(object):
    """
    Description:
    Check if object is visible object.

    Return: True or False
    """

    object_front_name = object.name.split("_")[0]
    object_last_name = object.name.split("_")[1]

    if object_last_name == 'TV' or object_front_name == 'cupboard':
        return True
    else:
        return False

Did you make sure that all objects in the collection have a child?

If viewable is True it must have.@XY

I don't thing so.

Viewable use the name to determine whether an object is visible or not, Return True or False.@XY

Try to test a no children object, it can return True, but no children.

I've tested it, same error occured in line bpy.data.objects[name].children[0].

Obviously, whether the function returns True has nothing to do with whether the object has child objects. So, it out of index.

Let us continue this discussion in chat.


text:
Why my blender always crash while running script?
Open blender and run script after 3-5 times later, it will crash and no response, even only a few lines of code.

Each time I have to close and restart it, how to solve this problem?
This is one part of my script.
from ast import Global
import collections
from operator import iadd
from pickle import TRUE
import re
import bpy
import math
import random
from mathutils import Vector
from gpu_extras.batch import batch_for_shader
import shapely.geometry

import numpy as np

C = bpy.context
D = bpy.data

def orient_vector(object):
    # center = object.location
    orient_vec = object.matrix_world @ (Vector((1, 0, 0, 0)))

    return orient_vec[0:3]

def ret_obb(verts):
    """
    Description:
    Get verts of object and calculate object's OBB

    Return:

    """
    points = np.asarray(verts)
    means = np.mean(points, axis=1)

    cov = np.cov(points, y = None,rowvar = 0,bias = 1)

    v, vect = np.linalg.eig(cov)

    tvect = np.transpose(vect)
    points_r = np.dot(points, np.linalg.inv(tvect))

    co_min = np.min(points_r, axis=0)
    co_max = np.max(points_r, axis=0)

    xmin, xmax = co_min[0], co_max[0]
    ymin, ymax = co_min[1], co_max[1]
    zmin, zmax = co_min[2], co_max[2]

    xdif = (xmax - xmin) * 0.5
    ydif = (ymax - ymin) * 0.5
    zdif = (zmax - zmin) * 0.5

    cx = xmin + xdif
    cy = ymin + ydif
    cz = zmin + zdif

    corners = np.array([
        [cx - xdif, cy - ydif, cz - zdif],
        [cx - xdif, cy + ydif, cz - zdif],
        [cx + xdif, cy + ydif, cz - zdif],
        [cx + xdif, cy - ydif, cz - zdif],
        [cx - xdif, cy - ydif, cz + zdif],
        [cx - xdif, cy + ydif, cz + zdif],
        [cx + xdif, cy + ydif, cz + zdif],
        [cx + xdif, cy - ydif, cz + zdif],
    ])

    corners = np.dot(corners, tvect)

    return [Vector((el[0], el[1], el[2])) for el in corners]

def Align():
    '''
    Description:
    choose all objects in nected collection then aline to one direction

    '''

    def ViewRectangle(obj):
            """
            Description:
            Define object's visible area, after align()

            """
            if Viewable(obj):
                temp = shapely.geometry.MultiPoint(obj["bottom_poly"]).convex_hull
                # x_i = (a, b)

                x_0 = temp.exterior.coords[0]
                x_1 = temp.exterior.coords[1]
                x_2 = temp.exterior.coords[2]
                x_3 = temp.exterior.coords[3]

                obj.select_get()
                point_0 = x_3
                point_1 = x_2
                point_2 = (x_2[0] + 3, x_2[1])
                point_3 = (x_3[0] + 3, x_3[1])

                bpy.ops.mesh.primitive_plane_add()
                bpy.context.object.scale[0] = 3
                bpy.context.object.scale[1] = x_1[1] - x_0[1]
                bpy.context.object.location[0] = (x_0[0] + (x_2[0] - x_1[0])/2) + (x_2[0] - x_1[0])/2 + 1.5
                bpy.context.object.location[1] = x_0[1] + (x_1[1] - x_0[1])/2
                bpy.context.object.name = obj.name + '_' + 'viewRec'

                bpy.data.objects[bpy.context.object.name].select_set(True)

    for object in bpy.data.collections["furniture"].all_objects:
        name = object.name

        object.select_set(True)
        bpy.ops.transform.transform(mode='ALIGN', value=(0, 0, 0, 0), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=False, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
        object.location.z = 0
        accessableArea(object)

        # rechoose object
        object.select_set(True)
        ViewRectangle(object)
        # bpy.data.objects["Cube"].select_set(True)
        bpy.data.objects[name].select_set(True)

        # combine object and its view rectangle into one
        bpy.ops.object.join()
        object.select_set(False)

def Viewable(object):
    """
    Description:
    Check if object is visible object.

    Return: True or False
    """

    object_front_name = object.name.split("_")[0]
    object_last_name = object.name.split("_")[1]

    if object_last_name == 'TV' or object_front_name == 'cupboard':
        return True
    else:
        return False

def Visible_cost(group):
    """
    Description: If some object in one object's visible area, then cost will rise.
    Here we define cost as the area of intersection of one object with another object's visible area
    """

    # group: bpy.data.collections["x"]
    for obj in group.all_objects:
        if Viewable(obj):
            name = obj.name + '_' + 'viewRec'
            bpy.data.objects[name].select_set(True)
            verts = [v.co[:] for v in bpy.context.object.data.vertices]
            plane_poly = shapely.geometry.MultiPoint(verts).convex_hull
            for obj_other in group.all_objects:
                if obj_other != obj:
                    obj_other.select_set(True)
                    verts_o = [v.co[:] for v in bpy.context.object.data.vertices]
                    x = shapely.geometry.MultiPoint(verts_o).convex_hull
                    if x.intersects(plane_poly):
                        return x.intersection(plane_poly).area
                    else:
                        return 0

def touchable(object):
    """
    Description:
    define if an object touchable

    Return:True or False
    """
    if object.name.split("_")[0] == 'sofa' or 'table' or 'chair':
        return True

    elif object.name.split("_")[0] == 'potting' or 'water_cooler' or 'cupboard':
        return False

def accessableArea(object):
    '''
    Description:
    One property for object.

    Return: object's acessable area(4 points)

    '''
    if object.name != 'door' or 'Plane' or 'window':
        object.select_set(True)
        bpy.ops.object.mode_set(mode = 'OBJECT')
        verts = [v.co for v in object.data.vertices]
        obb_local = ret_obb(verts)
        mat = object.matrix_world
        obb_world = [mat @ v for v in obb_local]

        # Visualization
        # bpy.ops.object.mode_set(mode = 'EDIT')

        # # draw with GPU Module
        # coords = [(v[0], v[1], v[2]) for v in obb_world]

        # indices = (
        #     (0, 1), (1, 2), (2, 3), (3, 0),
        #     (4, 5), (5, 6), (6, 7), (7, 4),
        #     (0, 4), (1, 5), (2, 6), (3, 7))

        # shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
        # batch = batch_for_shader(shader, 'LINES', {"pos": coords}, indices=indices)

        # def draw():
        #     shader.bind()
        #     shader.uniform_float("color", (1, 0, 0, 1))
        #     batch.draw(shader)

        # bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')

        # EXAMPLE of object's bottom_poly: [(x_1, x_2), (x_3, x_4), ... , (x_k, x_k+1)]
        list = []
        for x in range(len(obb_world)):
            if abs(obb_world[x][:][2]) <= 1:
                list.append(obb_world[x][:][0:2])

        object["bottom_poly"] = list
        object["accessArea"] = shapely.affinity.scale(shapely.geometry.MultiPoint(object["bottom_poly"]).convex_hull, xfact = 1.2, yfact = 1.2).exterior.coords[:]

        object.select_set(False)

    # box = object.bound_box
    # p = [object.matrix_world @ Vector(corner) for corner in box]

def CheckIfHit(object_1, object_2):
    """
    Description:
    check if object_1's bottom hit to object_2's bottom

    Return:
    True or False
    """

    obj_1_bottom_poly = shapely.geometry.MultiPoint(object_1["bottom_poly"]).convex_hull
    obj_2_bottom_poly = shapely.geometry.MultiPoint(object_2["bottom_poly"]).convex_hull

    return obj_1_bottom_poly.intersects(obj_2_bottom_poly)

def CheckIntersect(object_1, object_2):
    """
    Description:
    check if object_1's bottom in object_2's accessible area and return intersected point list

    Return:
    list of object_1's bottom points which intersected with object_2's access area
    """

    temp = object_2["accessArea"]
    obj_2_access_poly = shapely.geometry.MultiPoint(temp).convex_hull

    intersectPoint = []

    for i in object_1["bottom_poly"]:
        i = shapely.geometry.Point(list(i))
        if obj_2_access_poly.intersects(i):
            intersectPoint.append(i)

    if not list:
        return False
    elif list:
        return intersectPoint

def select_from_collection(some_collection):
    """ Recursively select objects from the specified collection """

    list = []
    for a_collection in some_collection.children:
        select_from_collection(a_collection)
    for obj in some_collection.objects:
        obj.select_set(True)
        list.append(obj)
        obj.select_set(False)

    return list

def calc1(list, object_2):
    """
    Description:
    Calculate the cost when A in B's access area but not hit with B

    list: list of points in access area

    object_2: object where A's points in its access area

    Return:
    cost(double)
    """

    temp = object_2["bottom_poly"]
    # obj_2_poly_context = {'type': 'MULTIPOLYGON',
    # 'coordinates': [[[list(temp[0]), list(temp[1]), list(temp[2]), list(temp[3])]]]}

    # # to calculate the distance from point to object_2's edge, first we set up object_2's shape
    # obj_2_poly_shape = shapely.geometry.asShape(obj_2_poly_context)
    obj_2_bottom_poly = shapely.geometry.MultiPoint(temp).convex_hull

    center = obj_2_bottom_poly.centroid

    sum_cost = 0
    for i in list:
        i = shapely.geometry.Point(list(i))
        dis = center.distance(i)
        cost = math.exp(1/dis)
        sum_cost += cost

    return sum_cost

def calc2(list, object_1, object_2):
    """
    Description:
    Calculate the cost when A in B's access area and hit with B
    use intersect area + calc1(~) as cost

    """

    point_cost = calc1(list, object_2)

    obj_1_bottom_poly = shapely.geometry.MultiPoint(object_1["bottom_poly"]).convex_hull
    obj_2_bottom_poly = shapely.geometry.MultiPoint(object_2["bottom_poly"]).convex_hull

    inter_area = obj_1_bottom_poly.intersection(obj_2_bottom_poly).area

    return point_cost + inter_area

def access_cost(group):
    """
    Description: if one object was set into an access area of another object,
    this function calculate the cost for this sence

    Return: cost
    """

    list = select_from_collection(group)
    for i in range(len(list)):
        for j in range(len(list)-i):
            # if they are 2 different objects
            if i != i+j:
                # if A in B's access area:(A count is list[i], B count is list[i+j])
                if CheckIntersect(list[i], list[i+j]) != False:
                    # if A not hit or cover B
                    if CheckIfHit(list[i], list[i+j]) == False:
                        Intersect_point_list = CheckIntersect(list[i], list[i+j])
                        cost = calc1(Intersect_point_list, list[i+j])
                    # if A hit or cover B
                    else:
                        cost = calc2(Intersect_point_list, list[i], list[i+j])
                else:
                    continue

    return cost

def attract_cost(group):
    """
    Description:
    To solve simulated annealing process without wall limitation problem, define attraction cost function to avoid
    objects scattered too much.

    Return: cost
    """

    max_lenth = 10# m, lenth of room
    def func(x):
        if x/max_lenth > 1:
            return math.exp(x/max_lenth - 1)
        else:
            return x/max_lenth

    list = select_from_collection(group)
    sum = 0
    for i in range(len(list)):
        for j in range(len(list)-i):
            if i != i+j:
                point_a = shapely.geometry.MultiPoint(list[i]["bottom_poly"]).convex_hull.centroid
                point_b = shapely.geometry.MultiPoint(list[i+j]["bottom_poly"]).convex_hull.centroid
                dis = point_a.distance(point_b)
                sum += dis
    average_dis = sum/len(list)
    return func(average_dis)

def total_cost(group):
    """
    Return attract cost, normal cost and visible cost.
    """
    # group: bpy.data.collections["x"]
    print(attract_cost(group))
    print(access_cost(group))
    print(Visible_cost(group))
    return attract_cost(group) + access_cost(group) + Visible_cost(group)

def move(object, T):
    """
    Description:move object randomly

    """

    std = math.sqrt(T/10)
    m = np.random.normal(0, std, 1)
    if np.random.randint(2):
        object.location.x += m
    else:
        object.location.y += m

def rotate(object, T, T_0):
    """
    Description:rotate object randomly
    """
    std = math.pi * (T/T_0)
    r = np.random.normal(0, std, 1)
    object.rotation_euler.z = r

def simulated_annealing(group):
    """
    """
    #         roomPoints= [geometry.Point(0,0),geometry.Point(100,0)
    #                      ,geometry.Point(100,100),geometry.Point(0,100)]

    # num: iteration times
    # alpha: cooling index
    # group: bpy.context.collection
    T_0 = 100
    T_F = 1
    num = 250
    count = 0
    alpha = 0.99
    T = T_0
    global beta
    beta = -1/T
    # initial arrangement
    c_0 = total_cost(group)

    T = T_0
    while T > T_F:
        for i in range(num):
            # generate new arrangement randomly
            for obj in group.objects:
                if np.random.randint(2):
                    move(obj)
                else:
                    rotate(obj)
            new_c = total_cost(group)

            if i == 0:
                old_c = c_0

            # if receive new solution:
            if Metropolis(old_c, new_c):
                old_c = new_c
                T = T * alpha
                count += 1

def Metropolis(old_c, new_c):
    """
    Description:
    1 means receive change

    0 means reject change

    """
    if new_c < old_c:

        return 1
    else:
        probability = math.exp(beta*(old_c - new_c))

        # recieve new solution probably
        if random() < probability:
            return 1
        else:
            return 0

if __name__ == "__main__":
    Align()
    simulated_annealing(bpy.data.collections["group_TV"])

Blender version：3.0
python version：3.7

Please paste your script into your question

I don't think it relate to my code, because even a simply if and else it will crash too after running several times. My code is debugging, it is long and might ahave many mistakes. I'll paste it up if it could help.@MartyFouts

If that's the case then please edit your post to include the simplest version of a script that results in a crash. You may want to take a look at the the Gotchas page of the Python API. However, based on your screenshot, it seems that Blender rather hangs/freezes than crashes/closes unexpectedly.

Yes it better be discribe as freezes instead of crash.

Yes, this example will, as you might say, crash Blender:
while True:
    pass

But this is not an issue, because you've made an infinite loop, that makes Blender execute it without end. While Blender execute Python script, it doesn't update the interface. And if the script executed too long, Windows might suppose that Blender freezes.
Some scripts execute too long, but after several minutes they finish the work. In that case, Windows can show a dialog that the program does not response, but you may click "wait" so there is no issue here.


text:
How to create some points attach to an object using script?

The question is I want to create some points which construct the area enclosed by brown lines in front for the sofa.This area is attached to the sofa and it will follow the action of sofa such as move or rotate.
How to realize it using script? Other packages are allowed.
Note that I have got OBB and orient of sofa, I'm thinking about scale OBB's bottom polygon as this rectangle.

can you clarify what you mean by "points"? Like which blender object types are you referring to? Empties? Vertices? Hooks?

All vertices.This question want to create vertices out of thin air that does not belong to any plane


text:
Object moving inside the boundary using python script
I'm a new user of blender.
I'm trying to control an object move and rotate using python script. Require the object limited on a plane each move or rotate.
As the picture showned, an object can only move inside the boundaries in X,Y coordinates, but not limited in Z axis.

Welcome to Blender's Stack Exchange! Could you please add what you have tried to implement so far? Is there a particular part you're having trouble with?

@RobertGützkow I selected the plane and read its vertices into a list

You need to check, if the new position is in the boundaries of your plane and thus allowed.
Given, that your plane is in X, Y, you may reduce this to a 2 dimensional task: You need to check, if the position of the object (a point) is in the polygon, that is described by the boundaries.
Thus, you may use the ray casting algorithm or the winding number algorithm, as described here: Wikipedia - Point in polygon


text:
How does the undo operation work?
I have a for loop that each time it will move or rotate several objects randomly, if some conditions not satisfied, it will undo all operations.
for obj in group_obj.objects:
            move_rotate(obj, T, T_0)

            accessableArea(obj)

        new_c = total_cost(group_obj)
        if i == 0:
            old_c = c_0
        if Metropolis(old_c, new_c):
            old_c = new_c
        else:
            for i in range(len(group_obj.objects)):
                bpy.ops.ed.undo()

This is move & rotate function
def move_rotate(object, T, T_0):
"""
Description:move and rotate object randomly

"""
if len(object.name.split("_")) < 3:

    std = math.sqrt(T/10)
    m = np.random.normal(0, std, 1)
    if np.random.randint(2):
        object.location.x += m
    else:
        object.location.y += m
    # rootate
    std = math.pi * (T/T_0)
    r = np.random.normal(0, std, 1)
    object.rotation_euler.z += r

It will report this error
RuntimeError: Operator bpy.ops.ed.undo.poll() failed, context is incorrect

Another question is, it seems blneder considered all operations down by script as one operation, Each time I run over the script press undo the sence will return to origin instead of last step.
Update:
Based on @X Y's answer, I made some improvement:
while T > T_F:
    for i in range(num):
        count = 0
        for obj in group.objects:
            bpy.ops.ed.undo_push()
            # repeat move&rotate until it won't cross the wall
            while True:

                move_rotate(obj, T, T_0)

                if check_if_cross_wall(obj):
                    bpy.ops.ed.undo()
                    continue

                break

            count += 1
            accessableArea(obj)

        new_c = total_cost(group)
        if i == 0:
            old_c = c_0
        if Metropolis(old_c, new_c):
            old_c = new_c
        else:
            bpy.ops.ed.undo()

    T = T * alpha

move & rotate function keep it as is.

report StructRNA of type Object has been removed.

Run bpy.ops.ed.undo_push() before you do some action.

That's because Run Script operation is a bpy.ops operation in itself so the undo would reverse everything done by the Run Script action. You can see this action as Run Script under menu Edit > Undo History

So this would push current state into stack and if I need reverse to a history state just need to use bpy.ops.ed.undo_history(i)?

If no restore point to get backwards, It will cause the Error: Operator bpy.ops.ed.undo.poll() failed, context is incorrect

when you access the object, for example: obj = bpy.context.object, and then if you run bpy.ops.ed.undo(), obj is invalid. So you need get the object again.

Thanks, I added obj = C.object, and it work!

Create a Restore point

import bpy

# make sure it has a active object
bpy.context.object.location.x += 1

bpy.ops.ed.undo_push(message = "Restore point 1")

bpy.context.object.location.x += 2

bpy.ops.ed.undo_push(message = "Restore point 2")

# restore part, use interface or run bpy.ops
def UNDO():
    try:
        bpy.ops.ed.undo()
        print("success")
    except:
        print("fail")

# undo 1 step
UNDO()
# because click to run script also create a store point
# so, Restore point 2 is gone!

Fix ReferenceError
import bpy

def UNDO():
    try:
        bpy.ops.ed.undo()
        print("success")
    except:
        print("fail")

bpy.ops.ed.undo_push(message = "Restore point 1")
obj = bpy.data.objects["Cube"]
obj.location.x += 1

UNDO()
print(obj) # obj cannot be used anymore (after undo)
# so need get the object again
obj = bpy.data.objects["Cube"]
print(obj.name)

I made some changes to make it more suitable for my needs, but there are some other mistakes appeared.

See the updated section for details.


text:
How to select an object in nested collection using python script

I want to select all objects in nested collection then do some operations using script. How?

Does this answer your question? https://blender.stackexchange.com/questions/144928/how-to-list-all-collections-and-their-objects

@HarryMcKenzie I don't think it does because that question deals with all collections, but this one wants nested collections and the code is different.

@MartyFouts yeah you are correct

First, this answer as good advice on how to develop Python scripts in Blender.  I also recommend the tutorial "Scripting for Artists" that can be found on Blender's YouTube channel.
Assuming you have a specific collection and you want all of the collections it contains, this function select_from_collection will do what you want:
import bpy

def select_from_collection(some_collection):
    """ Recursively select objects from the specified collection """
    print(f"Selecting from {some_collection.name}")
    for a_collection in some_collection.children:
        select_from_collection(a_collection)
    for obj in some_collection.objects:
        print(f"Selecting object {obj.name}")
        obj.select_set(True)

# Example: selecting all objects in the active collection
select_from_collection(bpy.context.collection)

Note that this code will arbitrarily make the last object it encountered the active object.
There are two things you need to know about collections to understand this code and one thing about objects:

To select an object, use bpy.types.Object.select_set()
If a collection is nested, its field children contains the names of all of the collections it contains.  You need to walk this structure recursively to find all of the nested collections within your starting point.
If a collection contains objects, they will be listed in its field objects. You have to iterate over that list to find all of the objects contained directly by the collection.

First i recommend you turn on python tooltips by going into Edit menu => Preferences and then ticking Python Tooltips checkbox

That way you can hover over the properties in the user interface and see python tooltips in your workspace so you don't have to remember them all.

And then checkout this thread here: How to list all collections and their objects? to get started. Also you can view the output of your script by going to Window => Toggle System Console

Note: "Toggle System Console" is a Windows feature.  On other OSes you get access to the system console in different ways.

@MartyFouts yes that is correct, im sure he will figure it out how to do it on unix and unix-like systems though :)


text:
Subdivision deforms mesh
Problem
I tried to subdivide part of the mesh so I can add more hair particles to the scalp, and as I added more subdivisions to the mesh it started to deform into an interesting pattern, I want the head to be smooth like before.

hello, we can't see your image  ;)

Hello and welcome. Instead of having users go through links and external sites please use the builtin tools to embed images in your post. See How to upload an image to a post? or GIFs

Hello, the question has now been updated, sorry for the inconvenience.

This is because subdivide command works differently than subdivision surface modifier's catmull-clark algorithm

You could, for example, P -> Separate by selection and use subd modifier, if you have seams marked correctly, but even then I'm not sure the results would line up exactly

You could also look at the lower left panel after running one subdivide, there's a "smooth" option, as well as making more cuts with a single command.

The smoothing seems to work, but the lines are still there.

https://i.ibb.co/zsWwhvB/image.png


text:
Prevent geometry nodes from overlapping bump map

I'm working on some condensation using geometry nodes but also trying to use a bump map for the smallest points of condensation. Generally, it looks really good; however, when looking very close, you can see the bump map through the larger droplets created by the geometry node. Is there any way to convert the geometry data into something I can use to mask off the bump map so it doesn't come through from behind the drops? If it was real condensation, the larger droplets wouldn't have small droplets behind. Again, the smallest droplets are coming from an image, not geometry, so there's no actual object collision happening. Any ideas?
UPDATE: I used the fantastic idea from Hulifier to use Dynamic Paint, but it resulted in a slight offset. It also didn't quite capture all the droplets from my geo node.
For the below image, I left the bump off and the new mask as a black color overlay so the offset can be seen better. Here is the result.

Update 2: Using a vector math node from the comments and editing the dynamic painting get's this very close to perfect. Some settings will need to be messed with for individual setup differences.

With Dynamic Paint, you can use your Geometry Node's geometry as a brush and your mesh as canvas to bake a texture, then you use that texture to mask the bump and roughness in the condensation material.
I don't know if you can do that with the Geometry nodes and the mesh in the same object, you may need another object to put your nodes.
Without DP texture masking:

Resulting texture from Dynamic Paint:

Mask applied, without and with the water drop:

If your render is an animation where the water drops will move, you will need to bake all frames within the desired interval, you will also need to enable dissolve and set it's time value to 1 so areas where the drops are no longer present don't remain painted.

I used the paintmap output for this result.
Your mask paint may have a little offset from your drops, I don't know the reason, but I managed to solve this by adding a little offset to the mask texture vector input:

the values you need may or may not differ.
Now, if small parts of the painting mesh are not painting, you can try to change the brush source to Volume + Proximity with a very small distance and mess with the options below:

Edit: Using the project option seems to give better results to me.
Edit 2: perfect method
Doing this, even small geometries will paint, and in the correct location.
Forget about translating the texture. Just do this:
Before baking, translate the entire brush geometry by 0.001 in every axis:

After baking, you remove the translation.
resulting texture:

The problem cause, probably:
/* a simple hack to minimize chance of ray leaks at identical ray <-> edge locations */
add_v3_fl(ray_start, 0.001f);

This code line in the dynamic_paint.c file apparently adds a little offset to raycast origins when using a mesh brush, the result is not very noticeable in large scale objects, but in small scales produces very different results from what one would expect.

thank you so so much for this response. It seems to be the right answer, but I must be doing something wrong in my implementation. I'm getting a result where the masking is offset from the drops, and some of them also aren't being painted for some reason. I'll post some additional shots in my original question to show it visually.

@WhitB i was getting a similar problem, but was thinking i was doing something wrong, so I didn't add my workaround to the answer, I will add it now, sorry.

great solve! The vector math node on the texture helped fix the offset. and the edits to the dynamic painting helped quite a bit. I'm still working on settings because some drops are missing, but just a matter of experimenting with the settings. Thanks so much!

@WhitB if some drops refuse to show even after messing with all settings, try using bigger scales for your project, Scale everything up and apply the scale, you may need to correct some things on your Geometry nodes after scaling, you will also need to adjust the vector node connected to the texture mask.

@WhitB Just in case you're still working on that project, I'm informing you that I added a method that works perfectly to the answer.


text:
Wrong animation after collada export
I have a problem with Blender when exporting my model to Collada.
I created a simple chest after following a tutorial on Youtube.
I order to animate the opening of the top-part, I've added a single bone and set the parent's object with an armature deform with empty groups.
After that, I selected the corresponding vertices of the bone's vertex groups and assigned them.
Finally, in pose mode, added the rotation & location keyframes.
The animation in Blender is what I wanted, but after exporting as a Collada file, my model seems to "turn" around an other axis (with the native viewer of MacOS at least...).
Despite checking different options, I wasn't able to find where the problem is.
 On Blender
 Collada model
Could you help me figuring what the problem is ? Thanks !

EDIT : If "Use Blender Profile" wasn't checked before the collada export, when I try to import the file again in Blender I get this :

Does it need to be exported as a .dae? Have you tried an .fbx export?

Yes, for some reason I really need to export in dae format (I'm loading it in C++, and the collada loader is fully implemented). I saw that there was the possibility of exporting to fbx and then dae through Cheetah3D. But considering the price of the tool, meh...

I exported it as a usdc and it worked fine. However exporting it as a dae didn't work, like you said.

It's always a good practice if you have a root bone, parent of all bones which never moves.

I just added a fixed root bone. After the export, the main box doesn't move but the lid of the chest continues to move oddly :/

Finally found the solution, here's my steps if someone get stuck with the same problem.
Just before exporting the model to .dae, in Pose mode, I had to select the bones (I've added a static root bone since my first post) and reset the rotation, translation and scale by pressing respectively Option+R, Option+T and Option+S (ALT+R, ALT+T, ALT+S on Windows).
After that, in Object Mode, I selected the mesh, and applied all the transforms ("Object" menu > Apply > All Transforms). Did the same with the armature.
After the export, everything seems to be ok !


text:
MIX RGBs not working
I'm struggling with something, as I am following a tutorial on youtube.
Lightning Boy Studio made a wonderful video on how to imitate Arcane's style in blender using camera projection and several UV mapping. Here is the video: https://www.youtube.com/watch?v=gG7ZoP3fd1w&t=879s
( Timing from 4:50 to 15:00 ).
I believe I really have followed the instructions to the letters yet, Lightning boy studio's results are different. So I am clearly missing something, and I'd appreciate any help. Here is a link to my project : https://we.tl/t-imUCu1TiIf
I have made the two projected textures look very different, with each face marked with a number to diagnose more easily where the issue lies. The front projected texture is a bright red with a number on each face ( from 1 to 3 ). The back facing projection is bright blue with the faces numbered from 1 to 2.
Here is the very simple shading setup.
2 textures, mixed together with an RGB mix node. A UV map node on the second texture set to another UV projection, using the alpha on the second texture to limit how much of the 2nd projection we see.

Here is the unfortunate result :
So clearly the limitation of the alpha channel isn't working. I thought the issue lied with my texture lacking an alpha. But I tried a PNG image with pure b&w instead of using the alpha channel, and still the masking didn't take place. So the issue is somewhere else.
I have made an extra effort to make sure I had 2 different sets of UV mapping, that are very different.
I named them "front" and "back" for more clarity. The camera the view they are projected from bare the same name.
The only difference I saw between my project and the tutorial I follow was the blender version. I use 3.1.2 while the tutorial uses 3.0. So installed the older version, and still the same issue persists.
I'm out of ideas, if you guys have any thoughts to share I'd really appreciate it.
Thanks for reading.

I didn't have a look at the tutorial, just your node tree. I think in the image texture nodes you have to change repeat to clip because if the texture is repeating there won't be any alpha, but when it is set to clip everything outside the image is transparent. And if there is no transparency your mixRGB node will only pass on the bottom image texture.

Hey, thanks for answering ! Unfortunately, that didn't change anything ! But again, thank you for trying.

Can you prove an image of your UV maps?

For sure ! Here they are !
https://ibb.co/wyXLHKZ
https://ibb.co/g9pRvmq

Here I also added them to the description, so it's easier for everyone to see!

The issue lies within your textures:

Your Textures cover the whole cube but in the tutorial they don't:

As you can see in the tutorial, there is only one face covered with texture, the rest is transparent and that is where the other texture will appear, but since your texture covers the whole cube, there is no transparency on the cube (only around it) and thus you don't see the second texture. to fix this you will have to change the textures like so:

Which gives you this result:

But as you might notice, in the UV Maps, take for example the face Front 3, there are other faces overlapping, like the bottom face or the one in the back right. This is why the texture is not only appearing on that one face but also other ones. To fix that you can change the UV map like so:
In edit mode, select all the faces that are not visible from the cameras perspective:

And move them to a transparent area in your UV-editor:

(Notice that the two faces, you want the texture on are still aligned with the texture)
This will give you the result you want, although it is not following the tutorial exactly:

OMG, omg OMG THIS IS AMAZING ! I'm SUCH a dumb ass ! Thank you THANK YOU !!!


text:
why is there weird shadows when I separate a model into 2 meshes? and is there a way to fix it?
there these weird shadows show up when I separate a model into 2 meshes,and I don't know how to get rid of them.
I use blender 4.1 if you wanna know, and the model's material has no normals
edit: I just checked that the material has normals node, it just that it doesn't have any other node connected to it.
model after I separate it.

model before I separate it.

the original model is an fbx, I imported it with "Custom Normals", "Custom Properties", "Import Enums As Strings", and "Image Search" being checked. also on the third image, the material has the normals node, probably due to importing the model with custom normals.

What exactly is the part you separated?

the arm, as you can see in the images

Have you done any research, do these answer your question? https://blender.stackexchange.com/questions/53749/normals-changed-after-separating-object-in-2-pieces https://blender.stackexchange.com/questions/65172/fixing-normals-after-separating-mesh-into-new-objects

@Duarte Farrajota Ramos not really, I guess I'll try to figure it out, thanks for the help!

Since the torso and arms are now separate meshes and are not connected, there will be no smooth shading across them. Having the edges split between objects is producing the split normals that you observed.
More information on shading an object smooth or flat can be found here.

Add a "Data Transfer" modifier, and transfer Face Corner Dat → Custom Normals from the original, whole mesh. You can then apply the modifier if you don't want to keep the original mesh. You could even separate the mesh further after that.


text:
anyone got an idea on how to set up an automatic walk cycle?
Something that can be easily control by changing the object location. I wanted to set up for something simple, like in games, where the character walk but also can turn according to the direction. And also, be able to customize the walking animation to different styles, because, well, everyone walk differently. Anybody knows where to start? Theres a lot of tutorial for unity, but unfortunately, i found almost none to not helpful in blender. I did however found a few spiders like thingy walking animation, using curve. but i'm not sure if it'll apply the same for human. Anybody got an idea where to start? Oh, i tried NLA, its pretty confusing and pretty nightmarish to understand, I don't think it'll fit with my kind of animation. I can't add any keyframe in between the NLA action, or at least i'm not aware of how to, Example below
character closing the door

character look down on the ground

character look behind

character turn animation

character walk animation

if i add the NLA walking action, i can't customize the animation in between(close door, look down on ground etc). This 10 seconds took an hour to make, i waste most of it on the turning and walking animation.
So anybody got an idea, any solution would help.

i would download a walk animation from free mixamo side and tweak that. Walk animation "manually" is - in my opinion - really hard to do if it should look good. NLA might be a nightmare - but worth learning it. Try to find some tutorials on yt about it because it is very good and can solve a lot of tasks for you.

...and what i wanted to add: i first learned the "low hanging fruits" like rigid body animations and such stuff. But all the things i left out because i didn't understand in the beginning like NLA turned out to be the most useful things once you understood them. Yes, NLA is for sure not intuitive, but a very powerful tool.


text:
light flickering on alpha texture
for some reason, the lights are not working properly on alpha texture

see the end of hair on forehead and also the plate near the spoon and fork
it seems to emit this silver color

the shadow on the tree at the  flickers not working

it seems to happen when alpha texture is overlapping with one another

how do i fix this?
is it the material properties on texture?

if you are in Cycles, don't let faces overlap otherwise it will appear black, is it your problem here?

well no, it doesnt appear black, but the shadow casting from the object is flickering, open the first and second, or the third and fourth image on new tab, then compare them. when the alpha is infront or behind one another, the shadow seems to flicker, even when far apart


text:
Will increasing the camera's focal length decrease the render image quality?
i know it is keyframable, and its perfect to zoom in. And ive tried testing it with two pictures, one with 50mm focal length and the other is 100mm focal length.
after i got the result, i zoom in the 50mm and compare both picture.
it seems like both image is the same, meaning using the focal length deteriorate the image quality. or maybe i render both of them with just 10 sample on both picture.
Anyway i wasn't sure if i'm right, that's why i'm here. Can you guys confirm my test?
50mm focal

50mm focal zoom

100mm focal

It should not be true. .. Caan you show us your tests?

If all you change is focal length, then the 100 mm version will have double the pixels for the same length = quadruple the pixels for the same area. However, if you render the 100 mm version in 50% resolution, the two renders should be roughly the same: https://i.imgur.com/07ha8OC.gif . For low samples amount making any change affecting the sample seed might make either version better just by chance. There also might be effects that don't exactly scale with 50% resolution, but I can't think of an example…

i'll upload the pictures
so im wrong then? i was hoping i was wrong, I mean to be fair, i did render it with 10 samples


text:
how do i make an object only appear through a transparent object?
i have a story, in which a ghost can only be seen through water, i was thinking about making a scene, where theres a water bottle, and you can only see the thing on the other side of the bottle, which is transparent
i've tried playing around with the light path

and it sorta work, but i wanted it to be reverse, you can see the object through transparency but not the other way around

so, i decided to change the location of the shader, top to bottom, and bottom to top

and it sorta work, but the part thats supposed to be transparent becomes black,

i've tried adding colour ramp and reverse the colour too(black to white, white to black), unfortunately same result. can anybody point me the issue here? kinda stuck.
edit
in respond to Christopher Bennett

https://blender.stackexchange.com/questions/159828/how-to-make-one-clear-object-invisible-inside-of-another-clear-object/ https://blender.stackexchange.com/questions/157621/how-can-i-make-an-object-only-visible-through-certain-material https://blender.stackexchange.com/questions/164773/is-there-a-way-to-have-an-object-show-up-only-in-a-reflection

if i understand correctly from the post, i've follow the third one, hence my issue, the other 2 seems to be the same solution. which is why i ended up with my situation right now

Use Transmission Depth instead of Transparent (only works in cycles):

Fyi - I made a pseudo "water material" for the plane - that explains the offset and the "waviness".

i did the same setup as you did, but why is it not working for me? am i missing smthing?(the plane on my file is fully transparent btw). please see the new added picture above

It doesn't workd for fully transparent items (alpha=0). For your water material, instead of going fully transparent, use  a Principled BSDF with the transmission set to 1. You can leave alpha at 1 and it will still be invisible.

omg!, that work! so i dont need to use transparent shader at all?

The principled BSDF can make a purely transparent (and I mean invisible) plane by changing the Roughness to 0, the Transmission to 1 and the IOR to 1. Also, the default "white" in the basecolor box is a few shades darker than pure white - make sure to put the "whiteness" up all the way to make the plane truly invisible.

sorry for the late reply, but thanks man, that really helps


text:
does object particle hair with collision kills emitter particle?
for example i have a plane, with trees on it, and i put the rain emitter particle and set it to die on hit on the ground object. does the particle from the ground(trees) will kill the emitter particle?
i wouldve test it myself(i did actually), but its very laggy for me to fully see.
but i could see the rain particle is just.. less. not sure if its the lagging, or the tree is actually killing the particle
if the tree does kills the particle, anyway i can disable it?
i have a lot of trees consisting of a single plane, there will be rain, i dont want the tree to kill the rain particle, only the ground itself. my question is will the tree kills the rain particle if it touches the tree

Each Object that is has a Collision modifier has a check-box option to "Kill Particles" that collide with it.   Try an experiment with a simple test file that only has a PS object and a Collision objects, so that you can see this clearly and with little compute power.

Ah a picture is always worth a thousand words!  You have your trees formed by a Hair PS.  The blender physics are not good at cross-interaction, so that any Fluid physics will not interact with Hair, even if the tree object were defined as a Fluid Effector Collision object.

ohh okay, i guess i gotta up the amount of rain, they probably falling behind the tree, maybe the reason it seems less. thanks man

You may be stretching the limit of your machine if this plane of trees is very large


text:
How to remove bone keyframe without interrupting location and rotation object
i started to animate body movement at first and the location and everything, and then i thought about coming back to animate the face. Now that i'm done animating the body, i went to the first keyframe, highlight the face and remove all the keyframe available, so i can animate the face. But unfortunately, it also remove the object location and rotation. What do i do so that only the keyframe of the face is remove instead of removing the object's location and rotation too. I cant animate the face because when i animate the body, i insert keyframe on all selected bone.
is there any way i could hide the location and rotation of the object and delete the face bone keyframe?

One way of doing this, is lock all other channels, then delete, then unlock the others like this:

heyy, that work. Of course, i forgot that you can do that. sorry for the noob question. I'm still getting used to animation. thanks man :D

No problem. We all started at one point. And I asked noob questions a lot here


text:
How can I hide Instance object?
I'm trying to create curved conveyor with array and curve. To avoid bending deformation I'm using Faces Instancing. How can I hide the Instance?

There is Show Instancer checkboxes, but it doesn't hide the cube (only hides planes uder the instances)

It should not be visible in render, but in preview you can press H to hide.

Hah, it works! Thanx.


text:
Render animation with compositing
Hello everyone I'm trying to render a sequence of images with compositing. I add an Image node, specify a link to the already rendered sequence in it, add a Glare node to create Fog Glow. Glow works in the preview window, but when I render the animation, Glow disappears in the final picture. Why can this happen?

you forgot to plug the Glare node to the Composite node as well. plugging it into Viewer node only let's preview the output. plug it into Composite node as well.

It works. Thanx!


text:
bpy object dimensions in Python script does not match the actual dimensions
I am currently writing a Python script using bpy and running it on Blender 3.1.2. I have imported an object of type CURVE from another .blend file and I need to find its dimensions in the current script.
If I directly run bpy.context.object.dimensions in the Python console, I get the correct dimensions. I verified this by using the Measure tool and also in the object properties.

However, when I run this exact same line of code from my Python script, the dimensions are incorrect. I have ensured that the correct object is selected, yet the dimensions do not match.

Why could this be happening? Any help is appreciated.
Update (Added code snippet)
def import_collection_from_file(filepath: str, collection_matcher: str):
    # Copy collection from file
    with bpy.data.libraries.load(filepath) as (data_from, data_to):
        data_to.collections = [coll for coll in data_from.collections if collection_matcher in coll]

    # Add collection to current scene
    for coll in data_to.collections:
        bpy.context.scene.collection.children.link(coll)
    return data_to.collections

def get_objects_from_collection(collection: bpy.types.Collection, object_matcher: str, direct_children_only: bool = True):
    objects = []
    children = list(collection.objects) if direct_children_only else list(collection.all_objects)
    for object in children:
        if object_matcher in object.name:
            objects.append(object)
    return objects

filepath = '' # path to file to import the collection from

# Import the first collection which contains 'Profile' in its name
collection = import_collection_from_file(filepath, 'Profile')[0]

# Access the first object in the collection which contains 'Profile' in its name
obj = get_objects_from_collection(collection, 'Profile')[0]

# Select the currently added object
bpy.context.view_layer.objects.active = obj
obj.select_set(True)

print('selected objects:', bpy.context.selected_objects[:]) # prints only the object that is currently imported

print('context.object dimensions:', bpy.context.object.dimensions)

profile = bpy.data.objects['Profile']
print('profile.dimensions:', profile.dimensions)
print('selected_objects dimensions:', bpy.context.selected_objects[0].dimensions)

Hello, it would be immensely more easier to help you if you shared the part of the script that outputs these values. Thanks :)

+1 to posting the code, Also you should change your units in the viewport to metric instead of inches, and compare those values the python Vector units are in metric, pretty sure and that will simplify sorting it out a bit.

@Gorgious, I have added the code snippet for your reference.

@Jakemoyo Yeah I took the unit conversion into account. The dimensions in the viewport are in inches and are the same as the first screenshot when converted to meters (i.e (1.52, 1.87, 0.0)). The values in the third screenshot (the output of the script) are also in meters but are not equivalent to (60.2, 73.8, 0.0) inches.

your object has any modifiers?

Also are you sure the scale is applied in the source object .blend file? have you tested this issue with a pair of 100% clean blend files? Like with the source file containing only a brand new default curve added into a collection

@XY No I have not added any modifiers

@Jakemoyo Yes, the scale and dimensions in the source file are correct. I just created a new source file containing only this curve and the issue still persists. One surprising observation is that if I run the script multiple times inside the target .blend file, the dimensions are incorrect only for the first time. After that, the values are correct.

I finally found the solution to the problem. As I am importing the curve from another file, it requires an update for the objects that are modified by the script.
Adding bpy.context.view_layer.update() after importing the object updates the view layer and the dimensions are now correct.
Final Code:
# Functions here

filepath = '' # path to file to import the collection from

# Import the first collection which contains 'Profile' in its name
collection = import_collection_from_file(filepath, 'Profile')[0]

# Access the first object in the collection which contains 'Profile' in its name
obj = get_objects_from_collection(collection, 'Profile')[0]

# Select the currently added object
bpy.context.view_layer.objects.active = obj
obj.select_set(True)

# Update the view layer
bpy.context.view_layer.update()

# .dimensions now gives correct results


text:
Camera path animation speed change
I am working with Blender principally to render camera animations of photogrammetry models of underwater shipwrecks and other sites.  I've successfully animated a camera along a nurbs path, using an empty to change the direction the camera points.  So far so good.  Where I am struggling is with the camera speed.  I wish to initially achieve a steady camera speed along the complete curve, to give a basis for finetuning that camera speed to slow down and speed up along certain segments.  However, the initial camera speed that Blender gives me is erratic, and speeds up and slows down seemingly dependent on the acuteness of the curve.  It seems to speed up in straighter parts of the curve and slow down when the curve bends more acutely.  This is very frustrating and I have to then use the graph editor to try and achieve some semblance of a steady speed, which I an struggling to do.  The same speed changes are apparent whether I am using a linear or bezier curve at the start, before applying any other modifiers.
I suspect I am missing something pretty basic but I also find it strange that I have not found any other posts on this subject.
The attached pic shows the path and areas where the speed up happens
I converted the path to a mesh and back again in order to generate an even distribution of points but that did not make any difference at all. Prior to that I added extra points in between existing ones, also no change.
I am using the "follow path" constraint. I am enabling the "fixed position" option then using the offset factor to try to fine tune the speed. However the speed changes happen when there are no intermediate keyframes, just one at the start with zero offset factor, and one at the end with 1 offset factor.
Link to minimal version of .blend file
Link to screen recording of animation
Thanks in advance
John

Please add a screenshot of your scene where the nurbs path is clearly visible. I suspect that having the camera speed is depending on how many control points you have. If you have an even distribution of points, the camera speed will be more even as well.

Are you using a 'Follow Path' constraint?

Hi Gunslinger, in fact I converted the path to a mesh and back again in order to generate an even distribution of points but that did not make any difference at all.  Prior to that I added extra points in between existing ones, also no change

@RobinBetts correct I am using the "follow path" constraint.  I am enabling the "fixed position" option then using the offset factor to try to fine tune the speed.  However the speed changes happen when there are no intermediate keyframes, just one at the start with zero offset factor, and one at the end with 1 offset factor

Something's up.. This example shows a curve being trimmed by constant length per frame, at the same time as being followed by a cube. (Using the default behaviour of 'Follow Path'.) Changing the distribution control points makes no difference of Maybe share a minimal version of your problem on https://pasteall.org/blend/

I simply cannot get the .blend file smaller than 24Kb so I have uploaded to google drive, not sure that's OK?  https://drive.google.com/file/d/1_oGafxgd4JAtoS04tDwiZYLFELnZFwn2/view?usp=sharing

Turns out you needed to apply scale to the curve.

One solution is to not animate the Offset Factor, but rather go to the curve and animate its Evaluation time.  For your file this means

Select the camera
Go to the Follow Path constraint
Toggle "Fixed Position" off
Toggle "Follow Curve" on.
Hover over the "Offset Factor" input field, right click and select "Clear keyframes"
Change the "Offset Factor" to 0 and also clear the keyframe there.
Select the curve
Go to the Curve Object Properties tab of the Properties editor and open the "Path Animation" tab:

With "Frames" set to 100, the evaluation time represents a percentage of the length of the curve.  If you wanted the camera to travel from one end of the curve to the other over the length of your animation, you would

Go to frame 1, set evaluation time to 0, and set a keyframe.
Go to frame 500, set evaluation time to 100, and set a keyframe.

You'll end up with an fcurve like this:

It has Bezier easing enabled.  If you want linear easing, select both keyframes, enter T to bring up the menu and select 'linear' from the easing tab.
Now you can add keyframes at intermediate points to control the rate of change.  You can even move the camera backwards this way.
EDIT:  Color me very embarrassed.  The acceleration is because you haven't applied scale.  Scale is off in the X direction, and that confuses the curve length calculation.  (Aside: You still have Bezier easing, so there's acceleration at the start and deceleration at the end because of that.)

This is probably going to come in handy for me.  Cheers Marty

I don't know what the devs were thinking.  Almost everyone hits on the idea of animating the offset in the modifier as their first approach to animating follow curve, probably because you think about animating the object, not the path it is following, but the approach I described is far more flexible. (and, in my opinion, easier to understand)

I tried this.  It is a nice intuitive approach to animating a camera along a curve but the end result is identical to my original and does not resolve the problem I have of the camera's erratic speed.  I've included a link to a screen recording of the animation here https://drive.google.com/file/d/1WHWnYnh7uh4ZxMp7tWqoIOLJPgLuOPmv/view?usp=sharing and in the original question

That's a screen recording.  It's rare that running an animation in the display will produce a consistent frame rate.  Without a consistent frame rate, you get what looks like erratic motion.  Replace the camera with an object, place a camera above the scene and render an eevee animation of just that object.  that's the one that will tell if you have actual erratic bhavior.

Thanks Marty.  I had in fact previously rendered a full scene (but using cycles), and I believed I had looked at the motion, while trying different settings, enough times to know for certain that the issue is not related to the screen recording.  To be 100% certain I took up your very valid suggestion and here's the result https://drive.google.com/file/d/1qozb9xz2AYwQkCm48wqIjhXhoaoGRmtT/view?usp=sharing.  This is with a totally new curve just to make sure there was nothing "wrong" with my previous one.  I can't help thinking that there may be some pretty simple setting I changed by mistake

@MartyFouts Re your suggestion to try a Damped Track constraint, the uploaded render does not have any constraints on the animated cube apart from the follow path constraint.

Can you change the blend file to the one you rendered?  I do want to solve this and I'm now very puzzled.

https://drive.google.com/file/d/14pqmI87NABAy9RLT-EUltYTLAKboiobE/view?usp=sharing all yours Marty

@MartyFouts that's perfect solution is great many thanks!

@JohnWood You're welcome. Sorry it took me so long to notice the scale thing.


text:
Can someone please help me get at the textures of this Sketchfab model?
For reference, the model is here: https://sketchfab.com/3d-models/otto-the-autopilot-7db2b78e311a44ac9b84b1bb6f768413. It's a very nice free model of a classic movie "character", the likes of which are not available anywhere else online that I can see.
I can import the glTF file into Blender and it looks good. I can save as a .blend file and then open that, and it is the same, so the textures must be in that somewhere. But when I export to .obj to use with another 3D program, there are no textures. There is an .mtl file, but it doesn't reference anything. No folder with any image files in it either.
I've searched this site for a solution and nothing I've come across seems to work. Of course, I am a total Blender newb so I may not be understanding some of this stuff properly. For example here: Export .obj file with png texture ..."Select all vertices/faces (press 'a'). Then start the UV Mapping, press 'u'." When I press 'u' nothing happens.
Somewhere else there was the advice to simply go to UV edit, select the texture and "save as". But there are no textures when I go to UV edit.
Like I said, I am very new to Blender, can someone help me out with this?

There are no textures.  As is often the case, Sketchfab models in gltf format consist of a number of objects all parented to an empty. In this case there a dozen, named 'Object_2' through 'Object_13'.  They all share this material, called "Scene_-_Root":

That is, they're all using Vertex Paint to set a solid color for that piece of Otto.


text:
Altering face colors in the python API
There must be something that I am fundamentally missing. I am using the python API to generate a mesh and object. I am having a lot of trouble figuring out how to change the face color of the object I just made. I don't get any errors in the code, but the color just doesn't seem to update.
import bpy
import bmesh

meshes = bpy.data.meshes
objects = bpy.data.objects

if 'topo_mesh' in meshes:
    meshes.remove(meshes['topo_mesh'])
mesh = meshes.new('topo_mesh')

if 'topo_obj' in objects:
    objects.remove(objects['topo_obj'])
obj = objects.new('topo_obj',mesh)

vertices = [(-1,-1,0),(1,-1,0),(1,1,0),(-1,1,0)]
faces = [(0,1,2,3)]

mesh.from_pydata(vertices,[],faces)

bm = bmesh.new()
bm.from_mesh(mesh)
color_layer = bm.loops.layers.color.new("color")
for face in bm.faces:
    for loop in face.loops:
        loop[color_layer] = (1,0,0,1)
bm.to_mesh(mesh)

view_layer = bpy.context.view_layer
view_layer.active_layer_collection.collection.objects.link(obj)

Why isn't the object turning red?

My overall goal is to change a .txt file with topography into an object where each location is colored according to some user-specified color map. I've got the mesh generation down already, I just do not know how to color the faces. Thanks in advance.

Edited:
Thanks for your help. I'll have to look at your modification to figure out why I couldn't get it working. I'm getting closer. :)

Are you using a viewport shading mode that supports displaying face colors? Are the face colors being used at all? Are they used in a way that produces visible results?

Yes, viewport shading is on. I can change the color using the sidebar and view it. I just cannot change it from my python script. Does that make sense?

I'm also able to use Edit Mode manually to individually change the faces of colors.

Just expose your color into material:

python:
# adding material and setup nodes:
mat = bpy.data.materials.new("topo_mat")
mat.use_nodes = True
node = mat.node_tree.nodes.new("ShaderNodeAttribute")
mat.node_tree.links.new(node.outputs['Color'], mat.node_tree.nodes['Principled BSDF'].inputs[0])
node.attribute_name = "color"

# set material to the object:
obj.data.materials.append(mat)

Thanks. Is there a way to reproduce using only the python scripting?

I've updated the answer

THANKS! that worked!


text:
Rigid bodies interacting incorrectly
Im attempting to drop a sphere on a turbo compressor wheel and i want the sphere to "roll" down the fin it hits. instead, when it falls its like it hits an invisible box that's near the comp wheel and shaped differently. Both are set to rigid body. sphere is active+dynamic. Comp wheel is passive+animated+convex hull. Bakes have been deleted. Pulling my hair out on this one. Blender file in google drive here - https://drive.google.com/drive/folders/1zhvlhD4nIpycrLnSardnUnzUsUVIx4kS?usp=sharing

Please don't make your questions depend exclusively on others downloading the file, or reading links, just to understanding the issue. Please use the [edit] option at the bottom of your question (https://i.sstatic.net/vHwEx.png) and add more information on how you set up your project. Add images that might help others understand your scene and settings.

You need to set comp wheel to Mesh, not Convex Hull, otherwise the concave shapes of the object won't be taken into account. Convex Hull creates a kind of envelop around the object.

congrats to be the absolute #1 here....!

Hey thanks, I hope Gandalf3 will keep sleeping    ;)

i am sure he will ;)


text:
Adding clay strips will subtract on certain surfaces of a face that I am modeling
I'm looking at a face I'm modeling from the front (although this is consistent from any angle), when I use the add clay strips on the bridge of the nose, if my brush even touches the sides (like the nostrils) the clay strips will subtract, even though it is still set to add.
I could draw a continuous line, left to right, across the face, it will add as it passes over the cheeks, but then as it crosses the sides of the nose the brush will subtract, but then add again as it passes over the bridge of the nose.
I followed the solution steps in a similar question on this site, but no success: I went to the object tab, ⌃ Ctrl + A, scale, and then it gives me some options, I made sure scale was checked.
Then I go to edit, select all, I have to hit ⌥ Alt + N to open the normals tab (if I hit ⌃ Shift + N, like I'm told, it will ask to open a new file) the normals tab is open and I tried the various options, even the two for recalculating and flipping. Doesn't work.
The images shows that I can add to the cheeks, but side of the nose subtracts and thins out the bridge of the nose

I did find a "solution" but I don't think it's great fix. Basically, if I keep adding material to the sides with the subtracting error, it eventually subtracts so much that it starts adding again, so then I remesh, and smooth it out. It's an annoying fix because I can see this solution not helping at all if I am working on many small details - I would basically have to resculpt it everytime it happens.

It could be a case of normals facing the wrong way. Try selecting the whole mesh in edit mode and select mesh > normals > recalculate outside from the menu at the top of the viewport.

It's Shift N, not Ctrl N, to recalculate normals.

@ChristopherBennett I tried that too, i Icouldn't get it to solve the problem that way, thanks tho

@joshsanfelici shift N for me creates a new document, it doesn't do anything for normals. Idk why. I just installed it recently so it's in default settings too

Try Alt+N for the Normals menu. The shortcut had changed for Blender 2.8. - Oh, you did that already (edited question).  Maybe check the face orientation with the overlay (https://blender.stackexchange.com/q/145751/107598). Red is bad.


text:
How to set dimensions of an object to default?
I have added a cube to the center and then I changed dimensions of the cube in add cube option on left bottom.
After that I just get those dimensions as default after restart, reset settings and everything. I just can not change the dimensions to default default settings of blender(something in decimals).

You can simply RMB click and Reset to Default Value
Note:
To make new cubes come in that default size, you'll need to type it in manually.
Simply resetting to default value won't work (not sure why).

Jachym Michal. Blender 2.79 and before : in the value field it was 1m (1000mm) but the field name was Radius and that gave a cube size of 2m. With 2.80 the field name was changed to Size and the default value set at 2m which also gave a 2m cube. "Hope this helps" :)

Oh, didn't know that, thanks :).


text:
HDRI environment texture assigned to background only shows a checkered background
I've just received a project which I imported into Blender with no issues.
However, whenever I go from World to Color then select Environment Texture and open my HDRI image which works with every other Blender project, all I see if a checkered gray and black background in rendered view.
Is it something to do with my viewport, or is it the project itself?
I tried editing the nodes and everything.

In the render properties editor, disable Film > Transparent.


text:
Blender 2.80 and Windows 7
I try to open Blender 2.80 on Windows 7 and nothing happens.
I have never had problems with previous versions on my machine, it works perfectly under Ubuntu (my second machine).
Does someone have an idea ?

Could your Win 7 machine have an older video card with less than OpenGL 3.3 drivers?

It seems like you possibly are trying to use the same blender download file for both Ubuntu and Windows, in which case you would need to download the windows file for blender 2.8: https://builder.blender.org/download/, although with the level of detail you have provided it is rather hard to tell. Could you state what machine you are using, where you downloaded the blender file from, and anything else that is non-orthodox about your setup.

I am using Windows7 too and I had problem with using blender 2.8 or above. Anyway I can use it now, on the other hand I have some more preblems to solve.
My first advice is to update your drivers with an app or manually.
If it doesnt works then you can go to this link.here
In the video, the guy is not talking English but If you need help virtually you can watch him.
Only thing that you need to do is go to this link
download the zip file then extract the .dll file to wherever you want. Then copy that .dll file and paste it to the where your blender.exe is.
At the second solution you might have take low fps in the editor ( even I had some crashes).
I hope it works for you :)
P.S : If you do the second process and then update your drivers you will need to delete that .dll file.


text:
Confused about material texture slots
New to Blender and I have done some basic modelling and painting textures on. In general that has gone well. One specific thing I want to do is copy a textured object so I can make some variation of it.
I thought this would be a routine operation but cannot find a way. When I duplicate the object the new and old share the same material and the texture slot linked to it. So if I paint one it also paints the other.
I can give a new material but I cannot link a copy of the texture to branch from.  I've tried changing Blender preferences to not link material/textures when duplicating. Tried settings users of the texture slot's associated image file's users to single user, and also changing the material between the object's data and object's object data but nothing has achieved what I want.
I know I could save a new blender file and work in that for variations but I want these objects in the one scene.

Make sure your image texture and your material are single users, if anything is repercuted on the other objects it means they are still using the same data-block.

Thanks so much for your reply. I had played a lot with this setting but had no luck so must have done something wrong. I am away right now but will try when I return home.


text:
Transparency not combining opacity between two translucent objects
I know that the title may seem confusing, but I don't know how else to explain it.
I am trying to make an "acrylic" material, but when I have two faces of transparency intersect, the transparency effects don't change, making it look like some of the "acrylic" isn't there. It's difficult to explain, so I'll just show some screenshots:

Thank you for your help. Is there any way to solve this? (and make it look more realistic?)
EDIT:
Here's the file, and the nodes/settings

Please [edit] your question and show how your shader is made. Additionally, you can also share a sample file on https://blend-exchange.com and insert the link in your question.

I've edited the post to include this. Hope that helps

Rendering technologies considerations
Prior to Eevee-Next, legacy Eevee used to have an old school way to handle transparency. And the default settings were basically to have none of it.

The default "Opaque" makes your rendered preview or material preview (powered by Eevee) looks as if it shows only what is visible from the front.
Try setting it to "Alpha Blend", and already it would at least let you see what's behind the front surfaces:

But, to be honest, Eevee Legacy being what it is, anything related to transparency, volumetric, refraction, ... Will be a chore at least.
You will also struggle with z-fighting a lot. When surfaces are on each other, Eevee will not know for sure which one to render in front of the other, and give you this kind of mess:

Moving your faces a bit away from each other will help in that regard.
Acrylic shader
When trying to replicate a matter, it's always good to wonder what its features are and how it translates into a shader in Blender.
Acrylic panes are basically a specific kind of plastic. The surface is most often smooth with slight imperfection. The "inside", the "body" of the matter, makes the color changes and diffuses light, making it more or less blurry when looked through.
That means, we need dielectric (non-metallic) surface reflections with little roughness and imperfections, slight tinting, refraction, and the inside must look more or less blurry and absorbing.
Using the Principled BSDF
If you want to stick to the Principled BSDF (which has the advantage of being familiar to use and easier to export or reproduce in other modern render engines), it would mean metallic at 0, transmission at 1, a little bit of Transmission Roughness to mimic the volumetric blurriness, maybe a texture plugged into the Roughness and normal for slight surface imperfections.
Which results to this in Legacy Eevee:

In Cycles, you can get very nice results with the same shader but lower Alpha:

Custom Shader
A custom shader mixing a Glass BSDF with a Translucent BSDF by the Fresnel factor could be used. Still with some roughness and normal texturing if wanted.
The result in Eevee isn't much different:

But it's quite a change in Cycles: