text:
How to extrude all faces at the same time after select linked faces
When I select faces by hand, I can extrude it with no problems. If I select faces with "L" (linked faces) then, the extrusion are separated from original faces.
The video shows first the result with the manual selection and then with the automatic selection with "L" (linked faces). Why is this happening? How can I avoid it?
https://youtu.be/SyS5gb2gDmg

hello, could you please share your file? https://pasteall.org/blend/

what version r u using?

Sorry, I've evolved the file. When I tried to rebuild it from scratch to share it, everything works fine. Can I discard this question?


text:
How to convert Blender as a Python module into an easily downloadable package?
I have successfully converted Blender 3.2 into a python module on Windows 10 and can import it into my Python 3.10 scripts and run bpy commands.
As described in Building Blender as Python Module on Windows 10 the folder structure for Python310 looks like this:

Note that it contains the 3.2 folder from Blender 3.2 (alpha as of writing this)

And the folder in \Python310\Lib\site-packages containing bpy.pyd and all .dll files looks like this:

Note that I have other modules installed like Django, CAPTCHA, Rest Auth, etc...

My question is; How do I create a downloadable package like Python's requests module? (it doesn't have to be on pypi, just downloadable from a git repo)
My goal is to deploy this bpy module to a Windows server running docker with a Django Rest_Framework API. I want to be able to tell DockerFile: Download bpy3.2 at this GitHub link when deployed or possibly add it to a requirements.txt file. What I don't understand is how the file structure of the folders above will affect the download and implementation into python310. Would it be easier to just use a Virtual Env and copy it to the container somehow?

source: Stack Exchange

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

sort: votes


text:
Blender crashes when exporting large amounts of high poly models and 4K textures as GLTF. What is causing Blender to crash?
Setup:
So I have a script running that exports thousands of models from Blender to a .gltf file(s). These models are big, about 200MB each, and the goal is to export about 6,000 of them. What my script does is select the objects in the Blender file scene, then export them with this function:
for obj in bpy.data.collections[some_collection].all_objects:
    obj.select_set(True)

bpy.ops.export_scene.gltf(
   filepath=f"{Save_Path_To_Model_File}.gltf",
   check_existing=True,
   export_format='GLTF_SEPARATE',
   use_selection=True)

Materials are also selected in a similar way and are unique for each export:
for obj in bpy.data.collections[some_collection].all_objects:
    selected_object = bpy.data.objects.get(obj.name)
    selected_object.active_material = bpy.data.materials[some_material]

