VSE: No proper Alpha Over for keyed video scene in front of background I'm trying to insert a keyed video in front of a background in the Video Sequence Editor. The video is keyed in the compositor in a separate scene. Then I try to alpha over the scene in front of a background but it won't blend over properly.

It somehow can't handle the areas which aren't completely transparent. How can I fix that?

Here is the blender project: keying.zip
It's just an example though and I would like to use the same technique in projects without static background as well.

Thank you very much ;)

To use the alpha output of the compositor in the VSE first convert the alpha to premultiply.  If your alpha channel isn't already an integral part of the image data you can mix it in using a Set Alpha node.


Can game settings be changed dynamically? I manipulate a game property using logic bricks. I can read the property in the following script and set the value of bpy.context.scene.game_settings.stereo_eye_separation which is changed as long the value is less than 5.0.

Unfortunately, setting this value during runtime has no effect.

Is there any 'update' method I'm supposed to call or another way to apply the changes?

import bge
import bpy

co = bge.logic.getCurrentController()
print( co )
sep = co.owner["eye_separation"]
print( " property:%f" % sep )
bpy.context.scene.game_settings.stereo_eye_separation = co.owner["eye_separation"]
print( "gs.stereo:%f" % bpy.context.scene.game_settings.stereo_eye_separation )

The bpy module is unlikely to have any effect during game play; you should use bge instead. Try bge.render.setEyeSeparation().


Is there a way to take keyframes and snap them to the value of neighbors keys? There was a script I used in Maya, called Snap Animation by Aaron Koressel, what it did was "Takes current selection of keys and offsets it's values so that it lines up with the neighboring key. Very useful for pasting/rearranging animation and keeping your animation relative to it's neighbor. Or snap a key into a hold and have the neighboring animation offset appropriately."
So I could animate, let's say, a character breathing, then paste this animation into another scene with this character, create a pose in a frame before the breathing animation and then select all of the keyframes except the first one (the one with the new pose), and snap that first breathing key to the new pose, and that would automatically also change the other keys by the same amount, making so that I would have the character now in the breathing in the new pose.
Is there a way to snap a key to the previous one like that on Blender?

