Simplify F-Curves of Shape Key animation i am trying to clean-up animation curves from facial mocap data.
The recorded data/animation is containing keys on nearly every frame.

Usually i would use the Add-on 'Simplify Curves', wich does exactly what i need (Reduce keyframes).
Unfortunately Simplify Curves does not seem to work with shape key animation curves. The option is just not available from the quick menu.

I am not that comfortable with python, so i can't tell if Simplify Curves is supposed to work on shape keys the way it does on other objects.

If you happen to know more, please let me know!
I am interested in any other tools/approaches for animation clean-up!

Thank you!

f.bra

The simplify f-curves operator has been created in a rigid way that only looks at the objects animation data. Not all animation data is stored in the one place, for example the shape key animation is stored as part of the mesh data, not as part of the object animation.

While some more work should be done to make the simplify f-curves a little more flexible, this modified version(v1.0.4) allows the shape key f-curves to be simplified. You can download and unzip this version, then use the install addon from file button to select the unzipped py file, blender should then replace the existing addon with this version, if you have permissions to write over the file.


Cloth sim : collision with external linked group meshes I have a scene, with some assets linked into it. Among them is a rigged character, linked by a group instance. The rig is well "proxied", and animated. I modeled a scarf, and wanted to make a cloth simulation. The part of the scarf which is around the neck of the character is parented to the neck's bone, and defined as "Pin" in the cloth parameters.

Now, I don't want the scarf to go through the body of the character, so I came back to the character's blend file, added a collider to the body, saved, and re-opened the scene. Nothing changed. The scarf still passes through the body. There is no cache applied.

Am I missing something ?

I just tried something else, which works... (with Blender 2.67b, however)

I created a new empty blend file, and linked both the character AND the scarf into it. I had to re-configure the cloth settings of the scarf because it seems these ones aren't linkable, but worked like a charm. And since it's the final "workflow" we're looking for (i.e. linking both the scarf and the character, into another "scene" .blend file), it's great !

But, it might be a bug of the 2.67 (before "bugfixes" releases)...


What's the difference between the Subdivision Surface modifier and the edit mode->RMB->Subdivide option? Sorry for the newbie question.

I'm following the famous donut tutorial for blender 2.8.

When I press the apply button for the subdivision surface modifier to the torus it makes more vertices + faces for the donut. However, when I press the subdivide option after selecting all vertices of the donut in edit mode, it seems like it's also making more vertices + faces for the donut.

Are these two options interchangeable?

Thanks in advance!

"Modifiers are automatic operations that affect an object’s geometry in a non-destructive way. With modifiers, you can perform many effects automatically that would otherwise be too tedious to do manually (such as subdivision surfaces) and without affecting the base geometry of your object."
https://docs.blender.org/manual/en/latest/modeling/modifiers/introduction.html

If you want to preserve the mesh for ease of use, Modifiers are the way to go. if you don't care about it they are not that different except more options before applying the modifier


How can I cut holes using a Voronoi texture? Is it possible to create this picture with the voronoi texture node?

Volume shader

It is not fast to render, it is not the most practical method, but  I cloud not resist to post this image:


2d vs 3d Depth of Field What is the difference between Depth of Field rendered at render time (3d) compared to Depth of Field created in post (2d). Both are depth of field, they look very similar if not the same. 2d depth of field has the advantage of being faster to compute and being and you can easily change what part is in focus, whereas if you use 3d depth of filed and you want to change it after then render you have to start over.
I am primarily focusing on cycles

I ran some tests with 100 samples each with this scene:

Defocus Node:

Time: 2:01 + roughly 7 seconds for compositing = 2:08
Cycles DoF:

Time: 2:02
Conclusions:
Based on the above results, rendered DoF seems more reliable and realistic, as well as a little bit faster in this case.
The main advantage of composited DoF is the ability to tweak the settings after the render.


Nigeria Female headtie ( called Gele in Nigeria) I'm trying to model a female headtie popular used in Nigerian wedding as shown in the images below , i dont realy know exactly how to go about it, im a bit confused either to use clothes feature in blender , or some sort of array modifier  and bend modifiers . Any help will be appreciated
some the links below will give you an idea
https://www.wikihow.com/Tie-a-Gele
https://www.concise.ng/2019/03/07/how-to-tie-gele/

You could begin with an extruded circle, then some bevels, some additional extrusions if necessary, and deform it a bit with the Proportional Editing option on. Then give it a Subdivision Surface modifier:

For the other side, duplicate and mirror your object. For the node, create a profile shape and a curve, use an Array and a Curve modifier to make the profile follow the curve, then apply the modifiers and again, rework a bit with the Proportional Editing so that it looks a bit more natural (needs to be improved of course). Give it a fabric texture:


How to convert object space normals to tangent space? I'm trying to experiment a workflow where I can manually paint normals to create stylized shading for a model.
Painting on the model, I want to use object-space normal, as it's easier to work with, but it's a problem that I end up with tangent space normals. Ideally I would want to just convert it back to tangent space in the shader.
At the very least I have to know whether or not it's possible to do what I'm trying to do?

The simplest way to do such a conversion is to calculate the dot products between the Object_Space_Normal and the Tangent plane, and then 'normalize' the result to RGB.
$\vec{Tg}_N = 0.5 +
\begin{bmatrix} \vec{Tg} \cdot \vec{N}_{obj} \\
(\vec{N} \times \vec{Tg}) \cdot N_{obj} \\
\vec{N} \cdot \vec{N}_{obj} \end{bmatrix}
/ 2 $
And with nodes:

This is the main process when working with vectors in World space.
In the case where your Normals are Object normals encoded into RGB, then you need to convert them first to world as in the following example:


Why is this character's arm moving when I edit its armatutre? I'm working on a custom character for SRB2Kart.

I've finished animating it, but I'd like to change the parent of two bones. I selected the armature, entered edit mode, made my changes, and left edit mode. afterwards, I noticed that its hand was raised:

I undid all my changes until everything was back in place. I realized that even without making any changes, selecting the armature, entering edit mode, then leaving edit mode will cause this, including in subsequent frames.
I've selected everything and remade the animation frames, but the problem persists.
Does anyone what's causing this? How do I stop this?
Update: I've attempted to work from the raised hand, but unable to copy and paste the pose from the left arm to the right arm. In fact, the rotation is virtually the same:

I've attempted making the w and x rotation of the right arm negative, but it just made things worse:

If merely entering then leaving edit mode on an armature leaves lasting changes to your pose, then you probably have a dependency loop-- some place where bone A depends on bone B which depends on bone C which depends on bone A (for example).  That's not going to work.
To rule in/out dependency loops, open a console window (from main menu's "window" menu) and look for any "dependency cycle" warnings.  If you have well named bones, you should be able to see where the loop exists.
Changing parenting on bones could easily create a dependency loop-- it interacts with constraints.  But changing parenting on bones also changes how they interpret their animation data.  You didn't ask about this, but if you change your parenting, don't expect your animation to be the same.


Bending arm causes odd deformation I am attempting to make a simple rig. Whenever I try to bend any body parts, particularly the arms and legs, however, they leave an odd gap where they are bent

I need the arm to bend in a smooth way like in the picture below, does anyone know how?

I have attempted to change the weight painting, and I have tried searching through forums, but I have been unable to find any solution to this problem yet.

Blend file

might be caused because you have a low poly figure with (high?) subdivision.
The subdevision performs a smooth over the low poly figure.
creating artifacts.

copy your blend file, apply subdiv, then do another autoweights with bones.

Its always is a bit tricky but it might look better.
Sometimes people add extra bonus just to keep things stable, (ea rigify feed solution)..
placing of the bones is essential


Spotlight Texture from object mapping? I'm currently trying to get a series of spotlights to change colour based on the corresponding texture they are mapped from.

In this case i'm trying to reference the "grid" object so that when I move the spotlight it will align with the colour above (as seen in the blue light)

I've enabled the grid as the reference object on the texture coordinate node but am unsure of what mapping type to put on the mapping node or whether I need to scale it.

any help would be greatly appreciated thank you :)

link to model: https://drive.google.com/open?id=1IeGsIcqmSVdlrpjDVLoAadxS1kyiT7O8

A simple setting to do that can be (have added empty at the spot location so that we can see them through the grid):

In this setting, all lamps have the same node tree.

But few conditions to make it work:

The grid origin is a bottom left corner, seeing it from top (3D cursor location in the image below): we want the position to map from 0,0.
The base grid dimension is 1x1 (here it is scaled as you want but the base mesh is one by one): we want the dimensions to fit 1x1 UvMap

The UV map orientation corresponds to the object base orientation (rotating the UV map was needed, starting from your file):

The default 'object' output from the texture coordinates is 'world to object', so the vector transform node is not needed here. The input is 0>1 without this node, because the lamp position is converted to the grid position in its inner coordinates which is 0>1 (as the base grid is 0>1 without scaling).

Though, if you want the grid to have its own inner dimensions different from 1x1, you can add the following, where the 'value' node has the grid dimension (without scaling):


Unwrapping buildings with holes I have been struggling for more than a week on how to unwrap this shape:

The two ways that worked are the "Project from view" and "cube projection", but the texture stretches among the Y axis when they are applied so it must be uv unwrapped.

From the Blender Manual:

Smart UV Project
Breaks the mesh into islands based on an angle threshold.

The islands are arrange to best fit the texture.
If you want to select an island, press L while the pointer is over a vertex to select the linked ones.


Acces unmodified Normals on object with Custom/Transferred normals I have a complex mesh that I am giving custom Normals to via the Data Transfer modifier. The normals are coming from a simpler mesh.

I want to use both the original normals and the custom normals in different parts of the material. Mainly, the original normals for the Diffuse, and the simplified custom normals for the Glossy. However, once I have custom normals of any type, I can no longer access the original normals. The Geometry and Texture Coordinate node Normal outputs both give the Custom Normals. The True Normal gives the original normals, but with flat shading, so that is not helpful.

Is there any method to get at the original normals still? Or a way to modifiy the True Normal in the material to be smooth shaded?

For a static model, this could be achieved by baking either the original or custom normals to a texture and using that. But that is not an option for meshes that deform as far as I can tell?

