Merging multiple OBJ files into one file with shape keys So, right now I have about a dozen different meshes that are all modified versions of a default head mesh. One for example is the same head but fatter, one with more pronounce eyebrows, one is smiling etc.

I am slightly new to blender, and I did not make these models. What I'm trying to do is find a way to merge these multiple files into one file as different shape keys. I can find information about how to make shape keys by editing a mesh but can't for the life of me find a way to blend two meshes into one and use one as the "target" of a blend key. If this is making sense.

The ultimate goal I have in mind is that I would like to have a single file with multiple sliders that I can ultimately export into Unity. I've learned how to export shape keys but I can't figure out how to get from where I am now with multiple meshes to where I want to be with multiple sliders. Thanks in advance for any help you can give a somewhat new user.

You can use this script to accomplish an obj sequence import to shapekeys.
Paste the script into the text editor in blender, and click the Run Script button.

This will add a new command in the file menu called File>Import>OBJ as Shapekey. Select your target object, and then run the new command.

bl_info = {
    'name': 'Load Obj Sequence as Shape Keys',
    'author': 'cmomoney',
    'version': (0, 2),
    'blender': (2, 6, 7),
    'category': 'Import-Export',
    'location': 'File > Import/Export',
    'wiki_url': ''}

# ##### BEGIN GPL LICENSE BLOCK #####
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####

import bpy, os
from bpy.props import *

class LoadObjAsShapekey(bpy.types.Operator):
    bl_idname = 'load.obj_as_shapekey'
    bl_label = 'Import OBJ as Shape Keys'
    bl_options = {'REGISTER', 'UNDO'}
    bl_description = "Import Obj sequence as shape key(s)"

    filepath = StringProperty(name="File path", description="File filepath of Obj", maxlen=4096, default="")
    filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'})
    filter_glob = StringProperty(default="*.obj", options={'HIDDEN'})
    files = CollectionProperty(name='File path', type=bpy.types.OperatorFileListElement)
    filename_ext = '.obj'

    @classmethod
    def poll(cls, context):
        return context.active_object is not None and context.active_object.type == 'MESH'

    def execute(self, context):
        #get file names, sort, and set target mesh
        spath = os.path.split(self.filepath)
        files = [file.name for file in self.files]
        files.sort()
        target = bpy.context.scene.objects.active
        #add all ojs in sequence as shape  keys
        for f in files:
            fp = os.path.join(spath[0], f)
            self.load_obj(fp)
        #now delete objs
        sknames = [sk.name for sk in target.data.shape_keys.key_blocks]
        bpy.ops.object.select_all(action='DESELECT')
        for obj in sknames:
            if obj != 'Basis':
                target.data.shape_keys.key_blocks[obj].interpolation = 'KEY_LINEAR'
                bpy.context.scene.objects.active = bpy.data.objects[obj]
                bpy.data.objects[obj].select = True
                bpy.ops.object.delete()
            bpy.ops.object.select_all(action='DESELECT')
        #reselect target mesh and make active
        bpy.context.scene.objects.active = target
        target.select = True
        return{'FINISHED'}

    def invoke(self, context, event):
        wm = context.window_manager.fileselect_add(self)
        return {'RUNNING_MODAL'}

    def load_obj(self, fp):
        bpy.ops.import_scene.obj(filepath=fp,split_mode='OFF')
        bpy.ops.object.join_shapes()
        return

def menu_func_import(self, context):
    self.layout.operator(LoadObjAsShapekey.bl_idname, text="Obj As Shapekey(.obj)")

def register():
    bpy.utils.register_class(LoadObjAsShapekey)
    bpy.types.INFO_MT_file_import.append(menu_func_import)

def unregister():
    bpy.utils.unregister_class(LoadObjAsShapekey)
    bpy.types.INFO_MT_file_import.remove(menu_func_import)

if __name__ == "__main__":
    register()

Please note this is not my script, I'm just posting it here for convenience.


Why is my object appearing as a series of incomplete lines in the 3D view? So I was just modeling a Pokeball to upload to Deviant Art for fun. And as soon as I left the live preview in object mode as seen here(Picture 1),

I went to start adjusting the camera only to be greeted with this(Picture 2).

The mesh is still fine in edit mode. I am just wondering what it is and why Blender is replacing the spheres with what would belong to a science fiction game.

Thanks in advance :)

Change viewport shading from Wireframe to Rendered, Material, Texture or Solid.

To display all the edges in Wireframe Shading enable Draw All Edges in Object Data tab.


Can a circle be filled with a triangle fan? When a cylinder is added to a scene Triangle Fan fill type for the cap is provided in the last operator panel.

Is there any tool to use with a circle to fill it like triangle fan would do?

The alternatives Grid Fill and F (n-gon) can't be used when the vertex in the center of the circle is required.

Create and poke face

You can do this with 2 operations.

F, ⎇ AltP

F (creates a face)
⎇ AltP (poke face, creating a triangle fan)

See: Mesh -> Face menu for both.

Note for Blender 2.80 users: Shortcut for Poke Faces was removed and the menu entry relocated to Face -> Poke Faces.

Extrude and merge edges

E, Escape, ⎇ AltM, A

E (Extrude)
⎇ AltM (Merge)

A (Menu accelerator for the  A̲t Center option)

Note:

Create face & Poke will assign UV's & vertex colors from surrounding faces (the extrude method will simply extend UV's/colors, which may not be what you want).
Poke uses a more advanced method to calculate the face center point(noticeable when edges aren't evenly spaced).


Change Navigation into walk Navigation with scripting I'm now trying to change Navigation into walk Navigation in the 3D viewport. So I write the code below.
import bpy

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        for region in area.regions:
            if region.type == 'WINDOW':
                bpy.ops.view3D.walk()

this returns error
  File "D:\3Dmodels\python_demos.blend\operator_modal_view3d.py", line 11, in <module>
  File "D:\programs\Blender\stable\blender-2.92.0-windows64\2.92\scripts\modules\bpy\ops.py", line 132, in __call__
    ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.view3D.walk.poll() expected a view3d region

So I added a line override = {'area': area, 'region': region} and change walk() into walk(override).
import bpy

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        for region in area.regions:
            if region.type == 'WINDOW':
                override = {'area': area, 'region': region}
                bpy.ops.view3D.walk(override)

However, Blender returns another error
ERROR (wm.operator): C:\b\buildbot-worker-windows\windows_292\blender.git\source\blender\windowmanager\intern\wm_event_system.c:1321 wm_operator_invoke: invalid operator call 'VIEW3D_OT_walk'

So if anyone knows how to run bpy.ops.view3D.walk(), please teach me and I would be very happy!

Putting 3D viewport in walk mode from py console.
Think you were 99% there.
IMO always a good idea to try things out in the python console
>>> C.area.type
'CONSOLE'

Override the context by finding a view3d area in the screen. Make sure an area aside from console is a view3d.
>>> for a in C.screen.areas:
...     if a.type == 'VIEW_3D':
...         break
...
>>> a.type
'VIEW_3D'

Make a dictionary and fill with usual suspects area, space_data, and region
It is AFAIK always the case that the 'WINDOW' region is the last in the area regions. If not of this opinion can iterate them as shown in question.
>>> c = {}
>>> c["area"] = a
>>> c["space_data"] = a.spaces.active
>>> c["region"] = a.regions[-1]

Ok now give the override a go... oh and remember all letters in an operator are expected to be  lower case eg 3d not 3D.... (However it does appear to accept view3D, but autocompletes on view3d)
Attempt 1... passed through.. equivalent of doing NADA.. but no errors.
>>> bpy.ops.view3d.walk(c)
{'PASS_THROUGH'}

Ok will try good old 'INVOKE_DEFAULT' execution context, this is as if we were there in the 3D view and pressed a button or chose it in a menu...
Attempt 2... BINGO.. 3D view is in walk mode.
>>> bpy.ops.view3d.walk(c, 'INVOKE_DEFAULT')
{'RUNNING_MODAL'}

Ok all that done and shown, if you are going to write an operator that is invoked from within the 3d viewport, all the override stuff is not required. (Similarly if you change the area to a 3d viewport as shown by @Chris, but in reality we rarely want to do that way... hard to type into console if it becomes the 3d viewport (for example))  The default execution context of a button or menu pressed is 'INVOKE_DEFAULT'.


Blender's /tmp/ folder is suddenly empty I work on an iMac. I am trying to render a fluid simulation that is very slow, and decided to do it in several batches.

For the first batch, I rendered frames 1-100, and had to stop rendering to perform other operations on my machine. I checked the /tmp folder to verify the result and it looked fine.

Then I rendered frames 101-200 and had to save the blender file and completely restart the computer, because another process made the machine crash.

After restarting, the /tmp folder for Blender didn't contain any rendered files:

I also checked the Trash, but there was nothing in there either.

Were these files completely erased from my machine after the restart? Or were they moved?

I am sorry if this sounds like a noob question, I've never used a /tmp folder with any other app, and I usually create 3D projects and animations that are rendered fast enough by Blender that I don't have to restart my machine during a render.

It's kind of sad if this default location just clears itself automatically upon restart, without even a dialog box warning or asking the user (but Blender's not really good at dialog boxes...). But if there's a way to change/act upon this behavior ("ask before delete" or "never delete tmp folder" options?), I'd love to know.

Do not render to a tmp folder!

Set a proper folder to render your files.

tmp folder is... For temp files... When the computer restarts it gets rid of temp files. This is not an issue with blender but the operating system.


Ideas for details at sculpting This is my current sculpt.  What other details do artist get into an initial sculpt before baking into a retopologized model. This is just the sculpted model with a shader. Is it too difficult do add more detail at this stage should I bake this, then paint more detail in say gimp/krita?

Sculpters have the opportunity to directly model wrinkles and bumps into their hi-res models for automatic normal map generation, instead of trying to approximate them with hand drawn normal maps later. If you have the patience, you can do that now. As for the diffuse texture, if you want to paint it directly onto the model, you will get best results doing that on the low-poly mesh (you will need to unwrap the model first). To be clear, the high poly model does not need texture coordinates.

After both versions of the model are completely modeled and you have finished unwraping the UVs for the low poly mesh, you can bake the Normal map, Ambient Occlusion map and Curvature map (If you want those last 2 for smarter textures) from the hi poly onto the low poly.