You use the NLA for this. Maya also has one.
Here's a walkthrough: https://youtu.be/-SQdHehksJw
You animate in your Fcurve. Open a dopesheet window, switch it to ACTION. Set your first keyframe (it doesn't matter where) and name the action: Breathe_1_10 (if you want to identify the duration for your keyframes, this is very helpful as you will produce ACTION clips). When you're done animating, press PUSH to NLA.
Open an NLA window, you will see an unnamed NLA track, double click it. Name it the same as your action (Breathe_1_10) and now your character's OWN NLA will be available to you wherever you port your character with your breathing animation. While in the NLA window, press N, go to STRIP tab on the right side tabs and scroll down to check-animate influence. That's the track's weight influence. If you want it to "CONTRIBUTE" to the animation, set the Active Strip>Blending>Add (alternatively: combine). They are self-explanatory.
Notice, once you enter the NLA, all the animation will be driven by mixing and combining weight Action clips, no longer it will prioritize the fcurve editor.


Uv unwrapping a bent cylinder shape not working correctly Recently I started working on a guitar model and for some extra detail I now want to apply a bump map to the thicker strings to make it look like wounded strings.

Basically they are cylinders ( without the top and bottom faces ) but the unwrapping doesn't work on the whole part of the mesh even though I added seams.

I tried every UV unwrapping option in the menu when pressing U, checked the scale and normals but can't find a proper way to just unwrap everything like the top and bottom parts. If anyone knows how to fix this?

It is hard to tell whether you properly marked the needed seams. Possibly the caps of the cylinder you are using for the strings are still there and alter the way it is unwrapped.

Try the following. Build Curve using a Bezier Curve -> Convert to mesh -> Mark seam along length of the mesh -> Unwrap -> Done


Example of persistent usage of «bpy.msgbus» and how to manage it? I was searching for a way to get notified when the user of my addon interact with for example a particle setting or texture setting. I found out about bpy.mgsbus but there’s literally too little info about it anywhere. Here’s what I found so far:

import bpy

handle = object()
sub_particles = bpy.types.ParticleSettings

def notify_test(*args):
    print("Notify changed!", args)

bpy.msgbus.subscribe_rna(key=sub_particles, owner=handle, args=(), notify=notify_test,)
bpy.msgbus.publish_rna  (key=sub_particles )

This code above is working fine for subscribing to any change user is making in any particle settings change, but how can we make it persistent, meaning being active when the addon is enabled. I am aware that an msgbus is not an handler. I saw an args options=set() from the function bpy.msgbus.subscribe_rna i'm doing some experimentation right now with options={"PERSISTENT"}.

The other issue I have is that the code bpy.msgbus.clear_by_owner didn't work for me as I didn't figure out what's in the args yet. So we could add as a question: How to remove the msgbus once set?  and also we could add How to make sure that the msgbus is not active? as it seems there's also no lists of active msgbus available.  Information we can get from the console:

#CLEAR BY OWNER
bpy.msgbus.clear_by_owner(owner)
.. function:: clear_by_owner(owner)
Clear all subscribers using this owner.

#PUBLISH RNA
bpy.msgbus.publish_rna(data, owner, args, notify)
.. function:: publish_rna(data, owner, args, notify)
:arg key: Represents the type of data being subscribed to
   Arguments include
   - :class:`bpy.types.Property` instance.
   - :class:`bpy.types.Struct` type.
   - (:class:`bpy.types.Struct`, str) type and property name.
:type key: Muliple
Notify subscribers of changes to this property
(this typically doesnt need to be called explicitly since
changes will automatically publish updates).

#SUBSCRIBE RNA
bpy.msgbus.subscribe_rna(data, owner, args, notify, options=set()
.. function:: subscribe_rna(data, owner, args, notify, options=set())
:arg key: Represents the type of data being subscribed to
   Arguments include
   - :class:`bpy.types.Property` instance.
   - :class:`bpy.types.Struct` type.
   - (:class:`bpy.types.Struct`, str) type and property name.
:type key: Muliple
:arg owner: Handle for this subscription (compared by identity).
:type owner: Any type.
:arg options: Change the behavior of the subscriber.
   - ``PERSISTENT`` when set, the subscriber will be kept when remapping ID data.
:type options: set of str.
Returns a new vector int property definition.

The PERSISTENT option doesn't make the subscription remain active when loading files. It is for ensuring that the subscriber remains registered when remapping ID data. Subscriptions will be removed when loading a new file. Persistent application handler appended to bpy.app.handlers.load_post can be used to call bpy.msgbus.subscribe_rna() when a new file is loaded.

bpy.msgbus.clear_by_owner() requires the owner that you've also passed to bpy.msgbus.subscribe_rna() as argument. It will clear all subscribers by this owner.

Below is an add-on that demonstrates the use of the msgbus. It creates a panel "msgbus" with two operators that allow to register/unregister a handler for the message bus. Once registered, whenever the active object changes, it prints information about it to the terminal/console.

bl_info = {
    "name": "Example add-on persistent msgbus",
    "author": "Robert Guetzkow",
    "version": (1, 0),
    "blender": (2, 81, 0),
    "location": "View3D > Sidebar > My own addon",
    "description": "Example add-on that uses msgbus",
    "warning": "",
    "wiki_url": "",
    "category": "3D View"}

import bpy
from bpy.app.handlers import persistent

# For more information see source/blender/python/intern/bpy_msgbus.c
# and https://developer.blender.org/P563

# Object that will store the handle to the msgbus subscription
subscription_owner = object()

def notification_handler(*args):
    print(f"Object: {bpy.context.object.name}, Location: {bpy.context.object.location}, Args: {args}")

def subscribe_active_obj(subscription_owner):
    # What the subscription is for, in this example the active object.
    # Note that for properties it may be necessary to use `path_resolve`
    # as shown in https://developer.blender.org/P563
    subscribe_to = bpy.types.LayerObjects, "active"

    # Subscribe to the msgbus to call the handler when the key is modified.
    # Please note that not every UI interaction will publish an update,
    # despite modifying the key you've subscribed to. For instance, when
    # subscribed to `bpy.types.Object, "location"`, changing the location of
    # an object through the move tool won't call the handler automatically,
    # while updating the location property in the "Tranform" panel in the
    # sidebar will. The publishing of an update can be forced through
    # `bpy.msgbus.publish_rna()`.
    # The "PERSISTENT" option ensures that the subscriber remains registered
    # when remapping ID data, it does not mean that the subscription remains
    # persistent when loading a different file. This can be accomplished with
    # a persistent application handler that is called on file load.
    bpy.msgbus.subscribe_rna(
        key=subscribe_to,
        owner=subscription_owner,
        args=("a", "b", "c"),
        notify=notification_handler,
        options={"PERSISTENT",}
    )

    # Register the persistent handler, ensures that the subscription will happen
    # when a new file is loaded.
    if load_handler not in bpy.app.handlers.load_post:
        bpy.app.handlers.load_post.append(load_handler)

def unsubscribe_active_obj(subscription_owner):
    # Clear all subscribers by this owner
    if subscription_owner is not None:
        bpy.msgbus.clear_by_owner(subscription_owner)

    # Unregister the persistent handler.
    if load_handler in bpy.app.handlers.load_post:
        bpy.app.handlers.load_post.remove(load_handler)

@persistent
def load_handler(dummy):
    subscribe_active_obj(subscription_owner)

class SCENE_OT_msgbus_register_active_obj(bpy.types.Operator):
    bl_idname = "scene.msgbus_register_active_obj"
    bl_label = "Register Handler"
    bl_description = "Register msbus handler for the active object."
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        subscribe_active_obj(subscription_owner)
        return {"FINISHED"}

class SCENE_OT_msgbus_unregister_active_obj(bpy.types.Operator):
    bl_idname = "scene.msgbus_unregister_active_obj"
    bl_label = "Unregister Handler"
    bl_description = "Unregister msbus handler for the active object."
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        unsubscribe_active_obj(subscription_owner)
        return {"FINISHED"}

class EXAMPLE_PT_panel(bpy.types.Panel):
    bl_label = "msgbus"
    bl_category = "Active Object"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"

    def draw(self, context):
        layout = self.layout
        layout.operator(SCENE_OT_msgbus_register_active_obj.bl_idname)
        layout.operator(SCENE_OT_msgbus_unregister_active_obj.bl_idname)

classes = (EXAMPLE_PT_panel,
           SCENE_OT_msgbus_register_active_obj,
           SCENE_OT_msgbus_unregister_active_obj)

def register():
    for cls in classes:
        bpy.utils.register_class(cls)

def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)

    # Unsubscribe and remove handle
    unsubscribe_active_obj(subscription_owner)

if __name__ == "__main__":
    register()

Please note that the message bus doesn't notify for every kind of update.

  The message bus system is triggered by updates via the RNA system.
  This means that the following updates will result in a notification on
  the message bus:

  Changes via the Python API, for example some_object.location.x += 3.
  Changes via the sliders, fields, and buttons in the user interface.

  The following updates do not trigger message bus notifications:

  Moving objects in the 3D Viewport.
  Changes performed by the animation system.

The implementation of the message bus can found in bpy_msgbus.c.


Capsuling a tube shape in a volume I have this node setup :

I want to improve it a bit giving the cylinder light a capsule shape like that :

This shape can be at any side, or both, you choose.

The distance of the red circle to object's bound has to be a parameter or relative to "border distance" node.
Same condition for the size (X axis) of the blue hemishpere.

it could help to have the object's axis (same as world axis) :

Ok, after quite a bit of experimentation, this is what I came up with:

The green group (which is duplicated, because I couldn't get it to work otherwise) creates  half spheres, which I then append to the ends of a cylinder. As of now, changing the node setup is made so that the cylinder is aligned with the Z axis; you can model your object that way, to start, and then rotate it around, remembering not to apply the rotation. Also, changing the Z Cylinder Scale input value in the material allows you to scale the whole construction.

You can get the blend file here.


How to make hair particles (grass) bend on z axis I created a grass animation with hair particles, but I cannot get the grass to bend (on the z axis) it just sways from side to side on the x axis.
  screenshots, more screenshots, link to video.

I have created an empty and assigned a texture to it, then linked the particles through the texture and I can control the animation of the grass through the empty but when I move the empty on the Z axis it just pushes the grass to the side without any bending.

Any help on this would be appreciated. cheers. If you need any more info let me know.

I'm not sure I understand the question completely, but I'll start with some possible solutions:

Hair Dynamics:

Using hair dynamics will simulate the strands with cloth physics,

Some examples with a wind force:
With hair dynamics:

Without hair dynamics:

If you really want to simulate it (Note, simulation probably takes longer and you can most likely do it satisfactorily other ways) you can use a Smoke simulation to get the airflow infromation and then use a Smoke Flow force to use it to effect the grass:

(The advantage to this is that you get all the complex little air currents caused by the cube as the air flows around it to effect the grass)

Texture Force field

I'm not sure what you mean by not bending (Is it not bending in the viewport? or only when rendered?)

Texture force with Dynamics:

And without:


Why does my blender 2.8 not recognize the gpu? I have AMD Radeon R5 M430 in my system and the blender version that I am using is 2.8 still it does not recognize the gpu.

At most of the places it is written that this gpu has GCN 2nd gen. The 2.8 version of blender support 2nd and above generation.

So why is this happening?
Has anyone else faced the same problem?

The Radeon R5 M430 has the GCN first generation micro-architecture and is therefore not fulfilling the minimum requirements for GPU rendering.

  Modell: Radeon R5 M430[158](Exo Pro)

  Launch: 15 May 2016

  Architecture: GCN 1st gen (28 nm)

Requirements for GPU rendering from the manual:

  AMD

  OpenCL is supported for GPU rendering with AMD graphics cards. Blender supports graphics cards with GCN generation 2 and above. To make sure your GPU is supported, see the list of GCN generations with the GCN generation and supported graphics cards.

  AMD OpenCL GPU rendering is supported on Windows and Linux, but not on
  macOS.


How do I make groups in 2.8? In the Blender Guru Donut tutorial he made a sprinkle for a donut. He copied that sprinkle and made a smaller version of it. He Shift selected both and made a group with the shortcut Ctrl+G. When I do the same it assigns both sprinkles into a collection. I have read that the layer system is redone completely. So when I make a group out of the two objects, is it the same as a group and where can I see that group?

Groups and Layers in 2.80 were scrapped and merged into the same thing now for 2.8.
These things are called Collections.
Open an Outliner Editor. Click the "Display Mode" button in the header and select "View Layer" from the dropdown menu.
You can make a new collection by right-clicking and pressing "New".

Then you can rename your new Collection.

Then in the Properties Editor, you assign your collection to be simulated in a particle system.


Temporary animating physical objects I am looking for a way to control physical objects, preferably with an armature, where the bones have variable influence from 100% making objects follow the bones and 0% where physical objects unaffected by the armature.

I have tried to enable Animated option in the rigid body settings, but this does not give an option for a variable influence and the objects jump back to the original position when Animated option is enabled.

Same problem occurs while using object constraints, when the influence changed to 0, the object is displaced to the original location and not following the inertia.

I also have tried applying force to the bone, but then it is not possible to clamp the object/s to the bone/s location.

Look into constraints, they have an influence property that can be animated like this: Keyframing Constraints - Is it possible?

For example you could animate an empty object, and constrain your body with "Copy Location" constraint to it.


Test if the mouse is over any object in the 3D View with python? How can I find out if the mouse is over any object in the 3D View area with Python?

There's no property or function to find it out, there's an example script to find mesh objects under the mouse however. It casts a ray on LMB and selects an object if there is one (only mesh objects and duplis).

You find the script in the built-in Text Editor, in the menu:

Templates > Python > Operator Modal View3D Raycast

AFAIK it can't be changed to also hit objects like lamps and cameras, 'cause they don't have actual faces (they are kind of virtual objects only).

If you tell more about your ultimate goal, we might find a different approach that doesn't require to know whether there's something under the mouse cursor or not.


Braided cord with curve and bevel curve I have here a set of two curves with a bevel object that I have made to have limited clipping issues, but the problem comes about when I want to array the two curves, If I try to array them the bevel object does not carry through effectively to the new arrayed curves, and if I convert to mesh and turn the mesh into a curve to bevel the twist of the sections does not carry over either. Anyone know a fix to this problem?

So always try to spot the repetitive pattern, which seems to be this one:

Recreate it, create a plane, cut it, bevel, cut again:

Move the faces on the Y axis, duplicate and rotate 180°:

Subdivide and clean a bit:

Array on the X and on the Z axis:

Give it a Simple Deform modifier/Bend mode:

Rework the mesh:

Give it a Solidify modifier, a Bevel modifier, a Subdivision Surface modifier, scale on the Z axis, apply the modifiers you want, merge the vertices, etc...


What is a 8, 4, 2 and 1k texture? I read about this for GPU computation and limitation. I don't know what it is...

Those are the sizes of the textures

1K=1024x1024px

2K=2048x2048px

4k=4096x4096px

8K=8192x8192px


How to make a mesh surface that looks like cubes stacked in the shape of a sphere? I want to make a mesh object that looks like the outside surface of cubes stacked in the shape of a sphere. I thought I saw this once, but I can't find it.

The final size will be big (up to 100x100x100 cubes) so I think making a million cubes and merging them (modifier Boolean Union) is going to take quite a while, especially if I have to do it differently for every frame.

As a first step, I've stacked cubes in a hollow spherical shell.

What I really want is just a single mesh object of the outside surface. But for 100x100x100 that's a million cubes to Union. There must be an easier way?
2) if not, how can I select say 20,000 cubes in a "shell" and Union them at once?

Through brute-force application of logic & math & coffee, I guess one could define an algorithm to generate the mesh directly, but I somehow think that I saw this done before in an elegant way. "cubification"? "cubation"?

Here's an example of a small shell that takes about ten seconds to generate. In the picture I've removed the top.

import bpy
import numpy as np

nx, ny, nz = 21, 21, 21
x0, y0, z0 = 10, 10, 10
r1, r2 = 6.0, 7.4

scale = 0.5

x, y, z = np.arange(nx), np.arange(ny), np.arange(nz)

rsq = (x[None, None, :]-x0)**2 + (y[None, :, None]-y0)**2 + (z[:, None, None]-z0)**2
sphere_1 = rsq < r1**2
sphere_2 = rsq < r2**2
shell = sphere_2 * (-sphere_1)    # I love python!

X, Y, Z = np.meshgrid(x, y, z)

ipoints = zip( X.flatten(),
               Y.flatten(),
               Z.flatten() )

points = zip(scale*(X.flatten()-x0),
             scale*(Y.flatten()-y0),
             scale*(Z.flatten()-z0) )

points = [thing for thing in points]  # convert zip object to list (python 3!)
ipoints = [thing for thing in ipoints]

points_shell = [thing for i,thing in enumerate(points)
                 if shell[ipoints[i]]]

for point in points_shell:
    bpy.ops.mesh.primitive_cube_add(radius=0.5*scale, location=point)

One possible way to do this would be to use the 'Remesh' modifier. It has an option to turn the selected object into blocks, though specifying the exact amount of blocks may be a bit difficult.

Here I have a UV Sphere with a remesh modifier set to 'Blocks'. I also added a Subsurf modifier before it so that the surface is smoother for the remesh:

You can use the 'Octree Depth' property to increase the resolution, but it will get increasingly slow when increasing this number.


How change this script to Blender 2.8, who is "use input() or raw_input() functions in blender scripting?" I found such a script in this post
Is there any way to use input() or raw_input() functions in blender scripting?
import bpy
import mathutils as math

# This class is the actual dialog that pops up to create the cube
class AddCubeDialogOperator(bpy.types.Operator):
    bl_idname = "object.add_cube_dialog"
    bl_label = "Add Cube"

    # Here you declare everything you want to show in the dialog
    name = bpy.props.StringProperty(name = "Objects Name:", default = "Cube")
    scale = bpy.props.FloatVectorProperty(name = "Scale:", default = (1.0, 1.0, 1.0))

    # This is the method that is called when the ok button is pressed
    # which is what calls the AddCube() method
    def execute(self, context):
        AddCube(self.name, self.scale)
        self.report({'INFO'}, "Added Cube")
        return {'FINISHED'}

    # This is called when the operator is called, this "shows" the dialog
    def invoke(self, context, event):
        wm = context.window_manager
        return wm.invoke_props_dialog(self)

# This method adds a cube to the current scene and then applys scale and
# name to the cube
def AddCube(name, scale):
    bpy.ops.mesh.primitive_cube_add()
    bpy.context.scene.objects.active.name = name
    bpy.context.scene.objects.active.scale = scale

# Registers the cube dialog to blender so that it can be called
bpy.utils.register_class(AddCubeDialogOperator)

# Calls the menu when the script is ran
bpy.ops.object.add_cube_dialog('INVOKE_DEFAULT')

This scrpt was written for Blender 2.79. I think so. Under Blender 2.8x is running, there is a dialog box, there is possibility to choose scale, but When I press OK, I have such errors:

line 16, in execute

AddCube(self.name, self.scale)

line 29, in AddCube AttributeError: 'bpy_prop_collection' object has no attribute 'active'

AddCube AttributeError: 'bpy_prop_collection' object has no attribute 'active' Line 29 is:

bpy.context.scene.objects.active.name = name
What needs to be changed to make this scrypt work properly under Blender 2.8x

Scene.objects.active is no longer valid
For 2.8 to get or set the active object use
context.view_layer.objects.active = ob

however after an operator call the object has context, so with minimal changes
    def execute(self, context):
        add_cube(context, self.name, self.scale)
        self.report({'INFO'}, "Added Cube")
        return {'FINISHED'}

    # This is called when the operator is called, this "shows" the dialog
    def invoke(self, context, event):
        wm = context.window_manager
        return wm.invoke_props_dialog(self)

# This method adds a cube to the current scene and then applys scale and
# name to the cube
def add_cube(context, name, scale):
    bpy.ops.mesh.primitive_cube_add()
    cube = context.object
    cube.name = name
    cube.scale = scale


Slow parent rotation issue SlowParent.gif (the upload from external links isn't working for me it says "File format unsupported")
The Method

I parented the circle to an empty and rotated the empty a complete 360, then I selected the circle, then I ticked the slow parent option in the relation extras tab and set the value to 7.

The Question

As you see in the gif image, while rotating the scale of the circle changes, which is surprising since I didn't animate the scale. How do I fix it ?

The BlendFile:

Edit:

I tried using Crantisz's solution but unfortunately a whole new problem shows up, the entire circle reverses it's animation at the end if I add a limit scale constraint.

I don't know why the 'Slow Parent' is causing a change in scale - intuitively that just doesn't make sense. Perhaps it's worth logging it as a bug report.

However, you can achieve the same effect using Drivers, using a Scripted Expression to define the relationship between the two objects.

To set this up, right-click the Rotation field in the properties panel (N) and 'Add Driver'. This should make the field turn purple to indicate the presence of the driver.

Swap to a Graph Editor window and change the mode to 'Drivers'.

Select your driver and you should see a variable ('var'). Add a second variable and set each variable to the relevant property in each object. In my example I have each set to 'rotation_euler1' for each of Cube and Empty.

Set the scripted expression to '(var * 6 + var_001)/7 if frame>1 else var_001'. This expression uses a conditional ('if .... else') to set the property to the value of 'var_001' on frame 1 or to the weighted average of 'var' and 'var_001' for any subsequent frame.

NOTE : You may need to set the 'Auto Run Python Scripts' in the User Preferences to enable 'Scripted Expressions' in Drivers if not already set.

This produces the following result :

To get the child to follow the parent more or less closely you can adjust the values in the weighted average. For example, '(var + var_001)/2 is an 'unweighted average', '(var * 2 + var_001)/3' is more weighted towards 'var', (var * 3 + var_001)/4' is even more weighted towards 'var'. To generalise, set it to '(var * A + var_001 * B)/(A+B)' and adjust A and B as desired.

Blend file :


Add an image texture to a shader subgraph I am trying to create a material which uses a texture. That texture is used in a subgraph (I think the technical term in blender is NoedGroup, but Im not sure). The input for that subgraph is the texture name as a string, uv coordinates and some other stuff.

I have a osl script which loads the texture using the texture name and do all the operations needed. The problem is that the script node is not compatible with eevee.

Is there anyway to add the image texture as an input to the subgraph so I can replace the osl script with eevee compatible nodes?

I have check this other answer, but seems to be doing exactly what I currently have.
Select Input Texture file name as parameter/node

Unfortunately there isn't any way to create a NodeGroup that has a Texture selection as an input without some coding to create Custom nodes. For the Custom node, you'd have to have the image texture node in the node tree, whose value you would change via code using the custom node UI. Please read information in the link below for a much more thorough explanation of this process.
Cycles Materials Math node with more than two inputs


Blender 2.79: Issue with Texture Painting The previous model I did had no issues with texture paint, it worked normally, but this time. . .not so much. I've looked through other solutions on here and various websites but I can't seem to fix it.

I've already:

Unwrapped and created an UV Map
Set up my nodes (crtl + T and Shift + crtl + click for textures) and
hooked up my UV map to the Image Texture node. Made sure everything
to the left of that node was set up appropriately. Followed a tutorial to
make sure this was right
Made sure the texture in Tools tab in Texture Paint is off.
Checked slots tab and made sure everything was set up fine.

I can still paint directly on UV Map and when I try to fill the 3D model itself, nothing happens. The oddest thing that just cropped up is that when I paint the UV Map, the preview area becomes completely white. Never had that happen before.

Blender file here.

Any help would be greatly appreciated as I've been trying to fix this for the past day with no luck. I'm also working with the top half, the human half, only.

Found the problem area (due to some help on another forum), which was a slight overlook:


How to cut at the same height I want to use the cutting tool add a new edge just above this doorway. I need the tool to cut at exactly the same height all the way around. I don't want to use Ctrl+R as the loop cut cuts other parts of the building too:

Try the Knife tool, set your view to an ortho side view hit "K" for knife than "Z"(cut through) and "C"(constrain) than draw your edge cut.

EDIT:
Another option could be to select these edges and just right click and select subdivide and than slide that edge by double tapping "G" to move it into position. Creating edge loop cuts is usually easier when you don't have Tris though.


None of my poses save. Every time I pose my characters arms, they reset and go back to a weird form I have been trying to get into first person animating with blender, but every time I try to edit a keyframe this happens: none of my poses save. Every time I pose my characters arms, they reset and go back to this weird form.
https://gyazo.com/46dca4449d15f0395ea69c517dfb0bf9

You have to add keyframes. Drag the line on the bottom to the time you want, then press I on your keyboard. Select the one you need, which is probably rotation. Important: drag timeline before you change the position/rotation and add keyframe.


How can I automatize the separation of flat faces in a geodesic polyhedron? I have these geodesic meshes from the geodesic add-on, every flat face is not made just by the vertices of the border. How can I separate every face as diferent object or linked meshes making them stay in place?

Look at the edges face angle

This answer https://blender.stackexchange.com/a/177913/15543 separates a mesh into all its faces, and makes the face center the origin of the new single face mesh.

Result, all flat regions separated, showing one "face object" in edit mode

Instead for script below, make a bmesh, find all the edges whos face angle is greater than 1 degree and split them.  Note a boundary edge has no face angle

Then pop into object mode and separate into loose parts.  As in prior answer the origin is moved to center of geom of new object, rather than keeping that of old.

Run the script with object of interest active and in edit mode.

import bpy
import bmesh
from mathutils import Quaternion, Vector
from math import radians

context = bpy.context

tol_angle = radians(1) # one degree tolerance of flat

ob = context.edit_object
me = context.object.data
bm = bmesh.from_edit_mesh(me)
edges = [e for e in bm.edges
        if not e.is_boundary
        and e.calc_face_angle() > tol_angle]

bmesh.ops.split_edges(bm, edges=edges)

bpy.ops.mesh.separate(type='LOOSE')

bpy.ops.object.mode_set()
z = Quaternion()
for ob in context.selected_objects:
    print(ob)
    me = ob.data
    mw = ob.matrix_world
    mwi = mw.inverted()
    c = sum((v.co for v in me.vertices), Vector()) / len(me.vertices)
    n = sum((f.normal for f in me.polygons), Vector()).normalized()

    q = z.rotation_difference(n.to_track_quat())
    M =  q.to_matrix().to_4x4()
    M.translation = c
    me.transform(mwi @ M.inverted())
    ob.matrix_world = M

Note the edge split modifier could be added and applied to emulate the edge split bmesh modifier (may be quicker on large meshes). Would need to be in object mode to apply modifier. Still need to be in edit mode to separate loose.


Cloth Simulation deforms before hitting anything, and seems to pass right through the table and plate I've just started learning animation in Blender, and I've come across a problem with the cloth simulation. In the attached picture, I made a table, a plate, and a piece of cloth. The cloth is simply a plane with 50 subdivisions, and I turned on cloth simulation and self collisions. I added the collision modifier to both the table and the plate. When I run the simulation, the cloth deforms before hitting anything, and seems to pass right through the table and plate. Can anybody help? Thanks!

In the future, including a .blend file or a minimal working example script would be ideal because then we can directly diagnose any potential issues.

In lieu of that, here is a minimal working example script using Blender 2.82a with cloth collisions, which you can build upon for your own tests.

If this script is in a file called test.py then you just have to run blender -P test.py from your command line (e.g., this is usually Terminal or iTerm if you're on a Mac OS). Then this will open up Blender, and you can play around with the settings and observe what modifiers need to be present.

import bpy

def clear_scene():
    """Get rid of the starting cube."""
    bpy.ops.object.select_all(action='DESELECT')
    bpy.data.objects['Cube'].select_set(True)
    bpy.ops.object.delete()

def make_meshes():
    """Make Suzanne mesh, with the collision modifier."""
    bpy.ops.mesh.primitive_monkey_add(size=2, enter_editmode=False, location=(0, 0, 0))
    bpy.ops.transform.resize(value=(2, 2, 2))
    bpy.ops.object.modifier_add(type='COLLISION')

def make_fabrics():
    """Make fabric that drops over the Suzanne mesh and collides with it."""
    bpy.ops.mesh.primitive_plane_add(enter_editmode=False, location=(0, 0, 0))
    bpy.ops.transform.resize(value=(3.5, 3.5, 3.5))
    bpy.ops.transform.translate(value=(0, 0, 6.0))

    # Sub-divide into 50, like how you did it.
    bpy.ops.object.editmode_toggle()
    bpy.ops.mesh.subdivide(number_cuts=50)
    bpy.ops.object.editmode_toggle()
    bpy.ops.object.modifier_add(type='CLOTH')

    # Turn on collisions an increase the quality of the steps.
    bpy.context.object.modifiers["Cloth"].settings.quality = 10
    bpy.context.object.modifiers["Cloth"].collision_settings.collision_quality = 5
    bpy.context.object.modifiers["Cloth"].collision_settings.use_self_collision = True

if __name__ == '__main__':
    clear_scene()
    make_meshes()
    make_fabrics()

A few additional comments about the code:

It deletes the starting cube and adds a Suzanne mesh. I figured this would be more interesting, and it also shows how you need to add the collision modifier.
The cloth is subdivided into 50 (like you did) with the collisions on.

Upon running the code, I end up with the following screen recording upon clicking
"Play":

The cloth correctly collides with the Suzanne mesh, as desired, though it slows down a bit. :)


AMD Radeon RX 5700 XT OpenCL Cycles Render 2.91 this is my first time using an AMD card with Blender and I was wondering how I get it to work. When I switch the rendering device to GPU compute and to OpenCL, in blender 2.91, it just crashes. The CPU rending works fine but whenever I try to use the GPU for rendering Blender just stops responding. Am I doing something wrong?

I had this issue for days with Radeon RX 580, today I updated the drivers to 20.12.1 (released in 2020. 12. 04.) and the problem is no more.


move vertex on plane / face I'm being frustrated by this simple task: I want to move the marked vertex, but it's supposed to only move on its surface. Reason being, I want to subdivide the surface into a specific shape. ...Tried for hours, searched online for hours, just couldn't find it out. I assume its more simple than I think it is, but I just can't get it to work. Can you help me?

Thanks in advance!

Change your transform orientation from Global to Normal then grab the vertex with G and restrict it from the local normal Z-axis by holding Shift and pressing Z


What are the light blue lines on my imported objects So recently, I have been noticing neon light blue lines on objects I import, in place of the the normal orange selection lines. Maybe I was supposed to be getting this variant of line before hand or maybe I just somehow haven't noticed it till now. But assumptions aside, I'm wondering what this line is for and how can I get rid of the light blue lines? Also Along with this my objects that are imported seem to  have their faces turn from gray to white.

This means in Shading/UVs those edges have been marked as Sharp:

The Sharp mark is used by the split normals and the Edge Split modifier, which are part of the smoothing or customized shading techniques. As seams, it is a property of edges, and these operators set or unset it for selected ones.

See the manual: https://docs.blender.org/manual/en/latest/modeling/meshes/editing/edge/edge_data.html#mark-sharp-clear-sharp

As for clearing sharp edges, open up the Edge menu (CtrlE) and select Clear Sharp:

In 2.7 versions, this can be done here from the Tool Panel T > Shading:

But this UI doesn't appear to be supremely intuitive (October 2015). it seems you have to click Sharp first before that panel becomes visible.

Here's a script that lets you

Mark selected edges as sharp
Or remove sharp status of a set of selected edges

Code for Object Mode:
import bpy

obj = bpy.context.object
for e in obj.data.edges:
    if e.select:
        # invert current state
        e.use_edge_sharp = (not e.use_edge_sharp)


Painting with combined textures - select texture section to use I have a combined texture (see image inside red box)

Now I know how to paint with just a single texture, however I am totally confused about selecting say the grass from the upper left of the combined texture. I know in many other applications you crop at min and max to define an area of the combined texture to be used, however it does not seem to be working here :\
I have google my head off and usually I find stuff really quick but apparently I do not know the correct terminology for what I am looking for as "Blender Using Combined Textures" fails to return anything useful other than "combining multiple textures into one"
So if someone could point me in the right direction that would be great. I am usually good at this type of stuff but blender has baked my noodle more than once in this endeavor :D

Your UV unwrapping needs to coincide with the image texture you are using. I would select the faces that need to be using a square of the image texture and Unwrap and then Reset, so that they are overlapped squares and with those selected in the UV Image Editor, scale and rotate to place them over the desired image portion - repeating the process until the unwrap is using the image the way you intend.


why is add skin data used in skin modifier? I found it always inactive we find an inactive button in skin modifier named add skin data what is it used for?

It's used in a very specific cases when you change mesh data on object with Skin modifier (from dropdown if you select other mesh data in Data tab). Then you click this button so Skin modifier updates. Was added after this issue (link).


I use physics to find the position of the objects, but then I can't save and go on beginner here :-)
I am trying to use rigid body physics to set objects' initial position. At first I was puzzled because I got to the end of the animation and could not even change the material or the color of the objects. Then I understood that I had to do that at the beginning, or "bake the animation", which I did and this allowed me to change the final position and few other things. However... I must be doing something wrong. In fact, I need to adjust the position of the objects to my liking, and I do so by rotating and moving the objects one by one. Many light bulbs are in the wrong position because I am using CAPSULE instead of MESH to speed up the process. So I must tilt the position by hand. However, and this is my problem, once I adjust the final position to my liking, if I save the file, and then open it, I find the objects in the position they were before my adjusting it. Even worse, if I render the scene, the position does not reflect my adjustment.
I am attaching an image of the problem. You can see that in the viewport the position of the light bulbs in the foreground has been fixed, but in the final render they are wrongly placed horizontally.

There are lots of issues in your file - this is not really a solution, but a start from which you should begin - in my opinion.
First - please watch tutorials about rigid body physics. I am assuming, that this is one of your first rigid body physics animations because you made a lot of things which an experienced user would not do.
What do i mean with that?

your objects aren't really separated (which is a situation which does not exist in reality) so some of your objects are overlapping at the start of your simulation. So what should Blender do with intersecting objects? Well...Blender does weird things with it, it is like dividing through 0 -> you can't do it. And in reality things do not overlap.

your objects have much too high subdivisions which isn't necessary for such an easy object. You should try to use as less subdivisions as possible, because more subdivisions mean: more used memory, less performance, more thing to calculate for Blender.

if you do not have basic shapes you always should use mesh as collision objects, else the physics looks weird and not realistic

start using physics with ONE object and check out whether it works. Then add more. Check performance. If it slows down dramatically as in your case, you did something wrong (too much subdivisions in your case). you can decrease your subdivision by using a remesh modifier.

decrease the margin for the collisions to 0, else it won't look really realistic.

Really watch or read tutorials/books/manuals about blender and rigid body physics. Learn from others instead of trying out yourself because it will save you lots of time. Blender is - in my opinion - not intuitive, but an amazing too. Lot's of people went to the problems you now have - learn from them and save time.

if you did all this - you don't have to manually move your objects, because they will fall down physically correct and realistic. and in a reasonable speed.

you did not apply transforms


Mantaflow. Bake Mesh does nothing I've been trying to find an answer online but it seems like the problem only happens to me :) The fluid simulation works well up until i try to bake mesh. This never results in any mesh, it takes time to bake but nothing gets added. The only thing that changes is that the bounding box automatically changes size to surround the particles as they move. I hope someone know what I've done wrong. / Alex

No mesh just bounding box.
Isn't that because you have set under
Object Properties > Viewport Display > Display as > Bounds?

BTW - What happened to me (when I tried to confirm your issue) is that mesh was generated just around particles. In that case - Save your file first.
Under 2.92 if you change Resolution, Simulation method or probably any parametr which restarts cache should solve it as well.
In 2.83 LTS it was't even possible run simulation without saving a file.


How to unhide hidden objects with a Python script? Here are a few objects that I have hidden:

I am using the script below to make them visible:

bpy.ops.object.hide_view_clear()

but it does not help.

So what is the perfect script to make them visible?

As of Blender 2.81, Object.hide_set() is working properly and seems to be the equivalent of Object.hide property in 2.7x versions.

Proof using the console:

>>> bpy.context.object.hide_set(False)

To unhide multiple objects you can run over objects in the scene and call the setter per object:

for o in ("Cube", "Camera", "Light"):
   obj = bpy.context.scene.objects.get(o)
   #if obj: obj.hide_viewport = False
   if obj: obj.hide_set(False)

You can also iterate through any given collection:

col = bpy.data.collections.get("Collection")
if col:
   for obj in col.objects:
       obj.hide_set(False)

Whatever you like...


Why is the ring of vertices not complete? I'm a beginner at blender and I'm trying to make a donut with icing with this tutorial: https://www.youtube.com/watch?v=f5Gb1VK98Wc&t=456s . At 33:30 He shows how to make a curvy edge to the icing, but I can't seem to make it work. He shows how to hide the top of the icing so you end up with one outer and one inner ring of vertices. But when I do this my outer ring is not complete. It's missing one line between two vertices. Should I just simply add a line between these two? And if so, how? Anyone who can tell what I've done wrong?

I think I know what you did. You had a vert or an edge of the line selected and then added the stuff you wanted to hide with box select. The previous selected vert or edge was also still selected.

You could have hit A to deselect it before the box select.

What you just need to do now is press Alt-H to unhide everything (or Mesh -> Show/Hide -> Show hidden), do your selection again and hide it again.


How to remove object of type FONT in Blender Python I want to clear a scene's master collection in order to ensure I am working with an empty collection before I run my script which will build the scene for me.

I search for answers on how to achieve that and they suggest selecting all desired objects and triggering the deletion operation with that selection. I attempted to adapt that code, but found that the object of type FONT actually lacks the select property/attribute and as a result I can't include my Texts in the selection to clear them.

# Clear all objects in the master collection to reset to a blank scene
for object in bpy.data.scenes[0].collection.objects:
    print(object.type)
    if hasattr(object, 'select'):
        object.select = True

bpy.ops.object.delete()

Is there an alternative way of selecting Texts? Or even better, can I clear the collection completely without "macroing" it by creating a selection and calling the delete operation?

Upon inspecting what sort of options there are using the Autocomplete function, I found unlink:

# Clear all objects in the master collection to reset to a blank scene
for object in bpy.data.scenes[0].collection.objects:
    bpy.data.scenes[0].collection.objects.unlink(object)

This clears all the objects from the collection, Text or not.


Curve modifier -applying Nurbspath displaces the object I have attached a blend file with tunnel and path objects.
When I apply object for curve modifier ie Nurbspath, my tunnel moves to a totally different location.
I have checked all my settings and can't find the source of the problem..

The curve modifier is complex and it takes some playing with it to get used to how it works.  Start by looking at how your objects are orientated in space.

In object mode, the curve is orientated with its X-axis along the global negative Y-axis and the Y-axis along the global X-axis.

Examine the curve in edit mode.  Your curve is oriented along the Y-axis with the curve normals along the X-axis.

In object mode, apply (Ctrl + A) the curve rotation.  Now the object's Y axis points along the curve and the object's X-axis points along the curve's normals.

The tunnel object is also rotated.  Apply the rotation so the tunnel points along the positive global Y-axis.

Now add the NurbsPath to the Curve modifier and set the deformation axis to Y.  The tunnel is deformed along the curve, but the roof is lying on the X-axis.  The curve thinks the X-axis is 'up' because its normals point in this direction.

Select the curve and tab into edit mode.  Select all of the control points and adjust their Tilt by 90 degrees (Ctrl + T, 9, 0).

Now you can adjust your curve's control points to make a nice, smooth tunnel.  Hint: turn on the Merge option on your array modifier.


Curves not showing direction in edit/object mode I'm importing roads from OpenStreet Map. They are imported as curves. However, these curves seemingly do not have direction. I have tried to change them to Bezier curves and "switch direction", but these do not work.
What can I do to display/set the directions of my curves?

2D curves have no normals.
For 3D curves enable show normals in the overlays section.


Why do weird edge lines appear connecting vertices that are not corrected the same way in Blender show up after render? I am extremely new to blender, and have a very basic idea how to use the tools to create models for games I would like to make. I am in the middle of making a simple pizza slice, and all went well during the creation, but when I exported to a .FBX file, the resulting model had weird glitch-looking lines where the "mushrooms" on the pizza slice are. I hope that someone out there more knowledgeable than me can explain the issue to me so I know for the future, as I have only watched two tutorials to learn the complete basics. Thank you!
Here are the images while in blender:

Here are the images in Microsoft's 3d viewer (it's kind of hard to see as I texture the models when I get into the game engine):

P.S. I only screenshotted one of the mushrooms on the slice, but both are having the same issue that I tried to describe.

I was able to fix it by doing research on the topics you gave and found that triangulating the objects fixed it by adding more geometry. The steps were to select the object/mesh, go to edit mode, and press CTRL+T.


Particle System Dupli Object's Children Not Rendered I have a model which consists of a few levels of parent/child relations, with a single common ancestor P at the top. I'd like to set up a particle system which emits instances of the whole model, but when I set the dupli object to P, it emits only P.

It's going to get ugly if I have to join all of the objects into a single mesh.. Is it possible for a particle system to emit a parent with all of its children?

Group all the objects and under the particles render tab set the render to Group and check whole_group.


How to fix "Fake_module : Addon missing 'bl_info' give bad performance!" I download new Blender 2.77 RC1, when i open console, this errors show up, please help me how to fix this ???

It means that you have a few non add-on python files in the following locations:

C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\raw_script.py

and

C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\2.77\scripts\addons\tt_operators.py

You can tell that these files aren't add-ons because they don't include a bl_info somewhere at the top. A bl_info would look something (but not exactly like)

bl_info = {
    "name": "Some Add-on Name",
    "author": "something",
    "version": (0, 5, 6, 6),
    "blender": (2, 7, 2)
}

these are from a failed installation of the TubeTool add-on, and can be safely deleted.


Slice up terrain mesh into chunks I have terrain (ANT Landscape plugin) that I would like to cut up into chunks (don't need to be equal size) for a game engine so that I can do occlusion culling /  or load and unload chunks around the player.

I am trying the knife project feature that I saw in the answer here but it doesn't work for my terrain mesh (using the terrain plugin).

I also tried some answers here that contain some Python scripts, but couldn't get them to work.

Any ideas of how I can cut the mesh up quickly in to chunks.  I've been doing it manually so far, but it takes forever to do as some terrains can be rather big. I don't mind having to do a little clean up of the mesh after.

Picture below shows the knife project method (following instructions from linked answer).

Thanks

Edit:

Example of mesh (terrain is usually much large than this) that I am trying to break into chunks.

How I am manually doing it.

Blend file that contains terrain and grid for the knife projecting method.

Script Version.

Displaced dense grid mesh split 2 in x, 2 in y.

Since the map is one continuous mesh and you wish to split into a grid, have used a modified version of @Codemanx's answer

Splits the mesh into chunks, locally using bounding box.

Run script in object mode.

Edit x_segments, y_segments, z_segments to suit.

import bpy, bmesh
from bpy import context
from  mathutils import Vector
# bounding box helper methods
def bbox(ob):
    return (Vector(b) for b in ob.bound_box)

def bbox_center(ob):
    return sum(bbox(ob), Vector()) / 8

def bbox_axes(ob):
    bb = list(bbox(ob))
    return tuple(bb[i] for i in (0, 4, 3, 1))

def slice(bm, start, end, segments):
    if segments == 1:
        return
    def geom(bm):
        return bm.verts[:] + bm.edges[:] + bm.faces[:]
    planes = [start.lerp(end, f / segments) for f in range(1, segments)]
    #p0 = start
    plane_no = (end - start).normalized()
    while(planes):
        p0 = planes.pop(0)
        ret = bmesh.ops.bisect_plane(bm,
                geom=geom(bm),
                plane_co=p0,
                plane_no=plane_no)
        bmesh.ops.split_edges(bm,
                edges=[e for e in ret['geom_cut']
                if isinstance(e, bmesh.types.BMEdge)])

bm = bmesh.new()
ob = context.object
me = ob.data
bm.from_mesh(me)

o, x, y, z = bbox_axes(ob)

x_segments = 2
y_segments = 2
z_segments = 1

slice(bm, o, x, x_segments)
slice(bm, o, y, y_segments)
slice(bm, o, z, z_segments)
bm.to_mesh(me)

bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.separate(type='LOOSE')
bpy.ops.object.mode_set()

See this answer re boolean chopping https://blender.stackexchange.com/a/133136/15543 Note: May not work correctly if modifiers are on object being sliced


Blender 2.8 more gizmo! I like the new gizmos in Blender 2.8!

I would like to see them more often while working. But I’ve been using Blender for a long time and I use shortcuts. For example, “R” key for rotating and “G” key for moving. When I use shortcuts, gizmos don’t work. I tried to configure shortcuts for gizmos, but nothing changed.

So now: I choose Cube - press “R”, “Z” - rotate the mouse or choose the needed figure - confirm the operation.

What I want: I choose Cube - press “R”, “Z” - rotate the mouse or choose the needed figure and here the needed gizmo appears from the T-board from the left (if I press “G”, the gizmo of moving appears) - with all this going on when I’m rotating the mouse, the gizmo is changing after the mouse or figures I press.

I would be thankful for your support and I’m waiting for your help :)

From what I understand, yes it would make sense to make the gizmo appear when you press G, R or S, but it doesn't seem to be the case, you need to click on the Move, Rotate and Scale button on the Tools panel, which is a bit tedious.

One thing that is useful to know though is that you can choose to have the gizmo always displayed when you click on the gizmo's options on the bottom. In my opinion it's much more natural to keep it anytime like it was the case in 2.7.


How to make a particle slide across a mesh? I was trying to create a tear drop effect and I'm using particle system and dynamic paint for this and the face of my character is a sphere(for now ;) ) and I want the tear drop to generate and slide along a vertex group in the sphere and along with make a trail of tear.The trail thing did appear because of dynamic paint although it appears really weird for now.But my another concern is the particle(supposed tear drop) jumps from the mesh.This is even more vivid when looked from the side.So,what I want is the particle to slide along the vertex group.Can anyone please suggest me about how to achieve this? Thanks in advance.

On the surface you want the drop to stick, enable physics collision. Then increase the stickiness value to keep it on the surface, a value of 1.0 will stop it bouncing off the surface as it hits.

You may also want to increase the friction factor to slow down the particle as it slides along the surface.


Recover Context after redraw Calling context.area.ui_type = 'IMAGE_EDITOR' succeeds before redraw.
After redrawing using bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1) it fails, with the error:
AttributeError: 'NoneType' object has no attribute 'ui_type'
How can I restore the context so that area is not NoneType ?