The issue:
After this code runs for about 17 loops, exporting 17 models, Blender crashes and an error message appears saying that Blender has run out of VRAM: RuntimeError: Error: System is out of GPU and shared host memory
Most of the time Blender just shuts down and doesn't display this message in the System Console when it reboots so I haven't been able to get the full message. But I'll edit it in this post if I manage to get it.
Traceback from the .crash.txt file when exporting .gltf files:
RuntimeError: Error: Python: Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\__init__.py", line 628, in execute
    return gltf2_blender_export.save(context, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 35, in save
    json, buffer = __export(export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 52, in __export
    __gather_gltf(exporter, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 66, in __gather_gltf
    active_scene_idx, scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 30, in gather_gltf2
    scenes.append(__gather_scene(blender_scene, export_settings))
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 67, in __gather_scene
    node = gltf2_blender_gather_nodes.gather_node(
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 31, in gather_node
    children=__gather_children(vnode, blender_object, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 109, in __gather_children
    child_node = gather_node(vtree.nodes[child], export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 31, in gather_node
    children=__gather_children(vnode, blender_object, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 73, in __gather_children
    node = gather_node(c, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 31, in gather_node
    children=__gather_children(vnode, blender_object, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 73, in __gather_children
    node = gather_node(c, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 35, in gather_node
    mesh=__gather_mesh(vnode, blender_object, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 246, in __gather_mesh
    result = gltf2_blender_gather_mesh.gather_mesh(blender_mesh,
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_mesh.py", line 61, in gather_mesh
    primitives=__gather_primitives(blender_mesh, uuid_for_skined_data, vertex_groups, modifiers, materials, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_mesh.py", line 147, in __gather_primitives
    return gltf2_blender_gather_primitives.gather_primitives(blender_mesh,
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_primitives.py", line 81, in gather_primitives
    material = gltf2_blender_gather_materials.gather_material(
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_materials.py", line 53, in gather_material
    pbr_metallic_roughness, uvmap_actives_pbr_metallic_roughness = __gather_pbr_metallic_roughness(blender_material, orm_texture, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_materials.py", line 334, in __gather_pbr_metallic_roughness
    return gltf2_blender_gather_materials_pbr_metallic_roughness.gather_material_pbr_metallic_roughness(
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_materials_pbr_metallic_roughness.py", line 19, in gather_material_pbr_metallic_roughness
    metallic_roughness_texture, use_active_uvmap_metallic_roughness_texture = __gather_metallic_roughness_texture(blender_material, orm_texture, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_materials_pbr_metallic_roughness.py", line 140, in __gather_metallic_roughness_texture
    return gltf2_blender_gather_texture_info.gather_texture_info(
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_texture_info.py", line 23, in gather_texture_info
    return __gather_texture_info_helper(primary_socket, blender_shader_sockets, 'DEFAULT', export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_texture_info.py", line 46, in __gather_texture_info_helper
    'index': __gather_index(blender_shader_sockets, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_texture_info.py", line 129, in __gather_index
    return glt

Interestingly enough, this crash report cuts off the traceback. I investigated the file it crashed and this is line 129 as mentioned above:

So as far as I know this doesn't even seem to be the full traceback which is odd.
System Specs:

GPU: RTX 3080 ti + GeForce GTX 1660
RAM: 4x16GB = 64Gb
CPU: Intel Core i7-7700 3.60GHz

I've ran multiple tests with this setup and crashes every time. As the software is running the system memory slowly creeps up to 100% in Task Manager, then Blender crashes. I've used GPU + CPU compute, only GPU compute using only my 3080 ti, but nothing seems to change.
My team and I believe the textures are the source of the issue, but we aren't sure. The reason we suspect the textures is because the external texture folder is about 11.5GB.
My Question:
Blender is obviously retaining unneeded files/information in memory when exporting this many files (most likely texture/material files). Why doesn't it just delete whatever files it is storing so that it doesn't pass my system memory limit? Is there anything I can do with the Blender Python API to stop this from happening? Maybe by deleting files from RAM after the models have been generated?
I also noticed this in Edit > System > Memory & Limits:

Is there a setting here^ I can possibly utilize to resolve my issue?
Thank you for reading this post and for your answers. I really appreciate you taking the time looking this over and helping me find the answer. Please let me know in a comment if there are any more details you would like me to provide.
Edit:
With further testing I have found that this issue only applies to exporting .gltf and .glb files. .fbx files export perfectly, do not increase memory over time, and do not result in a crash due to VRAM/RAM overflow. This seems like a very serious issue if and possibly a bug in Blenders GLTF/GLB file exporter. Am I wrong to assume this? I'm going to make a post on the devtalk.blender.org site about this.
Traceback from the .crash.txt file when exporting .glb files:
RuntimeError: Error: Python: Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\__init__.py", line 628, in execute
    return gltf2_blender_export.save(context, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 35, in save
    json, buffer = __export(export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 52, in __export
    __gather_gltf(exporter, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_export.py", line 66, in __gather_gltf
    active_scene_idx, scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 30, in gather_gltf2
    scenes.append(__gather_scene(blender_scene, export_settings))
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather.py", line 67, in __gather_scene
    node = gltf2_blender_gather_nodes.gather_node(
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 31, in gather_node
    children=__gather_children(vnode, blender_object, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 109, in __gather_children
    child_node = gather_node(vtree.nodes[child], export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 31, in gather_node
    children=__gather_children(vnode, blender_object, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 73, in __gather_children
    node = gather_node(c, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 31, in gather_node
    children=__gather_children(vnode, blender_object, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 73, in __gather_children
    node = gather_node(c, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 35, in gather_node
    mesh=__gather_mesh(vnode, blender_object, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_nodes.py", line 246, in __gather_mesh
    result = gltf2_blender_gather_mesh.gather_mesh(blender_mesh,
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_mesh.py", line 61, in gather_mesh
    primitives=__gather_primitives(blender_mesh, uuid_for_skined_data, vertex_groups, modifiers, materials, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_mesh.py", line 147, in __gather_primitives
    return gltf2_blender_gather_primitives.gather_primitives(blender_mesh,
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_primitives.py", line 81, in gather_primitives
    material = gltf2_blender_gather_materials.gather_material(
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_materials.py", line 53, in gather_material
    pbr_metallic_roughness, uvmap_actives_pbr_metallic_roughness = __gather_pbr_metallic_roughness(blender_material, orm_texture, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_materials.py", line 334, in __gather_pbr_metallic_roughness
    return gltf2_blender_gather_materials_pbr_metallic_roughness.gather_material_pbr_metallic_roughness(
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_materials_pbr_metallic_roughness.py", line 19, in gather_material_pbr_metallic_roughness
    metallic_roughness_texture, use_active_uvmap_metallic_roughness_texture = __gather_metallic_roughness_texture(blender_material, orm_texture, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_materials_pbr_metallic_roughness.py", line 140, in __gather_metallic_roughness_texture
    return gltf2_blender_gather_texture_info.gather_texture_info(
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_texture_info.py", line 23, in gather_texture_info
    return __gather_texture_info_helper(primary_socket, blender_shader_sockets, 'DEFAULT', export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_texture_info.py", line 46, in __gather_texture_info_helper
    'index': __gather_index(blender_shader_sockets, export_settings),
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_texture_info.py", line 129, in __gather_index
    return gltf2_blender_gather_texture.gather_texture(blender_shader_sockets, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_texture.py", line 36, in gather_texture
    source=__gather_source(blender_shader_sockets, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_texture.py", line 80, in __gather_source
    return gltf2_blender_gather_image.gather_image(blender_shader_sockets, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_image.py", line 43, in gather_image
    buffer_view = __gather_buffer_view(image_data, mime_type, name, export_settings)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_cache.py", line 38, in wrapper_cached
    result = func(*args, **kwargs)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_gather_image.py", line 101, in __gather_buffer_view
    return gltf2_io_binary_data.BinaryData(data=image_data.encode(mime_type))
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_image.py", line 117, in encode
    return self.__encode_unhappy()
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\addons\io_scene_gltf2\blender\exp\gltf2_blender_image.py", line 141, in __encode_unhappy
    out_buf = np.ones(width * height * 4, np.float32)
  File "C:\Program Files\Blender Foundation\Blender 3.2\3.2\python\lib\site-packages\numpy\core\numeric.py", line 204, in ones
    a = empty(shape, dtype, order)
numpy.core._exceptions._ArrayMemoryError: Unable to allocate 256. MiB for an array with shape (67108864,) and data type float32
Location: C:\Program Files\Blender Foundation\Blender 3.2\3.2\scripts\modules\bpy\ops.py:115  # Error

# backtrace
Exception Record:

ExceptionCode         : EXCEPTION_ACCESS_VIOLATION
Exception Address     : 0x00007FF69DFC7690
Exception Module      : blender.exe
Exception Flags       : 0x00000000
Exception Parameters  : 0x2
    Parameters[0] : 0x0000000000000000
    Parameters[1] : 0x0000000000000000

Stack trace:
blender.exe         :0x00007FF69DFC7690  Symbols not available

Loaded Modules :

# Python backtrace

*I have no idea what these tracebacks mean btw

The glTF exporter uses a cache that stays in memory after exporting. I'm not exactly sure what's in it though, or if it's big enough to matter. I think you'll get better results by filing an issue at https://github.com/KhronosGroup/glTF-Blender-IO/issues.

(I can tell you one thing you can do to use less memory is to make sure your textures are already packed in the glTF compatible way, eg. for metallic/roughness/AO. Your traceback suggests the exporting is having to pack them which is costky.)

@scurest Thank you for the link, I'll check it out and file an issue there. Yeah that would make sense, cache is mentioned in the traceback so I assumed its something to do with that. The weird thing is that it doesn't do it for other formats like fbx or obj. It's definitely big enough in my case, I see my RAM usage go up by the GB every 10 seconds when the program is running. Thank you again for the suggestion. I think my approach would be to find a way to delete that cache after each export, but I don't know how to go about that.

If I pack the files into the Blender file, I simply can't load the file after that (its a 11.5 GB external data folder, we found the limit for a .blend file is around 3GB at most). I've tried, it just crashes on startup.

The cache system is used so pervasively that appearing in the traceback isn't really proof of anything. Not packing them into the .blend, I mean packing the RGBA channels correctly, eg. G is roughness or whatever. Compare the images the exporter creates to the images you have on disk and they're probably different right?

Also you might try adding export_keep_originals=True to the op call.

@scurest Ok cool thanks for the export_keep_originals tip, that's really handy. It shouldn't matter if they are packed correctly, the files will still be cached right? It still doesn't change the fact that it's caching files after the export process is finished. So I need to find a way to bypass that or wipe the cache so that Blender doesn't overload my systems memory. You have to forgive me for my lack of texture/material knowledge, I know more python than I do Blender.

I know for a fact the cache is retained after export, but like I said, I don't know exactly what's in the cache, so I don't know whether your problem is related to the cache or not. I was just speculating, maybe shouldn't have mentioned it.

@scurest Oh ok I see, my bad for miss understanding. Thank you for your insight, I appreciate it :) I'll look into the RGBA channel packing and talk with our teams 3D expert, then report back if I find anything. Thank you once again

Using
for obj in bpy.data.collections[some_collection].all_objects:
    obj.select_set(True)

will add the next object to the selection set, so every time your script iterates it add the next object to the selection set, so every export will include the last set of objects and everything will get exported, effectively creating a larger and larger set of objects to be exported.
You need to deselect the object after each iteration and reselect the next object:
for obj in bpy.data.collections[some_collection].all_objects:
    obj.select_set(True)
    bpy.context.view_layer.objects.active = obj

    bpy.ops.export_scene.gltf(
       filepath=f"{Save_Path_To_Model_File}.gltf",
       check_existing=True,
       export_format='GLTF_SEPARATE',
       use_selection=True)

    obj.select_set(False)

Maybe I'm over simplifying this, but from the code snippet you've give it looks like the simplest answer

Oh yeah, my script doesn't do that, however it removes materials from previous exports as well. I forgot to include that in the example code above. The previously selected models aren't included in the exported gltf files when I import them into a separate blender file, let me give this a shot and see if it works. I also noticed from earlier that the files don't increase in size over the course of exporting.

Tried this method out, still experiencing the same memory creep and eventual crash due to VRAM and RAM overflow.

Shame, was hoping "the simplest way" would be the answer here. XD
Another thought, perhaps it's a driver issue? Looks like you're running Windows? If you have access to a Linux system it might be worth trying that as Linux generally has much less issues with memory leaks, where as Windows can be prone to serious memory problems, it can sometimes not free up RAM after it's used. Just a random possibility...

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


text:
How to bulk import and set up hundreds of PBR textures with Python?
I have a folder with 750 texture folders, within each texture folder there are four files: jpg, png, exr, and x2. I can import these textures manually by going to the shader tab and pressing Ctrl+Shift+T with Node Wrangler enabled and then select all the files within a given texture folder. My goal with this post is to automate this so that I don't have to manually do this for all 750 texture folders.
Here is the code I have so far:
import bpy
import os

FOLDER_PATH = "/Users/torrinleonard/Desktop/Texture_Importer/Textures_Folder"
MATERIAL_OBJECT = "Material_Object"  # The name of an object used to only add materials to the scene and nothing else.

for texture_folder in os.listdir(FOLDER_PATH):
    if texture_folder != '.DS_Store':  # Make sure Blender is not importing MacOs .DS_Store files
        # Get folder path for each texture
        texture_path = os.path.join(FOLDER_PATH, texture_folder)

        # Create new material slot in material list and create new material:
        material_object = bpy.data.objects[MATERIAL_OBJECT]  # Set active object to variable
        material = bpy.data.materials.new(name=texture_folder)  # Set new material to variable
        material_object.data.materials.append(material)  # Add material to the object

        bpy.context.area.type = 'NODE_EDITOR'
        bpy.context.area.ui_type = 'ShaderNodeTree'

        # Prepare node setup of material:
        material.use_nodes = True
        material.node_tree.nodes.get("Principled BSDF").select = True  # Set nodes in material node tree to active

        textures = os.listdir(texture_path)
        first_jpg = ""
        files = []

        for texture in textures:
            if texture != '.DS_Store':  # Make sure Blender is not importing MacOs .DS_Store files
                if texture.endswith(".jpg"):
                    first_jpg = texture
                files.append(
                    {
                        "name": texture,
                        "name": texture
                    }
                )

        bpy.ops.node.nw_add_textures_for_principled(
            filepath=f"//Textures_Folder/metal_plate/{first_jpg}",
            directory=os.path.join(FOLDER_PATH, texture_folder),
            files=files
        )

It's pretty self explanatory but here is the recap: We have an object in our scene, "Material_Object", for each texture located in our Texture folder, we add a new material to that object's material list, and create a new material. This creates a Principled BSDF node in the Shader Editor.
When running this script inside Blender, the materials are created, the names are set, but for some reason the files are not applied to the Principled BSDF node as if I were to do it manually:

Why is this happening?
I believe it is due to the way Blender is selecting the Principled BSDF node. In the console it prints it successfully Selected that node:

However going to that materials node group we can see it is highlighted in orange, not white, which is the selection type we need to activate Ctrl+Shift+T, or in this case, bpy.ops.node.nw_add_textures_for_principled with Python. REMEMBER: This was selected with the above function material.node_tree.nodes.get("Principled BSDF").select = True:

To contrast that, here is what the selection looks like when you do it manually:

Below I've highlighted the code for nw_add_textures_for_principled in Node Wranglers, it appears to be looking for nodes.active:

I have spent hours trying to find out how to get this hidden 'active' state on a node with python, but with no luck. I've poured through the documentation and node.select is the only thing close to what I can find, but that's not selecting the Principled BSDF like you would do it manually to import textures with Ctrl+Shift+T.
My question: How do I apply this hidden 'active' state to a node so that I can import images to a materials Principled BSDF node using nw_add_textures_for_principled from Node Wrangler?
Is this the only way to bulk import textures? Am I missing some much better solution?
I'm using Blender 3.1.2 on MacOS 11.6.7 Big Sur to code/test this and Blender 3.2 on Windows 10 to execute it if that matters

material.node_tree.nodes.active = material.node_tree.nodes.get("Principled BSDF") ? https://docs.blender.org/api/current/bpy.types.Nodes.html#bpy.types.Nodes.active active is a property of the node tree's nodes construct, it's not tied to each and every node (Every node can be selected, but only one node at most can be active per tree at any given time)

@Gorgious, that seems to be selecting the BSDF node correctly, however for some reason it changes the context away from the NODE_EDITOR/ShaderNodeTree:
RuntimeError: Operator bpy.ops.node.nw_add_textures_for_principled.poll() failed, context is incorrect

@Torrinworx The operator needs to be executed in the shader editor, which your script does not do. You will either have to supply a custom context or alternatively write your own script to connect the textures with the Principled BSDF. You can take a look at Node Wrangler's implemention in 3.2\scripts\addons\node_wrangler.py NWAddPrincipledSetup.

The strange thing is, when I add print(f"AREA TYPE: {bpy.context.area.ui_type}") before the node wrangler line, the console prints the area as AREA TYPE: ShaderNodeTree

@RobertGützkow Could you elaborate on what you mean by "needs to be executed in the shader editor" and "supply a custom context"? Do you mean running the script in a panel inside the Shading tab?
Is this what you mean when you say "connect the textures with the Principled BSDF": https://blender.stackexchange.com/questions/239854/using-python-to-batch-link-image-texture-alpha-to-principled-bsdf
Sorry for the newbie questions, I'm a python guy at heart

@Torrinworx Contex override the new way (3.2): https://docs.blender.org/api/current/bpy.types.Context.html#bpy.types.Context.temp_override or the old way: https://docs.blender.org/api/3.1/bpy.ops.html#overriding-context
The Node Wrangler operator's poll method requires that the script runs in the  shader editor so that certain UI elements etc. are present. This is not the case when just running the script from the script editor or as an add-on, it has to be explicitly set. Yes, that is what I meant by connecting the textures. You could do this yourself without relying on node wrangler.

@RobertGützkow, ok thank you for the explanation and links, I'm going to try this method out and post back here if it works

Also as a suggestion you could try and locate the part of the addon which creates the setup in the node wrangler addon and copy / paste it inside of your script, you'll even be able to tweak it to your liking and won't need to rely on operator overrides.

@Torrinworx hi did u try the solution?

I had a similar issue here, and finally got it resolved. The important but unintuitive thing is to set:
areas[0].spaces.active.node_tree = material.node_tree

This is the script that should work for you. Before you run it: make sure you test it first with a folder with only a few textures, maybe 2 or 3, because it takes a while for blender python to process.
import bpy
import os

FOLDER_PATH = "/Users/torrinleonard/Desktop/Texture_Importer/Textures_Folder/"
MATERIAL_OBJECT = "Material_Object"

#-----------------------------------------------------------------------------
#
# Starting in 3.2 context overrides are deprecated in favor of temp_override
# https://docs.blender.org/api/3.2/bpy.types.Context.html#bpy.types.Context.temp_override
#
# They are scheduled to be removed in 3.3
#
def use_temp_override():
    ''' Determine whether Blender is 3.2 or newer and requires
        the temp_override function, or is older and requires
        the context override dictionary
    '''
    version = bpy.app.version
    major = version[0]
    minor = version[1]
    if major < 3 or (major == 3 and minor < 2):
        return False
    return True

for texture_folder in os.listdir(FOLDER_PATH):
    if texture_folder == '.DS_Store':  # Make sure Blender is not importing MacOs .DS_Store files
        continue

    texture_path = os.path.join(FOLDER_PATH, texture_folder)
    object = material_object = bpy.data.objects[MATERIAL_OBJECT]
    material = bpy.data.materials.new(name=texture_folder)
    object.data.materials.append(material)

    object.active_material_index = len(object.material_slots) - 1

    material.use_nodes = True
    tree = material.node_tree
    nodes = tree.nodes

    material.node_tree.nodes['Material Output'].select = False
    material.node_tree.nodes['Principled BSDF'].select = True

    material.node_tree.nodes.active = material.node_tree.nodes.get("Principled BSDF")

    bpy.context.area.type = 'NODE_EDITOR'
    bpy.context.area.ui_type = 'ShaderNodeTree'

    textures = os.listdir(texture_path)
    files = []

    for texture in textures:
        if texture == '.DS_Store':
            continue

        files.append(
            {
                "name": texture,
                "name": texture
            }
        )

        filepath = texture_path + '/'
        directory = texture_path + '/'
        relative_path = True

        win = bpy.context.window
        scr = win.screen
        areas  = [area for area in scr.areas if area.type == 'NODE_EDITOR']
        areas[0].spaces.active.node_tree = material.node_tree
        regions = [region for region in areas[0].regions if region.type == 'WINDOW']

        if use_temp_override():
            with bpy.context.temp_override(window=win, area=areas[0], region=regions[0], screen=scr):
                bpy.ops.node.nw_add_textures_for_principled(
                    filepath=filepath,
                    directory=directory,
                    files=files,
                    relative_path=relative_path
                )
        else:
            override = {
                'window': win,
                'screen': scr,
                'area': areas[0],
                'region': regions[0],
            }

            bpy.ops.node.nw_add_textures_for_principled(
                override,
                filepath=filepath,
                directory=directory,
                files=files,
                relative_path=relative_path
            )

Could you maybe add just a few words explaining shortly what makes things work please? Just to make this answer reach more people :)

@L0Lock sorry i didn't give more details. the thing is the important piece is this unintuitive thing you have to set areas[0].spaces.active.node_tree = material.node_tree. i always run into this same problem wondering why things don't work because of this missing line.

https://projects.blender.org/blender/blender/issues/99484


text:
Rename Node Sockets
Is there a way to rename the sockets on a group node? This would be useful. Googling produces some unsettling results as it seems it is a feature being developed by a third party and maybe as an addon?

Yes, you can do this by clicking the node and open up the properties panel by hitting N within the node editor. With this you can edit name, label, outputs and inputs of the node.

Ah yes! I just found it myself! I was about to delete the question!

No problem, here is the link if you're interested in looking: http://meta.blender.stackexchange.com/questions/524/what-case-should-letters-inside-kbd-tags-be @poor

I won't delete it

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

authors: Павел Медведев


text:
Blend4Web does not render in Mac OS Sierra 10.12.6
All my Blend4Web.html files (which worked fine on my Mac) don't work anymore. I double click the html and I see the Blend4Web Wheel for a couple of seconds (as usual), then the buttons appear, but the 3D Object does not load. I never updated the drivers for the gpu and it always worked. Apart from the Mac OS update, the only other thing I changed was to always use the the graphic card and not switch between the internal and external. Any ideas why this does not work anymore would be great. Thanks.

This is a known Chrome 60 bug which is already fixed by Google in Chrome 61. Nevertheless, we're going to include a workaround in the upcoming 17.06 LTS and 17.08 releases.

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


text:
How Can I make a Fluid Simulation liquid become gooey or viscous?
I would like to change the properties of a fluid sim so that the liquid behaves gooey viscous. Which parameters would I have to change to get a slow, gooey viscous fluid. Much like hot sugar candy (e.g. https://www.youtube.com/watch?v=tEqvwnlMRvA).
I looked at some of the tutorials describing how to do honey, but they still look like water.
Also maybe there is an addon that does excatly that. I also would like to displace the mesh that results of this simulation by twisting it. Any help would be much appreciated. Thank you.

Primarily you want to adjust the viscosity settings. The smaller the viscosity the more watery the simulation. Note that the exponent value is negated so increasing the exponent makes the final value smaller.
You will also find that the real world size makes a difference. A real world size of 10.0 will give a watery result while a real world size of 0.2 will be closer to a slushy with the same viscosity.
As for twisting the result, it will depend on the effect you want. You could use a simple deform modifier or a lattice deform. With a thick fluid sim you may also be able to use a collision object that spins around.


text:
Round or hard corners on a single vertices in 2D
I have an 2D object (eg. circle) and would like to modify single vertices and their angle. Very much like in any graphic software I would like to select one single vertice and convert it either in a hard corner or a "soft"/smooth corner.
Couldn't find that in Blender. Proportional editing and smoothing won't work.
Related to this question I would like to manipulate vertices by exact dimensions and find that sometimes this is hard to achieve. For example I would like to scale by an exact dimension.

User413734, The intent of the Blender stack exchange site is for each question to contain a single question, or if not for all of the questions to be very closely related. Your question related to manipulating vertices by exact dimensions is not closely enough related (in my opinion) and should be its own question.

Mesh objects always have what you seem to be thinking of as "hard corners". When you're saying "like in any graphic software" I assume you're thinking about vector-based software like Inkscape or Illustrator which typically use Bezier curves.
If you want to manipulate points in a similar manner you would have to create Curve objects, not Mesh objects.

Use subdivision surfaces. Create a mesh, make it a 2d line, and add vertices near corners to sharpen them. Move those vertices away to loosen them up. Basically how one would work with splines in other softwares.


text:
Running Blender off of network drive
I need to run a BGE executable off of a network drive. I can not install or run any problems off of the computer. The network drive is also quite slow.
My Questions:
Does the blender executable depend on any DLLs or any thing that isn't already included in the folder below?
Can anyone confirm that the files in the folder below are all that the simulator.exe should need to run? (These files were created when I exported as a BGE executable)

Is there any reason that a Blender executable wouldn't like being run off of a network drive? The program runs well off of a USB.
This is the error I get when I try to run the above simulator.exe file

This is fine to work on any windows system.

In my case, the following worked on my own shared drive, both PCs running Windows 7 Ultimate 64bit:
1. in the sharing settings for that particular folder, make sure that Read AND write are enabled:

2. Make sure your antivirus and firewall allow the exe to run (In my case, Avast was blocking it)
3. make sure that "Run as Administrator" is enabled in the exe properties:


text:
How can I fill a "spinned/screwed curve"?
I am trying to make a cross-section of an object with a rotational symmetry.
I thought using a curve for the cross-section with the screw modifier would be a better way to do that than using boolean modifiers on a mesh.
But if I use a filled 2D curve and the screw modifier, the fill gets messed up as in the attached picture (Objects A and D).
If I use a 3D curve, there are just no caps (Object B).
Object C is what I would like to achieve. I made it by converting the bezier curve to a mesh, creating a face and then using extrude->spin in edit mode.
But then I loose the flexibility of editing the cross-section.
How can I achieve the same while keeping the cross-section a curve?

Blender example file:

I can't read your mind.. :) which one is BezierCurve .001?

Sorry, I was planning to add the .blend file, but could not figure out how. It's the one in the middle between the uncapped screwed bezier and the circular tube.

Added labels to screenshot.

Cheers! To add a .blend file, visit https://blend-exchange.giantcowfilms.com/, and fill in the forms (one of the fields is the url of this question)

Thanks. File added. :)

Have you tried using a Decimate modifier set to "Planar" so you get an ngon instead of triangulated faces on the caps? This should allow you to use the filled curve with the Screw modifier without creating more geometry inside (just a theory, not tried)....Or you fill the curve with an ngon right at the beginning.

I found one possible solution by simply using three linked curves, one for the solid and two for the caps. This can be further improved for flexibility by adding drivers.
See attached blender file and the included README:

In it, you can change the cross-section angle by changing the X rotation angle of "BezierCurveDriver".
Changing the material or editing the bezier curve will affect the extruded solid and the two caps.
How to do it:

Add curve

Make it 2D, cyclic and filled:

Properties->object data properties->Shape->2D
Properties->object data properties->Shape->Fill Mode->Both
Properties->object data properties->Active spline->Cyclic: check box

Optional: Now you may want to make your curve flat along the planned rotation axis (X for instance), by setting the some or all of the handle types to "free" and aligning some of the control points on that axis:

Go into edit mode (press tab with the curve selected with the mouse in the 3D viewport)
Select desired nodes
3D Viewport->Control points->Set handle type->Free (or press V and select "free")
Position control points along X axis as desired (snapping, scale YZ zero, enter Local/Global coordinates, etc...)

Make sure you are in Object mode, then duplicate the curve twice with linked data by pressing Alt-D (or 3D viewport->Object->Duplicate Linked):

One will form the solid by using a screw modifier: "BezierCurveWithModifier"
One will form the bottom cap: "BezierCurveBottomCap"
One will form the top cap and drive the angle of the screw modifier: "BezierCurveDriver"

Add a screw modifier to one of them ("BezierCurveWithModifier" in this example):

Properties->Modifier properties->Add modifier->Screw

Right-click on the Angle property of the modifier and select "Add driver". This will open up a driver editor window.

In the driver editor window:

Choose "BezierCurveDriver" as the Object.
Choose "X rotation" as the type.
Set the expression to "var".

Now you should be able to "extrude" the curve nicely to any angle by changing the X rotation angle of "BezierCurveDriver":

Properties->Object Properties->Transform->Rotation X

Changing the material or editing the shape of any of the three linked curves will affect the extruded solid and the two caps.


text:
Is there any way of running sphere projection after a modifier?
I have made a displace and decimate modifier pipeline to generate a globe with height map displacement. However the UVs after this process become messy. Even recalculating UVs by geometry nodes still have glitches around the edge because UV at the seam are merged and wrapped around as a result of decimate modifier.
The simplest solution should be just running UV > Sphere Projection but that is not an option on the modifier or geometry nodes
I am using blender 2.93. Are there any ways to make this possible by any means? Could I write script to run command after modifier? Or are there any ways to split the edge of decimated mesh and recalculate UV properly? Or any node in geometry node that I could use to completely imitate Sphere Projection algorithm? Or did this feature have been added in blender of later version?

Might be helpful: https://blender.stackexchange.com/a/280086/71578 Sharing your current file on blend-exchange.com might be helpful for those who want to take a look at your problem as well.

Note that you can do everything in that link in shader nodes as well (which is going to have more cross-version compatibility, be per-sample rather than per-vertex, and, possibly, have better performance.)

Sorry for not provide enough info. I can calculate UV of the sphere myself. But there was the well known problem to calculate spherical mapping that the UV will be mod into the range 0-1 instead of staying with nearby triangle
like this

In the end I could not found a way to do it in blender 2.9. But I found a solution in blender 3.4. In this version there is a geometry node Offset Corner in Face that let me get the value of other UV to compare with current UV

Which let me compare that, if the U value of neighbor UV of the same triangle face are distance apart than some epsilon (0.75 in this case) its mean the sphere projection was wrapped around from the calculation of atan2 and so that point need to be offsetted
The full node it this (the Node Group is the image above that utilized the node Offset Corner in Face)


text:
I have a problem duplicating a Mesh and again applying curve modifiers to the copy correctly?
I have a cube (A1) and a nurbs curve (N1)
I use an array modifier and a curve modifier so that cube (A1) follows the curve (N1) and fills exactly. But I do not apply the modifiers.
I then use SHIFT+D to copy A1, which gives me a new cube mesh, A2. I make a new nurbs curve, N2. I cannot use this new cube, A2 on the new nurbs curve because when I get upto the step of using a curve modifier, A2 just goes all over the place or stretches too big. Why and how and can this be fixed?
I've tried applying rotation, scale and location on everything, tried changing all the modifier settings  and tried multiple times in different ways but cannot get it to work.
I've tried this both on blender 2.74 and blender 2.79 and it's the same thing.
recreated blend file:

Can you add a sample file using https://blend-exchange.giantcowfilms.com/

sure. I have uploaded my blend file

moonboots I think I understand, I just tried it. I have to duplicate both A1 and N1 then delete the duplicate nurbs curve, and I can use the new duplicate cube for another curve! However there is a new problem, on my original project turns out I have already deleted the curve so the original mesh cannot be deleted/unlinked from it?

that's just so I can move mesh around the curve as I need. But there might be another way to do that. I'm just beginner so I'm not really sure what it does, just that's how I use in past. Also, how on earth did you figure out I needed to duplicate both Nurbscurve and mesh? Is there a book somewhere covering the bugs? lol how do I see how many times I've scaled curve?

you've enabled the Object Offset of the Array modifier, is there a reason for that? Because it messes your object: your curve is scaled 6 times, so it will also scale your cube 6 times... and if you choose to apply the scale of your curve, don't forget to bring back the Radius of your curve vertices to 1 in Edit mode

You've enabled the Object Offset of the Array modifier, with your curve as the offset object, is there a reason for that? Because it messes your object: as your curve is scaled 6 times, it will also scale your cube 6 times...
Object Offset will array your object taking account of the location, rotation and scale of the chosen object, like for example it will scale your original object increasingly if your offset object has been scaled, which is not what you want, you want a simple array, then a second modifier that makes the array follow a curve.
So disable this option as you just want your cube to be duplicated. It's the next modifier (Curve) that will take care of making your object following the curve.
Also, if you choose to apply the scale of your curve, don't forget, in Edit mode, to bring back the Radius of your curve vertices to 1 (on the N panel of your 3D view).


text:
Texture is only rendered correctly in first frame
I am new to Blender and I am trying to create an animation. My data is saved as a Blender voxel file which I load into a cube, adjust scattering etc. and it looks fine, but the texture is only visible in frame 1 and disappears in the following frames (in object mode and also when rendered).
What am I doing wrong?
Thank you very much in advance for your help!

It is totally fine to answer your own question. It will make this thread more structured and readable.

The cause of my problem was that I had not set Still Frame Number to 1, see this post: Bug? Voxel Data Animation Issue (Still Frame Number Keyframe not rendering).
Maybe it helps somebody else.


text:
How to emit particles at intersection of faces (Scan animation)
I want to make an animation that explains laser scanning. It will consist of two videos.
One of the videos is rotating duck with a laser on it.
You can see the animation here. The animation is by me and the first of the two videos is already done.

https://media.giphy.com/media/iDJOi8TmgXrHKRQuoA/giphy.gif
The other is supposed to be a sort of point cloud that is generated by the scanning laser from the first video. So wherever the laser hits the rotating duck, there should spawn points.
What I have tried so far:
I tried to make the point cloud with a particle system. It worked well except that I could only generate points over the entire duck faces and not only at the "laser line". Ideal would be to have an emitter that is the intersection between the rotating duck and a face.
I hope I stated my question clearly.
Thanks

Perhaps I didn't clarify enough. The GIF I posted is from me and that is the current state and only here to clarify what other video I want. The question is not about creating the laser. It is about creation particles/ point cloud that emit when the laser is at that spot.

Thank you for the feedback!

I think using a Shrinkwrap modifier on a line of vertices should help here. This will let the vertices map to the surface and you can then have the vertices emit particles. Rotate the camera and string of vertices around the object instead of rotating the object and the particles will appear to cling to the surface instead of being left behind. Hope this is enough to go on - can’t post a proper answer.

Material
Dot pattern texture with appearance controled by Radial Blend texture.

Laser line is shrinkwrapped line, just for illustration, you will use your laser :)
Particles
They looks better, since there is not a deformation on surface curvature. I wanted to use the same Radial blend texture as factor for Emission, but I had some dificulties to get it work for particle system. So here is a version with particles emited from Shrinkwrapped line of vertices suggested by Rich Sedman
Works nice like real one in term - light string follows surface and keeps empty places where light cant touch surface (like in tail part).
Issue is distribution. I wasnt able to set even release particles from vertices.

2 years later ...
Appearance of particles can be also controlled by Dynamic paint. Just add a plane (as laser) and use this object as a Brush in DP ... Duck as Canvas in DP.

Please be aware that this is not the technical most beautiful way, and that it's a half blind guess of mine.
I am not too familiar with particle systems, but my first attempt to emit particles at the intersection zones is to emit them from vertices generated by the boolean modifier.
What you see here is a plane, representing your "scanning laser", passing through the object that is supposed to be scanned.
If this works out how I think it will, the boolean modifier is generating a "ring" of geometry/vertices at the intersection around your object, which can then be used to emit particles from.
Sadly I couldn't set up a particle system myself because I have too little experience in that area, but I hope this will halp a but.
As I said, this is supposed to offer you a direction you could try, but I'm not quite qualified for particle system stuff.


text:
How to fix tile size not following set parameters?
I noticed that tiles in my renders in Blender have been consistently at 40. I have them set at 256 by default. It started after I tried the Auto Tile add on. When I noticed it, I disabled it right away. But my renders stayed at 40. I have tried to reset to factory settings and restarted Blender but it ist still rendering at 40 tiles. I am using GTX 1660 by the way and it render fine with multiple tiles last night.
Edit: I have also tried reinstalling it but it rendered at the same tile count -- 40.

And you have tried re-adjusting the tile size after you disabled the addon?

Yes. I tried clicking the tiles and set it to both 256 pressed enter. When I rendered the animation, it was still rendering at 40 tiles.

Hmm, I might uninstall the addon. Note that uninstalling blender may not have done that.

Notably, on a GPU, wouldn’t 45 be a good size? Why try to avoid it?

I thought GPU is good with big tile size and CPU is good with small ones. I tried a smaller tile size like 64 and 128 and it fixed it for some reason.

maybe I’ve got it mixed up. I remembered it the other way around, relying on the memory being typically smaller in a GPU than the main PC ram. Will check the blender docs…

Yes, yes. Thank you for your reply!


text:
Modifier disappears from render
I can't figure out why my modifiers sometimes stop rendering, and it apparently happens with both Cycles and Eevee. I'm using VertexWeightProximity together with UVWarp to change the transmission of the shader. It renders fine in the render view, it renders fine in render window. But I don't know what I do (if it's something I do), after I apply this to a couple of objects, I apply it to a new one and now it renders only in the render view, but not in the render window. And I swear I have the modifiers active for both render and viewport. See below: render view has this transparent line on the left, render window is all plain.

What could be happening? Could it be some name conflict (all modifiers, vertex groups, UV maps, etc. have the same names, although they belong to different objects)? Memory issues? Just a bug?
EDIT: A simpler setup, but that shows the same effect (plus modifiers getting borked in the viewport and needing to be re-toggled in order to be fixed): https://paste.c-net.org/SandyCruelest
EDIT 2: I think it must be a bug or a limitation (https://developer.blender.org/T92336), and it happens because object A has a modifier that depends on object B, and object B has a modifier that depends on object A. A workaround is creating a linked (and parented) duplicate of e.g. object A, so object B can reference the duplicate instead.

I don't see an appreciable difference in distance.blend (provided) between Eevee render and preview?  Maybe point out the difference in images so people can reproduce your problem?  But it's likely to be due to the different render and preview settings (iterations) on your subdivision modifiers.

After reviewing your bug report, the issue is a dependency loop.  I've commented there.


text:
I click just outside an object and it automatically selects the closest vertex or edge, why God?
Out of nowhere, whenever I hit the mouse button next to a vertex, edge, or face, it automatically selects, without the need to click right on it - so when I try to select multiple vertexes that are close to each other, it's just not possible, 'cause it keeps selecting the closest vertex.

In the GIF you can see I click just outside the object and it selects the closest vertex (it goes the same for edges)

hello, it's hard to understand, in Blender left click will select the object/vertex in the 3D view

is it possible that you pressed the W button by accident? just tap it again and it should work as normal again...

One of the problems is that I actually don't know exactly how to put this problem I'm having into words haha It'd be easier if I could show it in a video or GIF

I just added a GIF to the text, and also incremented the description a little bit. Thank you guys for the attention!

From your gif, you are switching between Move tool and the select tool (left tool bar)

I we click just outside an object it automatically selects the closest vertice, face or edge for everyone

If we click just outside an object it automatically selects the closest vertice, face or edge for everyone.These are just the default settings of blender. You haven`t accidentally changed any of the settings.
EXAMPLE

I mean, the problem may just be in my mind then, 'cause I've been using Blender for many months, and just now it's been bugging me, something still feels off lol Well, thanks for showing me that the problem is actually me.


text:
Cycles Emission Material Receiving Shadows
I am trying to follow this tutorial. Around 36:00 in the tutorial, he adds an UV sphere with an emission material that will eventually become the sun. However, when I follow the exact same steps, my object does not seem to emit anything, and instead receives shadows from the lamp. It is the very small object in the background of the picture below.

I have tried everything including:

Turning up the strength of the emission node up to 10, 20, and 50
Material Properties > Settings > Shadow Mode > None
Object Properties > Visibility > Ray Visibility > Deselecting Shadow
Adding a Light Path node, connecting it to the value of a Map Range node, and connecting the result to the strength of the emission node
Changing the sun lamp to an area lamp
Disabling the sun lamp altogether
Disabling my HDRI background altogether (note I have the ray visibility for the HDRI set to camera only and also have transparency selected for compositing purposes)

Nothing seems to be working.
Blender Version: 2.92
Material Settings:

Render Settings:

Hello and welcome, please add some screenshots of your material nodes and render settings, the more info, the better

Did you perhaps add a second material slot instead of putting the second material into the existing slot?

Make sure you really are using cycles, your screenshots are showing cycles material on the first one and EEVEE material on the second image

@Emir I am confused as to what you mean by this. The first two screenshots are of the exact same material. The third and fourth screenshots are of the cycles render settings.

@AllenSimpson This was helpful, thank you. I had to switch to edit mode and assign the mesh to the object.


text:
Inverse kinematics offset?
I have a problem with my rig. As I put a IK constrain on the two bones, the constrained one is just offsetting as shown in the screenshot below
Is there anything I did wrong?
Best regards

Are those bones connected? That would help for a start.


text:
How to do texture box mapping with blending in Blender Internal
I'm trying to do box mapping of texture with blending just like the node setting in Cycles below.

This is the texture I used

I could have used box mapping option on Blender Internal too but I couldn't have found blending option.

Is there way to do it easily? or I have to do some complicated node setting to do this? I guess it's possible to do this by using nodes but I can't come up with how.

I didn't understand what you're trying to do, but in Blender Internal the blending options are on the bottom of the influence tab.

Blending in box mapping is combining 3 textures projected from 3 direction by using face normal.

in the upper screenshot there's 1 image only. How do you map other 2? and btw which images are those? can you show them? I can't get it...

I added the picture of the texture I used. As you can see on material setting on Cycles, On image texture node, it's set to "Box", instead of flat. It will automatically project the same texture from 3(6 with negative direction) directions.

The key to this is in the node set up in the first image, the image texture node. It uses "box" projection, with the blend is set to 1.000. This was a feature added specifically for the purpose of blending the image being projected from all directions (even if that image is the same texture).
The description provided in the blender 2.79 manual is here:
https://docs.blender.org/manual/en/latest/render/cycles/nodes/types/textures/image.html
Projection
Projection to use for mapping the textures.
Box
Maps the image to the six sides of a virtual box, based on the normal, using XY, YZ and XYZ coordinates depending on the side.
Blend
For Box mapping, the amount to blend between sides of the box, to get rid of sharp transitions between the different sides. Blending is useful to map a procedural-like image texture pattern seamlessly on a model. 0.0 gives no blending; higher values give a smoother transition.


text:
How to get a list of Drivers used in certain bone
I would like to know how to get a list of drivers used in a certain bone.
like how many and what type and what kind of variables it's using.
I know I need to use bpy.context.object.animation_data.drivers but somehow I can't achive what I want.
If you know how to do that, please tell me.
Thank you in advance

I haven't found a super elegant way to access a driver directly from the bone, if someone knows that please let me know in the comments. But what you are trying to do can be achieved by building your own Python Dictionary over the armature in question. I assume that you have an armature with drivers on it, and it is the current active object. I further assume you have a console open (on Windows you can open it from the 3D View Main Menu, on Linux and Mac you need to start Blender from the console). Now run this from the Text Editor:
import bpy

# create an empty dictionary to store all found bones and drivers in
boneDict = {}

# iterate over all bones of the active object
for bone in bpy.context.object.pose.bones:

    # iterate over all drivers now
    # this should give better performance than the other way around
    # as most armatures have more bones than drivers
    foundDrivers = []
    for d in bpy.context.object.animation_data.drivers:

        # a data path looks like this: 'pose.bones["Bone.002"].scale'
        # search for the full bone name including the quotation marks!
        if ('"%s"' % bone.name) in d.data_path:

            # we now have identified that there is a driver
            # which refers to a bone channel
            foundDrivers.append(d)

    # if there are drivers, add an item to the dictionary
    if foundDrivers:
        print ('adding drivers of bone %s to Dictionary' % bone.name)

        # the dictionary uses the bone name as the key, and the
        # found FCurves in a list as the values
        boneDict[bone.name] = foundDrivers

# now you have a dictionary in hand, which you can use to
# retrieve all driver info from
print ('bonedict: %s' % boneDict)

# usage examples

# get all drivers of the active bone, if it has some
boneName = bpy.context.active_bone.name

# first check if it has drivers at all
if boneName in boneDict.keys():
    # if so, access the drivers list by using the bone name as the key
    activeBoneDrivers = boneDict[boneName]

    # get number of drivers:
    print('Number of drivers for bone %s: %i' % (boneName, len(activeBoneDrivers)))

    # iterate over those drivers only:
    for d in activeBoneDrivers:
        # print the expression
        print('expression: %s' % d.driver.expression)

        # print if driver actually works:
        print('driver is valid: %s' % d.driver.is_valid)

        # get the type
        print('driver type: %s' % d.driver.type)

        # print the variables
        for var in d.driver.variables:
            print('variables: name %s, type %s' % (var.name, var.type))

            for target in var.targets:
                # you can also iterate over the targets
                # if you use Pythons dir() function, you will see what methods and properties you
                # can access:
                print ('targets methods: %s' % dir(target))

I tried to comment the code as completely as possible, so all explanation how this works is in there. Also, I chose to add the FCurve to the dictionary instead of the Driver directly. FCurves can sometimes be used to further tweak the driver, so you might want to access the curve and its Modifiers too. If you have further questions, feel free to ask  :)

Thank you very much for the detailed answer! I will try this!

S far iterating through the object driver list and checking the the bone name vs the driver datapath is the only way I could figure out.  Then I searched here and found your same solution.


text:
Reduce file size and choose ideal file type
I have several stl files that are rather big (70 MB and more) and messy(surface scans that have been converted to stls, holes and uneven surfaces) and would like to understand better the process of reducing the filetypes and choosing the ideal file type for the best size/quality ratio because I would like to make them available online/download (Blend4web).
I know about the decimate modifier but don't have a complete understanding of the workflow (so I can tweak and optimize each step) to choose the right filetypes, reduce the polygons, smooth the surfaces (keep the overall shape but remove holes) and export to the ideal format. If there are scripts that automate this I would like to know about them.
If anybody would be aware of a good tutorial or script that does this please let me know.
Thanks for your help.

Decimation will reduce amount of geometry but also can severly affect its quality. Process of retopology would provide decent results but it is for the most part manual, time consuming and can get boring. (On the bright side - at least it is not extremely difficult)
Retopology would give you full control of how the model will end up looking, something automatic solutions wont be able to deliver.

For big objects you can make low-poly version and bake normal map from high-poly. For small objects the only way to reduce the amount of faces is to use the decimate modifier or remove extra faces manually. You can try using the decimate modifier with different settings until you're satisfied with quality and size.
Usually, loading time can be decreased by setting up caching on the server that contains web application. You can also try to take advantage of GZIP compression by setting up your server. But if for some reason GZIP compression cannot be set up on the server, it can be enabled in the application itself (here is more on this).


text:
How can I fit one complex object into the bounds of another (simple) one
For example if I would like to reproduce a chick growing in an egg. I create the skeleton, the egg, but how can I fit the skeleton into the egg. The morphing from one shape to another might be an option but seems more like a hack. I assume a lot of people need this in character modelling and maybe there is a standard way (modifier) to achieve this. Also if there is a tutorial for something similar it would be great to know.

shape keys?, or you could get a seperate model and then botch the animation to a multiple layer and just hide a part of it.

Maybe you could try Cast modifier?
https://youtu.be/PWxN5mP310E?t=432

Awesome thanks. Did not know about cast modifier. I think that's it.


text:
How to get Blender 2.80 to render through an ssh connection? [Minimal working example provided]
I am using Blender 2.80 on my local machine and the machines I am connecting to via ssh. My local machine is Ubuntu 18.04. I hope to use Blender to programmatically generate images as part of my code base, and to do this via ssh.
I installed Blender by taking the tar.bz2 file, and then running
tar -xvjf blender-2.80-d93a7290e506-linux-glibc224-x86_64.tar.bz2

and then in my ~/.bashrc, I have:
export PATH=${HOME}/blender-2.80-d93a7290e506-linux-glibc224-x86_64:$PATH

I have the following minimal working example:
#!/usr/bin/env blender --python
import bpy
bpy.ops.render.render()
bpy.data.images['Render Result'].save_render(filepath='example.png')

Suppose that file is called example-make-image.py. I call it via the following command:
$ blender --background --python example-make-image.py
Blender 2.80 (sub 74) (hash d93a7290e506 built 2019-06-11 23:26:36)
Read prefs: /home/user/.config/blender/2.80/config/userpref.blend
found bundled python: /home/user/blender-2.80-d93a7290e506-linux-glibc224-x86_64/2.80/python
Warning: 'OBJ_SEQUENCE_properties' doesn't contain '_PT_' with prefix & suffix
register_class(...):
Warning: 'OBJ_SEQUENCE_properties' doesn't contain '_PT_' with prefix & suffix
0  meshes freed
Fra:1 Mem:88.26M (0.00M, Peak 88.43M) | Time:00:00.08 | Syncing Cube
Fra:1 Mem:88.63M (0.00M, Peak 88.98M) | Time:00:00.08 | Syncing Light
Fra:1 Mem:88.64M (0.00M, Peak 88.98M) | Time:00:00.08 | Syncing Camera
Fra:1 Mem:88.64M (0.00M, Peak 88.98M) | Time:00:00.10 | Rendering 1 / 64 samples
Fra:1 Mem:88.64M (0.00M, Peak 88.98M) | Time:00:00.15 | Rendering 26 / 64 samples
Fra:1 Mem:88.64M (0.00M, Peak 88.98M) | Time:00:00.17 | Rendering 51 / 64 samples
Fra:1 Mem:88.64M (0.00M, Peak 88.98M) | Time:00:00.18 | Rendering 64 / 64 samples
Fra:1 Mem:48.48M (0.00M, Peak 88.98M) | Time:00:00.22 | Sce: Scene Ve:0 Fa:0 La:0

Blender quit

This will correctly generate an image example.png which I can open to see. It's a gray-ish image of the standard starting cube.
Now I would like to do the same thing via ssh over other machines. Here's a naive way of doing it. I just ssh normally into my machine with no special arguments, but I get this:
$ blender --background --python example-make-image.py
Blender 2.80 (sub 74) (hash d93a7290e506 built 2019-06-11 23:26:36)
found bundled python: /home/user/blender-2.80-d93a7290e506-linux-glibc224-x86_64/2.80/python
Unable to open a display
Aborted (core dumped)

Fair enough. I follow these instructions to enable me to run graphics applications over ssh. I connect via ssh -X user@machine-address, and I can confirm by running xterm & that I can open png images remotely. But when I try to run the same blender script above, I get:
$ blender --background --python example-make-image.py
Blender 2.80 (sub 74) (hash d93a7290e506 built 2019-06-11 23:26:36)
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 59644
debug1: channel 1: new [x11]
debug1: confirm x11
debug1: channel 1: FORCE input drain
debug1: channel 1: free: x11, nchannels 2
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 59646
debug1: channel 1: new [x11]
debug1: confirm x11
debug1: channel 1: FORCE input drain
debug1: channel 1: free: x11, nchannels 2
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': Device or resource busy
found bundled python: /home/user/blender-2.80-d93a7290e506-linux-glibc224-x86_64/2.80/python
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from 127.0.0.1 59648
debug1: channel 1: new [x11]
debug1: confirm x11
Received X11 Error:
    error code:   2
    request code: 154
    minor code:   34
    error text:   BadValue (integer parameter out of range for operation)
Received X11 Error:
    error code:   2
    request code: 154
    minor code:   34
    error text:   BadValue (integer parameter out of range for operation)
Received X11 Error:
    error code:   2
    request code: 154
    minor code:   34
    error text:   BadValue (integer parameter out of range for operation)
Received X11 Error:
    error code:   2
    request code: 154
    minor code:   34
    error text:   BadValue (integer parameter out of range for operation)
Received X11 Error:
    error code:   2
    request code: 154
    minor code:   34
    error text:   BadValue (integer parameter out of range for operation)
Received X11 Error:
    error code:   2
    request code: 154
    minor code:   34
    error text:   BadValue (integer parameter out of range for operation)
Received X11 Error:
    error code:   2
    request code: 154
    minor code:   34
    error text:   BadValue (integer parameter out of range for operation)
Writing: /tmp/blender.crash.txt
debug1: channel 1: FORCE input drain
Segmentation fault (core dumped)
debug1: channel 1: free: x11, nchannels 2

and no image is created.
Hopefully this explains my issue clearly. A few other things:

There is a question here about Blender 2.8 and running remotely. However, I believe even though I am using ssh, the -X option should mean I have a display on my remote machine. Am I missing something?
There is another question about using Blender via ssh, and the answer seems to suggest X11 forwarding, which I think is what I am doing above.
Another question/answer seems to offer an alternative to X11 forwarding, but I don't think this uses a Python script.

Is this error reproducible by others?
Let me know if any more information would be helpful.
UPDATE 1: I've reproduced the setup again, and here is the output in /tmp/blender.crash.txt:
# Blender 2.80 (sub 74), Commit date: 2019-06-11 21:45, Hash d93a7290e506

# backtrace
blender(BLI_system_backtrace+0x1d) [0x13835ad]
blender() [0x1169ef9]
/lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7febe4c9b4b0]
blender(GHOST_ActivateOpenGLContext+0) [0x2f37960]
blender(DRW_opengl_context_create+0x3d) [0x2a38b2d]
blender(WM_init_opengl+0x20) [0x1541cc0]
blender(DRW_render_to_image+0x2fb) [0x2a39b2b]
blender(RE_engine_render+0x311) [0x1412751]
blender() [0x1413e21]
blender() [0x1416bc8]
blender(RE_RenderFrame+0x114) [0x1417554]
blender() [0x3ea66bb]
blender() [0x1532b7b]
blender(WM_operator_call_py+0x60) [0x1533370]
blender() [0x1409f33]
blender(_PyMethodDef_RawFastCallKeywords+0x2b9) [0x176be69]
blender(_PyCFunction_FastCallKeywords+0x25) [0x176bf25]
blender(_PyEval_EvalFrameDefault+0x7dd1) [0x1165011]
blender(_PyEval_EvalCodeWithName+0xae3) [0x1820233]
blender(_PyFunction_FastCallDict+0xb7) [0x176b6f7]
blender(_PyObject_Call_Prepend+0xbd) [0x176c9bd]
blender() [0x17c9d81]
blender(_PyObject_FastCallKeywords+0x104) [0x176c044]
blender(_PyEval_EvalFrameDefault+0x632a) [0x116356a]
blender(_PyEval_EvalCodeWithName+0xae3) [0x1820233]
blender(PyEval_EvalCodeEx+0x3e) [0x182038e]
blender(PyEval_EvalCode+0x1b) [0x18203bb]
blender(PyRun_FileExFlags+0xb2) [0x1853432]
blender() [0x13f5b61]
blender() [0x1168138]
blender(BLI_argsParse+0xd5) [0x133fb95]
blender(main+0x2c9) [0x10d01f9]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7febe4c86830]
blender(_start+0x2a) [0x116680a]

UPDATE 2: Following this AskUbuntu question, I am reporting my OpenGL version on the remote machine directly after I log in via ssh -X machine:
$ DISPLAY=:0
$ glxinfo | grep -i opengl
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: TITAN X (Pascal)/PCIe/SSE2
OpenGL core profile version string: 4.5.0 NVIDIA 390.87
OpenGL core profile shading language version string: 4.50 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 390.87
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 390.87
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
$

and
$ glxinfo | grep 'version'
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
OpenGL core profile version string: 4.5.0 NVIDIA 390.87
OpenGL core profile shading language version string: 4.50 NVIDIA
OpenGL version string: 4.6.0 NVIDIA 390.87
OpenGL shading language version string: 4.60 NVIDIA
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 390.87
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
    GL_EXT_shader_implicit_conversions, GL_EXT_shader_integer_mix,
$

And it seems to be up to date.

Do you try to render on the GPU or CPU?

To me it looks like you're connecting to a VM which doesn't have the appropriate permissions set in order to use the GPU via ssh. Additionally the seems to be trouble with OpenGL / GLX which why these "Received X11 Error" appear.

@gtzkw I am not sure which of the GPU/CPU I am using to render. The machine that I am connecting to via ssh is another personal workstation that I use with an NVIDIA Titan X GPU (state of the art when it was released in mid 2016, I think). So I have two machines here and am sudo on all of these. I will look and see how to get more permissions.

As far as I'm aware using the GPU requires an X-session. In your example it crashes for some reason. Perhaps the /tmp/blender.crash.txt can tell us more.

@gtzkw Sounds good, added the /tmp/blender.crash.txt file.

Thanks for the added info. Unfortunately I can't see what's wrong. Could you try to set DISPLAY=:0 before running blender? If that doesn't work it's probably a good idea to file a bug report and let the experienced blender devs take a look. (https://developer.blender.org/maniphest/task/edit/form/1/)

@gtzkw Thanks. I tested that on two remote machines, one of which is a workstation in my office with monitors and displays, and another of which is a headless research server. Doing that actually worked for my workstation, but the same did not work for the headless research server. Note that I needed to do ssh -X user@machine, so I needed -X. TL;DR it seems like I can get this to work on a remote machine that has a display, but not a headless research server. Any ideas? :) If you have more to comment feel free to write it in an answer, and I will also write to the dev blender forums.

I haven't done this before, but it seems you have to configure this for the Nvidia card. X normally expects that a monitor is connected but the driver can create a 'virtual' display. See https://virtualgl.org/Documentation/HeadlessNV

Note that setting DISPLAY is relevant for X11 forwarding, which is when you want to run blender on a remote machine and show its window on the local machine, you shouldn't need this when background rendering. As mentioned earlier, report this as a bug as eevee fails but cycles works, indicating that eevee is trying to open a window in the background when it shouldn't.

For testing you don't need to run a script or setup a blend file, use blender -b -E BLENDER_EEVEE -f 1 which will render the first frame of the startup scene. Use -E CYCLES to compare.

@sambler Thanks for the response. I can test using your commands and also to make a post on the developer.blender.org forums.

I had the same problem of rendering with EEVEE on amazon aws (or any other remote machine). Using regular X forwarding doesn’t work for utilizing remote GPUs. So I searched and found about VirtualGL. Now I can render my scenes with EEVEE on AWS. Since most of the people have similar problems, I wrote down a guide on how I did it with some explanations on my website.
https://yigityakupoglu.home.blog/
I guess you can solve the problem with similar software such as TurboVNC, TigerVNC, etc… I am planning to test the same with TurboVNC and write a similar guide in the future. My email address is in

@yyakupoglu Thanks! Sorry for my late response. Any chance you can write it up as an answer? I haven't tried it but I will soon.

I figured out how to answer my question. The main source that I relied on was this wonderful answer (and then this follow-up) in the Blender devtalk thread that I referenced to in my original question. (Those answers were posted after I made this question here.) Here's my answer which somewhat cleans up their explanations, but credit goes to those two who answered on devtalk.
Here are the steps that I followed. Here, I assume that the remote machine has an NVIDIA GPU, is running Ubuntu 18.04, and has Blender 2.82a installed, with the blender command runnable.
(1) I ssh into my remote machine. I do NOT use X forwarding, so I do not use ssh -X.
(2) Running glxinfo returns this error:
$ glxinfo
Error: unable to open display

If you don't have glxinfo, run sudo apt install mesa-utils.
(3) To fix the "unable to open display" error, first run the following to see available GPU(s):
$ nvidia-xconfig --query-gpu-info
Number of GPUs: 1

GPU #0:
  Name      : TITAN X (Pascal)
  UUID      : GPU-9adbb93a-e6c6-b54c-651c-66d1414a6b82
  PCI BusID : PCI:1:0:0

You may get other outputs for additional GPUs (for multi-GPU machines) and for monitors if there are attached monitors. For now we don't worry about those. We just pick the GPU we want, and look at the PCI BusID value.
(4) Next, we run this, where I insert the PCI BusID into the --busid argument:
$ sudo nvidia-xconfig --busid=PCI:1:0:0 --use-display-device=none --virtual=1280x1024
[sudo] password for user:

Using X configuration file: "/etc/X11/xorg.conf".
Backed up file '/etc/X11/xorg.conf' as '/etc/X11/xorg.conf.backup'
New X configuration file written to '/etc/X11/xorg.conf'

According to devtalk, this will "create a virtual x screen" and "create[s] the xorg.conf file. Xserver will read this file and setup the xorg server accordingly".
(5) Now, run sudo Xorg :1. If you get an error like I originally had:
$ sudo Xorg :1
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
(EE)
Please consult the The X.Org Foundation support
     at http://wiki.x.org
 for help.
(EE) Please also check the log file at "/var/log/Xorg.1.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.

Then run ps -C Xorg to see what Xorg programs are already running. Then use sudo kill -9 [pid].
(6) A working command produces this output for me:
$ sudo Xorg :1

X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-148-generic x86_64 Ubuntu
Current Operating System: Linux takeshi 5.3.0-40-generic #32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 2020 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.3.0-40-generic root=UUID=99a59366-4621-4034-b183-bfaf2a8af7eb ro quiet splash vt.handoff=1
Build Date: 02 May 2019  08:06:54AM
xorg-server-hwe-18.04 2:1.20.4-1ubuntu3~18.04.1 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.34.0
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Mon Apr 27 12:06:11 2020
(==) Using config file: "/etc/X11/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"

Now, this will be running in one shell. Using CTRL+C will not work to kill it. For your subsequent work, you can use a separate shell.
(7) For this, I decided to do another ssh command to enter my remote machine. This step is critical: export DISPLAY=:1. This will set the display variable to be what the Xorg command did in the other shell.
(8) As a sanity check, make sure that glxinfo returns expected output:
$ glxinfo | grep -e render -e NVIDIA
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: TITAN X (Pascal)/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 430.50
OpenGL core profile shading language version string: 4.60 NVIDIA
    GL_ARB_conditional_render_inverted, GL_ARB_conservative_depth,
    GL_NVX_conditional_render, GL_NVX_gpu_memory_info, GL_NVX_nvenc_interop,
    GL_NV_command_list, GL_NV_compute_program5, GL_NV_conditional_render,
    GL_NV_path_rendering, GL_NV_path_rendering_shared_edge,
    GL_NV_shader_thread_shuffle, GL_NV_stereo_view_rendering,
OpenGL version string: 4.6.0 NVIDIA 430.50
OpenGL shading language version string: 4.60 NVIDIA
    GL_ARB_compute_variable_group_size, GL_ARB_conditional_render_inverted,
    GL_NVX_conditional_render, GL_NVX_gpu_memory_info, GL_NVX_nvenc_interop,
    GL_NV_command_list, GL_NV_compute_program5, GL_NV_conditional_render,
    GL_NV_path_rendering, GL_NV_path_rendering_shared_edge,
    GL_NV_shader_thread_shuffle, GL_NV_stereo_view_rendering,
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 430.50
    GL_EXT_multisampled_render_to_texture,
    GL_EXT_multisampled_render_to_texture2, GL_EXT_occlusion_query_boolean,
    GL_EXT_render_snorm, GL_EXT_robustness, GL_EXT_sRGB,
    GL_NV_clip_space_w_scaling, GL_NV_conditional_render,
    GL_NV_path_rendering, GL_NV_path_rendering_shared_edge,
    GL_NV_shadow_samplers_cube, GL_NV_stereo_view_rendering,
    GL_OES_element_index_uint, GL_OES_fbo_render_mipmap,
    GL_OVR_multiview_multisampled_render_to_texture

(9) Finally, I run my ultimate test: blender -b -E BLENDER_EEVEE -f 1 to see if the rendering works. If all goes well, you'll see this output:
$ blender -b -E BLENDER_EEVEE -f 1
Blender 2.82 (sub 7) (hash 375c7dc4caf4 built 2020-03-12 05:30:40)
found bundled python: /home/user/blender-2.82a-linux64/2.82/python
Fra:1 Mem:88.40M (0.00M, Peak 88.68M) | Time:00:00.32 | Syncing Cube
Fra:1 Mem:88.72M (0.00M, Peak 89.01M) | Time:00:00.32 | Syncing Light
Fra:1 Mem:88.72M (0.00M, Peak 89.01M) | Time:00:00.32 | Syncing Camera
Fra:1 Mem:88.73M (0.00M, Peak 89.01M) | Time:00:00.33 | Rendering 1 / 64 samples
Fra:1 Mem:88.73M (0.00M, Peak 89.01M) | Time:00:00.37 | Rendering 26 / 64 samples
Fra:1 Mem:88.73M (0.00M, Peak 89.01M) | Time:00:00.39 | Rendering 51 / 64 samples
Fra:1 Mem:88.73M (0.00M, Peak 89.01M) | Time:00:00.40 | Rendering 64 / 64 samples
Fra:1 Mem:48.47M (0.00M, Peak 89.01M) | Time:00:00.43 | Sce: Scene Ve:0 Fa:0 La:0
Saved: '/tmp/0001.png'
 Time: 00:00.75 (Saving: 00:00.31)

Blender quit

I am able to secure-copy (using scp) that image onto my local machine, and I can confirm that it looks correct.
(10) Once I'm done, the last thing I do is run nvidia-smi to see what processes are there:
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     22948      G   /usr/lib/xorg/Xorg                            14MiB |
|    0     22976      G   /usr/bin/gnome-shell                           6MiB |
|    0     23332      G   /usr/lib/xorg/Xorg                            10MiB |
|    0     30462      C   python                                       847MiB |
+-----------------------------------------------------------------------------+

Then I can run the usual sudo kill -9 [pid] where the process ID comes from above. I think one of the two Xorg commands will constantly restart itself so it may not be easy to kill, but I will need to do more investigation.
Final comments: thanks to @sambler in the comments, I now know that to test the rendering, it is easier to use these one-line commands:
blender -b -E BLENDER_WORKBENCH -f 1
blender -b -E BLENDER_EEVEE -f 1
blender -b -E CYCLES -f 1

rather than the python script that I was using in my original question. These use all three of Blender's available rendering engines. The last command, using CYCLES, will work remotely without the bells-and-whistles here, while the first two will not. But the downside is that CYCLES is much slower than the other rendering engines.
I did another test where I enter GNU screen (via screen command) and ran the same one-line blender testing command above. It seems to work successfully, suggesting that one can run in screen and then log out of the machine, and have images repeatedly be generated.
You can also run the Xorg command in a screen shell so that you can exit it, and the command will just run permanently until you turn it off. I was able to do this and run the Blender tests successfully. This is probably my preferred setup since it doesn't require me to explicitly leave a "tab" open (e.g., a tab in iTerm2, which I use to ssh and to program).
Finally, for faster iterations, you can combine the display and the blender commands:
DISPLAY=:1  blender -b -E BLENDER_EEVEE -f 1

and this should also work.
Update 1: sometimes, step (6) does not work. I've noticed that if you log into a remote machine that does not already have an X-server running (which I think we can tell by running nvidia-smi and checking that there exists an Xorg process running) then you might get this error:
$ sudo Xorg :1

X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-148-generic x86_64 Ubuntu
Current Operating System: Linux mason 5.0.0-23-generic #24~18.04.1-Ubuntu SMP Mon Jul 29 16:12:28 UTC 2019 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.0.0-23-generic root=UUID=877a0d47-b6cc-4687-8778-3a947fc7cb04 ro quiet splash vt.handoff=1
Build Date: 02 May 2019  08:06:54AM
xorg-server-hwe-18.04 2:1.20.4-1ubuntu3~18.04.1 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.34.0
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Wed Apr 29 10:11:48 2020
(==) Using config file: "/etc/X11/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) no screens found(EE)
(EE)
Please consult the The X.Org Foundation support
     at http://wiki.x.org
 for help.
(EE) Please also check the log file at "/var/log/Xorg.1.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.

In this case, starting up a normal X server should work. However, I have yet to get this working. The above error message with a machine that has GPUs, but does not have an attached monitor, whereas I got mine working from another machine that did have a monitor. I think the fix is to consult these references (source 1, source 2, source 3).
Update 2 (July 21, 2020): I tried running:
sudo nvidia-xconfig --busid=PCI:1:0:0 --virtual=1280x1024  --use-display-device="DFP-0"

and I have been able to fix the above error with that. I would suggest starting with the above if that works.

How would you go about it without gpu rendering?. I use a general purpose AWS EC2 T3 instance and came upon "Unable to open a display" while trying to render in the background.

How to do this inside docker container? I don't have access to host machine

To answer a few of your questions:
  ssh -x is indeed forwarding X-11 (X-Window) traffic from your remote machine to your local one. It assumes you have a local display. If you were to ssh to machine A and then from there ssh -x to machine B, you would not have a display. It might be best to start on your machine with a display and ssh to machine B directly.
Blender is primarily a GUI application and I'm not too familiar with running it without displaying graphics. However, it seems --background should be doing that. But, clearly it is not keeping it entirely from running without communicating to X-11. So, there may be something to add to the python program to get it to exit blender when completed, instead of maybe starting up the GUI. Like:
import sys
sys.exit(0)

Another option: Do you need to run blender remotely or can you do the processing on one machine and copy the results (scp) to other machines?

Thanks. The issue is that I need to run many, many copies of Blender in parallel. My work relates to imitation learning and we have to run many simulations to get lots of data. That unfortunately means I need to use servers that have many CPUs, but which are headless.

Well, here is the next thing I would try. Connect via ssh but without the -x, so X11 should stay on localhost (the remote host). You could try: DISPLAY=localhost:0.0 to force it. It may result in a permission error, and there is probably a way around that, but I think it would be more fun to run a headless X11 server on the remote machine. Take a look at this answer to another question for an option to try: https://stackoverflow.com/a/834801/238074 . It uses an X11 server that just tosses all the output. Should be good enough to fool blender.

virtual x screen tool:xvfb work for me
sudo apt-get install -y xvfb

xvfb-run --auto-servernum --server-args="-screen 0 1600x1024x16" blender -b -o /tmp/ -E BLENDER_EEVEE -f 1