One point tracking - Image in Render Layers is not showing on the movie Hi all, I am following a one point tracking tutorial on youtube and everything worked fine until the compositing stage. I am having trouble showing the Renter layers on the movie. Is there anything i missed? Please help!

Best Regards,
Gary

you need to toogle the two inputs of the alpha over node


Visualizing depth image after accessing render results Based on the work of [1] I obtained the depth data of my scene as shown in the code bellow:

scene.use_nodes = True
tree = scene.node_tree
links = tree.links

# create input render layer node
rl = tree.nodes.new('CompositorNodeRLayers')

# create output node
v = tree.nodes.new('CompositorNodeViewer')
v.use_alpha = False

# Links
links.new(rl.outputs['Z'], v.inputs[0]) # link Z to output

bpy.ops.render.render()

# get viewer pixels
pixels = bpy.data.images['Viewer Node'].pixels
# size is always width * height * 4 (rgba)
pixels = np.array(pixels)[::4]

ix = scene.render.resolution_x
iy = scene.render.resolution_y
depth = np.zeros((ix/2,iy/2))

for i in range(0, int(round(ix/2))):
 for k in range(0, int(round(iy/2))):
     depth[i,k] = pixels[i+k]

np.save('...\\outfile.npy', depth)

I set up the nodes, forward the z-data to the output node, render and save the pixels as an array. Since I use depth data instead of RGBA, I only use every 4-th element in the array since the other 3 ones are equal. Further, I use the dimensions of the image to setup a ndarray with numpy (depth) wich I save to an .npy file finally. Somewhere in this part I make a mistake since following code (from commandline) generates a somehow weird looking plot (shown below as well)

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np

data = np.load('...\\outfile.npy')
x, y = np.mgrid[:data.shape[0], :data.shape[1]]
fig = plt.figure()
ax = fig.add_subplot(1,1,1,projection="3d")
surf=ax.plot_surface(x,y,data)
plt.show()

For a centered cube I get the following outcome:

So I hope somebody can give me a hint on where to look exactly for the error, and also I would be very thankfull for coding and style tips. I also found similar posts, but no one where the obtained data is visualized.

[1] https://ammous88.wordpress.com/2015/01/16/blender-access-render-results-pixels-directly-from-python-2/

the line

depth[i,k] = pixels[i+k]

seems off to me, it seems as if you need to transform your indices between the 2d depth array and the flat 1d pixels array like:

depth[i,k] = pixels[i*int(round(ix/2))+k]

where the index i offsets multiples of the length a whole row into the array, and k additionally offsets into each element of it.


How to Uninstall Blender Software I installed Blender for a project working on and it's way more than I need. I'd like to uninstall it, but can't figure out how to do so. It's not showing up in Programs (using Windows 9) and I can't find instructions on how to remove it in the Blender documentation. Any assistance would be greatly appreciated. Thanks.

Seeing that it's not in the list of programs, it seems like you downloaded the zip version, rather than the msi version, which means blender isn't actually installed on your system.

Just delete the folder where blender.exe is, and it's gone!


Class already registered as subclass (module structure for addon) I am working on creating an addon and I have a main __init__.py file and then I have a another file we will call utils.py. __init__ registers all the classes in utils by import utils and then bpy.utils.register_class(utils.CLASS), it has several classes and that file registers them all.

If you run the file once it works fine, but if you run it again it gives the error that the class is already registered as a subclass.

utils contains a bpy.types.Panel and bpy.types.Operator class. It is almost like the bpy.utils.unregister_class(utils.CLASS) isn't working. File

You can replace all calls to bpy.utils.register_class(...) by a single call to

bpy.utils.register_module(__name__)

and all calls to bpy.utils.unregister_class(...) by a single

bpy.utils.unregister_module(__name__)

You won't have to (un-)register single classes ever again and your error should no longer occur. Do it in __init__.py only and import all module files from here (from . import ...).

Note that the order of class definitions may matter, e.g. if you use a custom property group class in an operator (the code of the property group class needs to be above the class definition of the operator).

Example addon to show the file structure and imports: blender-addon.zip


Realistic Gingerbread Material Christmas is coming quickly, and I'm working out a way of quickly designing gingerbread houses.

So far, everything is working except the gingerbread shader.

At the moment, I want it to look as real as possible, to something like this:

This is the closest I can get:

If someone would be able to either give advice, a node setup, or just help me to understand it better, I would appreciate it greatly.

Ultimate outcome would be to have a shader that looked like the picture.

.blend file .blend doesn't include the HDRi, so light it as you will.

Here is what I did

For the displacement, I mixed different Noise Textures with different settings to them with a bunch of Mix RGB nodes. At the end, I mixed the Noise textures with a Musgrave texture too add some lumpiness to the displacement.

You can play around with the noise settings to achieve the look you want.

For the color, I attached the noise textures to a color ramp, black being a darker brown, and white being a lighter brown, and plugged that into the base color of the principled BSDF shader.

I didn't change any of the BSDF shader settings, but I realized it might help if you increased the roughness.

I hope I helped out.


Blender crashed computer while baking cloth animation So I'm following this Tutorial: https://www.youtube.com/watch?v=gFOJ7ul19AE&ab_channel=Ducky3D
I'm following exactly as the video, the only difference is that I'm using an Skull instead of the ball.  The animation is supposed to only be of 20 frames n the video at 2:50 he bakes the clothing animation, when I do that, the program bakes normally, but always, the bake stops suddenly, and the % of the baking wont go up, and the computer gets incredibly slow, bordering crash, (although it always goes kind of slow and stutters a lot)

that's the only picture i could get because the program crashed after only adjusting the pressure as seen in the video. hope you guy cqan help me out.
The specs are:
Graphics: Geforce RTX 3060ti
Ram: 16Gb
motherboard: MSI x571-A pro
Processor: AMD Ryzen 5 3600TX 6-core 3.8GHz
windows 64bits

With self collision and a complex object in the center, I can almost guarantee you're running out of RAM and your PC is having to do swap-file operations.
Check your Committed Memory (RAM + Virtual Memory) in Task Manager while doing a bake.

In the short term, you can reduce the number of divisions in the mesh or lower the quality steps.
In the medium term, I can suggest buying a VERY cheap SSD (that you do not care to ruin) and running your page file off of it for bakes.
If you plan on doing this for long I'm sure you'll find plenty of reasons to upgrade your hardware, you won't need any convincing from me.


Rigging problem with IK: why do the bones turn around? it's my first time doing this and I have no idea what to do. I have seen a lot of youtube tutorials and at some point my results differ from the video even if I followed it exactly.
As you can see in the picture I cannot animate this rig properly. The leg bone will rotate around when going past the pole bone. Also the control bone doesn't stick to the joint, but moves freely. The control bones were cleared from the parent and deform deactivated. The yellow bones have a chain length of 2, everything else is default.

Thanks for your help

The floating bone controls which direction your knee bends. (or which direction you want your leg to direct). I assume you have 2 knee bone controllers instead of one controlling both. Play with the knee bones, I'm sure you will put 2 and 2 together real quick.


How to change color only of selected objects in a matrix? I'm trying to exempt a couple of objects from being colored by an 'empty' which is coloring the cube matrix based on the distance.

In the image there are 2 empties: one is coloring the cubes blue, the orther coloring them red and offseting by X.

What could I do if I wanted those 3 selected cubes, not to be colored by the 'empty' object?
For coloring method I used roughly similar method as in here:
Color objects based on distance in Animation Nodes

You can use the List Boolean Operations node to removed the selected objects from your object list as follows:


Python: create popup dialog from panel? I know it can be done as shown here: https://www.youtube.com/watch?v=-fhI2imoo4U&feature=youtu.be&list=PLsowJ3v5QWhE9db_GcPnSrTXWJrA5poWg&t=50

(can't buy the addon right now as I'm broke)
Does anyone know how that can be achieved in Python? Adding an existing panel inside a popup dialog? Thank you.

This turned out to be easier than I thought. You simply do something like this:

import bpy
from bl_ui.properties_paint_common import UnifiedPaintPanel

class BasicSettings(bpy.types.Operator, UnifiedPaintPanel):
    """
    The basic brush settings like strength, radius etc.
    """
    bl_idname = "view3d.basic_settings"
    bl_label = "Brush Basic Settings"

    def execute(self, context):
        """
        Show the basic brush settings popup dialog.
        """
        return context.window_manager.invoke_popup(self, width=300)

    def draw(self, context):
        """
        What follows is basically a copy of the Python code
        responsible for the placement of the settings in the Tools tab,
        taken from Blender itself.
        """
        layout = self.layout
        toolsettings = context.tool_settings
        settings = self.paint_settings(context)
        brush = settings.brush

        capabilities = brush.sculpt_capabilities

        col = layout.column()

        col.separator()

        row = col.row(align=True)

        ups = toolsettings.unified_paint_settings
        if ((ups.use_unified_size and ups.use_locked_size) or
                ((not ups.use_unified_size) and brush.use_locked_size)):
            self.prop_unified_size(
                row, context, brush,
                "use_locked_size", icon='LOCKED')
            self.prop_unified_size(
                row, context, brush, "unprojected_radius", slider=True, text="Radius")
        else:
            self.prop_unified_size(
                row, context, brush,
                "use_locked_size", icon='UNLOCKED')
            self.prop_unified_size(
                row, context, brush,
                "size", slider=True, text="Radius")

Etc. These are just copy pasted from within Blender. Just go to any UI element in the panel you want, right click on click and then Edit Source, it will open a file in the text editor and from that you have to figure out what you want and then just copy paste it. And now, whenever you call this operator shown here, it will create a popup dialog similar to the panel.


Export blender rendered image as numpy array I want to know the easiest way to export rendered images from blender to be exported as numpy array.
PS: I don't want to save the images first in *.jpg or *.png and then access them. I want to directly export the rendered images as numpy array.

Numpy array isn't a native output option.
Notice up at the top of the screen, when you click Render,
it specifies Render Image