The solution was to Override the Context
Before calling redraw, create the override
override = context.copy()
After redraw, set the area on the override instead of the context object
override['area'].ui_type = 'IMAGE_EDITOR'
Any bpy.ops.* calls must pass the override as the 1st argument eg:
bpy.ops.image.save_as(override, filepath = fileName)


Blender 2.8 DECALmachine PIL not installing on Windows I've been trying to get PIL to install via the DECALmachine addon. I've ensured that my Python on my Windows machine is up to date: Python 3.8, PIP upgraded, PIL installed. I know that Blender uses its own Python.exe. Is there a way to get Blender to use my machine's Python? I haven't been able to find where the PIL DLL is install to attempt to move it inside the Blender bin folder.

I've ensured that all my Blender Foundation (and below) allow not only my user account by Admin account have total access via the Properties. I've run Blender in Admin mode and clicked the Admin options to install PIL inside the Addon DECAL interface, nothing turns the checkmark to green.

The first error I get is:

Ensurepip: C:\Program Files\Blender Foundation\Blender 2.82\2.82\python\lib\ensurepip False

I've confirmed this module is installed properly.

Has anyone else dealt with this?

Thank you in advance.

Blender doesn't use your system's Python interpreter by default. That would require the use of --python-use-system-env in Blender 2.82 and later (see this answer for more information). Additionally your system's Python interpreter and modules would need to be compatible with the version Blender expects. Blender 2.82 use Python 3.7.4.