Animation Node can be used to assign vertices normals to vertices colors in near realtime. Using those normals in cycles won't yield the same results as the Phong smooth shading cycles uses, however it provides very similar results.

Background Information

Understanding How Vertex Colors Work

The name Vertex Color is a bit misleading, it should be noted that color data is not stored per vertex, but rather per loop. A loop is basically a vertex of a polygon, so if a vertex is part of four polygons, it will compose four loops, to understand this better, lets look the following illustration:

The above is a mesh with 4 polygons, each polygon has 4 vertices and subsequently 4 loops. We represented loops by colored dots, you notice that each vertex compose either 4 loops as blue loops, 2 loops as red loops or a single loop as violet loops. Now, If we were to color all loops white expect the blue loop in polygon three, we will get something like this:

There are some advantages of storing colors in loops instead of vertices, the main advantage being the ability to color polygons. If colors were stored in vertices, it would not be possible to color a polygon with a single color, think about it ! To color a polygon using loops, we just have to color all loops in the polygon with the same color:

On the other hand, to color a vertex, we have to color all loops that are part of the vertex, same-color dots in the above illustration:

In case of coloring vertices, the fragments (pixels or dots) in polygons will be colored according to a convex combination of the colors of its vertices (a bilinear interpolation for quads), such interpolations are particularly useful to represents smooth shading in your case !

So if we were to color vertices based on some color list, we will have to identify the loops that are part of each vertex (same-color dots in our illustration) and color those loops based on corresponding color from the color list. We will also explain polygon coloring for completeness.

Understanding How Loops Are Stored In Meshes

Vertices have indices which we can use to identify and select them by, the same goes for polygons and edges. How are loops ordered and how can we identify them? To answer that, let us consider this simple cube as a study case:

Where polygon indices are shown in red and vertices indices are shown in blue. The ordering of loops follows two rules:

Loops of the first polygon are stored first, loops of the second polygon are stored next, and so on.
Loops in individual polygons are sorted from the lowest vertex index to the highest.

We can represent the loops as an ordered pair $(x, y)$ where $x$ is index of the polygon it is part of and $y$ is the index of the vertices that it is composed of, and the set of ordered pairs for quadrilateral mesh will be:

$$
\begin{aligned}
&(0, 0), (0, 1), (0, 2), (0, 3),\\
&(1, 0), (1, 1), (1, 2), (1, 3),\\
&(2, 0), (2, 1), (2, 2), (3, 3),\\
&(3, 0), (3, 1), (3, 2), (3, 3),\\
&\dots
\end{aligned}
$$

To understand this better, we drew the indices of the loops over the study case :

Coloring Polygons

In order to color polygons with flat colors, we have to color all loops in a polygon with the same color, in the above case, in order to color the polygon with index zero, we will have to color indices $(0, 1, 2, 3)$, to color the polygon with index one, we will have to color indices $(4, 5, 6, 7)$, and so on. Notice that the indices are in the pattern $(0, 1, 2, \dots)$, grouped in groups of length equal to the number of vertices of the polygon, so all we have to do is generate a list such that the first $n$ number of colors are the color of the first polygon where $n$ is the number of vertices in the first polygons, the second $n$ number of colors are the color of the second polygon where $n$ is the number of vertices in the second polygons and so on. In practice, we loop (iterate) over polygons, get the number of vertices in it ($n$), get its color from the color list, append it to an initially empty list $n$ number of times. An implementation in animation nodes is as follows:

Don't worry about the Set Vertex Color Subprogram, we will study it in a second. Notice that we used the polygon normals as colors in here. Also, we represent colors using 3D vectors; because they in fact are (Vertex Color doesn't support Alpha Channel).

Coloring Vertices

Vertices coloring is a bit harder to understand but easy nonetheless. Lets look at the study case one more time:

Remember that in order to color vertices, we have to color all loops that compose that vertex, in the above case, $(0, 4, 8)$ should have the color of the vertex at index zero, $(1, 5)$ should have the color of the vertex at index one, and so on. Notice that polygons are merely an indicator of which vertices are in each polygon, now remember that loops are stored in the same order of polygons, so the algorithm for generating the loops colors is as easy as looping (iterating) over polygons, using the indices of the polygon to get the colors at the same indices, append the colors. Take your time to understand it, you will only understand it if you think about it. An implementation in animation nodes is as follows:

Notice that we use the vertices normals as colors in this example.

Set Vertex Color

Animation Nodes currently does not have a node to set vertex colors directly, so we will have to write a small script to do that, a possible way to do it is as follows:

#Create a vertex color map named "Normals" if it is not already created.
if "Normals" in Object.data.vertex_colors:
    map = Object.data.vertex_colors["Normals"]
else:
    map = Object.data.vertex_colors.new("Normals")

#Loop over Colors and assign them to the vertex color map.
for i, color in enumerate(Colors):
    map.data[i].color = color

The script creates a vertex color layer named Normals which is then filled with the data from the Colors list, the Colors list is a 3D Vector list of $n$ Vectors, where $n$ is the number of loops in the mesh.

Answer

You probably already know how to set the vertex normals to vertex color map by now, we did it couple of time above, so such a node tree should achieve what you want:

But wait, there are some things to take care of. Blender only store the colors in the interval $[0, 1]$, but our vectors are signed, ideally in the interval $[-1, 1]$ if normalized. This can be handled by linearly remapping the $[-1, 1]$ interval to the interval $[0, 1]$ in Animation Nodes, then in cycles use the inverse remapping function to transfer the vectors back to the interval $[-1, 1]$. The remapping function can simply be $\frac{V + I}{2}$ where $I$ is the identity vector matrix, and the inverse remapping function will be $2(V - I)$. Notice that $V$ has to be normalized, because while Animation Nodes doesn't care about the magnitude of the normals, cycles does, and will yield unexpected results if not handed normalized vectors. Moreover, normalization has to be done in Animation Nodes due to the assumption we made that the vectors are indeed normalized in the remapping function.


How do I solve "Color management: using fallback mode for management" When I do

import bpy

I get the following message in my console

Color management: using fallback mode for management

It happens everytime I start Python and import bpy, see the shot below

Prior compilation I disabled Cycles, OSL, OpenColorIO, and LLVM from makefile.

However, multiple import bpy statement does not show this error/warning message multiple times. See image below.

Is this normal? Is there a way to get rid of it?

This is normal but you can make this message go away by building with OpenColorIO. Since it is the default now for color management in Blender, by not using it in your case here, Blender is falling back to an simpler set of color management rules, where float buffers are linearized sRGB buffers, and byte buffers are sRGB nonlinear buffers.

Note that imports after the first will use the cached module so they are not loading the entire Blender state every time. But this means you can't for eg, have 2+ blend files loaded from Python at once. each Python process can only operate on one blend file at a time.


Blender Cycles Freestyle Line Breaking I'm trying to make a short 5 minute toon shaded starship scene with Blender Cycles. The ship(s) in the scene also have a toon outline created by two line sets, one thinner one set to only render on creases and edge marks and one thicker one set to only render on object contours.
It looks good and like the way I want it to be, but when I render an animation (camera flyby) I notice that on some frames certain lines break. You can see that here:
https://youtu.be/czazInaUevc

That looks pretty ugly. Is there any way this can be avoided or at least greatly minimized?
Here's the scene's .blend file:
https://drive.google.com/file/d/1ceVqcvQTiVrjOe-18zJdUkYJpaEqc1QP/view?usp=sharing

You have to adjust your model (topology) to be better compatible with freestyle.

Two problem of your geometry are

intersections
very sharp angles

left: intersections; right:sharp angles

Freestyle isn't designed to work with intersections. An intersection will remove other lines if freestyle wrongly thinks that a line segment is occluded (even though it may be only partially occluded).

If you are using Smooth Shading and Subsurf Modifiers, you should consider checking Face Smoothness. The manual is quite vague

  When enabled, Smooth Shading will be taken into account for edges calculation.

However, I have found that some edges with wouldn't be connected, are connected with Face Smoothness enabled.


bpy python: is it possible to get the selected collection? for a script I am writing I need to know the collection that is currently selected in the outliner.
I have seen a solution where the ui is probed and it seemed very convoluted at the time and I was wondering if there might be a more elegant solution out there.
any tip and/or trick would be greatly appreciated.
thx,
S

Take a look at this repository, it has a function that could help you, get_active_collection ()
https://github.com/curtisjamesholt/EasyBPY/blob/master/easybpy.py


Pros and cons of seperating meshes into objects and ways to switch between I got confused recently where I couldn't select a mesh in edit mode unless the object was selected.
I'm working on a map with a lot of separate meshes, so it's a chore to scroll down to the appropriate object and select it in order to start editing.
Is there a good reason for separating meshes by object?
And is there a way around selecting the object before editing, or a way to move meshes to the same object?

you can join objects/meshes by selecting more objects and then CTRL - J


Can PBR be "faked" in Blender Internal or the Game Engine? Physically-Based Rendering / Physically-Based Shaders

My very basic understanding of physically-based shaders is that they have an accurate Fresnel curve (becoming more reflective at grazing angles), and they obey energy conservation (light will not get brighter or dimmer upon hitting the material - it either passes through the surface or reflects off, but is always accounted for).

What I would like to know is: To what degree can these concepts be applied in Blender Internal in order to create more convincing (but still quick to render) materials? This would be useful for the BGE and Blend4Web as well, but the first step is to figure it out for Blender Internal.

It is my understanding that creating the physically accurate Fresnel curve in BI is easy, but that the energy conservation and accounting for "roughness" is not something BI can do because light is not handled in a physically correct way (although maybe baking from Cycles could be a workaround?).

Please correct me wherever I may have misunderstood. And thanks in advance.

I found this video & post really helpful for PBR for non-cycles renders: https://cgcookie.com/2015/05/20/pbr-in-blenders-viewport/

He uses 2 environment maps, one blurry and one sharp, and blends them in way that the sharp one is reflected on the edges and the blurry one is reflected in the front, the way fresnel reflections work. He uses a normal node to do the fresnel reflections in a clever way.