If you want it to directly output to a non-standard container,
you'll have to modify the source code to accomplish that.
http://download.blender.org/source/
...
You can convert standard arrays into a numpy array like this:
https://stackoverflow.com/a/4562455/3342050
So if you don't mind running render, then using a script to export:
# path2numpy = '/home/me/.local/lib/python3/dist-packages/numpy/'   ##  linux
# path2numpy = 'C:\\Users\\me\\AppData\\Local\\Python\\Lib\\site-packages\\numpy\\'   ##  win

import sys
sys.path.append(path2numpy)

import numpy as np
array = []

# render = bpy.ops.render.render(layer="RenderLayer", scene="Scene")
# render = bpy.data.node_groups['Compositing Nodetree'].nodes['Render Layers'].layer

array.append(render)

np_array = np.array(array)

The render output data is most likely going to be found in one of those commented render lines.
You'll have to decide which one suits your needs.
You may have to iterate through the data to get it into the necessary format.
Something along the lines of:
for h in range(height):
  for w in range(width):
    R = render[h][w * bpp]
    G = render[h][w * bpp + 1]
    B = render[h][w * bpp + 2]
    data.append((R,G,B))
  ''.join(data)
  array.append(data)

Then convert regular array to numpy array, as above.
That's all dependent upon how you want that array set up though...


UN Parent armature but keep the pose I am asking this question as I cannot get this to work using the suggestions in other peoples posts.

I am trying to un parent my mesh from the armature, whilst keeping the pose and the corresponding weights.

Before applying the armature I have :

I have attempted to set the pose to the rest pose
Attempted to set the rotation and scale and location (this makes my mesh do weird things)
Attempted ctrl P > armature deform
I have attempted baking the action and clearing the parent

None of these have worked. They either retard the mesh, or, when the armature is applied, the mesh loses the pose.

Any help is appreciated. Thank you.

Select your mesh and press Ctrl+A in object mode, select visual transform from the list.
your mesh will stay deformed after you un-parent or even delete the armature.


How to edit a split vertex normal without affecting others? I apologize for the long post ahead, but please bear with me:

I am facing a problem which, after transferring normal, I want to edit split vertex normal to fix shading on a particular face, but avoid modifying other normals on the same vertex.

To illustrate the issue:

STEP 1: I transferred normal from this cylinder onto an arc of its piece (so that the shading is smooth when we put multiple of these arcs together.)

STEP 2: as we can see, while the top/bottom/front/back sides of the arc are now shaded smoothly, the left/right sides of the arc will shade badly, mostly because the cylinder doesn't hard edge/faces along the same sides.

STEP 3: we know splitting the edge (aka setting hard edge) will give us more vertex normals to work with, BUT, because Blender use "Auto Smooth" to display custom normals, doing so cause it to recalculate the normal, which defeats the purpose of transferring normal in the first place.

STEP 4: so I tried setting hard edges + Edge Split modifier before normal transfer, it got the hard edge sorted, BUT I still need to set the vertex normal, and importantly, 1 vertex normal from each split vertex, to be the same as face normal.

STEP 5: This is where I got stuck, I don't know how to do that without affecting the other 2 normals on the same vertex. I know they are different vertices rendering wise, BUT Blender's normal tool doesn't know that.

STEP 6: also note that, because Blender's Data Transfer modifier depends on Auto Smooth, even if I have applied Edge Split modifier beforehand, the transfer only store custom normal data for Auto Smooth mode! (these 2 objects are identical, the only difference is one has Auto Smooth enabled).

Thank you for reading this far, so my issue comes down to:

I want to transfer normal data.
I also want to edit normal after transfer.
BUT normal transfer (Data Transfer modifier) depends on Auto Smooth.
AND Auto Smooth by definition doesn't split vertices, so I can't edit normal individually.
AND I can't set hard edges or use Edge Split after transfer as they will modify other normals.

I am in this circular dependency hell, please help!

In hindsight, it all comes down to order, you need to:

Set hard edges + Auto Smooth before Data Transfer modifier.
After transferring the normals, apply Edge Split modifier (to hard edges only)
Then select the faces with incorrect normals and set their vertex normal to face, since vertices are split properly, it won't affect other existing normals.


Multiple meshes not welded with pydata For an addon, I want to transform the mesh of an object into multiple meshes to create an array using from_pydata. My problem is that the vertices of the meshes are not welded in the final object :

Could you tell me what i do wrong ? Why the vertices are not welded, is this a normal behaviour ?

You can try the script on a startup file with a 'Cube' :

import bpy
import bmesh

vertices = []
face = []
verts = []
edges = []
faces = []
numface = 0
nbcol = 2
nbrow = 2
scale_x = 1
scale_y = 1

#--Gap between each row / column
gapx = 1.2
gapy = 1.2

#--Width of each row / column
widthx = 1 * scale_x
widthy = 1 * scale_y

#--Compute the corners so the new object will be always at the center
left = -((widthx * (nbcol-1)) + (gapx * (nbcol-1)) ) / 2
right = left + widthx
start = -((widthy * (nbrow-1)) + (gapy * (nbrow-1))) / 2
end = start + widthy

#---Get the data from the object
brush = bpy.data.objects["Cube"]
obj = bpy.context.selected_objects[0]
obverts = brush.data.vertices
obfaces = brush.data.polygons

for vertex in obverts:
    vertices.append(tuple(vertex.co))
for f in obfaces:
    face.append(tuple(f.vertices))

for x in range(nbcol):
#---Create Verts, Faces on X axis
    for f in face:
        for i in range (0, len(f)):
            verts.extend([(vertices[f[i]][0]-left, vertices[f[i]][1]-start, vertices[f[i]][2])])
        faces.append([r for r in range(numface,numface+len(f))])
        numface += len(f)
    start2 = end + gapy
    end2 = start2 + widthy

    for y in range(nbrow-1):
    #---Create Verts, Faces on Y axis
        for f in face:
            for i in range (0, len(f)):
                verts.extend([(vertices[f[i]][0]-left, vertices[f[i]][1]-start2, vertices[f[i]][2])])
            faces.append([r for r in range(numface,numface+len(f))])
            numface += len(f)
        start2 = end2 + gapy
        end2 = start2 + widthy

    left = right + gapx
    right = left + widthx

#---Update the mesh
# Create mesh data
mymesh = bpy.data.meshes.new("Cube")
# Generate mesh data
mymesh.from_pydata(verts, edges, faces)
# Calculate the edges
mymesh.update(calc_edges=True)
# Update data
obj.data = mymesh
# Make the the object the active one to remove double
bpy.context.scene.objects.active = obj

Thanks a lot for your help.
C.

You end up with a lot of doubles (ie verts in same location) from your logic of running thru faces.  Remember on the cube each vert is shared by 3 faces.  Hence you end up with 4 x 3 x 8 (96) verts for four cubes, instead of 4 x 8 (32) vertices.

If you ran the the remove doubles operator on your mesh it would "weld" it.

Here is another take on this, using the list comprehension methods here https://blender.stackexchange.com/a/54130/15543 and then extending and offsetting for each row, col with gap for the vertices coordinates list, and incrementing the face vert index by the number of verts in the "brush" object for each copy.

import bpy
from mathutils import Vector
context = bpy.context
cube = context.object
mesh = cube.data
rows, cols = 5, 7
scale_x, scale_y = 1, 1
#--Gap between each row / column
gapx, gapy = 0.2, 0.2
#--Width of each row / column
widthx, widthy = cube.dimensions.x * scale_x, cube.dimensions.y * scale_y
verts = []
faces = []
lenverts = len(mesh.vertices)
# make the
for i in range(rows * cols):
    row = i % rows
    col = i // rows
    # vector math
    verts.extend([v.co + Vector((col * (widthx + gapx), row * (widthy + gapy), 0.0))
             for v in mesh.vertices])
    faces.extend([[v + i * lenverts for v in p.vertices] for p in mesh.polygons])

# new mesh
mymesh = bpy.data.meshes.new("mymesh")
mymesh.from_pydata(vertices=verts, edges=[], faces=faces)
obj = bpy.data.objects.new("foobar", mymesh)
context.scene.objects.link(obj)

You may want to adjust the vector math depending on where you want the origin to be.


Animations not working in the BGE? I have a simple character (below) that is in the middle of an animation that does not work with my logic bricks.

Here are my logic bricks. Sorry, may be hard to read (click on the image for a bigger version).

It states that when the property inMovement is set to 1, it will play a walk animation, and, on the other hand, it will not when it is set to 0. I thought that the problem would be with the parenting, but it all looked fine:

After this I thought that the animation just didn't work, but it did. This is the animation of my blocky character picture at top.

.

Everything I stated here is true, and I did not lie and/or take pictures at different times. All the screenshots were taken at one point in time, and no editing was done between them.

How do I get the animations to play (Loop Stop) based on whether the value is set to 1 or 0?

I'm currently making a game myself, and what i do is connect the W A S D keyboard sensors to individual AND controllers. These each go to seperate MOTION actuators directing the speed and direction to walk in (A and D can be set to rotation). Then create an ACTION actuator with your animation in it and connect it up to the AND controllers of the W A S D sensors. You can reverse the animation for S key by duplicating the ACTION actuator and reversing the KEYFRAMES. If A and D are for rotating, don't add the action.


Combine 2 objects to 1 object with animations I have two objects, and 1 of them has animation. I want to combine them with ⌃ Ctrl + J, but when combined, the animation is deleted.
How can I reduce 2 objects to 1 object while keeping the animation ?

As Nascent says you can select the object with animation at last, you can also join and the action will still be available in the Dope Sheet > Action Editor and look into the dropdown menu:

But your question is a bit more complex as you want to join a lid to a box object and I guess you want the lid to keep its animation, and you don't want the box to move. In that case you have 2 solutions:

Don't join the 2 objects, just parent the lid to the box (select the lid, shift select the box, then CtrlP to parent). When you'll move the box, the lid will follow, and it is still animated.

Join the 2 objects. In that case you can't count on your current animation anymore as it will move both the lid and the box, but you can use bones to animate the part of the object you want.