While it's unclear why DECALmachine fails to install Pillow, it shouldn't be necessary to use your system's Python interpreter. The script below will try to install the package and import the module.

Start Blender and open the Scripting workspace
Create a new text block (Text > New)
Copy and paste the script into the text editor
Open the console (Window > Toggle System Console)
Run the script and check the output of the console for errors.

import bpy
import os
import ensurepip
import subprocess

try:
    import PIL
except ImportError:
    # The import failed, therefore we check that pip is available and attempt to install the package.

    # ensurepip.bootstrap() also calls pip, which adds the environment variable PIP_REQ_TRACKER. After
    # ensurepip.bootstrap() finishes execution, the directory doesn't exist anymore. However, when subprocess
    # is used to call pip, in order to install a package, the environment variables still contain
    # PIP_REQ_TRACKER with the now nonexistent path. This is a problem since pip checks if PIP_REQ_TRACKER is
    # set and if it is, attempts to use it as temp directory. This would result in an error because the
    # directory couldn't be found. Therefore, PIP_REQ_TRACKER needs to be removed from os.environ.
    ensurepip.bootstrap()
    os.environ.pop("PIP_REQ_TRACKER", None)

    # Try to install the package. This may fail with subprocess.CalledProcessError
    subprocess.run([bpy.app.binary_path_python, "-m", "pip", "install", "Pillow"], check=True)
    import PIL