It works with environment maps, not specular (phong) shading, though personally I prefer the environment map look. Note that if you add a light the hilights you get won't match the reflections.

So it's a bit of a hack - 2 reflection maps needed, lights don't reflect right - but it works.


Run blender without GUI? I'd like to use Blender's physics engine/rendering capabilities headlessly (so it would have to be via command line). I'd like to run a lot of little physics experiments (thousands) on a server. Python scripting will be involved in this, naturally-not sure how to do this without using the logic editor, though...I need some way to be able to run these scripts and have Blender output some sort of physics "movie" without having to deal with the GUI. Is this possible?

Have you tried blender --background -P your_script.py -- py_argv1 py_argvN?

% blender --help|grep background
-b or --background
    Run in background (often used for UI-less rendering).
    Enable time profiling for background jobs.
    Playback <file(s)>, only operates this way when not running in background.
    # blender --background test.blend --render-frame 1 --render-output '/tmp'
    # blender --background --render-output /tmp test.blend --render-frame 1
    # blender --background test.blend --render-output /tmp --render-frame 1


Hold Frame in Compositor In my scene I have a text object I'm rendering over a photograph with nice natural depth of field. I am matching the depth of field effect with a defocus node in the compositor. Since the camera doesn't move for the duration of the sequence, I'd like to hold the first frame. Effectively rendering the defocus node for one frame and extending that frame in the VSE for the length of the sequence.

I do not want to render the frame out to a file and then import it back in. I will be doing this many time and want to avoid any manual two step process. I need a non-destructive way to do this in one step. In NUKE, this is a 'HoldFrame' node, in After Effect you can use TimeRempaing, FUSION also has a solution for this.

You can add a input->image node and open the video file with it.
In the node controls you can set how many frames of your video file you want to use (frames), when to start in your composition (start frame), and the offset value is the one that will allow you to choose the exact frame to be used.
In this example the original quicktime file has 1600 frames but only 1 frame (797) will be displayed, as freeze frame, starting at frame 1 and for the entire length of the composition.


Using D-Noise for denoising photos has anyone tried using the Optix denoiser (D-Noise plugin) to remove noise from photo, not just render ( on which it works marvelously)?
In compositor or image editor tab, i have the D-Noise button, but in case of imported photo (tiff or jpg), it doesn’t do anything. Same if the image is imported as plane and then rendered with camera at the photo’s resolution.
I see no reason why it shouldn’t work this way. Any tips?

OptiX™ won't work on simple plain picture.

From the original research: Interactive Reconstruction of Monte Carlo Image Sequences using a Recurrent Denoising Autoencoder [SIGGRAPH 2017]

  We therefore frame the problem as a reconstruction of the final image (rather than denoising) from these sparse samples - (page 98:2)

  End-to-end training allows our network to automatically learn how to best utilize auxiliary pixel features, such as depth and normals, with no guidance from the user.

It is base on training data from IRay render engine, with all the useful feature like Depth, Normal.

If you provide a single image without these information, it will not work since OptiX treats them as a plane rather than a scene. OptiX didn't learn how to denoise a plane with noise (or bad at it).

There are a lot of denoiser to remove noise from single image, but OptiX is not the one aim to do this job.


subdivision surface display when enable my subdivision surface looks like that:

I have seen a video with this display for the subdivision surface on edit mode (the edges are no longer straight and we don't see them with transparency because they fit the shape of the mesh with subsurf) How can I get this type of display ?

Use 'adjust edit cage' button on the modifier panel.


Script for splitting a mesh into n components along z axis I'm trying to divide a mesh into multiple parts along the z axis. I've followed another tutorial and managed this, which divides the mesh into 2 parts, but I can't seem to divide it into more than two. Quite new to blender scripting so I'm not sure how to fix this. Any help would be appreciated, but the solution does need to be a script. The code I'm using at the moment is below.

import bpy, bmesh
from bpy import context as C

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

bm = bmesh.from_edit_mesh(C.object.data)

edges = []

for i in range(-10, 10, 2):
    ret = bmesh.ops.bisect_plane(bm, geom=bm.verts[:]+bm.edges[:]+bm.faces[:], plane_co=(0,0,i), plane_no=(0,0,1))
    bmesh.ops.split_edges(bm, edges=[e for e in ret['geom_cut'] if isinstance(e, bmesh.types.BMEdge)])

bmesh.update_edit_mesh(C.object.data)

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

Thanks!

My guess is you have scaled the mesh and haven't allowed for local space for the bmesh operator(s).  Eg if you add a prim cylinder and scale it by z 10 fold, it's local space will still range between -1 to 1 for z for each vert coord. Running the script will only give the 0 plane cut.
Multiplying the plane location by the inverse of the objects matrix world will put the cuts into local space.
import bpy, bmesh
from bpy import context as C
from  mathutils import Vector

# matrix world inverse
mwi = C.object.matrix_world.inverted()
bpy.ops.object.mode_set(mode='EDIT')

bm = bmesh.from_edit_mesh(C.object.data)
geom = bm.verts[:] + bm.edges[:] + bm.faces[:]

for i in range(-10, 10, 2):
    j = mwi @ Vector((0, 0, i))        # Blender <3.90: mwi * Vector((0, 0, i))
    ret = bmesh.ops.bisect_plane(bm, geom=geom, plane_co=j, plane_no=(0,0,1))
    bmesh.ops.split_edges(bm, edges=[e for e in ret['geom_cut'] if isinstance(e, bmesh.types.BMEdge)])

bmesh.update_edit_mesh(C.object.data)

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

Alternatively apply scale before running splits.
bpy.ops.object.transform_apply(scale=True)


Can i automatically add textures to a large amount of materials? I have around 1500 objects. Each object has a material that is named exactly after the texture it corresponds to (e.g. "Tex_01.dds", "Tex_233.dds", etc). The objects and textures are both in the same folder. Is it possible for me to make an automated method that applies the correct textures to all objects in one go?

Edit: As the question appeared too vague, i've constructed a series of images to further explain the issue.

These are all the objects which i'm trying to add a texture to. They originate from a building system from a game. I wish to recreate this in Blender with a grid system.

Each object has one material. The name of the material is the same as the name of the texture that connects to the model.

Lastly, these are the textures which i would like to put on the models.

Edit 2: All materials have no nodes in them. The manual procedure would be to add a material output, diffuse node, image texture node and optionally a texture coordinate for UV.

I've also included a .blend with some samples if anyone would be interested in checking it out.

https://www.dropbox.com/s/blvgx98lmp8n27o/MS2Props02.zip?dl=0

Script.

Similarly to How can I connect a texture node to a material with Python? the script below, Looks for all materials whose name has a corresponding image (note the ugly check for "_dds" to ".dds") Then for all material, image pairs adds an image texture node and connects it to the BSDF node.

Script assumes you have already loaded in the images, a simple process of multiple selecting images when opening.

import bpy

for m in bpy.data.materials:
    img = bpy.data.images.get(m.name.replace("_dds", ".dds"))
    if not img:
        continue
    if m.use_nodes:
        # done this already??
        continue
    m.use_nodes = True

    nodes = m.node_tree.nodes
    bsdf = nodes.get('Diffuse BSDF')
    if bsdf:
        # add image texture
        teximage = nodes.new('ShaderNodeTexImage')
        teximage.image = img
        #link to bsdf
        m.node_tree.links.new(bsdf.inputs['Color'],
                teximage.outputs['Color'])


Cycles. Image sequence used as texture renders pink I add to texture as image sequence on plane I set up first and end frame. Auto refresh and cyclic activated.It works well in rendered mode but texture goes pink when I render it.It seems like texture is missing.

Blender v275
OS Windows 8.1 64 bit
Cycles render

Usually when blender renders something in bright pink / fuschia , its the indication that the link to the image is broken. Meaning the image texture file or sequence file may have been moved from their original folder or moved to another drive of your computer. Renaming of texture files also causes links to be broken.

If you did not move those files, it can be an indication that your harddisk or operating system are having trouble locating those files. Check to see if it's also an underlying hardware issue.


How to Mix Face Textures Across UV Edges TLDR: I'm trying to figure out the best method of mixing textures across UV edges in a dynamically textured mesh. For instance, if you have a plane with 4 faces and each one has a non-seamless texture applied to it, is there a way to mix the textures across the edges?

I'm making an adventure game where the terrain is dynamically generated. I've considered a few methods of texturing each face if the terrain but I run into problems with seams in the UV mesh. I've been pointed to Cycles but, and this was a while ago so I might remember wrong, I had problems getting it to work in the BGE. I was pointed to video textures, but I think there was still an issue with seams.

I tried, at one point, using the RGB color channels but I ran into an issue with only having 3 or 4 possibilities for texture. I think it was one default, and one for each color. And this also caused obvious squares, as I was applying this by vertex colors.

As an example I might shift from grass to dirt, and the edge this happens along should fade from a green grass texture go a brown dirt texture. At the moment it looks more like Minecraft, with an obvious seam between blocks.

What method should I look at? I like the idea of making a single image with each type of terrain painted in a grid, and moving UV's to change terrain type on the mesh. This is easy enough but I can't fade the textures together.

Here is an example to illustrate how you can use Empties to control some aspect of your material - in your case textures. This is how it is done in Cycles, so hopefully you are able to carry this concept over into your game code.

Just a basic black and white spherical gradient appearing on a simple landscape object. The placement and size of the gradient are determined by the Empty (it's located where the 3D Cursor is in the screen shot). The Color Ramp is for controlling the falloff.

And here is an example of what this technique can produce when you have multiple Empties and they are actually controlling textures instead of just a color result. In the screen shot below two Empties are used against a base grass texture.


How can I copy weights to another mesh which has another rig? Assume I have two identical spheres. I add a rig to the first sphere, then I deform second sphere in sculpt mode without adding new polygons or vertexes. I duplicate the rig and I want to connect this secod rig with my second sphere that the rig could animate this deformed sphere exatly like another rig animates first sphere. Another words I need to transfer weights from the first sphere to the second sphere. But 'weight transfer' option only works with objects that connected to the same rig. So I have two spheres and two rigs.

How can I manage that?

You can copy vertex groups (and corresponding weights) from your first sphere to your second one :

Select second one first
Then select first one
Use "Copy Vertex Group to Selected"

If deformation bones have same names in both Armature, it will work.
Else, you need to rename your Vertex groups to fit deformation bone names.


Camera coordinate appears to be left handed It is weird that I have a camera that has a left-handed coordinate system.
All the other cameras are right handed.

Left handed camera:

Right handed camera (all others are right handed, too):

I can't tell what caused this.

As hinted at by cegaton, you set the x-dimension of the scale to a negative value for one of the cameras. Open the properties region with N and set the scale back to positive 1 if you like.


Why does my control panel not stay the same? My material panel doesn't look like this when in cycles render mode

I would like it to look like this in Cycles mode because here im in Blender render but instead it looks like this

Is there a way to do this? I am trying to make the plane a shadow catcher to it should be invisible but i can't do that in this control panel. Please tell me how i can fix this or switch control panels

What you need is not possible.

Some of the Panels in the Properties Editor are dependent on the render engine.

Blender Render Engine has different shading philosophy and thus the settings appear differently.

You must choose a render engine for a project and go with it.


precisely moving faces in different directions Here is a picture to help show what I mean

Thanks to anyone who helps :D

Click G to grab or translate the face, which you've selected and type the certain distance you want the face to go. You can use the X, Y and Z keys to lock the movement to a certain axis.


How to slowly increase rotation speed of actuator So i'm making a game in bge and i've came across a problem. It's a driving game and i noticed for turning if i just put a certain number for rotation in the actuator the steering would be messed up. So i tried coding it and came across a problem. Idk how to make the rotation speed go up slowly. sorry.
Code:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner
#Sensors
leftSensor = cont.sensors["Left"]
rightSensor = cont.sensors["Right"]
#Actuator
turningSensor = cont.actuators["Turning"]
turning = 0
if leftSensor.positive:
    turning = turning - .03
if rightSensor.positive:
    turning = turning + .03
own.applyRotation((0, 0, turning))

I have tried using a while loop instead of a if so it will loop(like i want it to) but a while command will completly crash bge. How do i do this

Timing
A logic brick represents the behavior of a single step. This step should be as fast as possible. It does not describe behavior that lasts longer than a single frame.
Therefore you should not try to describe a whole journey unless you want to finish it with one step. Even with that it has to be a fast calculation.
Bricks and Python
Your code reads an actuator but does not use it. Either the code is obsolete or it is missing something. I guess your original design was to reconfigure the actuator's parameter. Later you decided to use the applyRotation() making the actuator to act as actuator. Both ways are possible.
They do not make a difference regarding your question.
Model
A model describes the inner status of a specific aspect. In your case the aspect is how much to turn. So the model is "turning".
( A model can be much more complex. e.g. it can describe the status of a complete car including, speed, position, if doors are open, what lights are on ...).
Here the model describes how much to turn (single value).
Lifetime
You chose a variable as model. Please be aware that a variable exist only with the current processing of the code. It will not survive the exit of the controller. In other words you get a new variable at each single frame.
Thinking about a car model: your get a brand new car with each single frame .   (This might be a nice idea at the first sight, but it the car is always located at the car dealers place, without gas ).
You can see that at the console when you add print(turning).
It is better to keep the same model as long as the car exist. You need a model that survives when the controller's completed it's processing at the current frame.
There are several different ways to achieve that.
Property as storage
I suggest you use an object property. It will bind the "turning model" to the game object that performs turning. This allows different game object that all can perform individual turns.
The change to your code is minimal but has major impact:
import bge
controller = bge.logic.getCurrentController()
owner = controller.owner

PROPERTY_TURNING = "turning"

#Sensors
leftSensor = controller.sensors["Left"]
rightSensor = controller.sensors["Right"]

turning = owner.get(PROPERTY_TURNING , 0.0) # get your model from storage

if leftSensor.positive:
    turning = turning - .03
if rightSensor.positive:
    turning = turning + .03

owner[PROPERTY_TURNING] = turning # update the storage with the modified model

own.applyRotation((0, 0, turning))

I hope it helps


Part of render blurry I am trying to render a scene but as you can see in the image, the lower part of the shield (the line between red and white) is blurry. I've tried changing dof and tweaking materials but the problem still persists. What should I do?
Blend file

Move your empty closer to the camera and lower the aperture value, real world cameras also have approximately one third of DOF close and two third far from lenses.


Why is my road offset from it's parent bezier (wrapped to a sphere)? I'm currently combining this tutorial with this answer in an attempt to make something like this:

Instead, I'm getting something like this:

I'm using two simple deforms in order to turn the bezier into something like a sphere, then shrinkwrapping it to a UV Sphere in order to make it more rounded and avoid weird twists inward.

Unfortunately, the road array is going a bit crazy. Can anybody tell me how to get it to more closely follow the curve (in a sphere shape)?

Thanks in advance,

--Rev

PS: Shrinkwrapping the road just results in the road losing geometric detail as it's smooshed into a razor thin coating on the sphere.

EDIT / ADDITION:

Just to try and clarify, ultimately I'm looking to have a road layout similar to the following wrapped around the sphere seamlessly.

As mentioned below, I'd like to be able to have multiple roads and intersections connecting to each other and looping over and around each other with interchanges, etc

Do you really need one unique road?

If that's the case, you could create a sphere, a curve, and use the Snap option to stick the curve to the surface of the sphere, then gradually scale down the sphere so that the curve also scales down.

If you don't absolutely need one unique road (which in my opinion is the case in this picture) you could fake this kind of object this way:

Create your road segment, apply the scale and the rotation, give it an image texture.

Create a curve. Give your road segment an Array modifier, Fit Type > Fit Curve, and a Curve modifier.

Duplicate your curve + object, rotate and move it as you like, scale the curve (and only the curve).


2.8 Glass not reflecting in mirror? I'm new to Blender and modeled a glass lantern and mirror. For some reason, my glass is not reflecting in the mirror and the reflections in the mirror are lower in resolution. The glass lantern and mirror are simple materials I have made in the node editor based off of a few tutorials. I appended other glass models into my scene and the mirror seems to reflect everything but glass.

How can I make my mirror reflect details accurately? Why do glass objects not reflect in my mirror? Also, how do I conceal the shape of my area lamp in my final render without hiding it because it reflects in the mirror?

Please help me figure out what is going wrong.

EDIT:
Here is the blend file with reflection plane:

mirror_lanter_bulb.blend

Unfortunately, the glass bulb inside the glass lantern is not visible at certain angles. May someone know why?

EEVEE supports reflection by having a map that saves a screenshot of reflection.

You can add a reflection plane in front of your mirror. Also, the reflection setting in both the material settings and in the main render panel should be checked.


How to animate cuts between shots? I'm having a surprising amount of difficulty finding an answer to a rather simple question...

I've worked out how to animate things in Blender. But I'm having trouble putting cuts into the animation.

Initially I had the camera just fly from place to place, but the repeated fairly fast camera movements come across as rather disorienting and confusing. Then I had the idea that maybe cutting from shot to shot might work better. But how do I do that, exactly?

My first though was that this would be trivial: If you put two keyframes on consecutive frames, the camera position will just instantly snap to the next keyframe. Well, it does, but it also screws up all the interpolation. (Presumably Blender is still trying to make the control spline smooth, so it's changing the animation I've already set up.) It's also really fiddly to set up this way.

I'm really struggling to find the right search terms to answer this simple question. Google returns lots of hits for how to existing cut video files (not what I'm asking), or how to animate a character jumping (nope), or how to animate cutting an object in half (still no).

I did find a few glimmers of relevant stuff, but I don't really understand it. One page off-handedly mentioned multiple cameras. (Wouldn't that be an error? How would that even work?) Another hinted at having multiple "scenes". (What's that?) But I couldn't find any in-depth explanations.

Basically, what is the "correct" way to cut between shots? Surely everybody does this constantly, all the time, so I'm confused as to why I can't find any information about it...

As per the comments, I eventually went with the approach of using multiple cameras.
Basically this consists of:

Have more than one camera object in the file.
Add "markers" to the dope sheet on a specific frame number.
Select the marker you want, select the camera you want, and find the hidden menu item to "bind" one to the other.

Now the render output does a hard-cut from one camera to the other when that specific frame is reached.
Unfortunately, binding a camera to a marker deletes the label on the marker, so it's now useless for... you know... marking anything. But hey, it generates the right output frames...


Using Freestyle with semi-transparent materials I am working on an animation which will have a model behind transparent materials making up the foreground:

However, no Freestyle settings ("QI Range", etc.) are working for me. I tried setting "Edge Mark" and "Exclusive", but depending on the "Visibility" setting I either get the lines showing through the foreground mesh or being entirely hidden by that mesh.

What would be the optimal way to approach this problem?

Via Carlo's comment above (linking to this question), it appears that in Blender, "transparent faces are treated as opaque faces," so my setup would not work. Instead, I will separate the Freestyle layer.


Why won't my eye texture mirror? I am having this problem with the mirror modifier with the eyes. Blend will copy the shape, size, location, and rotation, but if I add transparency and create a texture, only the original half renders out texture, while the mirrored one doesn't register the changes.

I've tried deleting the modifier and adding another mirror modifier to no avail.

Is there a fix for this or will I have to keep duplicating the original eye and mirror it manually?

You're using a procedural texture with generated coordinates. It's normal if it doesn't mirror.
If you want this blend texture to mirror while keeping the mirror modifier you'd have to use UV coordinates with an equirectangular projection and using a linear blend texture.
Or you can simply apply the mirror modifier, separate the eyes and put the origin of each one at its center.


How 'Remove Selected from Active Collection' feature works? I thought Shift+Alt+G (Remove Selected from Active Collection) was just a change to a collection.
I read the official manual and understood it.

But in fact, the way this function works in the blender is not only removing the selected objects from the collection to which the active object belong, but also the active object.
Please check the GIF.

What do I misunderstand?
The result I expected was as follows.

Additional Question
If so, how to check the active collection in Blender UI?
When checked with bpy.context.view_layer.active_layer_collection.name, the last clicked collection in the outliner is displayed.

This will also be displayed in the top left of the 3D viewport.
However, the active collection that the collection allocation operations mean seems to mean the collection to which the last selected active object belongs, not the last selected collection in the outliner.
I am curious how to check this active collection in UI.

Solution:
Ah, this was simple and basic.
To easily check the list of active collections to be used in the collection assignment operation, check the property editor\Object tab\Collections panel.

This is functioning properly, but you must understand two concepts:

The active object is one of the selected objects, always
If you remove an object from all the collections in a scene, it will appear as though they have been destroyed, although they are still present in the file memory. It can also still be loaded in another scene's collection.

The way I see it, Add Selected to Active Collection should be relabeled to Add Selected Objects to Active Object's Collection(s). In fact, if your active object is part of several collections, the UI will ask you to which one you want to add the selected objects, or if you want to add them to every one of these collections.
Similarly, Remove Selected from Active Collection should be relabeled to Remove Selected Objects from Active Object's Collection(s). It also prompts the user whith which collection they want to remove the selected objects from.
However, if by doing so you remove one or several objects from their last container collection in the scene, it will effectively disappear from said scene. You can see they are still in the file if you change the outliner display mode from view layer to Orphan data. You can then manually re-add it in your scene.
I agree that there should be a warning if you are removing an object from its last collection saying something like "Warning : This will remove this object from the scene"
To do what you want to achieve in your last set of screenshots, you just have to deselect the cone and call the operator.


How to export object with its texture for 3d printing? hopefully, this is a simple noob issue. Yes I have seen that it's been asked again and again and again, and I have tried lots of the solutions but I'm still stuck.

I have a model that I have applied a texture to and it renders nicely in Blender.

Ideally I want to export this to Shapeways for printing in colour sandstone, or when I eventually get an Mcor Arke, print it on there. So, I have a few options, DAE and X3D for example, these require the texture to be alongside the file in a zip file, and when I upload them, Shapeways says there is a texture (probably because the zip file included a PNG file), but won't render it. When I look in the X3D or DAE file with a text editor, there is no reference I can find to the PNG texture file.

I also tried this post on using the blender render engine, but it still doesn't have a reference to the texture when I export the object.

From when I used to do scanning, PLY seems to have all the image data in the file, so I tried that. Interestingly, Paint 3D recognizes PLY files and renders my bust scan... but, still no model of mine. I thought it may be the mirror modifier, but checking the export attributes, it applies those and includes the UV data, and I applied it manually to test anyway, but no.

Stumped, I continued my search. There was this post about not using nodes, but as I walked through the screenshots, I didn't have the "Mapping" tab that was there, then I did something somewhere and it was there, but it didn't have a UV option for coordinates, when I did the original unwrap I did use the smart option... because I followed a youtube example, so I went back to the beginning of this article, and did the unwrap.... but now I cannot see the material rendered at all in any view. I can't seem to find a walkthrough example of a complex paint job without nodes.

Finally, I found this post. I didn't really understand the explanation, but it did mention baking, which I saw in an option somewhere. So I gave that a pop.

Still nothing. So now I'm out of ideas. Any other ideas much appreciated, but, please bear in mind I still don't know Blender all that well.

If you're interested, here is a zip file with my .blend file and texture.

Any help much appreciated before I lose my mind.

I originally followed this tutorial where it outlines smart unwraping as part of the UV creation process. I started from scratch, and instead of doing the smart unwrap with island spacing, I just did an unwrap (more like one of the posts I looked at) and things now work as expected. The only downside is that some of the geometry has warped into very small triangles on the PNG file, but this isn't (in this case) a big issue.

PLY's still don't embed the data, but that's a problem for another day :)


Weight paint in cycles nodes? I'm trying to use weights from a vertex group in cycles nodes to change the transparency of the mesh. But as far as I know this is still not supported.

Is there any workaround that I could use?

This is what I want to achieve:

As you can see, I use a VertexWeightProximity modifier, to paint the vertex group, and I would like to use it in the node tree to affect the transparency of the mesh. The attribute node doesn't seem to read vertex groups yet.

You need to translate vertex weight into some proxy that nodes can read.  Consider using UV as a proxy.  It can be read by nodes and it can easily be mapped to vertex group weight.

Create a new UV mapping for your mesh and set all vertices to 0,0 on that new map.  Add a UV warp modifier editing this new mapping, modulated by the vertex group you want to reference, and set it to use two empties, one located at 1,1 and one at 0,0.  Now, by accessing these new UV coordinates, you're accessing the vertex group modulating the modifier.


Python: template_ID()-like UI for PropertyGroup For a Blender add-on I am trying to create an UI that let's the user

choose from a list of existing instances of a PropertyGroup stored in
a CollectionProperty
create new instances of that PropertyGroup and name them
possibly delete instances

This is much like the normal chooser for ID types that you get with the template_ID() function, but for a non-ID type.

First I was thinking if it would be possible to derive an ID-type myself, but I found no information on that online, so I doubt that it is even possible. Note that my items cannot really be represented by any ID-type already present in Blender.

Things I've already tried:

template_search() gives me a nice way to look up existing properties, but because my items' name properties are not necessarily unique, it is not really an option, because I can't get the original item back from the name string.
prop() with a dynamically generated EnumProperty sort of works. However there is no way to rename the item without a secondary name input box.

I was wondering if somebody has already created a similar kind of input for another Blender add-on or even as a Python module that I could use for my purposes.

It is possible to create a group of inputs that behaves very similar to the normal chooser. This is the code to draw the widgets:

def draw_buttons(self, context, layout):
    group = layout.row(align=True)
    choose_props = group.operator('example.choose_item', text="", icon='PRESET')
    if self.item_set:
        group.prop(self.get_item(), "name", text="", expand=True)
        clear_props = group.operator('example.clear_item', icon='X', text="")
        clear_props.node_tree = self.id_data.name
        clear_props.node = self.name
    else:
        new_props = group.operator('example.new_item', icon='ADD', text='New')
        new_props.node_tree = self.id_data.name
        new_props.node = self.name
    choose_props.node_tree = self.id_data.name
    choose_props.name = self.name

The choose operator itself uses context.window_manager.invoke_search_popup() to open a search box of available items. Here is example code for the operators:

items = [('one', 'Any', "", 'PRESET', 1), ('two', 'PropertyGroup', "", 'PRESET', 2), ('three', 'type', "", 'PRESET', 3)]

class ChooseItemOperator(bpy.types.Operator):
    bl_idname = "example.choose_item"
    bl_label = "Choose item"
    bl_options = {'INTERNAL'}
    bl_property = "enum"

    def get_enum_options(self, context):
        global items
        return items

    enum: EnumProperty(items=get_enum_options, name="Items")
    node_tree: StringProperty()
    node: StringProperty()

    def execute(self, context):
        tree = bpy.data.node_groups[self.node_tree]
        node = tree.nodes[self.node]
        node.item_set = true
        node.set_item(self.enum)
        return {"FINISHED"}

    def invoke(self, context, event):
        context.window_manager.invoke_search_popup(self)
        return {"FINISHED"}

class NewItemOperator(bpy.types.Operator):
    bl_idname = "example.new_item"
    bl_label = "New Item"
    bl_options = {'INTERNAL'}

    node_tree: StringProperty()
    node: StringProperty()

    def execute(self, context):
        global items
        tree = bpy.data.node_groups[self.node_tree]
        node = tree.nodes[self.node]
        node.item_set = True
        newitem = ('four', 'type', "", 'PRESET', 4)
        items.append(newitem)
        node.set_item(newitem)
        return {'FINISHED'}

class ClearItemOperator(bpy.types.Operator):
    bl_idname = "example.clear_item"
    bl_label = "Clear Item"
    bl_options = {'INTERNAL'}

    node_tree: StringProperty()
    node: StringProperty()

    def execute(self, context):
        tree = bpy.data.node_groups[self.node_tree]
        node = tree.nodes[self.node]
        node.item_set = False
        return {'FINISHED'}

Of course this is just example code and adding new items should be smarter than just adding items to a global list, but this is the general idea.


Texture paint showing a random old render on my model See the following screenshot.
I am trying to paint my model but some random artifacts are showing up on my model and makes it hard to see what I'm painting exactly.

Deleting my models texture, UV map and material does NOT solve it.

I also tried restarting it obviously but without luck.

I think you need to look to see if you have your old render as a brush texture.


Have a ray create a force? Scene:

I have a simple weapon system: weapon which has a ray that collides with game-related objects (i.e. objects that can collide with player); an empty that is always at the end of the ray; and, on a trigger (left click), an object (damage object) is added to the end of the empty, the object changes the health value of an opponent when collision occurs. There is also an opponent, for the simplicity of this question, a cube set to dynamic for physics.

Problem:

I am trying to get the ray to exert a force the way it is facing/going. I'm not quite sure how to create such an idea in the game-engine. How can I have a ray create a force facing the same way the ray is facing/going?

Include/Note

Force only affects certain object(s). This/these object(s) are whatever the damage object collides with. In other words, the force will affect no object but those that the damage object collides with. (You can have it collide with the object(s) the ray collides with if you can't do this)
Force does not decrease/increase strength over time; force is constant.
A property that defines how much force to use.
A property that defines how long the force will last.
Please try to answer in python.

Any help is appreciated. Thanks!

Due to the dynamic nature of that operation you need a Python controller to apply that impulse/force.

I suggest to use a ray sensor. It provides the object hit, the position where it was hit and the direction you measured.
Usage

Place this snippet in a python file force.py

import bge
import mathutils

PROPERTY_STRENGTH = "strength"
DEFAULT_STRENGTH = 1.0

def applyAtHit():
    if not allSensorsPositive():
        return
    sensor = getDetectionSensor()
    affectedObject = sensor.hitObject
    hitPosition = sensor.hitPosition

    strength = getOwner().get(PROPERTY_STRENGTH, DEFAULT_STRENGTH)

    direction = mathutils.Vector(sensor.rayDirection).normalized()
    force = direction * strength

    affectedObject.applyImpulse(hitPosition, force)

def getDetectionSensor():
    return bge.logic.getCurrentController().sensors[0]

def getOwner():
    return bge.logic.getCurrentController().owner

def allSensorsPositive():
    for sensor in bge.logic.getCurrentController().sensors:
        if not sensor.positive:
            return False
    return True

Apply following logic to the measuring object:

Setup a ray sensor (must be the first one) with a distance that covers the range you want to have, [True Level Triggering] is not needed as you want a single impulse
Setup a Python controller in module mode with Module: force.applyAtHit
Ensure detected objects are physics objects (dynamic, rigid body, softbody)

How does it work?

When all sensors are positive and any of the sensors triggers the controller the function applyFromHere() will be executed. Each run will apply exactly one force or no force at all.
That is the reason for [True Level Triggering] disabled. This prevents subsequent execution unless you "activate" again. Means you need all sensors positive and at least one to trigger.

The ray sensor checks for an hit. The Python controller calculates the

the affected object
the direction towards the affected object
the strength of the force

With that the Python controller applies the individual force to the affected object. Here we use applyImpulse(). This does not just affects the linear motion, it results in change of the torque too.

I hope it helps


Rigging a complex character with clothes My workflow is as follows:

I created a low poly character. Each part of the body is a separate object. I also created joints.
Then I created underwear so that it could hide the joints and so that it was clothes at the same time. Here are socks, pants and a jacket.
Next, on top of the underwear, I created armor and armature.

It's time to move the character. The fact is that thanks to the individual parts of the body, I can make them bones and the character moves perfectly.
I went to YouTube to find out how to solve the problem with clothes. However, I found only lessons where people create a character from one object, and the clothes that should move are just part of the form.
Then I found a lesson where they work with the weight of an object:

A. Join the body of the character (Ctrl + J) and set parent to the armature with automatic weights

B. Joning all parts of the armor (Ctrl + J and set parent to the armature with empty groups

C. Select a character, then armor and go into weight mode

D. Apply the settings.
Yes, the armor began to move with the body, but they literally became one object when moving. If I tilt my body stronger, the armor inside the body will be very ugly.

My question is: Can I make some (metal) armor really hard so that they do not deform when moving and hook them on a bone or joint?

Perhaps I created a problem by creating such a complex character, I'm new in the Blender.

If you want to make something to deform like absolutely solid thing, you need to maintain the vertex weights of this part assigned to one single bone, and only this bone. That may lead to further problems though. Generally, skinning such "sandwich" chars as yours is always a pain in a butt, and you'll probably have to be ready to agree with some clipping in any case...


Linux Ubuntu 18.04 - Sculpting performance (dyntopo) is terrible in comparison to Windows OS: Ubuntu 18.04
CPU: i5-6600K
GPU: GTX 970
RAM: 32 GB

Sculpting on objects with more 100k polygons (dyntopo constant detail 50 px) lags blender, especially using Snake Hook brush and dragging freezes Blender.

For comparison - on Win10 I can handle 1.5m polygons with Snake Hook with similar performance.

I have Nvidia 396, Cuda and most likely other Nvidia stuff installed too.
I tried Blender 2.77, 2.79 from archive, from synaptic, on steam and 2.8 as well, all of them have the same terrible performance.

Since I was moving from Win to Ubuntu, I used Win startup.blend file so I have most of in-blender optimizations activated, Cuda, backface culling included.

Is this a normal occurrence and I should stay on Win10 or is there something wrong with my Ubuntu?

This is not normal. The entire Blender Animation Studio is running Linux, with many machines using NVidia GPUs. All the Open Movies were made on Linux.


Smoke emitter not rendering in viewport I'm following this tutorial and at 32:45 he tests out the smoke emitter, and I've followed every step to that point, and it doesn't work for me. He starts explaining how to do it at 30:15. Here's a link to my .blend file, can someone please explain to me (very simply) what I'm doing wrong here?

p.s. sorry for asking so many questions!

You have the domain settings on what should be the emitter object.

The domain should be the cube around the cylinder, and the emitter object should be the cylinder inside it (see the wiki).

Note that the smoke simulator was updated a bit in blender 2.64, so to get an the same effect in 2.70a:

Enable the smoke domain for the cube object:

Adaptive domain is a setting which was added in 2.64, and it basically just skips calculating parts of the domain which don't have smoke in or near them. Enabling it should speed up the simulation without affecting the result.
Enable the smoke flow physics on the cylinder (in your file this was set to domain)

Make sure Initial velocity is enabled. You may also want to up the number subframe smaples, but note that this will slow down the simulation.


Image texture is not mapping correctly I unwrapped part of my mesh (front of an iphone screen) and added the image texture.

Strange things are happening but this image texture is not mapping correctly. What is wrong and how to solve this problem ?

There are few issues in the UV Mapping.

To fix theme, select the faces with Screen Material in the Material Panel,

then UV map "Project from View (Bounds)" (U -> Project from View).

If you disable the Subsurf modifier, it works.
To fix the Subsurf issue, add an edge loop near the external edges of the screen.


I cant attach object to armature I am trying to attach simple model (cloths in my case) to rigged and animated character model. I am following this tutorial, but I am not able to attach my object to my character. I recorded short video where I am showing details what I am doing. What am I doing wrong? Thanks for advice

The Transfer Weight function has some parameters (the values are not visible in your video).

By default, i have these parameters :

For you want to do, try this one for the source layer selection :

That will allow to create groups with the same names you have in the character model.

If this still dont work correctly, try to change the vertext mapping and the ray radius value (as your two meshes does not fit exactly) :

Anyway you'll probably need to try values and adjust them so that is corresponds to what you want.


How do I change my Objects' local axis? I am making a robot with a lot of different connected parts that are parented to each other.. When I now wan´t to animate it they don´t rotate in the direction of it´s parent. That is makig animating very tideous so i wonder if there is a way to make them rotate around its parents´ local axis

There are several ways to do this:
1: use an armature, slow to make, but makes it much easier for animation.
2: set the 3D cursor to the parents origin, right click on the child, click on, set origin - to 3D cursor. ( this won't work if you want the robot to rotate the children indipendently later. (not recomended for animation)
3: to rotate them, select the parts you want to rotate, with the parent selected last.  set the pivot point to active element and rotate them. (also not reccomended for animation.)

There are other ways to do this too, but I hope this helped.

ps, I think the armature is the best  method, but If you just want to pose your robot for a still image, the other methods will help you.


Can particle object color and alpha be controlled by Particle Age (Blender Internal Render)? Can particle object color and alpha be changed in Blender Internal Render?

Edit for Clarity 6 months later.

Blender Cycles has this practical feature Particle Info Node.

Blender Internal appears not to have an equivalent feature.

Blender Internal.  Is it easy to change dynamically, based on strand/particle mapping, halo particle size and opacity. Thus halos of different ages will have different opacity and sizes.   Halo and Object are different choices for particles on the particles pane.

Is it possible to achieve a similar color and transparency control with object particles based on particle age?

Failed attempts to achieve goal follow.

I have changed the opacity of a particle halo with a second material with a texture on the emitter.

When I try to change the opacity of a regular particle object, the material selection is grayed in the emitter particle panel.
I added a material and texture using the strand/particle mapping to the particle object.
The particle object was rendered, but the material failed and did not achieve my desired results.

The way I solved this was to give the particle object (not the emitter) a blend texture, mapped to the coordinates of an empty.

This way, the colour of the particle depends on the distance to the empty.

Example here: https://www.dropbox.com/s/il0aiq8a7gteelw/chimney.blend?dl=0


Apply map topography to my NurbsCurve? I'm a newbie and I'm working on a race track based on my neighbourhood. So I used GIS addon to download my area as an object with topography. Then I made NurbsCurve following the track I'd like to make.
Now thing is my Curve is not actually alligned to my terrain and I don't really know how to do it. If it's possible?

Ok, I found out I can move every (point?) of my curve and snap it by Z axis to the closest face of terrain. Seems like it works.


How to combine Cycles and Blender render god-rays? I have tried to add a new scene (Merge) and in the compositor I've added the renderlayers from each scene and then merged them with Color>Mix>Screen.

It seems like there should be a better way.

I also tried to use the File Output node without success.

Here is some test using the suggested methods, still testing:

Here is the Alpha with the invisible selected.  I think this is it!

If you set Alpha to Transparent in Render Settings > Shading for the BI scene:

The render will have an alpha channel: (Note that you have to enable RGBA in Render Settings > Output to be able to save it with the alpha channel)

(I made the spot lamp red so it would be visible here)

You can then use the Alpha Over node to mix this with a Cycles render:

You could also use the alpha channel as a Factor:


texture mapping menu missing in blender render 2.75 I cant find the texture mapping drop down menu in the texture menu when using blender render, are there any alternatives?

This is because Use Nodes is enabled on the material using the texture:

Once this option is disabled, the Mapping panel is available in the texture options.


Grass collection as particles for plane mesh not rendering correctly - Grass does not cover ground entirely in viewport, but does in render SOLUTION: Nvm figured it out -- went to particle settings -> children -> made sure display and render amount were the same. they were not.
So I have a plane mesh with a collection of particles (grass) in a scene I made. In all viewports, the grass mostly covers the ground, but not entirely. You can see dirt here and there, and parts where the ground is otherwise visible between the grass.
However, when I actually render the image, the grass entirely covers the plane so you can't see any ground at all.
I'd like it so the render matches the viewport, in that the grass does not entirely cover the mesh in the render, as it doesn't before the render.
Image examples:
The scene in the rendered viewport. As you can see, the grass does not entirely cover the ground.

The scene as rendered. As you can see, the grass entirely covers the ground for some reason.

Trying to make it so the grass looks like it does in the viewport, when I render it. Thanks!


Blender VSE - speed control and cross effect at the same time I try to use cross effect between two stripes and set speed control effect to one of these stripes , only one of these effects works (the one which is on the top).

You need to put the cross on the speed control strip, not the original strip. You see only the cross at the moment because it is the top most.

Here is the step by step process:

Add the speed strip  (in your case to the rejs_anima... image strip)
Select the newly added speed strip (not the original image strip) and the second video strip (MVI_... in your case) then
Add the cross strip


Stretch side of half cylinder I am trying to pull the curved side of a half cylinder, so instead of doing this,

The curved side should bend to match where I am dragging the edge, while keeping the base in place (instead of pulling whole curved side, the curved side should bend to keep its position.)

1 - You can choose 3D cursor as pivot point and select everything and do s+z to scale on Z axis.

2 - You can use proportional editing, select the top edge and pull up. Adjust circle/influence size with mouse wheel.


Fixing deformation due to IK bone constraint I've been trying to use the IK bone constraint with my rigs as it makes animating much easier, however I find that when I apply the constraint, I get twisting in the mesh. I've tried remedying this by adjusting the pole angle, and although that does remove the twisting, my joint will no longer be bending at the right angle in comparison to the, say for example, Elbow.R.IK, etc... This problem has happened to all of my models that I've applied the constraint to. Thanks for the help]1

Without actually seeing the the .blend file. It sounds like a possible issue involving rotation/scale. One should always be sure to apply Rotation & Scale when done. ( Ctrl + A )


How to convert image sequence to video using the VSE? I've exported all my frames to .png.

Could you please explain (step by step) how to convert images to video using the video sequence editor? I used to export as .avi raw before, but because I'm having to constantly start again anytime I come across an error, I've decided to change my method.

In video sequence editor choose "Image".

Use B to select your frames quickly.

In properties> Render> Output, choose an output location.

Directly below, in properties> Render> Encoding, choose a video format (here I've chosen "H.264"). Select "RGB" right next to it, and hit "Animation" at the top.


Cropping a 2D image imported as plane I apologize for the very basic question, but I have been struggling for some time now with the following task:

I want to create a 3D print of a 2D image by importing it as a plane, subdividing it and the using the displace modifier to obtain a 3D image. However, I have not found a way to crop the original image into the desired shape (circular in this case).

I have tried the boolean  modifier, but it does not work for 2D objects. I have also tried to extrude it into a parallelepipedic object and then use a cone and the boolean modifier, but the image would disappear after the operation. Using the knife or subdividing it and deleting the undesired regions manually would be a solution but both are not very elegant. Is there an easy method to do it?

It is easier to map the image on a circular mesh.

As an alternative you can create another image (or alpha channel) that defines the circle and use that as a mask to define transparency.


I can't figure out how to make PNG file with UV map I've am finishing up my model. But I want to paint the textures on it, but I don't understand how do I extract image with unwrapped object appearing on image so I would have some kind of guidelines on where should I paint

First, you should try the latest version of blender (2.81 at the moment), then just go the the UV menu (in the UV Editor) and select "Export UV Layout" : you 'll be asked to choose a file name, image type AND a resolution so you can paint on it in an external paint program.

But If you want, you can also just go the Texture Paint mode, create an empty texture Map and directly paint on your model ! Have Fun !


Render ONLY the Alpha Channel I would like to render just the alpha channel in an animation, in order to use it as a matte when editing video.

How would I go about doing this?

There is a feature for this

The Combined Pass includes an alpha channel:

The Render Layers Node has an Alpha output for it:

If using Cycles make sure to enable Film > Transparent in the Render Context.

If using Blender Render make sure to enable Transparency in the Materials Context.

There is no need to change the material for all the objects in your scene!

There is no need to use ID Masks for this either.

There are cases where using an ID Mask will cause you problems, for example if your materials have transparency. Observe this tree. Its leaves are texture planes, so if you use an ID mask you will only see the outline of the planes.

If rendering glass with a transparent background in Cycles, see this.


How to move vertices without duplicating them? Whenever I move vertices using grab function (G), the original vertices always stay in their position. How can I prevent this?

This may be because you have a couple duplicate vertices in the same location.

Select all your vertices using A in edit mode and then press W to bring a dropdown menu. Either select "Remove Doubles" or press R as it's faster. Now try moving your vertex. It should work.


Create NURBS surface with Python How can I write a script to create a NURBS surface with given control points?

I did find a helpful piece of source code that got me here:

import bpy

surfacedata = bpy.data.curves.new(name='test', type='SURFACE')
surfacedata.dimensions = '3D'
surfacedata.resolution_u = 4
surfacedata.resolution_v = 4

objectdata = bpy.data.objects.new('obj_test', surfacedata)
objectdata.location = (0,0,0)
bpy.context.scene.objects.link(objectdata)

nurbs_surface = surfacedata.splines.new('NURBS')
nurbs_surface.points.add(4)
nurbs_surface.points[0].co = (-1, -1,  0.25, 1)
nurbs_surface.points[1].co = (-1,  1, -0.25, 1)
nurbs_surface.points[2].co = ( 1, -1, -0.25, 1)
nurbs_surface.points[3].co = ( 1,  1,  0.25, 1)
nurbs_surface.order_u = 2
nurbs_surface.order_v = 2
nurbs_surface.use_endpoint_u = True
nurbs_surface.use_endpoint_v = True

However, the object that this produces is just a 1D curve in space,

I can check some of its properties from the python console,

>>> print(len(bpy.data.objects[2].data.splines[0].points))
5

>>> print(bpy.data.objects[2].data.splines[0].point_count_u)
5

>>> print(bpy.data.objects[2].data.splines[0].point_count_v)
1

So, I'm not sure why points has 5 elements (instead of 4), and why
point_count_u and point_count_v are 5 and 1 instead of 2 and 2, respectively.

While it's not very pretty, it is possible. This example recreates the default  NURBS Surface. Inspired by https://blender.stackexchange.com/a/8587/47
import bpy
from mathutils import Vector

surface_data = bpy.data.curves.new('wook', 'SURFACE')
surface_data.dimensions = '3D'

# 16 coordinates
points = [
    Vector((-1.5, -1.5, 0.0, 1.0)), Vector((-1.5, -0.5, 0.0, 1.0)),
    Vector((-1.5, 0.5, 0.0, 1.0)), Vector((-1.5, 1.5, 0.0, 1.0)),
    Vector((-0.5, -1.5, 0.0, 1.0)), Vector((-0.5, -0.5, 1.0, 1.0)),
    Vector((-0.5, 0.5, 1.0, 1.0)), Vector((-0.5, 1.5, 0.0, 1.0)),
    Vector((0.5, -1.5, 0.0, 1.0)), Vector((0.5, -0.5, 1.0, 1.0)),
    Vector((0.5, 0.5, 1.0, 1.0)), Vector((0.5, 1.5, 0.0, 1.0)),
    Vector((1.5, -1.5, 0.0, 1.0)), Vector((1.5, -0.5, 0.0, 1.0)),
    Vector((1.5, 0.5, 0.0, 1.0)), Vector((1.5, 1.5, 0.0, 1.0))
]

# set points per segments (U * V)
for i in range(0, 16, 4):
    spline = surface_data.splines.new(type='NURBS')
    spline.points.add(3)  # already has a default vector

    for p, new_co in zip(spline.points, points[i:i+4]):
        p.co = new_co

surface_object = bpy.data.objects.new('NURBS_OBJ', surface_data)
bpy.context.collection.objects.link(surface_object)

splines = surface_object.data.splines
for s in splines:
    for p in s.points:
        p.select = True

bpy.context.view_layer.objects.active = surface_object
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.curve.make_segment()

The ideal situation would be where the spline.points would take a nested list and automatically combine them under the hood, rather than requiring calls to bpy.ops.
Edit: For Blender 2.8+, linking objects uses 'bpy.context.collection'


Collect, apply modifiers, and triangulate meshes before export, without touching the original mesh I try to export a collection of meshes such that

The original meshes is not touched by the exporter
All modifiers affect the exported mesh
The exported mesh is triangulated
It should not look like the file has been changed by the exporter

It is permissable to not fullfil the fourth requirement though.
Here is my preparation functions, used to copy the meshes and joining them into one:
def collect_meshes(collection):
    meshes = []
    for object in collection:
        if object.type == 'MESH':
            tmp = object.copy()
            tmp.data = object.data.copy()
            meshes.append(tmp)
    return meshes

def apply_modifiers(objects):
    context = bpy.context.copy()
    for object in objects:
        # Cannot select this object because it is not in a view layer
        # object.select_set(True)
        for modifier in object.modifiers:
            # How to apply a modifier on a different object?
            # bpy.ops.object.modifier_apply(context, modifier =  modifier.name)
            pass

def join_meshes(mesh_array):
    context = bpy.context.copy()
    context['active_object'] = mesh_array[0]
    context['selected_editable_objects'] = mesh_array
    bpy.ops.object.join(context)
    return context['active_object']

def triangulate(mesh):
    bm = bmesh.new()
    bm.from_mesh(mesh)
    bmesh.ops.triangulate(bm, faces = bm.faces[:])
    bm.to_mesh(mesh)

In case something went wrong, I also have the following cleanup:
class MeshCopy:
    def __init__(self, mesh):
        self.__mesh = mesh

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_value, traceback):
        self.__mesh.user_clear()
        bpy.data.objects.remove(self.__mesh)

    def get(self):
        return self.__mesh

So I can use the with statement for RAII. Is only way to get this working to create a copy of the original file, and export the content of that file and then delete the copy?

Bmesh from object.
See How do I get a mesh data-block with modifiers and shape keys applied in Blender 2.8?  Can use the evaluated mesh and look at loop_triangles or with a bmesh and call the bmesh triangulate operator. In both cases no new data need be added to file.
The two answers show how to get the evaluated mesh as either a bmesh or an evauated mesh.  In either case there would appear little need to bother with a context manager to use the with statement.

Result of running on two selected subsurfed default cubes, creating one joined and triangulated to export
Here is an example that creates a joined and triangulated bmesh from all the selected mesh objects.
Just as with multiple calls to bm.from_mesh(...) can be used to read multiple meshes into one bmesh, can do same for bm.from_object.
On each "read" the new vertices are transformed by the objects matrix world.
To demonstrate result, a new mesh object is created and added to scene, whereas the exporter can simply re format the bmesh data.
import bpy
import bmesh
context = bpy.context

meshobs = [o for o in context.selected_objects if o.type == 'MESH']

dg = context.evaluated_depsgraph_get()

bm = bmesh.new()

for o in meshobs:
    n = len(bm.verts)
    bm.from_object(o, dg)
    bmesh.ops.transform(
            bm,
            verts=bm.verts[n:],
            matrix=o.matrix_world,
            )

bmesh.ops.triangulate(
        bm,
        faces=bm.faces,
        )

# new object to test
me = bpy.data.meshes.new("TriExportTest")
bm.to_mesh(me)
ob = bpy.data.objects.new("TriExportTest", me)
context.collection.objects.link(ob)

World or Object Coordinates?
Note the created bmesh above will have its vertices use the global coordinates of the input meshes. And an identity matrix world (no transform)  To more closely emulate the join operator, by using object space of the active object
Save and calculate inverse of matrix world of active object.
mw = context.active_object.matrix_world
mwi = mw.inverted()

then in the bmesh transform operator
    matrix = mwi @ o.matrix_world

and finally assign the matrix world to the joined object
ob = bpy.data.objects.new("TriExportTest", me)
ob.matrix_world = mw


Use display as bounding box with eeviee my issue is that I have a scene with many objects for a game with Eeviee (UPBGE), and I cannot afford to display them in the viewport, even though I put together a few logic bricks that emulate a binary LOD (visible/invisible) so that in-game doesn't lag from having to draw distant objects.
I wanted to use Object Properties > Viewport Display > Bounds but Eeviee doesn't render the meshes when the game starts.
When using the 'visibility' logic node, effects are taken into account and it is stated that the node acts upon the render switch button from the outliner, but manually setting this switch outside of the game has not effects, thus I don't understand how the game engine treats Eeviee viewport's render.

I could be wrong, but for view bound meshes, even though Blender doesn't render those polygon faces, they still render the vertices points for meshes, which is still a performance hazard. By the way, I totally forgot the wireframe modifier works at run-time for 0.3x. Does this solve your problem?


Filling pentagon with quads (combinatorics) How to subdivide edges of the pentagon so that when I'm making grid with faces I get perfect quads or almost all quads ?

This is more math-combinatorics question but is quite important for the mesh to have nice grid.

For example, if I press grid fill with this subdivion, Blender says  to  select two edge loops and I can't fill it with almost all quads.

Original answer (edit addressing the question clarification below)
If you look at how the Catmull-Clark subdivision algorithm does it, you can see it creates a five-pointed star:
Before:

After:

When you surround it with quad geometry, it still works the same:
Before:

After:

With Catmull-Clark smoothing:

If we look at this, we can see that this redirects the topology very nicely:
It is important to note, though, that in a few cases, you can change the way you divide it up to change the topological flow. Most times though, this is the easiest and most useful subdivision.
Edit:
When I saw your edit and understood better what you were asking, the first thing I thought of was CGCookie's Retopoflow addon. You can purchase it on the Blender Market. This has a few algorithms to fill or "patch" areas like that. I looked at how it did that and came up with a few ideas:
#1: Are all of your subdivisions necessary?
I know that this doesn't answer your question directly, but it seems like the number one thing that the RetopoFlow does is reevaluate whether all of the vertices on each edge are necessary. It will add or remove vertices to adjust and produce cleaner topology.
#2: Treat it like a quad
In some cases, you can treat it like a quadrilateral. For example, if you have a pentagon like this:

You can treat the two right edges as one edge and still fill it like a quad:

It doesn't have to be symmetrical:

In addition, Retopoflow has a open pull request that has more sophisticated N-gon filling methods. You might be able to look through the source code to find what algorithms it uses. Here is a gif from the site of what this produces:


When in weight paint, armature is outlined in red rather than selecting a bone? Why is it that, when I open a rig that has the limbs separate and the bones don't move the mesh yet, I select the armature and go to pose mode, then open the rig of the body in weight paint mode and try to select a bone, the whole armature is outlined in red rather than outlining a single bone in blue?

First check that your armature is in Pose Mode. Switch it to Pose Mode (Ctrl+Tab) and then select your mesh and paint.

If it doesn's help, you probably didn't assign Armature Modifier to your mesh. In this case select your mesh, then holding Shift select your armature and press Ctrl+P and then choose Armature deform.


assign a single texture to atlas type uv-map? I have an environment model from a game and i was trying to assign the textures in Blender. In this example, there are hundreds of leafs on a wall and i have a single texture of a leaf, but the uv-map shows them all next to each other in varying sizes, like a texture atlas. Is it possible to assign the texture without re-unwrapping the mesh? I have to keep the original uv-map intact, to make it look exactly like in the game.

example:

You need to make another UV map, unwrap leaves individually to a leaf image and then bake it to the atlas texture using the original UV map, like this:

Whole procedure in one gif

Invidividual steps:

Create new image for the atlas texture by going to UV/Image and Alt+N

Create new UV map

Create a material with a leaf texture

Select All A, change image in UV/Image editor to the leaf image and then Unwrap U > Reset - this sets whole UV
space for each leaf so you can apply your leaf texture to all of them individually. Adjust UV to your needs.

Switch back to original UV map and click on the camera icon of the UV map with individual leaves (so we will bake from this UV map)

Navigate to Render > Bake, hit Bake

Your leaves are now baked into the atlas texture


Fluid not working, stuck at midair I've set a simple scene, big box containing everything set as domain, container inside the domain set as obstacle, icosphere at the center as inflow (shell, like the obstacle). What i got is this behaviour, the liquid floats mid air like there's some box obstacle

I've noticed the center of the axis (sorry don't know the exact name) was not at the center of the object, also followed here and it worked


Object doesn't follow the navigation mesh path using steering actuator So, I manually created a navigation mesh (i.e. added and edited a plane mesh > changed the physics type in bge to navigation mesh). I then added a steering actuator (path following) to my human model, set-up the target object and used the navigation mesh I just created. But when I press P, the human model doesn't follow the path of the navigation mesh. What it does is walk through a path that doesn't have a navigation mesh.

What I want is to make the actor object (human model) to use the navigation mesh as the path like so,

This is my logic set-up

Also, the human model can't detect any obstacles along the way, but the is another problem.

Any help is appreciated. Thanks in advance.

Building the navigation mesh using the properties in the Scene also doesn't work

Instead of setting a "Navigation Mesh" physics type on an existing object, you should generate the navigation mesh via the relevant button in the scene properties.

In my tests, that seems to work fine.

Here's a tutorial for that procedure: https://www.youtube.com/watch?v=aMWeTXL98mM

And here's a working demo: nav_mesh.blend


MixRGB vs Math for greyscale I'm currently using Blender 2.8, but this applies to 2.79 too.

In the shader graph when using scalar/greyscale values is there any difference between using the Math node and MixRGB for the operators that exist in both?

e.g. if I use multiply in MixRGB is it going to give me inferior results to using multiply in a Math node? Particularly when generating textures from different noises and mixing them to create maps.

I asked this same question to one of the developers of Blender at the Blender Conference in 2019 and he said that they are identical.


combine objects by name in scene into one object In my scene, I have multiple objects with the following names:

Verts
Verts.001
Verts.002
Verts.003
Verts.004

I want to combine all of these objects into one mesh which I can then export out as an stl. For what it's worth, the objects are just point clouds, with no face or edge information.

You can use the startswith() function to select all the objects that stqrts with Verts and join them into one object :

import bpy

bpy.ops.object.select_all(action='DESELECT')
objects = bpy.context.scene.objects
for o in objects:
    if obj.name.startswith("Verts") :
        obj.select = True
bpy.ops.object.join()


How to shorten object names? I was basically wondering how you can shorten your object names automatically instead of going in and do it manually on countless of objects.

I know there is a object renaming add-on, but this only renames all the objects.

So, if anybody knows how I can just shorten the object names, I'd be very grateful!

This script renames all the objects and assigns a number.

import bpy

objects = bpy.context.scene.objects

for i in range(0, len(objects)):
    print(objects[i].name)
    objects[i].name = "object" + str(i)
    objects[i].data.name = "object" + str(i)


Increase size of column width in save dialogue short list view our filename conventions are rather long and i can't see and/or edit them in the Blender save dialogue short (or long) list view.

Is there a way to make the columns wider?

Thanks
JK

Set the file display size to Large.

If you still can't read the labels, you will have to decrease the font size in the User Preferences.

Ctrl+Alt+U opens the User Preferences. Then go to the Themes rider and change the Points value under Widget Label: Kerning Style.

Right clicking on a folder/file item will display its name in the File Name box of the File Browser.


Is the Mtl file required with the Obj? I have written a parser for an .obj/.mtl files.

I was wondering: Is it possible to define a model without an mtl file?

If this is possible, what are the default material values?

I have spend a decent amount of time reading up on the formats of .obj and .mtl files. I have yet to see anything that talks about how to handle the case when an .obj does not reference an .mtl file.

You mean with Blender?

The Blender obj exporter let you "write materials" or not, i.e. create the .mtl file or not (by default yes, uncheck it before confirm exporting).

And you can import in Blender a .obj file even without a .mtl

But I don't know if I answered you.


Physics sim - Progressively destroy bridge I'm attempting to destroy a bridge progressively and have cell fractured a mesh that is 80m long and then smashed through it with a cube (both are rigid bodies).  All the cells in the fractured mesh are "Start Deactivated" with angular and transitional velocity set to .5m/s to activate.  The bridge starts deactivated but the whole thing falls as soon as my cube touches the first end.  How do I get around this? Image below shows how it starts and when cube hits.

I've had similar problems in the past, there are just a few simple things you need to do to avoid everything exploding. Just need to set the threshold for activating to be a little higher.
When making the cell fracture make sure that you have a decent margin so that the pieces aren't inside of each other. As well as make sure that the pieces have their origins recalculated to their centers. While the margins might not look good, you can always boolean the original uncracked object out of the way later during the animation.
The most important part is to make sure that after you've made all the rigid bodies, to go to the object menu, rigid bodies, then select connect. This will add a bunch of rigid body constraints that will help keep the bridge from exploding.

Just make sure that you change the setting in the constraints to breakable so that it can actually fall apart when given enough stress. You can also quickly copy the value to all of them by selecting all the constraints with one set as the main active. Then just set the breaking to on and then right click it, a small window should appear, all you have to do is click copy to selected.