How to fix viewport being tilted on startup? I just started using Blender 2.90.1 a few days ago, and noticed that whenever I create a new .blend file, the viewport appeared just slightly tilted. I thought I was going crazy, until I used "Align Active Camera to View" to inspect the transform of the viewport's camera, and Rotation Y was set to 0.76 degrees. It's miniscule, but I work with a lot of geometric shapes, so I definitely notice it, and it bothers the hell out of me.
Additionally, once I do manage to fix the view (by switching to Front and then panning around), the viewport in other Workspaces do not change--they still are tilted.
Is there a way to make Blender start up with all viewports not tilted this way?
Below is the transform values of the initial viewport camera position:

The 3d view's view_rotation
This is purely an arbitrary choice in the default startup file. Edit and save the startup file if any are not to your liking.
Instead of aligning a camera to view, can get the view matrix of the 3d view.
For example, looking at the 3d view rotation of the 3d viewport in General Workspace.
>>> s = D.workspaces['General'].screens[0].areas[3].spaces.active

>>> list(map(degrees, s.region_3d.view_rotation.to_euler()))
[63.52429048891948, 0.7600397052594825, 65.79110050085248]

showing the 0.76 degrees result for y Euler rotation.  Like a camera the view looks down its local Z axis.
Test script to change all 3d views in all workspaces to have a zero euler rotation y component.
import bpy

context = bpy.context

for ws in bpy.data.workspaces:
    for screen in ws.screens:
        for area in screen.areas:
            if area.type == 'VIEW_3D':
                r3d = area.spaces.active.region_3d
                eul = r3d.view_rotation.to_euler()
                eul.y = 0
                r3d.view_rotation = eul.to_quaternion()

Result of above after running script
>>> list(map(degrees, s.region_3d.view_rotation.to_euler()))
[63.52429048891948, -9.830594791652178e-07, 65.79110050085248]

(y rot value is -0.000000983 which can be considered zero within blenders tolerance limit)
To make these permanent, open new file, paste script in text editor, run script, (unlink after running to not save script) then save startup file. File > Defaults > Save Startup File Now any new file will reflect this change.
For other templates would need to open and edit the blend file associated with the template [look for link].


Is there an option for ghosting in armature in blender 2.8? There is no ghost settings in armature properties in blender 2.8. Is there any other way to access it?

I have found (but not yet tested) this Add-on for Blender 2.80 which claims to do onion skinning (a.k.a. ghosting) on any mesh objects: https://blendermarket.com/products/onion-skin-tools


How to scale along the local axis of an object? I have an object which is rotated and not parallel to any axis. The picture shows how it looks if I scale four vertices along the y-axis. How can I extend the vertices along the local axis of the object?

When you are in edit mode, select the desired vertices, press S, and then press either X, Y, or Z twice in a row.

After the first press it will transform along the global orientation as usual:

After the second press it will use the transform orientation selected in 3D view > header, which is set to local by default:

If the orientation is set to global pressing the axis key (X,Y,Z) twice will still use the corresponding local axis.

This solution does not work if the vertices were rotated in edit mode. For that you may have to change the transform orientation to normal, and manually move the edges.


Unity fbx export has resulted in a destroyed looking mesh Ok so I'm making an unturned mod and I made the gun model in blender and exported it into unity as an fbx. Now when I exported it and opened it in Unity, the model looked destroyed and many faces of the gun was missing. I tried switching shaders of the material but to no avail. I cant figure out if its something in Unity or how I exported the model through Blender.

All you need to do is invert normals to right direction.

In edit mode:
Easiest way is select all faces by "A" > recalculate by "CTRL+N". This work in most cases. Usally does not work in non-closed/un-manifold meshes

Second way is manually select normals which you need invert and press "SPACE" > start typing "flip normals" > "Enter".


image texture node - Image sequence control by slider Is there a way, how to change images from image sequence by slider or driver?

I founded the solution, its alittle bit tricky and not fully suported at this time, but.

A) Set a driver to offset in Image texture node set to image sequence:

B) Create an object or custom property, but object responce was better for me, and write #frame to any slider (Z scale in my situation) and tap enter > it create a driver.

C) In offset driver find the scale value from object you set in and the value where is set your image number it must be integer so I rounded it. And voila.

Pros: It can be done.

Cons: In viewport - refresh image is not fully working after change the slider - you can see right result only in render view.
In blender 2.80 it is not working at all. But I hope it will be. I am looking forward to make sume flat puppets and re-drawing the phases of hands and faces trough grease pencil it will be awesome.


Remove doubles corrupts UV mapping I'm importing a Wavefront OBJ file. The file contains a lot of duplicate vertexes, so I use the remove doubles functionality in Blender (from a Python script to be precise). Not doing so, gives problems later when using a subsurf modifier (distortion of the mesh).

With removing the doubles, the mesh is perfect, but the OBJ file also contains UV mapping (vt tags etc). After using remove doubles in Blender, the resulting UV mapping has holes. Several vertex mappings have disappeared, resulting in incorrect mapping of the textures to the mesh. Seems like UV mapping is not taken into account by the remove_doubles feature.

This seems like a fundamental issue of the feature, not specific for my model. Hence I was wondering whether there is a workaround/solution for this ... to have UV mapping corrected as well.

Thanks a lot.

The problem turned out to be a bit more tricky then I expected. The model I'm importing contains several duplicate vertices, but as a result also duplicate faces. Depending on the order the faces are defined in, in the OBJ file, the resulting material that is visible differs. So I ended up writing a bit of Python code to pre-process the obj file: remove all double vertices, remove double face definition ensuring that the remaining face has the correct material defined.


How do I convert an svg (or a plane) into a rounded mesh? How can I smoothly extrude a plane or an svg curve into a circular/rounded mesh? if I simply import an svg and extrude it and then add a subdivision surface modifier, it makes a big mess. I need a way to take a flat complex 2D object and extrude bit by bit systematically while changing the diameter of each extrusion (layer apon layer). I would hope it would end up looking like the semicircle in the photo (though using more complex 2D shapes though). I want to make the bottom image into a semicircular mesh to make it look like the top image.

Any advice?

The manual way of doing this would probably be to extrude it up and then use the"Shrink/Fatten" (Alt+S) tool which scales each Vertex/Edge/Face along its normal which should give you something you might be able to work with.

I wouldn't be surprised if there was already a tool or an add-on to do this more or less automatically but sadly I don't know it


How to model a fluid like object without particle system or fluid simulation What I had in mind is something like this:

Now I know it probably can be done with particle system and metaballs (something like this ) or fluid simulation.

Thing is that in order to do it with metaballs you need a quite powerful PC to handle all the polygons and same thing with fluid simulation ( and I also have 0 experience when it comes to fluids sim). Is there a way to make object like in images with bend modifier or even maybe sculpting, any idea?

You could try using a displacement modifier with a texture.

I tried using a clouds texture and a stucci texture, which came up with a decent result. Didn't look to much like the image, but if you have a better base mesh, and just keep messing around with adding more textures, and adjusting size and strength, you should be able to come up with a good answer.

p.s. you need to add another displacement modifier for each new texture you add.


Strange fluid sim behaviour Good day.

I found another member had the same prob twi years ago. Maybe someone can help me this time.

THe prob is the following:

I got (now) a simple setup with a bowl (acting as fluid->obstacle) and some water in it (fluid->fluid). The scene is surrounded by a cube (acting as fluid->domain). Last object is the camera.

I reduced my scene to only this four objects to reduce possible error sources.

Now when I'm start the baking process, this is the first frame after the simulation starts:

It is not my first fluid sim and I never had such a problem before. Setting are pretty much default. Any hints on this?

YES! I solved the problem. Thanks to sardipax! It was very simple: the normals ofc were facing inwards bcs. I created the water mesh from the bowl/glas. Flipping the normals solved this issue.

Thanks for everyone who took care here.

Damned what a wasted night just because of such a simple mistake ... ;-)


I can't move, rotate or scale in blender 2.8 object mode I am very new to Blender 2.8.
I know that hotkey like G, R and S are essential and very useful but I can't do any of them in object mode. I can only move the origin (the orange thing that for the object) freely.

I have a MacBook and use a mouse.
I tried looking at transformation locks too but that wasn't the problem.

Did I click on a weird setting?

Any help much appreciated!

It appear you have accidentally selected to move the Object origins. This is only available in Object mode, hence the difference. Unless you are wanting to move the origins, turn it off.


How do I make a textures values translate into shader values So the title might be a bit confusing bit it's the best I can do.

I'm trying to make a simple way to control the roughness of my material with a texture.
I want this particular material to have 0.75 roughness on most of it, and 1.0 on the rest.
So I make a texture in GIMP with 100 value on the rough parts and 75 value on the less rough parts, But plugging it into the roughness makes the .75 parts way to shiny.
In Blender's image viewer it says the value of that part of the texture is 0.749, but it doesn't translate to the same value in roughness.
Is there a way to fix this?

I've tried RGB to BW, seperate HSV and only using the value, putting it into a colour ramp and using  that, but nothing's worked so far. I've also tried using the alpha instead and that works fine, but the texture is much harder to create and look at.

Thanks to anyone who can help with this

The Alpha Channel works, because it is read linear. No Gamma correction etc. Color spaces HSL, HSV etc. can be very complex, so my suggestion is as @Jachym Michal points out, non-color, or linear color. However keep in mind, the roughness values of the materials are squared now, so they are less sensitive than in 2.79, in case you want to work with precize values. Lastly, you can use a color ramp to map the 2 values (0.75 and 1) to any color you want. That might save you going back and forth between GIMP and Blender.


How to Save a Material as an Image I am making some photo-realistic rocks in Cycles, and I made a material using nodes, and combined two images using a bunch of modifiers and then connected them to the rocks material node. How can I take the rocks material and save it as an image? I've tried to bake it, but I can never find where the baked image is. Thanks in advance.

The Render output panel is in: Properties Panel->Render->Output

-

https://www.blender.org/manual/render/output/output.html#output-panel


How to make this script compatible with Blender 2.8 API? The error I'm getting is:
TypeError: Converting py args to operator properties: : keyword "constraint_orientation" unrecognized

I've been told that it's due to API differences since 2.8, particularly "constraint_orientation".
The code in question:
import bpy

def reset_shape_keys ():
    for name, shape_key in get_active_block().items():
        shape_key.value = 0

def get_active_block ():
    block_id = bpy.context.object.active_shape_key.id_data.name
    return bpy.data.shape_keys[block_id].key_blocks