print(PIL.__version__)

A more generic version that allows install packages in a simple way:

import bpy

def ensure_and_import_module(module_name, package_name=None, global_name=None):
    """
    Ensures that the required package is installed and imports the module. It will attempt to install the package
    through pip if the import of the module fails.
    :param module_name: Module to import.
    :param package_name: (Optional) Name of the package that needs to be installed. If None it is assumed to be equal
       to the module_name.
    :param global_name: (Optional) Name under which the module is imported. If None the module_name will be used.
       This allows to import under a different name with the same effect as e.g. "import numpy as np" where "np" is
       the global_name under which the module can be accessed.
    :raises: subprocess.CalledProcessError and ImportError
    """
    import os
    import sys
    import importlib
    import ensurepip
    import subprocess

    if package_name is None:
        package_name = module_name

    if global_name is None:
        global_name = module_name

    try:
        # Attempt to import the module and assign it to globals dictionary. This allow to access the module under
        # the given name, just like the regular import would.
        globals()[global_name] = importlib.import_module(module_name)
    except ImportError:
        # The import failed, therefore we check that pip is available and attempt to install the package.

        # ensurepip.bootstrap() also calls pip, which adds the environment variable PIP_REQ_TRACKER. After
        # ensurepip.bootstrap() finishes execution, the directory doesn't exist anymore. However, when subprocess
        # is used to call pip, in order to install a package, the environment variables still contain
        # PIP_REQ_TRACKER with the now nonexistent path. This is a problem since pip checks if PIP_REQ_TRACKER is
        # set and if it is, attempts to use it as temp directory. This would result in an error because the
        # directory couldn't be found. Therefore, PIP_REQ_TRACKER needs to be removed from os.environ.

        ensurepip.bootstrap()
        os.environ.pop("PIP_REQ_TRACKER", None)

        # Try to install the package. This may fail with subprocess.CalledProcessError
        subprocess.run([bpy.app.binary_path_python, "-m", "pip", "install", package_name], check=True)

        # The installation succeeded, attempt to import the module again
        globals()[global_name] = importlib.import_module(module_name)