def select (selection):
    bpy.ops.object.select_all(action='DESELECT')
    selection.select = True
    bpy.context.scene.objects.active = selection

def select_last_shape_key ():
    shape_key_count = len(get_active_block().items())
    bpy.context.object.active_shape_key_index = shape_key_count - 1

def remove_shape_keys (object):
    selection = bpy.context.object
    select(object)
    shape_key_count = len(get_active_block().items())
    select_last_shape_key()
    for i in range(0, shape_key_count):
        bpy.ops.object.shape_key_remove(all=False)
    select(selection)

def apply_modifiers (object):
    selection = bpy.context.object
    select(object)

    for key, modifier in object.modifiers.items():
        if key != 'Armature':
            bpy.ops.object.modifier_apply(apply_as='DATA', modifier=key)

    select(selection)

def super_apply_modifiers ():
    original = bpy.context.object
    bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(0, 0, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "texture_space":False, "remove_on_cancel":False, "release_confirm":False, "use_accurate":False})
    backup = bpy.context.object
    backup.name = 'backup'
    remove_shape_keys(original)
    apply_modifiers(original)

    for key, shape_key in get_active_block().items():
        select(backup)
        bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(0, 0, 0), "constraint_axis":(False, False, False), "constraint_orientation":'GLOBAL', "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "gpencil_strokes":False, "texture_space":False, "remove_on_cancel":False, "release_confirm":False, "use_accurate":False})

        meshed_shape_key = bpy.context.object
        select(meshed_shape_key)
        reset_shape_keys()
        get_active_block()[key].value = 1
        bpy.ops.object.convert(target='MESH')

        select(original)
        meshed_shape_key.select = True
        bpy.ops.object.join_shapes()
        select_last_shape_key()
        bpy.context.object.active_shape_key.name = key

        select(meshed_shape_key)
        bpy.ops.object.delete(use_global=False)

Here is the Script converted to 2.8
import bpy

def reset_shape_keys ():
    for name, shape_key in get_active_block().items():
        shape_key.value = 0

def get_active_block ():
    block_id = bpy.context.object.active_shape_key.id_data.name
    return bpy.data.shape_keys[block_id].key_blocks

def select (selection):
    bpy.ops.object.select_all(action='DESELECT')
    selection.select_set(True)
    bpy.context.view_layer.objects.active = selection

def select_last_shape_key ():
    shape_key_count = len(get_active_block().items())
    bpy.context.object.active_shape_key_index = shape_key_count - 1

def remove_shape_keys (object):
    selection = bpy.context.object
    select(object)
    shape_key_count = len(get_active_block().items())
    select_last_shape_key()
    for i in range(0, shape_key_count):
        bpy.ops.object.shape_key_remove(all=False)
    select(selection)

def apply_modifiers (object):
    selection = bpy.context.object
    select(object)

    for key, modifier in object.modifiers.items():
        if key != 'Armature':
            bpy.ops.object.modifier_apply(apply_as='DATA', modifier=key)

    select(selection)

def super_apply_modifiers ():
    original = bpy.context.object
    bpy.ops.object.duplicate_move()
    backup = bpy.context.object
    backup.name = 'backup'
    remove_shape_keys(original)
    apply_modifiers(original)

    for key, shape_key in get_active_block().items():
        select(backup)
        bpy.ops.object.duplicate_move()

        meshed_shape_key = bpy.context.object
        select(meshed_shape_key)
        reset_shape_keys()
        get_active_block()[key].value = 1
        bpy.ops.object.convert(target='MESH')

        select(original)
        meshed_shape_key.select_set(True)
        bpy.ops.object.join_shapes()
        select_last_shape_key()
        bpy.context.object.active_shape_key.name = key

        select(meshed_shape_key)
        bpy.ops.object.delete(use_global=False)

You can write the bpy.ops.object.duplicate_move() like this because your only use the default values of this operator.
[Tested on 2.83.3]


My weight painting only works at 100% no matter the shade I am trying to weight paint using blender 2.73a, but no matter what weight I assign to a vertex or what shade the weight painting is it always gets influenced 100% by the armature/bone.

Has anyone else had this problem?

I add this picture of a cylinder and one bone. As can seen the weight paint is not uniform, but the entire cylinder follows the bone.

Or am I totally not understanding weight paint.

I also add a link to the blend file below:
blend file of cylinder with bone

This is how weights work.

The weight doesn't define an influence of a particular bone; It describes the Mix factor of influence between multiple bones.

So a vertex with 1% weight on one bone and 0% on all other bones will be 100% influenced by the 1% bone.
A vertex with 1% weight on one bone and 50% weight on another bone will be almost entirely controlled by the 50% bone.

In other words, a vertex is always influenced 100%. Weight only controls which bones do the influencing.

To get a result similar to what I think you are expecting, add a second bone weighted to all the vertices by 100%. Now the first bone's weights will cause non-uniform influences, as you might expect.