# Make sure that Pillow is installed and PIL can be imported
ensure_and_import_module("PIL", "Pillow")
print(PIL.__version__)


How to find which materials use a missing texture? Menu command File > External Data > Report Missing Files gives output such as:

Warning: Path '/foo/sometexture.jpg' not found

How do I discover which materials use that texture?

Or, is there a way to get a list of materials that have missing textures?

Update: I'm specifically interested in Cycles materials.

For blender internal materials that is easy. Enter the image name into the find field in the outliner header. Matches will be highlighted in green with material and objects easily visible for each.

For node based materials it is a bit more complicated. While the information can be found within the Datablocks view of the Outliner it is fairly well buried and not practical to find for a large project.

Currently the easiest way to search multiple cycles materials would be to use an addon called Online Material Library(cycles materials only - not blender internal node materials). This addon is currently still considered Beta. While not included with official release builds you should find it included with custom/svn builds from graphicall or can be downloaded from the above link and installed from the preferences addon panel.

Step 1 - activate the addon (or install from file and activate)

Step 2 - Show tools. This will now be available under materials properties.

Step 3 - Save All materials.

This saves all the cycles materials in the current blend file into the folder specified above the Save all materials button. The node information used for each material will be saved into it's own file. This leaves you with a folder full of text files that can easily be searched to find the image filename you are looking for.

While it doesn't appear to have been updated for a while blender-aid may also be another option.


How can I sort vertex positions sequentially indices in a closed area? I need to sort the vertices sequentially to make an effect, something like this video. I know I should draw them by hand, but sometimes when I subdivide edges, vertex indexes will change.
The vertices in the below image are correct.

For example, vertices in the below image are sorted randomly. Can you sort them sequentially?

I tried to sort them along the x-axis or z-axis, but it didn't work.

Please consider that your solution should work for complex shapes:

Sorting vertex indices.
Answer here https://blender.stackexchange.com/a/36619/15543 shows how to sort vertex indices using bmesh.
Answer here How to order a list of vertices based upon position?  goes some way to show how to walk the edges for an order.
To be sure to be sure would walk the edges as shown above until the first vert is re-encountered (since its a loop) and use this for the order.  Will leave it up to you to piece together the script from what is here
As demonstrated in @Leander's answer
Shortest Path
Using the script from What is the bmesh equivalent to bpy.ops.mesh.shortest_path_select()? could select edge as link between first and last index vert, temporarily remove it, find the shortest remaining path (the only path) from edges two verts.  Reinstate the edge.
Face winding order
Instead for a closed loop like above, contend can fill with an ngon, use the ngon face verts as order (the winding order) re-sort the verts and remove the ngon face created.
import bpy
import bmesh

ob = bpy.context.object
assert ob.type == "MESH"
me = ob.data

bm = bmesh.from_edit_mesh(me)

f = bmesh.ops.contextual_create(
        bm,
        geom=bm.verts[:] + bm.edges[:],
        )["faces"][0]

for i, v in enumerate(f.verts):
    v.index = i
bm.verts.sort()
bm.faces.remove(f)

bmesh.update_edit_mesh(me)

Select a first vert and clockwise or counter
To select the zeroth vert, and ensure anticlockwise (from top view) indexing
Run in edit mode, select the vert you wish to have index 0.  Assumes the shape lies in the XY plane.  If the normal of the created face points down the winding is flipped.

Random order, vert 22 selected, script below run
import bpy
import bmesh
from mathutils import Vector

ob = bpy.context.object
assert ob.type == "MESH"
me = ob.data

bm = bmesh.from_edit_mesh(me)
v0 = bm.select_history.active
f = bmesh.ops.contextual_create(
        bm,
        geom=bm.verts[:] + bm.edges[:],
        )["faces"][0]

fverts = f.verts[:]

if f.normal.dot((0, 0, 1)) < 0:
    fverts.reverse()

for i, v in enumerate(fverts):
    v.index = i
    if v is v0:
        iv0 = i

for v in fverts:
    v.index = (v.index - iv0) % len(fverts)

bm.verts.sort()

bm.faces.remove(f)

bmesh.update_edit_mesh(me)


Clear Blender BVH Cache A lot of times when I'm rendering in Cycles, I enable BVH caching to speed up my render time. The only downside to doing this is that in scenes with high geometry my hard drive fills up quickly.
Is there some sort of solution to clearing the cache at the end of the render?

Here's a simple add-on that'll clear the BVH cache.
It's a one-click process that works quite nicely! Enjoy!

https://github.com/gbolet/BlenderCacheManager


how could i compile and update dependencies automatically? I find this custom driver on templates / python / driver_functions
and I did it run.
But I realize that always I close and reopen the file, it need to be compiled and updated in the driver.
I try this but it doesn't compile in the open file and also I don't know how to update all dependencies after
import bpy
import os
import sys

if __name__ == "__main__":
    path = "F:/fILES/proyectos/bpy_study/Scripts"
    fname01 = "driver_functions.py"

    if path not in sys.path:
        sys.path.append(path)

    file01 = os.path.join(path, fname01)

    exec(compile(open(file01).read(), fname01, 'exec'))

It was easy to do, just turn on the checkbox register in Menu/ Text/ Register
and the next time to open blender it is run automatically


Lamp Posts: correctly oriented instances on a 3D curve I'm trying to create a row of street lights, both the lamp pole and a spot light. Since i can't simply join these two and use an array + curve modifier to set this up (using an array modifier + a curve modifier always deforms the mesh) so i came to the conclusion that working with collections and instances would be my best bet.

To get to my current result i parented the spot to the lamp mesh. Then i parented those two objects to a plane. after that i parented the plane (and so also the lamp mesh and the spot) to a curve that i converted to a mesh. I then activated Instancing for the curve with verts which resulted in something like this:

As you can see the lamps all face the same direction, while i want them to be rotated inwards. There's an option for 'aligning the objects to vertex normal'

but enabling this exposes a multitude of problems:

Problem 1: it turns out there's two instances of every object. (i have no idea why)
Problem 2: the street light meshes get deformed.

Problem 3: the actual lights all face toward the same place

 (I drew over the lamp directions with blue arrows for visibility)

If anyone knows how i can get this to work i'd really appreciate it, but other techniques are welcome too.

You almost got it. You can do it by using an array + curve modifier, you just need to use the plane as an instancer.
Select the plane, add an array modifier and set the length to "fit curve", and set your curve.
Add a curve modifier, set it to your curve again.
Make sure to parent the lamp post to your plane, then go to the plane's object properties and select "Faces instancing". Here you go :

Note that this will not work well if you use a 3D curve.
How to tweak the workflow for a 3D curve :
Instead of using a simple plane for the array + curve combo, use an elongated plane in the Y axis.

Then after the Array and Curve modifiers, add a Weld modifier and tweak the distance until the vertices in the local X axis merge. You should now have a series of segments, with both vertices of each segment on the same XY plane. These segments follow the 2D curvature of the curve object.

Add a Screw modifier on the X axis, set the angle to 0°, the steps to 1 and the screw property to a small value.

Now enable instancing on faces.


Natural movement to polygon Hair I'm trying to make a polygon type hair, which moves as naturally as in the first gif, but it doesn't see like it and it doesn't stay in its place, (I used the softbody for the hair anyway) is there a way to get a more natural movement?

There is something wrong with how you weight painted the mesh. If I remember correctly, if you weight painted it at "the roots", the part of the mesh that is not weight painted should move. Or it could be the other way around. So just to be sure, here are some videos to help you out on the softbodies issue.

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

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

Hopefully, these videos can lead you into the right direction.


How to render separate monochrome layers? I have this logo:

.blend file: https://www.dropbox.com/s/1bib5ds8oufc9s9/logo.blend

The thing is I'm trying to make it lasercut. My lasercutter supports two colours - that is black and white (monochrome).
So, with the above logo I made it monochrome in Photoshop:

As you can see, no matter how I try, the logo will not actually work (the text is not readable)

But, this can be repaired by rendering each part of the logo black or white. For example, the background splodge could be in places white, and where there are the holes, black.

Then each of the circles could have an outline of black and the text could appear white, but to create the tilt effect, the sides of the text could be in black.

As you can see, I am trying to make the text visible by making certain parts black and some white. I could change the material colours in Blender, or something, but then it will do a gradient, which is the issue.

Thank you for reading my essay! ;) And I look forward to hearing from answers

Actually, monochrome effect can be easily done by ColorRamp node:

To your question:

As you mentioned, it seems that the only problem now is the tilt/side area on the text. I suggest to consider taking the advantage of Material Index here:

To do so:

First, convert the Text objects to mesh (Shortcut is AltC. You may want to remove doubles and correct normal directions after that);
Select all sided faces, then assign a new material to the selection (even can be the exact duplication as the original one, if necessary);
Set a different Pass Index value in setting of this material;
Toggle Material Index passes in Render Layer setting for outputting. You can then use it to separate the tilt/side area and have it controlled separately.

If you don't want to do it for compositing use, using plain materials with Shadelss toggled can also be an easier way:

UPDATE:

Inspired by gandalf3's cool answer, here is the option for outlined result, also with more control by ColorRamp.

You may also consider to generate outlines by FreeStyle, though relatively inefficient and less flexible in this case.


Replace ivygen leaf cards with custom leaves is there anyway to replace the leaf cards that ivygen generates with custom modeled and textured leaves (a group) but keeping the original orientations of the leaf cards from ivygen?

Most often you don't want to do that: think about the amount of polygons that would be. (You could kinda get away with it if you work with Ivygen at a small scale. Good luck with doing it with a tree in the Sapling add-on...)

The smart way as long as the camera is far enough to get away with it is to alpha map the leaves. (I believe they are UV unwrapped by default, I could be mistaken.) This reduces the poly but gives you a greater amount of detail.

If you want an example of this technique out in the wild, have a look at this piece from blenderartists: http://blenderartists.org/forum/showthread.php?382855-Fairytale-Village

If the camera is too close for a pure alpha map, you may want to use dupliobject (and specifically duplifaces) to give it some depth. These approaches can be mixed: the exact outline of the leaf can be done using alpha maps to save on polygons. For duplifaces, see here: You could use dupliobjects. See here: http://wiki.blender.org/index.php/Doc:2.4/Manual/Modeling/Objects/Duplication/DupliFaces


How can I prevent boid particles from intersecting? I'm currently doing some proof-of-concept work for a Lego-style music video with a rock band on a stage in front of an audience. My idea was to use boid particles to simulate the crowd but I'm already facing several fundamental problems:

What do I have to do to actually prevent my boid meshes from intersecting? Even when I set the "personal space" to the maximum, my minifigs are still moving through each other... (and I've got both "Separate" and "Avoid collision" in the boid brain) - I already tried adding a force field to each particle but, while this indeed causes the particles to repel each other, repelled boids will then still be pushed through other boids.
I want the crowd to generally "gravitate" towards the stage side of the arena, but not towards a specific point (though the attraction should probably still be a little stronger near the center). I already tried using a stretched cube mesh (with applied Scale) with a boid force field with the shape set to "Surface" but the boids still only move towards the origin of the goal object. How would I accomplish a more general tendency to keep moving in a global "direction" rather than toward a point?
How do I get the boids to (mostly) keep facing the stage and not turn away from it so much when moving around? So far, I tried a Locked Track Constraint on the particle meshes but, while this does make a difference compared to not having that constraint, the audience is still nowhere near as "focused" on the stage as I would like them to be.

I'm starting to wonder whether boids really are the way to go for this.

Update: Looks like I've kind of solved two out of those three (I will post the solutions as an answer later in case anyone else stumbles across this). What remains is the issue with particle/mesh intersection.

You can use CrowdMaster to simulate the stadium correctly. You can view a nice example of this kind of scene in this video: https://www.youtube.com/watch?v=kmjfbEGzX6M


Combining both Bevel Tools in to One (Edge Bevel and Vertex Bevel) Currently in Blender you have two bevels:

-Ctrl+B (for edges and faces)

-Ctrl+Shift+B (for vertices).

I was trying to create an operator that will identify what mode you're in and activate the appropriate Bevel Tool.

I bound this script to a hotkey and it actually works, HOWEVER, it applies the bevel instantly without giving me the interactive mouse drag for offset and scroll wheel to change segments.

QUESTION:
How can I activate the interactive version of the bevel tools from the operator script?

My current script:

import bpy

def main(context):
    #for ob in context.scene.objects:
        #print(ob)
    toolSettings = bpy.context.tool_settings
    if toolSettings.mesh_select_mode[1]:
        print('Edge Mode Active')
        bpy.ops.mesh.bevel(offset=0.48369, offset_pct=0, vertex_only=False)
    elif toolSettings.mesh_select_mode[0]:
        print('Vertex Mode Active')
        bpy.ops.mesh.bevel(offset=0.537019, offset_pct=0, vertex_only=True)

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

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        main(context)
        return {'FINISHED'}

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

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

if __name__ == "__main__":
    register()

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

Thanks to some outside help I found the commands I needed to activate the interactive version of the bevel tool from the script.

It's wrapped around an operator so it can easily be mapped to the "B" key for example.

import bpy

def main(context):

    toolSettings = bpy.context.tool_settings

    #Are we in Vertex Mode?
    if toolSettings.mesh_select_mode[0]:
        bpy.ops.mesh.bevel('INVOKE_DEFAULT', vertex_only=True)

    #Any other Mode...
    else:
        bpy.ops.mesh.bevel('INVOKE_DEFAULT')

class SmartBevel(bpy.types.Operator):

    """

    [Smart Bevel]

    Description:
    You no longer need 2 separate hotkeys to bevel vertices or edges/faces.
    Simply map the command to something like the "B" key under "3D View / Mesh / Mesh (Global) / Add New Keymap".

    Command:
    arc.smart_bevel

    (www.armoredColony.com)

    """

    bl_idname = "arc.smart_bevel"
    bl_label = "Smart Bevel (ARC)"

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        main(context)
        return {'FINISHED'}

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

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

if __name__ == "__main__":
    register()


Omit certain bones from Automatic Weight calculations? I have a foot rig I've prepared in advance, for use on various characters. It has some bones that are only IK target bones, so I don't want Automatic Weights to be calculated for those when I parent the mesh to the armature.

How can I make Automatic Weights ignore just the bones that shouldn't deform the mesh?

Or if there is not a way to keep those bones from being included, what might an alternative solution be? Maybe there is something obvious I'm overlooking, because I would think this is not an uncommon situation.

Thanks in advance.

For bones that you don't want to deform the mesh, uncheck deform in the Deform Panel of bone properties.


How to expand a hamburger menu In my Image Editor there is a "hamburger menu" (the icon with three horizontal lines in a stack) that I customized in Blender 2.79 or earlier on a computer with a smaller display. Now I've decided I want to get rid of the hamburger and keep those menu items expanded instead (so that I can see the asterisk that appears by Image* when an image file has been modified since last saved).

Maybe this type of collapsed hamburger menu is not used anymore in recent versions of Blender. I'm not sure. I don't see an option in the menu to expand it again.
How do I revert this part of the menu to the default view? I don't want to load factory settings just to revert this one part of the interface.

Right click on it, and in Header, check "Show Menus".


Tris to Quads using UV map I have some old models that I need to repair. When I use Tris to Quads it doesn't work properly preserving the edgeloops because of the curvature of the models. But the UV map of the model is perfectly squared. Is there a quick way to remove the unwanted edges using the UV map? I can do that manually but it takes way too much time.

The UV layout for this model makes selecting rows very easy with the Box Select tool.  (I hid the ends because they have hidden faces that are causing problems.)

By selecting every second loop of the UV's and then using Tris To Quads, you can establish guide loops that allow you to use the tool again and achieve consistent results.

b for Box-Select.  Also make sure to activate the icon for use_uv_select_sync as shown in the animation.

Now use Tris to Quads on the selected rows, then select everything and repeat Tris To Quads.

Now you can repair the few mistakes by using the Join tool j.  In the following case, I used Join and then used Make Face f to make a quad at the center of the error point.


Exporting the blend file as a python script I am looking to automate the steps I took to build the model in the blender GUI as a python script. You can think of it like how it would be if blender had a 'export as .py' which I could take and execute to render the model.

Blender does spit out some python in the window above the file toolbar, but I cant use it to automate the model rendering as it is incomplete and seems to only have the configuration, here is a screenshot:

As hinted at by the comments, this is by no means an exhaustive or a general solution. At the moment there is no real way to save or export the actions you perform in Blender as a script or macro.

So the only way to automate things is to learn and understand the Blender Python API well, and to write a specific script to automate each task. You'll often be able to reuse code from one script in other scripts, and even to write generalized libraries that perform specific tasks, but it won't really allow you to tackle ANY problem or to automate all cases.

So here's a script that automates the creation of a rock like object from a cube, and will show you:

How to add primitive objects (in the example: cube, camera)
How to add modifiers and to set their properties.
How to add materials and set their properties.
How to add textures and set their properties.
How to set the render output path.
How to render to a file.

There's lots of things it does not show, including:

How to add and set up lighting.
How to change render settings (resolution, etc).
A zillion other things like animation, rigging, compositing, creating complex node based materials in cycles, simulations, particles... and more.

For these you'll have to read and learn other specific techniques and APIs.

Here's the code:

import bpy
from math import radians

# Add the base cube shape
bpy.ops.mesh.primitive_cube_add()

# Create a reference to the active object (which is the cube since we just added it)
cube = bpy.data.objects[ bpy.context.object.name ]

# Add a new subdivision surface modifier and set its view and render subdivision levels to 4
subsurf1 = cube.modifiers.new( "Subsurf", "SUBSURF" )
subsurf1.levels = subsurf1.render_levels = 4

# Add a new displacement modifier, set its texture to a new noise texture, and set the displacement strength to 0.15
disp = cube.modifiers.new( "Disp", "DISPLACE" )
disp.texture = bpy.data.textures.new( "DisplaceNoise", "NOISE" )
disp.strength = 0.15

# Add a 2nd subdivision surface modifier, and set its view and render levels to 2
subsurf2 = cube.modifiers.new( "Subsurf", "SUBSURF" )
subsurf2.levels = subsurf1.render_levels = 2

# Add a camera and set its location and rotation values
bpy.ops.object.camera_add( location = (0, -4, 0 ), rotation = (radians(90),0,0) )
camera = bpy.data.objects[ bpy.context.object.name ]
bpy.context.scene.camera = camera

# Give our rock object a new material
cube.active_material = bpy.data.materials.new("Rock.Mat")
mat = cube.active_material # Create a shorter reference variable to the material

# Set material properties
mat.diffuse_intensity  = 0.45
mat.specular_intensity = 0.1
mat.use_shadeless      = True

# Create a new musgrave texture and apply it to our materials as its active texture
mat.active_texture = bpy.data.textures.new( "Diffuse", "MUSGRAVE" )
mat.texture_slots[0].color = (0,0,0)         # Set base texture color to black
mat.texture_slots[0].texture_coords = 'ORCO' # Set texture coordiantes to object

# Set render filepath and render
bpy.context.scene.render.filepath = "/tmp/rock.png"
bpy.ops.render.render( write_still = True )

The unimpressive result of this script:


Trees/plants/rocks spam for my game terrain I'm making a terrain for a video game. Is there a tool to spread a lot of trees/plants/rocks on a terrain? For example Unity has a built-in terrain tool for placing them, are there similar methods for Blender? Also, I don't want to decrease perfomance for every tree. Thanks!

If you intend to export a whole terrain to unity (or any other RT 3D game engine), it would be wise to create your terrain, the trees, rocks and so on as independent objects, then import them into unity and let unity's distribution method do the work.

The reason for this is that unity works with instances of objects, while Blender would produce actual geometry or - if you do not intend to join your terrain into one object - many objects with possible redundancy of materials. That means more draw calls which lead to a heavy load on the engine.

Besides from that, you would still need to create collision meshes, which means even more redundant data or, if you chose to join all objects into one mesh with submeshes, it would be nearly impossible to generate the collision meshes automatically.


fSpy for interior design - Can't get it to work I'm a beginner(Blender V2.79) and modeled a few things and grasped the basics of modelling.

I've been trying to figure out how to adjust camera for an interior scene since 2 days and would love to get some help and insight on how to use fSpy.
I'm using this really unorthodox image which I haven't found any similarities with

I thought i'd get started with interior design on a simple scene but my god it's a pain to adjust the camera.

I would really appreciate if someone could explain how to use fSpy for interiors.

Firstly I would suggest looking for a different image if this is your first time using fspy, as it doesn't show an obvious vanishing point. I suspect this is a crop of a larger image therefore the vanishing point may even be off canvas to the left.

Here's how I have used it:

Drag an image into fspy when it first opens, by default you'll be presented with two two vanishing point axis and a orientation gizmo.

You need to click on the small circles at the end of each of those axis lines (highlighted by me with yellow circles), and attempt to line those up with similar axis on your photo.

As you can see from my example I have aligned the X and Y vanishing point lines with lines on the photo. As you modify the position of these lines you will witness the gizmo updating to show you how it is calculating the orientation of the scene it.

Using Shift and dragging you get a really nice zoomed in view of the point you are moving which will help to position it with greater accuracy.

Once you are happy with your positions, you should adjust the green I shape on the gizmo which will relate to the reference distance in the menu, I think it currently defaults to 4, which could be 4 blender units. You may change this as necessary.

If you find that the Z axis on your gizmo is pointing down then the scene imported into Blender will also be upside down. To correct this, change one of the axis in the vanishing point axis menu from + to - or vice versa to flip the gizmo to Z up.

I cannot really offer much in way of how to use the Principal point, I just leave it on image midpoint for this example, if you need to ensure this is calculated exact then choose From 3rd vanishing point and you get the option to utilize the Z axis lines.

Use the dim image check box as necessary to see your image while aligning these various lines.

Once you have completed your setup, you need to save this as a .fspy file by choosing save as option not export.

Finally you will use the Blender plugin to import this saved .fspy file to setup your scene.

You should now have a correctly oriented scene based on your settings derived from the original photo.

To aid with you compositing of objects, what you need to do next is go to front view and orthographic so that you can add a background image, this should be the same image you used in fspy. Now you can add objects that should match the perspective of the view.

If you want to have the image in the scene then you can add this in the compositor afterwards, you will need to render your objects with transparent from render panel and turn on any shadow catchers you need.

Use a color mix or alpha over node in compositor to add your rendered objects above the original image which you can add in the compositor and plug also into the mix or alpha over node.

I hope this helps you.


How do I add a texture when Importing from OBJ scan? I am rather new to using blender, and I have run into a bit of a problem. My boss has been using a 3D scanner, and I am supposed to import the results of the scans. I am able to import them into Blender, however there are no textures or materials. It just shows up as White. How do I import the textures onto the mesh?

Go to material, and activate "use nodes"
then on "color", click and select "image texture"

then at left of "open", click and select your texture  then at right of "object mode" change viewport shading to "material" or "texture"


Gray cone obscuring/clipping the 3D Viewport When looking at my objects in 3d view I'm seeing a gray cone that seems to be hiding other objects.

Can anyone help me turn this off and explain what it is please.

Screenshots attached.

You somehow enabled the clipping region (or clipping border). It's created in 2D, but projects into 3D, thus it looks like a cone from certain angles.
Disable it by clicking View > View Region> Clipping Region... in 3D View header, or press AltB


Novice needs help with slicing section off a tapered cue I'm trying to design a snooker cue & I'm finding it tricky to slice a section from the butt of the cue to give a flat edge about 6" length. I've marked where I want the slice on the picture with a yellow line. Thanks.

A couple of ways I might do this:

Using the KNIFE tool with Cut-Through enabled (K, then Z) to slice through the mesh at your desired angle. Though note this is likely to result in Tri's or Ngon faces, which might not work well if you have a subsurf on the mesh.

Select the faces you need to flatten and use the 'Flatten' command (press space, search flatten) - then rotate the selection or use proportional editing to move the flattened faces to the desired angle.

Hope this helps!


Simulation not rendering i was making an blast for a clip animation, but the explosion in not working, besides that the explosion in not visible in the render mode .
This is the image of the render mode

This is the Solid

I think the shader node setup is not correct. You can use this node setup for the smoke domain.. I think you will get the desired result. You have to tweak with some variables in the node setup.


.data.vertices returns an empty collection in Edit Mode Why does a mesh object return an empty vertex collection when in Edit Mode? As you can imagine my forehead is a bit bloody from this noodling and want to understand why the following access to data.vertices is dependent on mode.   Here you see the same print statements before and after the editmode_toggle:

                bpy.ops.mesh.primitive_plane_add( size=sizeR, location=locat, scale=(1, yScale, 1), enter_editmode=True )
                bpy.ops.mesh.select_all( action='SELECT' )
                bpy.ops.mesh.subdivide( number_cuts=12 )
                # randomly select a portion of the vertices and move them along the Z axis (to create shadows)
                obj = bpy.context.active_object
                print( str(obj.data  ) + " vertices=" + str( obj.data.vertices ) )
                bpy.ops.object.editmode_toggle()

prints:
<bpy_struct, Mesh("Plane.008") at 0x000001FFE8F782D8> vertices=<bpy_collection[0], MeshVertices>
<bpy_struct, Mesh("Plane.008") at 0x000001FFE8F782D8> vertices=<bpy_collection[196], MeshVertices>

i.e, an empty collection when in Edit Mode, but a complete set of (196) vertices in Object Mode.
Thanks for any insight.

A "snap shot" copy.
When entering edit mode, blender takes  a "snap-shot" object mode copy of the mesh.  (Differs from accepted answer, as AFAIK this is not a bmesh)  Any referencing of the mesh while in edit mode will be values of the copy.  The edit mode manipulated mesh is written back to the mesh when exiting edit mode, or via Object.update_from_editmode()
The question code is adding a new object entering edit mode via the operators enter_edit_mode property, in which case it reports the 0 verts.. of a new mesh object with no geometry.
Had we added the plane primitive in object mode, then toggled into edit mode and subdivided would report 4 verts (the unsubdivided plane pre edit mode)
updating the mesh from edit mode, eg inserting this line
obj = bpy.context.active_object
obj.update_from_editmode()
print( str(obj.data  ) + " vertices=" + str( obj.data.vertices ) )

would update the mesh and print 196 vertices.
Avoid edit mode.
In many cases can avoid edit mode completely.
My rule of thumb would be, if there is no need for the user input to select specific geometry there is probably no need to bother with the mind numbing overhead of numerous & repetitive bpy.ops.mesh... calls.
Avoid unnecessary operations.
A 12x12 cut subdivided plane is a 14x14 grid
>>> bpy.ops.mesh.primitive_grid_add(
...         x_subdivisions=14,
...         y_subdivisions=14,
...         )
{'FINISHED'}

>>> len(C.object.data.vertices)
196

instantly replacing all code in question.
Use bmesh.
If edit mode selection is required would recommend the use of a bound edit mode bmesh, bound in that it is tied to the edit mode mesh and any changes to selection or geometry  via bpy.ops.mesh... are instantly reflected by the bmesh data.
Have answered numerous questions and titled them bmesh script, so in no particular order  https://blender.stackexchange.com/search?q=user%3A15543+bmesh+script


Import image as planes appears desaturated Whenever I import an image as a plane, the image appears to be desaturated as compared to the original. How do I make it more accurate?

This is the result of lighting affecting your object. Since its getting hit by a white light, it appears more white and faded. Increase the material's roughness and decrease the specular properties if you want to reduce the effects of lighting on its appearance.


How do i stop simulating rigid bodies past a certain point? I just started using blender last week and I've been messing around with physics simulations. Right now I'm using Magicavoxel assets for a destruction simulation and I noticed that a lot of parts fall off the edge of the plane and fall into the void. My question is how can I stop simulating the objects once they get past a certain point. It feels like a waste of processing power to calculate the physics for hundreds of cubes that will never be seen.

Just uncheck the dynamic checkbox for the frame, where you want to stop it.
For the frame before, check the dynamic checkbox.
Tap I on your keyboard while hovering over that checkbox for both keyframes.