How to constraint object to perspective user viewport (Not render camera) I would like to constraint an object (cube) to the viewport camera, so it will be always in user's field of view.
Is it possible with constraints (I didn't find any way) ?
I also tried with python to get 3d coords :
import bpy
from bpy.props import IntProperty, FloatProperty
import bpy_extras
from mathutils import  Vector, geometry
import mathutils

class ModalOperator(bpy.types.Operator):
    """Move an object with the mouse, example"""
    bl_idname = "object.modal_operator"
    bl_label = "Simple Modal Operator"

    first_mouse_x: IntProperty()
    first_value: FloatProperty()

    def modal(self, context, event):
        if event.type in {'MIDDLEMOUSE', 'WHEELUPMOUSE', 'WHEELDOWNMOUSE'}:
            coord = self.get_view_coord(context)
            print("coord = ", coord)
            return {'PASS_THROUGH'}

        elif event.type in {'RIGHTMOUSE', 'ESC'}:
            context.object.location.x = self.first_value
            return {'CANCELLED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}

    def get_view_coord(self,context):
        region = bpy.context.region
        for area in bpy.context.screen.areas:
            if area.type == 'VIEW_3D':
                rv3d = area.spaces.active.region_3d
                break

        pos = bpy_extras.view3d_utils.region_2d_to_location_3d( region, rv3d, Vector((100,500)), Vector((0,0,0)) )
        orient = bpy_extras.view3d_utils.region_2d_to_vector_3d( region, rv3d, Vector((100,500)))

        bpy.ops.object.empty_add(type='ARROWS', location= pos)

        bpy.context.object.rotation_mode = 'QUATERNION'
        bpy.context.object.rotation_quaternion = orient.to_track_quat('Z','Y')
        return pos

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

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

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.modal_operator('INVOKE_DEFAULT')

Edit 1 : The final goal is to have several controller objects on the sides of 3d viewport, so I can manipulate them and via handlers, tweaking previously generated curves.
Edit 2 : With this modal example, I can have an empty placed in 3d viewport, but still don't know how to follow camera, how to get height and width of 3d area (to place it at the top left corner for example), plus Z axis is well oriented, but I would like Y axis to be parallel to the border of the screen.

Keep context object centered on largest viewport in screen.

The view is set up similarly to the camera, ie it looks down its $-Z$ axis.
Rotate an object to camera view
Access view orientation from python?
whereas meshes are normally $Z$ up $-Y$ forward.
The view_align method below, looks for the largest 3d view, then using its matrix aligns the context object such that it looks directly at the view, from 5 global units away.
The rest is basically the modal timer operator template, similarly to question
import bpy
from mathutils import Vector, Matrix
from bpy_extras.io_utils import axis_conversion

distance_from_view = 5

A = axis_conversion(
        from_forward='Y',
        from_up='Z',
        to_forward='-Z',
        to_up='Y').to_4x4()

def view_align(context):
    areas =  sorted(
            [
                a
                for a in context.screen.areas
                if a.type == 'VIEW_3D'
            ],
            key=lambda a : a.width * a.height
        )

    if areas:
        screen = context.screen
        ob = context.object
        mw = ob.matrix_world
        r3d = areas.pop().spaces.active.region_3d
        M = r3d.view_matrix
        V = M.inverted()
        # maintain global distance from camera
        T = Matrix.Translation(V @ Vector((0, 0, -distance_from_view)))
        # keep original transform align to view
        #T = Matrix.Translation(mw.translation)
        R = M.to_3x3().transposed().to_4x4()
        S = Matrix.Diagonal(mw.to_scale()).to_4x4()
        ob.matrix_world = T @ (R @ A) @ S

class ModalTimerOperator(bpy.types.Operator):
    """Operator which runs its self from a timer"""
    bl_idname = "wm.modal_timer_operator"
    bl_label = "Modal Timer Operator"

    _timer = None

    def modal(self, context, event):
        if event.type in {'RIGHTMOUSE', 'ESC'}:
            self.cancel(context)
            return {'CANCELLED'}

        if event.type == 'TIMER':
            view_align(context)

        return {'PASS_THROUGH'}

    def execute(self, context):
        wm = context.window_manager
        self._timer = wm.event_timer_add(0.01, window=context.window)
        wm.modal_handler_add(self)
        return {'RUNNING_MODAL'}

    def cancel(self, context):
        wm = context.window_manager
        wm.event_timer_remove(self._timer)

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

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

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.wm.modal_timer_operator()


Any idea whats going on with these back legs? I tried removing doubles and nothing happened. Not sure what else to try


bl_space_type = 'NODE_EDITOR' not working Blender 2.92x
I want to make an N pie menu panel for The Shader Editor.
By the way, what is up with the label miss-match.
The menu reads the Shader Editor, but in BPY the term is NODE_EDITOR.
class TestPanel(bpy.types.Panel):
    bl_label = "Nodes"
    bl_idname = "PT_TestPanel"
    bl_space_type = 'NODE_EDITOR'
    bl_region_type = 'UI'
    bl_category = 'Nodes'

If your Panel's code is just what you posted, then you're missing some parts of a Panel's requirements.
Here's a small template for 'Shader Editor' to mess around:
import bpy

class SuperSimplePanel(bpy.types.Panel):
    bl_label = "The label of this panel"
    bl_idname = "NODE_PT_ThisSimplePanel" # This is new
    bl_space_type = 'NODE_EDITOR'         # This tells where to show
    bl_region_type = 'UI'
    bl_category = 'OH ANOTHER TAB'     # if it doesn't exist, it will be created

    @classmethod
    def poll(cls, context):         # This tells when to show
        return (context.space_data.type == 'NODE_EDITOR' and
                context.space_data.tree_type == 'ShaderNodeTree')

    def draw(self, context):       # This tells what to show
        layout = self.layout
        layout.label("I'm a label in a Panel")

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

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

if __name__ == "__main__":
    register()
```


How to get a Matte/Clay render Hello Blender Community,

I have a question for all you expert blender renderers.
I'm trying to achieve this super simple clay look. Is there anyone who could point me in the right direction to achieve something like this?

Thanks

A simple shader node should work in Cycles render. It's using the new Principled BSDF shader with the roughness set to 1. Alternatively you could use a Diffuse BSDF shader with the roughness set to 1 and get the same result.

I have a main sun light source  with Ambient Occlusion under World->Ambient Occlusion and set the value to .1. If you increase the value for the Ambient Occlusion, you'll see less shadows.


Creating a mesh on top/inside of a mesh In the linked video at 6:40, how did the author create a face on top of the figure? How do you create a new mesh/plane on top/inside of an existing one?

https://www.youtube.com/watch?v=kfebPwr0gx4

Also,
the faces on the mesh in the image are not flat because the edges are bent in places where there are no vertices. How do I make flat faces?

Create a new object (plane), get into Edit mode, and use the Snap option (and Type > Face) so that the vertices of this new object stick to the other object behind. Also, enable the Project Individual Elements option (so that when you extrude, both the vertices stick to the other object).


How do I add a constraint to an object with Python? I am currently writing a script, and have gotten to the point where I need to add a constraint from inside the script in my for loop. I have been unable to find any recent documentation on the subject however, it all being from a good 7-8 years ago for the most part.

How could I accomplish this?

import bpy

o = bpy.context.object
constraint = o.constraints.new('COPY_LOCATION')

#constraint properties
constraint.show_expanded = False
constraint.mute = True

https://www.blender.org/api/blender_python_api_2_77_release/bpy.types.ObjectConstraints.html?highlight=constraints#bpy.types.ObjectConstraints

https://www.blender.org/api/blender_python_api_2_77_release/bpy.types.CopyLocationConstraint.html?highlight=constraints


Export Vertex Normals into Obj File I would like to export the from Blender calculated vertex normals into an .obj file. I realized that the amount of vertices in the .obj file does not equal the amount of normals (there are more vertices than vn). I expected that there is a vertex normal for each vertex so there should be the same amount of each.
I guess Blender doesn't export the vertex normals but the face normals and hence there are less normals than vertices.
Did anyone else experience the same problem and solved it somehow? Is there a way to get the vertex normals into the obj file?

Did you check the "Write Normals" option in the export dialog?
The tooltip for that says: "Export one normal per vertex and per face, to represent flat faces and sharp edges"

To test it I edited the vertex normals of a cube with the blend4web add-on and reimported it and the altered normals were preserved on re-import. So with the checkbox checked it should do it the way you want.

EDIT: I looked in the file and I think see what you mean. Let me investigate.
EDIT2: So it seems the vertex normals are only written once, when they are needed (no duplicates) and in the "f-group" they are then referenced. Each face points to its vertex indices and (via the number after the second slash /) to the belonging vertex normal indices (f v//vn - the middle can also have an index for texture coordinate --> f v/vt/vn). So multiple vertices may be  associated with the same vertex normal index if they share the same value.

https://en.wikipedia.org/wiki/Wavefront_.obj_file

So in order to have a dictionary (vertex index - vertex normal) you would need to go through the faces (the f-group) and follow the reference for each vertex normal, discarding all vertex indices you already have sampled.

EDIT3: Answering your comment below :)

There are sometimes more 'vn's than 'v's, because there are actually more vertices. One entry in the "v group" doesn't really represent a vertex but a set of unique vertex coordinates.
If you e.g. look at the corner vertex of a cube that is hard-shaded, this one vertex is actually 3 vertices! These 3 share the same coordinates and thus only get one 'v', but they have different normals - one for each face the three-fold corner vertex is part of.

They still can only be moved together - a ripped vertex (meaning two or more unconnected vertices in one place) is represented by having more 'v' entries with the same coordinates. For unripped vertices that are part of a hard edge Blender doesn't show the real count in the scene stats, but if you import it e.g. in Unity the vertex count suddenly is much more.

It looks like that this is just the way that the obj format is designed - not unique identities but just pointers to values. You could of course rewrite the exporter to force duplicates, but it would be difficult to be consistent, because of what I described above. It think would result in all hard edges beeing split. Anyway I think it would be more complicated than just reading out the obj file with some loops and stuff. The information is there, it is just represented differently than we would assume at first glance.

EDIT4: To correct myself above - when reading out the obj it's not really possible to discard any vertices if you want to preserve all info. The combination of v, vn and use in an f is what makes them unique, right? So really you can just walk through the faces and fetch the values. Or gather unique v-vn pairs but lose info about their faces.


How to make outlined texture in blender? How to make outlined edges and not transparent texture in blender? Like on the img below?

UPD

I get this bird beak effect on every edge.Is there a way to remove this?

UPD

I've tried Chaining method and refused from it because it makes the line thiner. See screenshot:

Also, here are my settings:
Caps are Butt. Edge Types are Edge Mark. No modifiers.

I add this to show some example related to your edited question:

You say very little about your object mesh, but it seems you set a linestyle thickness quite high for the overall mesh size.

I try to replicate it here:

where you can see the corners are not that good but just changing one setting gets  better results:

of course you have to experiment, to find your best setting, and freestyle really has tons of settings...


What voxel format is used by blender to store smoke data? What voxel format is used by blender for storing smoke data? There is an easy way to export this data to something like OpenVDB? It's for use the simulation in our current rendering engine (Guerilla Render) that support openVDB format. Or is it an easy format to get the voxel back into Guerilla Render.

When baking smoke Blender can save the cache as OpenVDB.  Select the smoke domain, go to the physics panel, and go into the smoke cache settings.  Change the file format from "Point Cache" to "OpenVDB".  You can then choose your compression and data depth.


How to append a Rig with a python interface at the same time I'm making a rig that has a python interface and I was wondering if their was anyway to append the rig and the script at the same time so the script runs as soon as it's appended.

If you do this manually, you need to run the script after it is linked. The script auto-runs only on file open/reload (if it is registered).

You can write an addon, that will link your character, create proxy rig from it, link the script and run the script:

Here is how you link stuff with python
You make proxy rig like this:

# get your linked group object
objects = bpy.context.scene.objects
group_ob = objects.get('Character')   # <- you probably have this from linking already
# create proxy rig
objects.active = group_ob
bpy.ops.object.proxy_make()
# get the proxy object if you need
proxy_ob = bpy.context.active_object

Running the script is easy:

script = bpy.data.texts.get("rig_script.py")   # <- you have this from linking
exec(script.as_string())


Hierarchy missing, how do I bring it back? I'm making a model in Blender and then I think I pressed something on my keyboard and then my hierarchy went missing! How can I bring it back again?

Thanks!

It looks like you've maximized a viewport.  Ctrl+Space should set it back.


Torus object stretched in array curve modifier I have a chain object. And i have a curve it follows. I got it to work for following curve, but chain object is not circles but both parts are more like stretched circles (ovals).
Object i made with 2 toruses one rotated 90 degrees and then joined them together. I tried single torus too. But same issue. on a curve it just looks stretched oval. What can be the issue?

Thanks

The curve modifier distorts the objects, that is the intended behavior. If you want an undeformed array use either Duplifaces or a particle system instead.

Add your Array+Curve modifier stack to a simple plane mesh instead.

Create a new plane mesh, parent one single chain link to it and activate Duplifaces on the plane's object properties.

Then add the array modifier, use an empty object rotated $90º$ to introduce rotation to each link. Activate the Object Offset option and pick the empty.

Adjust spacing and settings as desired, and then add the curve modifier exclusively to the plane object alone.

Alternatively use a particle system instead of Dupligroups feature with one particle per face if you wish to hide the original link independently. Manually adjust particle count to match the number of arrayed links.


How do I remove F_01 from the Timeline? I've been dumb and fearless! It's a personal goal - however, my smash into animation triggered this thing which might be an F Curve somewhere? More importantly than what it is in any detail is getting rid of it. Perhaps useful later, it was unsolicited this time.

You must have accidentally pressed M on the keyboard while your mouse was hovering over the timeline. These are called markers in Blender.

To delete it, select the marker with left-click (LMB), keep your mouse hovered over the marker area, and then press X then Delete Markers.


AMD ProRender installed but not working I just installed AMD's ProRender and I'm trying to experiment with it and see if I like it.  Using Blender 2.8 on Windows 10.

Here's a scene I made, previewed in Cycles:

Here's the drop down for the Render engines, seems like ProRender is there.  And I didn't have any errors or warnings while installing it or the materials library.

But when I select the ProRender and either hit "render image" or just chance the viewport mode to rendered.... nothing happens.  Like so:

In fact, the objects kinda disappeared.  When I hit "render image" the picture never shows up at all.  I never touched any of the default ProRender settings on the right there.

Any ideas?

For those looking at this later, per the comment section:  the nodes I had used in Cycles were causing trouble.  When I open a new default scene ProRender worked.


Armature not completely moving head mesh So I have a singular head bone on top of my character so I can rotate the head as a whole. But when I rotate the head bone after applying the armature, it does not correctly move parts of the mesh:

https://puu.sh/sEevu/02bc7256ec.jpg

https://puu.sh/sEeAw/8fd79caeff.jpg

I had made sure all parts of the head was joined together into one mesh and I also removed all doubles.  Should I join the body and the head meshes? I hope this is a simple mistake because this is confusing the hell out of me. I guess its also worth noting that this is my first rig.

I noticed that marios right arm gets twisted when the armature gets parented.
To fix that, you need to go into pose mode of the armature, press CTRL + A and select apply pose as rest pose.

Even though the eyes,mustache, and face are one object, the eyes/mustache arent connected to the face but floating in mid air. So the automatic weights didnt work perfectly. You can see that because when in weight paint mode, the eyes are blue (meaning the vertices arent assigned to that bone) and the mustache is green (meaning it is only partially controlled by that bone)

You can easily fix that by manually selecting all the vertices in the face with A  and assigning all of them to be fully controlled by the head bone in the Properties Editor->Data->Vertex Groups->Assign. I also noticed the mustache is partially controlled by the chest bone so I removed it from its control.

The process is called "weight painting".


Snap to vertex or edge does not work I want to join two sides of an object.
1. I used Knife Project to mark both sides of the object with a circle.

2.Then I deleted the marked faces.

I selected the edges of the hole created from the one side
I turned on the magnet
I extruded along the Y axis.  But I cannot get it to snap the the vertices on the opposite side of the object.

Although not 100% sure, I believe
1. I need to press and hold the Ctrl key while extruding.
2. I set the snap to option to Closest
3. I set the pivot point to active element

I did turn on "Automatically merge vertices moved to same location".  However, when I checked afterwards by clicking the remove doubles, 56 doubles were still removed.  So not sure how that is suppose to work.


BGE: How to display random list of text in game with python? Perhaps there is no function like this in blender, but how do I use python to display text randomly from an array? Essentially, during a loading screen I want to be able to scrub through different "tips" randomly using python; these tips will be displayed in a text-box inside the game. Thank you.

ah this is a simple python problem.

if I understand correctly all you have to do is

import random
print(random.randint(0,len(tips)-1))

or

import random
random.choice(tips)

of course actually displaying them in the game itself is possible, just slightly more complicated.

also next time please post a python question in a python thread.

since this is technically a duplicate:
https://stackoverflow.com/questions/306400/how-to-randomly-select-an-item-from-a-list


Material only assigning to part of object, not all of it EDIT: I've since discovered that the issued stemmed from the fact that the light wasn't shining on the black areas. Change it to hemi and the problem is fixed.

I'm new to blender, but I have a grasp on the basic functions. Supposedly. I've gone through an excellent course on it, but I'm still a bit lost in the area of materials and textures.

I am currently trying to texture a roof of a hut. Despite the fact that I've selected the whole roof in edit mode and assigned the material with the texture on it, only part of the roof gains the texture - the top.

Note: The top of the roof is tecturing properly: it looks solid because I'm in material view, not render. That's not the problem. The problem is that the texture is not assigning to the whole of the roof. Not the black edges of the roof, and the underside (if you open the project linked below). Those areas need to have the texture.

Why is this? I've tried to assign the material to the whole object multiple times, even selecting only one or two faces that were not affected. I can't tell if the material is ignoring the faces, the texture is, or both are (since the material looks no different from the rest of the hut for some reason - a way to tell that would be nice if I'm missing it).

I want the texture on the top of the roof like it is, but also on the sides and underside, which you cannot see in the picture. The roof is a single object, separate from the rest of the house.

File to download.

Folder to download, including texture.

What I've tried/checked:

All normals are facing the correct way. This is the first thing I checked.
I'm in Blender Render, not Cycles Render (I did some research and that was mentioned).
The material/texture does work. It's on the top of the roof, after all.
I have no way to confirm that the material is assigned to the whole object, though I don't know why it wouldn't be. I assigned it multiple times. I even deleted it and started over with the whole roof selected (ctrl+A).

You need to set the diffuse color as shown below for all the parts you want to have the same material. So I added new material for the other parts as well and set the diffuse color to be the same as shown below:

The updated .blend file can be found here:


Create custom physics for an object with python Blender has physics options which we can enable for our objects - cloth , fluid etc. Is there a way I can add a custom physical behavior to my objects, where this behavior is modeled as a python script. For example, I'd like to add a new button to the physics tab like "My Physics", and when it is attached as a modifier to objects , the objects follow the behavior as modeled in the script.

Basically, I want to test some physics algorithms and want to use blender for that. So I'd be relying on blender to do the rendering and other things, but the physics will be provided by my code.

Is something like this possible?

Yes it is possible, there are 2 ways of doing this, but there are also 2 big drawbacks for both methods:

method 1: You can script your own modifier in c++, here is how to start. The drawback is you need to build your own Blender version yourself. Modifiers cannot be add with python or addons. If your modifier gets approved it can be added in the trunk (official release).
method 2: You can add your physics simulation code in the app handlers. This way your code gets executed for example every frame change. You can manipulate objects, change mesh etc. This will work from addon but the code will be very slow and you will unlikely get real-time fps.


Creating depth of field from Beauty+Depth passes (rendered in another software) Creating DoF in the compositor is very easy if you have the scene rendered in Blender and the camera depth set right. But what if you rendered a beauty (raw render) and depth pass in another program?

This was rendered in Maya, the white is at the front and the black at the back. There is no "focal distance" value on the Defocus node, so I don't know how to tell it what distance is supposed to be in focus.

I also tried using a regular blur node with "Variable Size" on (Gaussian Type) after putting the depth through a color ramp to remap the values, but this causes areas in focus to have the out-of-focus background blur "bleed" into them:

(The whole worm should be in focus, no blurred edges)

So how should I create depth of field using these two passes alone and no access to the scene itself (since it's in another software)?

The Defocus node works in conjunction with the settings for the active camera.

You can use this node setup:

You have to check "Use Z-Buffer" so your depth image is used. If you omit the Add node all parts of the image where the depth image is black are sharp independent of your focal settings. I don't know why, maybe that's a bug.

You also have to set the "Distance" to 1.0 with your active camera selected under Properties > Camera Data > Depth of Field.

This is the result:


Blender python custom mouse cursor Is there a way I can change or modify my mouse cursor in the 3d view while my custom operator is running?

A quick search for cursor yields Window.cursor_set

So i.e.

bpy.context.window.cursor_set("HAND")


Is there a way to make custom coffee foam? I want to make a cup of coffee with the nice swirl of white and brown foam, but I want to be able to influence it using an object (similar to how they make hearts in cappuccino).  In this case it's an .svg logo I would import.  I've seen lots of examples where image textures were used for foam, but I'm wondering if there's a way to actually influence the foam in Blender itself.  Is this possible?

Here's an example of the type of foam I am going for:

And here is an example of a logo I would want to use as the design in the foam:

EDIT:

Here are the changes I made based on responses provided.  I modified the node setup slightly in that I did not use the coffee nodes as I decided to just use an image texture for that.  Unfortunately, it made the logo part heavily distorted and I'm not sure why.

Here's the node setup:

Here's the result:

I've attached the .blend:

NEW EDIT:

Based on the follow up answers provided, here is the finished render (including blur techniques used in GIMP):

It's not extremely good, but this should give you a good place to start:

The image you want to appear on the foam is very detailed and hard to reproduce on real coffee. This is why I thought it should be pre-processed in some image editing software to make it more realistic and doable. I used Photoshop to smudge out the image a bit, and I got this:

The coffee itself that I made in Blender was a simple squeezed sphere. I then used the image above as a texture to determine the color of the foam. Here is my node setup for the foam:

I'll go into the details now.

Distorting the image

I used a Wave texture to distort the image in rings. You can adjust the frequency and amplitude of the distortions.

Some noise texture on top of that

I added some noise to the image, because nocoffee is perfect.

Bump map

I didn't have any actual coffee to look at, but I'm assuming that the image should have some effect on the bumps in the foam, due to stirring. So I created some "ripple" bumps around the borders of the texture (kinda):

The coffee shader

Now, we have calculated both the texture we want on the coffee and the bump map. I used a gradient to get the right coffee colors. The actual shader was a simple mix of a diffuse shader and a glossy shader:

Here is my resulting .blend file you can play with:

Here are some possible improvements you could consider:
- It is very easy to adjust how much you want the image to be distorted in rings. In the "Distort Image" frame, just change the second value of the Divide math node.
- Consider introducing a subsurface scattering component, because coffee is transparent. Or, even better, use a volume shader. Coffee is a little bit transparent.
- You could change the colors to make them a little warmer, because my coffee looks like mud. Yuck. :)
- You could further tweak the original image: smudge it, adjust contrast, add noise, etc.


Curve goes in different directions I have a single path as mesh and after I've converted it into a path there are some vertices going in the wrong direction.

For example at the top right and at the bottom in the middle there is also some weird things going on as seen in the lower picture.

If I apply a bevel object it looks a bit weird as you can tell.

Is there a way that all vertices have the same direction?

Here you can download the file
Please don't mind the Audi R8 and the German names of the layers.

The curve is going in different directions because there are gaps in the curves. In your case there are several point where the curve has a gap. It looks like it is a single continous curve but actually there are 2 end points on top of each other that only make it look like a single curve.
You can fix this by moving on of the overlapping endpoints away form the other and than filling it, use F to connect to points. The direction of the curve will then automatically be normalized. Just to be sure: when you are done with that you can also normalize the curve using Ctrl+N

How to find these overlapping points:
To find these point you can in Edit mode, hover of a point with the mouse and hit L. This will select all the connected points. You can than select the end points manually.


Why are part of my model differently colored? I tried to redo normals, but this doesn't seem to be the issue here. When imported to Unreal the different colored items have missing polies.

easy, recalculate the normals of the oddly colored area of the model. the normals look like they have been reversed.


meshes being generated at target instead of at 0x0y0z I'm having trouble. I'd like to have a cube pop in at 0x0y0z instead of popping in at the left click's target's location, it wasn't always like this. Can you help?

Shift S

Snap Cursor to Center.
Then add Cube

or

Shift S

Snap Cursor to Center.

Click on Cube

Shift S

Snap Selection to Cursor.

Do not be concerned with [it wasn't always like this.]
Be ready for new ideas in Blender


How get length of Navigation Mesh? I have a navigation mesh (as shown in the attached picture). The navigation mesh consists of curve and array modifiers. As it is has an array modifier, it consists of strings of planes (I see it when I switch to 'edit mode').

My question is, can I iterate over the navigation mesh to get its the length and coordinate of center of each small planes in the navigation mesh. If yes then, please give me some python based example. Thanks in advance!

Since each of the small planes are the faces of the mesh, iterating through the polygons on the object mesh data provides access to the coordinates of the center of the face. Then using two consecutive coordinates, the distance between the centers can be calculated. This approach assumes the previous face is adjacent to the current face. Additionally, because accessing mesh data uses bpy, any changes will not occur while the game engine is running.

import bpy, mathutils

plane = bpy.data.objects["Plane"]

previous = None

for poly in plane.data.polygons:
    center = mathutils.Vector(poly.center)

    if previous:
        previous -= center
        #print length and center
        print(previous.length, center)

    previous = center


Is there an easy rigging tool in blender? Good day.
I'm a software developer. I don't know how to animate but because of this pandemic i lost my job and i want to learn animation to be able to upload videos on youtube. I learn from doing things rather than reading or watching lengthy tutorials, then search a solution of error i encountered during the process.
Is there an easy rigging tool in blender? Something like. A tool that contain animations and we can also add custom animation. Then transfer the animation to our custom 3d model? Is there something like select the 3d model. click a button for animation then the animation will be applied to the 3d model?
Thank you

No, but there are two options:-
You can learn inverse kinematic(I am also learning that). It simplifies many things in rigging.
You can add the addon “Rigify” ( I hope I spelled it right). It adds premade skeleton in blender and you can dont have to install from some site. It lies in preferences.


Moving a ball forward, mechanical force I'd like to have a ball (blender game engine) which rolls forward by its own and with real physics and friction.

It shouldn't be animated though, what I'd like to have is kind of like a "motorized ball" who rolls forward just by its own force. No work arrounds with wind or invisible objects pushing or draging it.

What I did:

keyframes for the spinning animation (360 degrees)
made it a rigid body
sensors "always" and "action" so that it spins when in game mode

but it just falls down to the floor and spins where it is. It doesnt react to the floor whatsoever (which has collision on and is a passive).

Or is there a complete different way to do such things like "mechanical animation" or whatever it's called?
Thank you in advance :)

You need to tick the Animated checkbox under the Rigid Body tab:

If the object just sets there and doesn't roll, you should make sure your Friction levels are set properly for the involved collision objects:

Zero friction will result in no forward movement, make it higher and the "Stickiness" gets higher while lower settings make it more slippery.


How to rename objects based on LODs in python script? I want to rename objects and their meshes by their triangle counts in a particular collection. The script should identify similar objects and put them in a collection then rename them based on their triangle counts in a format below:
Format:

LOD0: Cube

LOD1: Cube_LOD1

LOD2: Cube_LOD2

LOD3: Cube_LOD3

LOD4: Cube_LOD4
and so on...

LOD0 should not have a suffix.

From:

TO:

import bpy
name = 'Cube'  # case sensitive
collection_name = f'{name}.collection'
i = 0
obj = bpy.data.objects.get(name)
group = []
while obj:
    # this loop assumes you don't have a missing object
    # (e.g. Cube, Cube.001, Cube.003 will not reach to the Cube.003)
    group.append(obj)
    i += 1
    obj = bpy.data.objects.get(f'{name}.{i:03d}')

'''lines 4-12 could be replaced with a single line below, but the line below
will match objects with names 'Cube.000', 'Cubes', 'Cube_copy' etc. as well
as it will go through all objects on the scene, which (rarely) could  be slow'''
# group = [o for o in bpy.data.objects if o.name.startswith(name)]

target_collection = bpy.data.collections.get(collection_name)
if not target_collection:
    target_collection = bpy.data.collections.new(collection_name)
    bpy.context.scene.collection.children.link(target_collection)

def sort_key(obj):
    obj.data.calc_loop_triangles()
    return len(obj.data.loop_triangles)

result = list(enumerate(sorted(group, key=sort_key), start=1))

for i, obj in result:
    obj.name = name + (f'_LOD{i}' if i<len(result) else '')
    for collection in obj.users_collection:
        collection.objects.unlink(obj)
    target_collection.objects.link(obj)

How to put similar named objects into collection in python?
Finding Vertices, Edges, Faces, and Tris using Python


How to avoid noisy renders in Cycles? I know that this question is a bit old or maybe overdone, but I'm running the latest edition of Blender and when I use the Cycles engine I get really fuzzy results and I can't find a simple, non-compromising solution to the quality.  I don't know exactly what I'm doing wrong here, but I'm sure others share my frustration.

Leaving everything in default settings, I started a new project and switched to the Cycles render.  I duplicated the cube and set colors for two Diffuse BSDF shaders, then went ahead and made walls and a floor all sharing the same diffuse shader.  I made two windows to emit blue light.  The screenshot has gaps between the walls because of the setup:

I'm aware that it's considered very incomplete and many have come to terms with some amount of noise, but is this normal?  Furthermore, with default settings or not, I can't change the amount of noise produced.  Supposedly, using "progressively refine" in the rendering tab should make it refine itself indefinitely, however Cycles only counts to 10 refines and then stops, creating a render which is a pixel-perfect match of the ordinary rendering method when it's completed.

I understand that there are tricks that can be used to reduce noise, but at the cost of extra processing time and usually small quality conflicts, like blurring.  My question essentially boils down to is this Cycles' current limit?

Samples:
What you want is the number of Samples.
A Sample refers to cycles firing a "ray" into the scene and returning information based on the color and other properties of objects it interacts with.
E.g. If a ray bounces off a red object and then hits a light source, the corresponding pixel will get a red color.
Also see Why can't cycles cast one ray per image pixel, instead of rendering progressively to infinity?
You can change the number of samples taken per pixel in Render settings > Sampling > Samples > Render:

Increase this value to take more samples and reduce noise. See the manual:

There are two integrator modes that can be used: path tracing and branched path tracing. The path tracing integrator is a pure path tracer; at each hit it will bounce light in one direction and pick one light to receive lighting from. This makes each individual sample faster to compute, but will typically require more samples to clean up the noise.

Progressive refine:
Progressive refine does not change the number of samples, it disables tiled rendering. With tiled rendering each tile is rendered to the full number of samples before starting the next. Disabling this is useful for rendering the entire image all at once, so the user can manually stop the render and get a finished image.
Note that the render will still stop at the number of samples defined in Sampling > Samples > Render using this setting, and rendering the entire image this way is much slower than rendering with tiles.


displaying a powerpoint presentation in the background of a video clip How do I display a powerpoint presentation in the background of a video clip, changing the slides in time with the speaker talking in the foreground? thanks.

Blender doesn't have support for reading powerpoint presentations. However you can save the presentation as a sequence of images and display the image sequence within blender.

In powerpoint choose "Save as" and select an image format.
In blender you can easily setup a plane to display the images with the import image as plane addon.
Adjust the texture to display an image sequence.

You can also find the same settings in blender internals image settings.


Black reflections in cloudy glossy acrylic floor material Okay so I'm building out my scene and before I know it there's these strange reflections in my floor.

So the way my scene is setup is I have three walls, all of them are the same semi-transparent material and I have light panels shooting through them.

The floor is a cloudy, glossy acrylic-like material and I also have a light shooting from below. Let me know if you have questions. I have my floor settings with the Principled shader below.

Blend file here...

The problem is due to your wall material - specifically that you are using Subsurface Scattering on a mesh that is non-manifold.

The Subsurface shader (and the Subsurface element of the Principled shader) simulate subsurface scattering based on the surrounding geometry of that mesh - ie, to determine the thickness of the volume enclosed by that mesh and how the light that hits the surrounding surfaces would propagate through that volume before scattering out of the surface again. For this to work properly requires manifold meshes - otherwise you will get unpredictable results.

In your case you have a single-surface plane for the floor and similar for the wall (albeit with ridges for the beams and edges) - ie, these are non-manifold (meaning that they do not fully enclose a single volume in space).

To resolve this you have two options; either change the wall and floor meshes to be manifold panels, or switch to use a Translucent shader in place of Subsurface (which produces a very similar effect).

I amended your example to replace the Principled shader for the walls with a simple Translucent shader and updated the floor with a material made up of a mix between Translucent and Glossy (ideally you'd also include Fresnel for the glossiness but this is grossly simplified) :

This produces the following result (obviously I'm missing your logo - hence the pink) :

Blend file included

Note : To track down issues like this in the future it's best to start from a copy of your file and remove elements bit by bit until you have a very simplified file that contains just those parts that are causing the problem. For example, remove all the lamps, remove the side walls, remove all but one of the 'light panels', remove each material in turn - checking at each stage whether the problem still exists. Once you've tracked it back to a particular material you can substitute each element with a simpler one until you know the exact setting that is causing the problem (in this case the Subsurface setting of the Principled shader). After that it's a matter of determining under what circumstances the issue causes a problem and, hopefully, this should point to a cause.


(Solved) Trying to Bake Texture from multiple materials - Blender baking UV texture problem I'm trying to bake the lighting onto this scene, I believe I did all the steps correctly, but the texture I get when I press Bake just comes out as these diamond-shaped blobs. I tried to google and look around, but I can't find anything.

The model I'm using was made from just a plane so the bottom of it is hollow, it's all joined as one piece, save for a few point lights I put inside the houses with translucent windows as an experiment. I also have 2 sun lamps and some of the windows are using an emission material.

I checked the normals and they all seem right, I switched on Backface Culling for a second to make sure.

Is there something I'm missing in the baking settings or something? Are there things in the scene that aren't compatible with baking? I've never changed it so I'm pretty sure it's set to the default. I followed a tutorial by Blender Guru and it looks like all the same settings, so I don't know what the problem is.

Thanks for any help.

EDIT:

I added a world color and closed of the bottom of the mesh, the last image is the current baking result and all my settings. A little more of the texture managed to actually bake, but it's grainy and messed up looking.

I added an image texture node to all my materials and this is what I got now lol

EDIT 2:

Okay, so I added the image texture node to all my material and then I selected the actual mesh in edit mode, then I baked it, and it seems to have actually worked. Now I'm just messing with the clamping and the sampling to get ride of the fireflies and graininess and it seems to have actually worked. So problem solved.

add an image texture node to all the materials, select the mesh in edit mode, then bake it


How to disable Auto - Keyframing in Blender 2.8 Yesterday Blender 2.8 was released and it was exciting for me. But when I move the objects in the viewport, a keyframe gets added, which is quite annoying. Could someone tell me how to turn this off? Thanks in advance (:

You need to deactivate the Automatic Keyframe Insertion button: