Removing ridge by smoothing How can I remove the ridge created by the edge of the T-shirt?

I'm using the mesh in an acoustic simulator, and a distinct ridge is sure to create some unnecessary echo artefacts.

Is there any better alternative than simply decimating the mesh?

I'd try Sculpt mode, then hold Shift and drag mouse while holding left mouse button over the ridge to smooth it out.


Can modifiers such as "Subdivision" and "Array" be "animated"? Suppose I wanted to animate an object growing out of the ground, or turning from a cube to a much smoother shape, could I animate this using modifiers and key frames?

I know I can use shape keys to achieve something similar, but modifiers would make it easier and smoother. Is this possible?

You sure can! You can animate any of the values in the modifiers by Right Clicking on the field and choosing Insert Keyframe. Then insert another frame further down the timeline where you wish.

You can also insert keyframes from a value by hovering your mouse on it and pressing I, or you can remove keyframes on the current frame by pressing Alt + I.


RADIAL Colorramp gradient texture Ok so I got as far as getting the colors I want, and making them gradient. Now my question is how do I get the colors to wrap around a circle mesh like the rings around a planet? Im guessing it has something to do with mapping?

In cycles
use a gradient texture using a quadratic sphere as the color style blending.

Blender Internal
Use quadratic sphere for the blend and sphere for the projection:


What is the difference between duplicating and instancing an object, in regards to the materials they point to? As a follow up of my question What does the 'F' button and '2' button do (materials tab)?, I have another question:

When I added an object mesh and applied a material, and I added another mesh, not duplicate but with ShiftA, and choose this same material than it is added as a new user (checked by press the 'F'-button and look at the number next to it).

When I duplicate linked an object by AltD their material data are linked, but this duplicated linked object mesh is not added as a new user (checked by press the 'F'-button and look at the number next to it)

But when I change the viewport color of the material then the added objects meshes (with ShiftA) and the duplicate linked object meshes (AltD) do change their viewport color. So are material from added objects linked different then the material from duplicate linked objects?

By default materials are linked to the object data. Hence when you instance the object data you are not duplicating the material, or the users of the material.

When you AltD an object, you are keeping the same object data.
If you look at the Data tab of the properties window for any linked duplicate object, you will see that the Mesh Data has the number of users.

The material still only has one user because part of the object data is the materials.

However if the material link is set to "Object" then AltD duplicating an object will increase the user count for the material.


Texture types and how to use them Good day everyone. I took a 3D model from the game, and it's using a few textures. I opened them, and now I'm a little bit confused.

Why does each texture end with _d or _m?

_d - is diffuse, right?

_n - Normals.

_m - Weight paint

and what about others?

I did a sample render with "Diffuse" map:

There's an actual game screenshot from MLBB. Archives has *.unity3d files:

After extracting games character archive, there was a file AdditiveBackface.txt

And inside it says:

Shader "<effect>/AdditiveBackface" {
Properties {
 _diffuse ("diffuse", 2D) = "white" {}
 _intensity ("intensity", Float) = 0
 _Color ("Color", Color) = (0.5,0.5,0.5,1)
}
SubShader {
 Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
 Pass {
  Name "FORWARD"
  Tags { "LIGHTMODE"="ForwardBase" "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" }
  ZWrite Off
  Fog { Mode Off }
  Blend One One
Program "vp" {
SubProgram "gles " {
"!!GLES

#ifdef VERTEX

attribute vec4 _glesVertex;
attribute vec4 _glesColor;
attribute vec4 _glesMultiTexCoord0;
uniform highp mat4 glstate_matrix_mvp;
varying highp vec2 xlv_TEXCOORD0;
varying highp vec4 xlv_COLOR;
void main ()
{
  gl_Position = (glstate_matrix_mvp * _glesVertex);
  xlv_TEXCOORD0 = _glesMultiTexCoord0.xy;
  xlv_COLOR = _glesColor;
}

#endif
#ifdef FRAGMENT

uniform sampler2D _diffuse;
uniform highp vec4 _diffuse_ST;
uniform highp float _intensity;
uniform highp vec4 _Color;
varying highp vec2 xlv_TEXCOORD0;
varying highp vec4 xlv_COLOR;
void main ()
{
  highp vec4 _diffuse_var_1;
  lowp vec4 tmpvar_2;
  highp vec2 P_3;
  P_3 = ((xlv_TEXCOORD0 * _diffuse_ST.xy) + _diffuse_ST.zw);
  tmpvar_2 = texture2D (_diffuse, P_3);
  _diffuse_var_1 = tmpvar_2;
  highp vec4 tmpvar_4;
  tmpvar_4.w = 1.0;
  tmpvar_4.xyz = (((
    ((xlv_COLOR.xyz * _diffuse_var_1.xyz) * (_diffuse_var_1.w * xlv_COLOR.w))
   * _intensity) * _Color.xyz) * _Color.w);
  gl_FragData[0] = tmpvar_4;
}

#endif"
}
SubProgram "gles3 " {
"!!GLES3#version 300 es

#ifdef VERTEX

in vec4 _glesVertex;
in vec4 _glesColor;
in vec4 _glesMultiTexCoord0;
uniform highp mat4 glstate_matrix_mvp;
out highp vec2 xlv_TEXCOORD0;
out highp vec4 xlv_COLOR;
void main ()
{
  gl_Position = (glstate_matrix_mvp * _glesVertex);
  xlv_TEXCOORD0 = _glesMultiTexCoord0.xy;
  xlv_COLOR = _glesColor;
}

#endif
#ifdef FRAGMENT

layout(location=0) out mediump vec4 _glesFragData[4];
uniform sampler2D _diffuse;
uniform highp vec4 _diffuse_ST;
uniform highp float _intensity;
uniform highp vec4 _Color;
in highp vec2 xlv_TEXCOORD0;
in highp vec4 xlv_COLOR;
void main ()
{
  highp vec4 _diffuse_var_1;
  lowp vec4 tmpvar_2;
  highp vec2 P_3;
  P_3 = ((xlv_TEXCOORD0 * _diffuse_ST.xy) + _diffuse_ST.zw);
  tmpvar_2 = texture (_diffuse, P_3);
  _diffuse_var_1 = tmpvar_2;
  highp vec4 tmpvar_4;
  tmpvar_4.w = 1.0;
  tmpvar_4.xyz = (((
    ((xlv_COLOR.xyz * _diffuse_var_1.xyz) * (_diffuse_var_1.w * xlv_COLOR.w))
   * _intensity) * _Color.xyz) * _Color.w);
  _glesFragData[0] = tmpvar_4;
}

#endif"
}
}
Program "fp" {
SubProgram "gles " {
"!!GLES"
}
SubProgram "gles3 " {
"!!GLES3"
}
}
 }
}
}

d is diffuse color

n is normal

s is specular color

e is emission I guess

m is mask. It's used to separate into different parts ; ie here you can see the red color isolate metallic objects, wich will probably use a different shader ; same for green (hairs)


When I enter sculpt mode half of my model goes missing? When I enter Object mode, both sides of my model shows.
However, when I enter Sculpt Mode only half of my character shows up.

This makes it difficult to sculpt without seeing both sides.

i have put one mirror and one multiresolution modifier on my model that I have just made. I have clicked subdivide twice and would like to start sculpting.

I'm new to blender, so I believe the fix may be simple like I forgot to hit a key or something? Any ideas on how to fix this?

Any help appreciated. Thank you for your time.

Multires modifier is the only one which can't be repositioned in stack of modifiers, as per manual:

  The Multiresolution Modifier is the only modifier that cannot be repositioned in the stack if it means that there will be geometry or other object data created or removed before it

This means that while it can be only in the top of stack relatively to other modifiers generating geometry Sculpt mode will take into account only data generated by Multires, all others (especially generator modifiers, like Mirror) will be skipped.

So in order to have all mesh faces available for sculpting while in Sculpt mode with Multiresolution apply Mirror modifier and edit mesh  with X-Mirror option (in Edit mode) or Toolshelf > Tools > Symmetry/Lock
(in Sculpt mode) instead.


How to build a street gradient with a curve (Avoiding rotation) i'm new. I want to build a street, which follows a curve. The street has a 270° curve with gradient.
Here a picture to illustrate it:

The picture show also my problem. The street rotates on the second end.

How can i avoid this effect?

You can twist the curve points using Ctrl+T :

Or you can use the Z up curve option :


Scale of Curve to effect Location of "Set of objects" I'm trying to create a rig in Blender and i'm fairly new to the program, I am wanting to scale a Bezeir circle that will in turn shrink the distance of a set of objects in a circular motion.
I really can't wrap my head around it, any help would be greatly appreciated

Circular Path
If the shape of the curve is a circle, this can be achieved even without a curve.  You just need a few empties placed in correct positions (around the circle) and parented to some object whose Scale will be adjusted to move the visible objects (Cube in my example)

When the circle is scaled, each empty moves as if they are parented to a certain location on the (circular) curve.  But in fact this is just simple parent transformation.

Instead of parenting the cube to an empty, we can just copy its location using Copy Location constraint.
Non-Circular Path

A more generalized solution is to use a Follow Path constrains on the visible objects and constrain them to the curve directly.
Important thing here is to give each visible object a difference offset (on the curve). If we have 6 objects, for example, each one should have an offset 100 / 6 * i (where i is the index of the object, 0, 1, 2, ...).

This method should work on any kind of curve, open or closed.


Can't Edit Cached Particles I must be misunderstanding something because for the life of me I can't seem to get the editing of a cached particle system with Hair Dynamics to work. I tried in 2.83 and 2.9, but in both all the hairs disappear, the cache becomes totally corrupted and I have to delete/recreate a new one for the hairs to show back up, a whole new cache, not just delete the bake.
Just from a basic cube, add hair particle, check Hair Dynamics, scroll down to cache, set end frame to 20, Bake, save, scroll to frame 20, go to Particle Edit, Particles disappear and cache is corrupted. If I close and reopen the without saving the hairs are still gone (which is why I assume cache is getting corrupted).
Disk Cache is NOT checked, but maybe there is some other cache parameters I am missing? Or maybe it is a plugin? I have many, though I can't easily turn them all off.
https://docs.blender.org/manual/en/latest/physics/particles/mode.html
Here is an example blend file, if I tab into particle editor at this point the hairs get destroyed. Do others get this too? Am I missing a step?
https://drive.google.com/file/d/1Q9lAERudg_qia51_wVxeyVqj9v7B1MpB/view?usp=sharing
Thanks, I have spent, oh let's see, about 12 hours now straight fiddling with this damned thing.

There is a reported bug In Particle Edit mode, Emitter particles are not visible in the viewport. It is about Emitter particles, but Hair particles are not visible either in Blender 2.91.
As a workaround you can

bake/run the simulation
convert the desired frame to a Mesh object in the modifier's panel
use the add-on Hairnet 0.6.3 (for Blender 2.9.1) to generate a new Hair Particle System based on the mesh data

Hairnet will edit the particles and place them along the mesh edges. Use the button 'Fibremesh'. Select the mesh first, then the scalp/head (must be highlighted light orange). The script may run a while depending on the number of particles.


Properties Editor : Scene : Color Management This is probably a dupe, but nothing so far helps. The manual says "Properties Editor : Scene : Color Management." I have searched and searched here, the manual, and in Blender itself. I need to FIND Color Management. Please tell me exactly HOW.

The color management is in the properties panel. If you don't know where the properties panel is, its over here:

Now, go to the scene panel, its the third one:

over here you will find colour management

If its closed, open it up by pressing the arrow

 if you still can't find it please post your .blend file over here
http://blend-exchange.giantcowfilms.com/


Why does Blender 2.70 not stay in Orthographic view when rotating from, say, Front Ortho view? I've just upgraded to 2.70 and now when I'm in Front Ortho view (or Back Ortho, Right Ortho, etc) and rotate out of it into User view, it switches out of Orthographic mode into Perspective. Blender 2.69 didn't do this? Why is it happening now in 2.70?

In blender 2.70 Auto Perspective is turned on be default in the user preferences. This will cause you to go from perspective to orthographic when changing from the User View a view like the side view. The same is true visa versa.

To change this behaviour you can edit the user preferences.

Open the user preferences, Ctrl Alt U
In the Interface tab disable Auto Perpective
To make this change permanent Save User Preferences


Headless Blender using Cycles without X-server? I would like to render with Cycles on a headless machine, without an X-server.

Has anyone done this with success?

I am getting the following error on Linux using Blender 2.78a:

$: blender -b cube.blend -E CYCLES -x 1 -o cube -f 1
terminate called after throwing an instance of 'OCLRT::xcb_error'
  what():  XCB ERROR: X session is not running!
Read new prefs: /home/mbomba/.config/blender/2.78/config/userpref.blend
read blend: /home/mbomba/Documents/art/3d/cube.blend

Update:
To clarify, this works fine if executed in a terminal when an X session is running.  I'm wondering if it's a bug -- I was thinking about automating a cluster to render animations but the X dependency is kind of raining on my parade.

Update 2:
I compiled a version of Blender using the WITH_HEADLESS flag and I get the same error when I run it without X.

Update 3:
While I haven't been able to assimilate any of this information into a coherent solution, after some research I found that people encountered the same error occurs frequently with Beignet / Intel OpenCL driver installations.

Update 4:
I tested this via ssh on another machine and it works fine.  It must be a problem specific my system.  I would like to know what library is causing this issue, but I plan to do most of my rendering on the other machine anyhow.

SOLUTION

As sambler suggested in the comment, changing set(WITH_CYCLES_DEVICE_OPENCL TRUE) to set(WITH_CYCLES_DEVICE_OPENCL FALSE) in intern/cycles/CMakeLists.txt prior to building allowed me to render with Cycles in a tty.  The issue must be related to the OpenCL drivers on my system.

It has been a while but I have rendered on a headless machine. I did have Xorg installed to be able to run x11 apps remotely but the was no running X-server on the remote machine.

If you want to get blender running without any X-server software installed then you will most likely have to compile your own version of blender. There is an option to build WITH_HEADLESS that will disable all dependencies on Xorg libraries.


Normals looking bad when tapering This is my problem. The normals look too sharpwhere the carrot gets thinner and it just destroys any maps i put on it. If I add a lot more geometry the problem smoothes itself out. But I can't afford that much geometry as this is meant for a mobile game. Does anyone know of another way to deal with this?
Thanks in advance!

You could try some Smooth Vertex to a couple of the edge loops.


Restore last windows arrangement in single/multi-monitor setup I would like to get the windows that I left open the last time I worked in Blender, either in single or multi-monitor settings.

How can it be done?

As CharlesL pointed out, the UI layout is saved in the .blend file.

Setup your windows as desired.
File > Save Startup File (shortcut Ctrl + U).

When loading files uncheck the Load UI option to prevent the layout changing. This can be made the default by disabling said setting under the User Preferences > File tab (shortcut Ctrl + Alt + U).


Selecting Vertices on Symmetry Line of Mirror Modifier I am trying to extend an existing script that scans meshes for certain conditions, like poles, non-manifold edges and the like.

When a mirror modifier is present on the mesh, all vertices on the symmetry line fall therefore under the conditions non-manifold and 3-valence pole (in case of quad meshes, at any rate).

I want to select the points on that symmetry axis and gather them in an array, to remove them from the other checks' results.

I am uncertain how to best do that, if anybody has suggestions, I would be very grateful for those.

A simple code to retrieve vertices that are on the standard (centered X axis) symmetry plane.

This assumes to be without other modifiers before the mirror.

Principle:

Get all edges that have only one linked face (border edges)
Test their distance to the symmetry plane under a limit which should be similar to the merge limit of the mirror modifier

The code:

import bpy
import bmesh
from mathutils import Vector, geometry

obj = bpy.context.object

bm = bmesh.new()
bm.from_mesh( obj.data )

bm.verts.ensure_lookup_table()
bm.edges.ensure_lookup_table()

# If mirrored on self with X axis
center = Vector( (0,0,0) )
axis = Vector( (1,0,0) )

limit = 0.00001

border_verts = set()

for e in [e for e in bm.edges if len(e.link_faces) == 1]:
    if geometry.distance_point_to_plane( e.verts[0].co, center, axis ) < limit:
        border_verts.add( e.verts[0] )
    if geometry.distance_point_to_plane( e.verts[1].co, center, axis ) < limit:
        border_verts.add( e.verts[1] )

print( len( border_verts ) )


How can I keep a single frame of a smoke cache? I have an 8GB smoke sim cache directory for 250 frames.

I only want the sim results for frame 15 - 13mb.

How can I just retain this single frame across the 250 frames of the file? I guess a kind of bake of a bake. Or converting this frame smoke to an object making it a static element?

Blender 2.81 (not mantaflow)

  This solution works but was probably never designed to work like this, therefore I can't guarantee that it's a stable workflow. It was stable enough when I tested it anyway.

Unfortunately, you should have already baked your smoke simulation using "External", otherwise you'll need to bake it again. Choose a directory for your bake to go to (e.g. //cache)

After you've baked, in //cache you will have several files called _<frame>_00.bphys. Copy the file corresponding to your selected frame, and paste it into a new directory //cache2, changing its name to _000001_00.bphys.

Note down the dimensions of your smoke domain, and create a new cube with exactly the same dimensions. You can now remove your original smoke domain.

In the newly created object, enable Smoke, set its type to Domain. Under Cache check External and use //cache2 as its Path. Simulation "End" gets automatically reduced to 1.

The object now holds the smoke information from only the selected frame and, as far as I've seen, it doesn't try to overwrite your cache or to add new frames to it.

The original //cache folder, containing all your bake and the unnecessary frames, can now be removed (but I'd keep it as a backup, at least the first N frames, where N is the frame you've picked)


Copy materials and material indices to instances which aren't copies of anotther object From this question: link I learned how to transfer UV maps from one object into a new instance. How can this be done with materials and material indices?

AN in 2.8 seems to have a new system but I'm still stuck in 2.79.

EDIT

@Omar Ahmad offered a solution which works great for the materials but material indices aren't transfered correctly here is how the graph looks like.

The Mesh Object Input node have a Material Indices output, you can use that as the input material indices of the Mesh Object Output node as follows:

Alternatively, you can use the following expression to get the material indices:

[p.material_index for p in object.data.polygons]

Where object is your object. To apply modifiers first, you can use the following expression:

object.an.getMesh(bpy.context.depsgraph, True).an.getPolygonMaterialIndices()

As for copying materials themselves, the 2.8 version have a system to set materials to object. But if you are on an older version, you will have to use a python script. Something like this should work:

target.data.materials.clear()
for material in source.data.materials:
    target.data.materials.append(material)

Where source and target are you source and target objects.


Deselect Neighbours Faces is it possible in blender v2.70 or with a python function deselect neighbours faces, so that they are alone ?

i'll upload a picture to understand what I mean.

I hope it's doable.

Using bmesh

Yes it is do-able.

Add all selected faces to one set
Remove the active face from set
Find all neighbouring faces

Going by screenshot, this is any face that has an edge in the edge loop of each of its vertices is deselected.

Remove them from the selection
Repeat with next selected face until exhausted.

Result of running on this grid with all selected

Test script, run in edit mode. Have a face as the active selection.

import bpy
import bmesh

context = bpy.context
ob = context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)

selfaces = set(f for f in bm.faces if f.select)

f = bm.select_history.active
selfaces.remove(f)
while True:

    # find all "neighbours" of f
    desel = set(f for v in f.verts for el in v.link_edges for f in el.link_faces)
    for f in selfaces.intersection(desel):
        f.select = False
    selfaces -= desel
    if not selfaces:
        break
    f = selfaces.pop()
bmesh.update_edit_mesh(me)

Recommend checking out bmesh via the py console. With a mesh in edit mode

>>> import bmesh
>>> bm = bmesh.from_edit_mesh(C.object.data)
>>> bm
<BMesh(0x7f3308fde308), totvert=100, totedge=261, totface=162, totloop=486>


Why do particles escape from the tube? I am very new to blender and only started in February this year and I currently got stuck with a very specific problem.

I am doing a project where I want to have bubbles inside a glass tube. I did this by creating the tube and adding an emitter inside the tube emitting spheres. Everything looks fine so far. However, some of the generated "bubbles" escape the tube. I set the tube to collision and everything, but still some of the bubble stick for example half-way through the tube.

In order to make it more clear what I mean, a simplified version of the file can be found here: https://www.dropbox.com/sh/q2hal3ll6vt47co/AACrXRq3cki0XVecXFOKEQHQa?dl=0
 (please ignore that the emitter is too long on the left site).

I cannot reproduce it with blender 2.77. I can see the bubbles escaping the tube in the cached position in your file, but as long as I go back to the beginning and restart the animation, it works almost ok.

Either you have an older version and something was fixed in blender or you never actually reset the cache. Blender resets the particle cache when you set the current frame to 0. You have to run the animation again for blender to recalculate particle positions. Thus, you might have already fixed that and you can't see it

In a theoretical attempt to solve the problem there are a number of things that might help:

Nothing is really impermeable. Though you have (correctly) permeability set to 0. Some bubbles might escape still. IIRC increasing the subdivisions on the pipe might improve the situation, but it seems this isn't the case here.
Increasing the Particle Damping factor on the pipe's collision properties helps to catch those rogue particles that would escape
Making your pipe a solid instead of just a wall of faces. Either use the solidify modifier or just extrude everything and then press AltS to offset the new faces. This way the particle will have to escape two faces to get out. It will also help with the bubbles that partially stick out of the pipe.

Finally, your pipe is way too high-poly for just being a pipe. You should be able to achieve the same rendered quality without so many polygons.


Vertex Weight Proximity Not Controlling Hair Particle Density In a scene, I have a Grid with hair particles growing out of it. The grid is a very large grassy field, so I want only the hairs close to the camera to render.
A sphere is parented to the camera, and the Weight Proximity modifier uses it as a target.
The vertex weights work fine with "Length" of the hair, but won't change the "Density."
Why is this?

Solved!
When applying said modifier, enable "Use Modifier Stack" (found under the Emission section in the Particle tab)


Duplicate one fluid simulation with a time offset? Helo,
I'm trying to create a scene where I have 10 bubbles coming up in a bath with splashes one after another. If I put them in one big domain it bakes forever and the resolution division is way too chunky. And if I bake 10 smaller domains I get crazy with managing 10 different cache folders and keyframing the objects on and off at the right time.
Is there a way to create one nice simulation and duplicate it with a time offset, so I only have to bake one simulation and rotate the others and position them in different locations so they kind of look different from different angles?
Thx,
A
Blender2.83.1

The duplicating and rotating is no problem, just copy the domain with Shift + D. But the time offset is a different thing. Let's say your simulation goes from frame 1 to 50. If you want to duplicate it with an offset of 10 so that it runs from frame 11 to 60 you have to duplicate the cache folder, rename the data file suffixes from _0001 - _0050 to _0011 - 0060 and then tell your domain that it should use this cache folder instead of the original one. You also have to adjust the "Frame Start" and "End" to 11 and 60.


Harsh zooming after large object import I imported a large .obj object into blender, and it was way too big so I scaled it down, but ever since I imported the object the zooming and the pan view and rotate view are very harsh.(they zoom too much and too radically)

edit - prefrences - navigation - auto depth


Get frame to frame object location Blender 2.81 + I have a script which generates a curve path and sets an object to follow the path, I can see the object moving correctly in the animation move, and it also moves to the correct location (at least visually in the view port, the coordinates when you press n do not change) when I use bpy.context.scene.frame_set(desirved_frame). However, when I try to get the location and rotation of that object at the frame that I set, it just returns the original location of the object at frame 0. Below is the code I have used to generate the animation data and what I'm using to try and get the location.
curve = bpy.data.objects["curve"]
follower = bpy.data.objects["Follower"]
con = follower.constraints[0]
con.target = curve
con.use_curve_follow = True

bpy.ops.object.select_all(action='DESELECT')
curve.data.use_path = True

path_length_m = curve.data.splines[0].calc_length()
time = path_length_m / car_v_mps
target_fps = 30
length = int(target_fps * time)
print("Frames is: ", length)

anim = curve.data.animation_data_create()
anim.action = bpy.data.actions.new("%s-Action" % curve.data.name)

fcu = anim.action.fcurves.new("eval_time")
mod = fcu.modifiers.new('GENERATOR')
mod.coefficients = (-frame_start / length * 100, frame_start / length / frame_start * 100)

def get_ext(scene, depsgraph):
    obj = scene.objects['Follower']
    obj = obj.evaluated_get(depsgraph)
    print("Frame: ", scene.frame_current)
    print("Location: ", obj.location)

scene = bpy.data.scenes[0] #This is the only scene, == bpy.context.scene

for frame in range(scene.frame_start, scene.frame_end):
    bpy.app.handlers.frame_change_post.append(get_ext)
    scene.frame_set(frame)
    bpy.app.handlers.frame_change_post.clear()

I have also tried replacing the final loop with:
for frame in range(scene.frame_start, scene.frame_end):
    scene.frame_set(frame)
    depsgraph = bpy.context.evaluated_depsgraph_get()
    ob = bpy.data.objects["Follower"]
    ob = ob.evaluated_get(depsgraph)
    print("Location: ", ob.location)

Both methods just print out the original location of the object.
Reading this documentation I'm not sure how I would use the examples they show to extract the evaluated location and rotation from the class they register, or how to even call the execute method.
Below are some solutions and answers I have read and attempted, with no success:
How do I get a mesh data-block with modifiers and shape keys applied in Blender 2.8?
Updating a 2.7 script that uses frame_current to work with 2.8+
Number of vertices and edges report no changes after adding boolean intersect modifier
Location of an object at a specific frame
Handler frame_change_pre doesn't work in render
Sun object not moving when Rendering Animation
I'm really not sure what I'm doing wrong as some of the questions I've looked at are quite similar to my issue.
Thank you for any help you can provide.

Object.matrix_world.to_translation()
Recommend using the matrix world,  of the evaluated object. Which is calculated for  each frame of blender. What you see in the UI, is the matrix basis.
Does a child object inherit the matrix from the parent?
Note the local matrix can be gained by multiplying the matrix world of an object, by its parents inverted matrix world. (link above shows how this relates to matrix basis, which is what we set via its components (rot, loc, scale) in the UI)
Here is a quick test script to output the global location of the cube, and evaluated cube for each frame.
There is no need to clear and add a handler for each frame.  Do make sure to clear handlers if running script multiple times as they will accumulate.
import bpy

names = ("Cube",)
def frame_change_post(scene, dg):
    f = scene.frame_current
    for name in names:
        ob = dg.objects.get(name)
        if ob:
            print("dg", ob.name, ob.matrix_world.to_translation()[:])
        ob = scene.objects.get(name)
        if ob:
            print("scene:", ob.name, ob.matrix_world.to_translation()[:])

bpy.app.handlers.frame_change_post.clear()
bpy.app.handlers.frame_change_post.append(frame_change_post)

scene = bpy.context.scene
for f in range(scene.frame_start, scene.frame_end + 1):
    print(f"frame {f} ------------------")
    scene.frame_set(f)

Output of running script.
Here I've run the script above directly from the text editor. The cube has an arbitrary follow path.  Note no difference here between result of un or evaluated object.
frame 1 ------------------
dg Cube (-0.4548962712287903, -7.230154037475586, 0.0)
scene: Cube (-0.4548962712287903, -7.230154037475586, 0.0)
frame 2 ------------------
dg Cube (-0.9097925424575806, -7.199532985687256, 0.0)
scene: Cube (-0.9097925424575806, -7.199532985687256, 0.0)
frame 3 ------------------
dg Cube (-1.357460618019104, -7.115467071533203, 0.0)
scene: Cube (-1.357460618019104, -7.115467071533203, 0.0)
frame 4 ------------------
dg Cube (-1.8044718503952026, -7.026542663574219, 0.0)
scene: Cube (-1.8044718503952026, -7.026542663574219, 0.0)
frame 5 ------------------
dg Cube (-2.238593101501465, -6.889674186706543, 0.0)
scene: Cube (-2.238593101501465, -6.889674186706543, 0.0)

Rendering animation.
dg Cube (-0.4548962712287903, -7.230154037475586, 0.0)
scene: Cube (-2.238593101501465, -6.889674186706543, 0.0)
Saved: '/tmp/0001.png'
 Time: 00:00.42 (Saving: 00:00.01)

dg Cube (-0.9097925424575806, -7.199532985687256, 0.0)
scene: Cube (-2.238593101501465, -6.889674186706543, 0.0)
Saved: '/tmp/0002.png'
 Time: 00:00.31 (Saving: 00:00.01)

dg Cube (-1.357460618019104, -7.115467071533203, 0.0)
scene: Cube (-0.9097925424575806, -7.199532985687256, 0.0)
Saved: '/tmp/0003.png'
 Time: 00:00.34 (Saving: 00:00.01)

dg Cube (-1.8044718503952026, -7.026542663574219, 0.0)
scene: Cube (-1.357460618019104, -7.115467071533203, 0.0)
Saved: '/tmp/0004.png'
 Time: 00:00.34 (Saving: 00:00.01)

dg Cube (-2.238593101501465, -6.889674186706543, 0.0)
scene: Cube (-1.8044718503952026, -7.026542663574219, 0.0)
Saved: '/tmp/0005.png'
 Time: 00:00.33 (Saving: 00:00.01)

dg Cube (-2.238593101501465, -6.889674186706543, 0.0)
scene: Cube (-2.238593101501465, -6.889674186706543, 0.0)


How do I model a 12 sided shape? I want to make the shape shown in the images below, but I have a problem with the bottom side of it which I can't make. It is 12 sided and it is curved a little bit. Any ideas or ways to make it?

I think there're many ways to model it (e.g. creating one lower segment, arraying it along a curve and using a bridge tool to connect it with circle). I'll show you my solution though :).

Add a cylinder with 12 vertices (change its number in a tool shelf- T). Add a loopcut (Ctrl+R) and place it near the bottom of the cylinder. Then scale the bottom edge a bit. Next select all the horizontal edge loops and subdivide them twice (W-->Subdivide). Select every fourth vertex of the middle edgeloop and place them lower (G,Z). Now select the middle edge loop and press Alt+Shift+S,1. Do the same with the upper one. Finally add the additional edge loops to make the subsurf modifier crease the edges nicely.

Add a subsurf modifier to the cylinder and smooth it. Add two vertical edge loops at the corner of the cylinder, next merge some vertices (Alt+M) and dissolve some edges (X-->Dissolve) as pictured below.

Do it for the other 3 corners. Delete other part of the cylinder and use a mirror modifier to create 3 halfs with the edge loops created.


Is there a way to lock a node? Is there a way to lock a node within a single .blend file so that it can't be adjusted by accident? I've searched the site and couldn't find an answer.

you could just hide the node? (press H) Then it would look like this:

if you have multiple nodes, i suggest you make a node group, which will protect the nodes inside the group

I don't think there is a lock functionality


Logo on Mesh is Mirroring I've used a free human model to create a T-shirt. I feel great about the shirt, but I'm at the point where I need to put a logo in the center of the chest. I've looked up a few other threads and I'm running into a snag.

My logo is mirroring itself directly in the center of the shirt. At first, I thought it was because I hadn't applied the mirror modifier on my shirt mesh. I tried that and it still continues mirroring. I've tried adjusting the location, rotation and scale in the mapping node with no luck. Below are some screenshots. If If you need something I haven't supplied, let me know and I'll post ASAP. I appreciate your help!

Mr. Zak had it right. I had accidentally applied the mirror modifier to my shirt after I had unwrapped it. Went back a few steps, applied the mirror modifier and then unwrapped. Worked like a charm!


How to have freestyle render change to outline only at a distance I've been playing with making coloring pages from some low-poly models of mine. To give my coloring pages variety without too much work on my part, I created a scene, populated it with all the models, and created cameras looking at it from different angles, with a different focus on each one.

https://www.youtube.com/watch?v=Z7OWs0-pGmA

However, with this method, sometimes objects in the background get very line-dense, and I'd like if Blender could pick those object out and remove the extra lines, perhaps even switching to just outlines in those cases. Is there any way to accomplish this?

Solution: Use a freestyle line modifier

For your scene I'd recommend using the Distance from Camera modifier on Alpha of the freestyle lines found in the Linestyle panel. The hack is to choose the same value for Range Min and Range Max. This will draw a sharp distinction between the 'close' and the 'far' objects in view.
With two line sets (one for the 'close' objects and the other for the 'far') you can choose for the 'far' line set to only render the outlines.

Here's a simple example

That's the freestyle setup

The scene without any modifiers

And with the modifiers


Armature appears in edit mode but not pose/object mode The armature I made for my model doesn't seem to appear in pose mode nor object mode. I'm not sure if this is the result of creating an animation (the armature seems to have disappeared after I created a base animation and added edited versions of it by creating actions in the action editor).

The armature appears just fine in edit mode, so I'm not sure what exactly is going on.

Does this have anything to do with deleting key frames?

Edit:
Thanks for all the suggestions! I still can't find a solution so I've uploaded the file. If anyone can help that'll be great.

The pose bones are hidden.

To selectively unhide the bones click the plus sign next to "Pose" and select the closed eyes.

To unhide all posed bones at once, select "Pose", hover over your mesh and press alt +  H.


How Does Cloth Friction Work? Scene: A floor plane rotated at 45deg. A cloth plane rotated at 45deg and 1m above the floor plane. The floor plane uses a Collision Modifier and the cloth plane uses a Cloth Modifier; when I run/play the simulation/animation the slanted cloth falls onto the slanted floor (collides), and slides down the slanted floor.

Question: How does Cloth Friction work in a scene such as this (or any other situation)? I tried increasing the Cloth Friction, from 0.0 to 80.0, and I didn't see any significant difference in the speed of the cloth sliding down the slanted floor. I did see a change in the speed when I changed the rotation on the cloth&floor from 45deg to 35deg and 25deg -- the cloth slides faster when the floor has a steeper incline. However, I didn't see a difference in speed/motion when I increased the Friction to its maximum (80.0). I'd love to try to increase the maximum past 80.0 to see if it works, but I don't think it is possible with Blender. Is this expected/normal behavior? I would expect the cloth to slide down slower with a higher friction.

Here's a simulation of the situation (Blender 2.75).

The parameters that I cosidered in this "catalogue" are:

Resolution of surfaces (unsubdivided-> first row; Collision object subdivided-> second Row; Cloth object subdivided-> third row; Both subdivided-> fourth row)
Friction (0.1 or 80)
Repel Distance (0.001 or 1)

By comparing the elements of the first row, I can say that it seems to be at least a little difference of the behavior when friction jumps from 0.1 to 80 (but is not that strong as one expect)

Look at the last element of the matrix (4-4): it is the one where friction reveal itself in a more convincing way..but there's another, which has the same behavior: 2-4. This led me to think that is also important to consider how many faces your collision object has.

Now compare 2-4 with 2-2... also the max Repel distance influence the behavior.

Conclusion

It seems that changing only the Friction factor is not enough to run the sim as expected, but you have to deal at least with other two parameters:

resolution of collision object (should be enough detailed, but more subd won't give more frictional effect apart from the contribute given by the fact that the faces are in range for a longer period)
repulsion distance (act as a sort of detecting thershold, but more rep dist won't give more frictional effect)

Friction is the value that drives the pover of frictional effect, but it must be supported by other variables in order to affect the sim.

Here's the blend of where the gif comes from:


Weird shaddows on glossy baked object could you help me please to get rid of that shadows inside that appear if i bake it using glossy bake option.  I'm trying to get closer to a render result

Unfortunately, this is not possible.

What you are basically attempting to do is bake reflections, which is the difference between your true render vs. your baked texture version.

Since this is very environmentally dependant, there is no way to realistically do that in a single image.  The reflections change based on camera angle, room lighting, and other factors can change what the bake should be.

Note that some game engines manage to fake it, but it needs to be re-baked for every environment, lighting situation, and movement, and falls apart in dynamic scenes.  Blender itself does not support this in any form.


The rendered image is different than what I see in the viewport My render for this project continues to appear extremely zoomed in to the camera view. The first image is what the camera was supposed to capture and the second image is what was actually rendered. What settings should I change to prevent this?

Your view is locked to this quad sphere, which I believe means your camera is not traveling along with your view as it should be with this option checked.  In fact you should not be able to adjust your viewport focal length from the N-panel if your camera is locked to view.


Cycles - Rendering with RTX 2060 CUDA Error I'm running the latest version of Blender 2.79 and I'm trying to render in cycles with a RTX 2060. I'm unable to render anything. At first I received the Error "CUDA binary kernel for this graphics card compute capability (7.5) not found."

I followed the steps in this youtube video https://www.youtube.com/watch?v=sZjIQGLieB4
Basically downloading a filter and kernel file and moving it into
C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\cycles\lib

After doing that I no longer received the first error, now I'm receiving this error "CUDA error: Not found in cuModuleGetGlobal(&cumem &cubytes, cuModule, bind_name.c_str()), line 729"

Any recommendations or fixes anyone can suggest?
Thanks in advance!

You can also use the 2.79 version from the latest builds. It works with the 20 series as well.


Materials from Blender to Three.JS: Colors seem to be different I am just working on a bigger WebGL project, using the three.js framework. I am also using Blender as my 3D Software and the latest version of the three.js blender exporter.

While developing I noticed, that colors seem to be slightly different from the colors I picked in Blender.

I started tweaking colors via code and when I told the purple material at the straw for example to be the hexcode from Blender (#9081E7), this is what my webgl result looks like:

I think it's safe to say that the result looks more like the colors from Blender.

Now my question is: why is this happening? And how can I fix it, without telling every single material to have a specific hexcode?

I looked into my straw.json file and noticed that the three.js exporter is exporting colors in rgb values like so:

"colorDiffuse": [0.278894,0.219526,0.799103]

Is it possible that the engine rounds these values what causes the difference in color?

Thanks in advance

Okay, I found the solution by myself.

The reason, why the colors are different in webgl is: the exporter makes use of the rgb values that blender provides. After a lot of research I found out, the rgb values in blender are not gamma corrected. The Hex values are gamma corrected.

Thats why the colors were correct, after I applied the corrected hex-code to the materials.

Since that is a very crappy workflow, I talked to a developer from my team and he did some research on the WebGLRenderer.

He found out that you can enable a property called "gammaOutput". If you do that, all colors get gamma corrected by the renderer.

SOLUTION

renderer.gammaOutput = true;

compared to the first image in my question you can see the webgl version isn't that dark and oversaturated anymore. The small difference you can still notice comes form the environment lightning in blender.


How to freeze a falling rigid body animation for good? What I've been trying to do is to make a simple bowl in which candies fall using the the rigid body animations for both. But after say certain key frames I want it to be the final(or rather the default) model, as if it was never animated and this itself was the default model. I want to use this model in another file.
I can't find any option like the cloth simulator where you can simply apply it and it finalizes. Any help would be appreciated.
I'll post pictures in a bit.

Select the object(s) you want, select the frame you want in the timeline, then in the header menu > Object > Rigid Body > Bake to Keyframes and choose the frame(s) you want in the pop-up.


Blender script keyframe in loop doesn't affect first element Here is mine area with objects (frame 0):

I'm trying to make objects move with python script. Every object on list should move into center of my area. I'm using for loop. Unfortunately first element doesn't want to keep it's initial position on 0 frame. It looks like it is replacing 0 frame position with 20 frame position and then it works properly but it makes every move 20 frames before rest of them. I don't have idea why it is not working properly. Can you see my code and try to find out what is wrong with it?

Code below:

new_loc = [0,0,0]

frame_num = 0

for obj in creatures_names:

    ob = bpy.data.objects[obj.name]
    scene.frame_set(frame_num)
    ob.keyframe_insert(data_path='location', index = -1)

new_radius = radius - 4

while frame_num < settings['frames']:
    frame_num += 20
    for obj in creatures_names:

        ob = bpy.data.objects[obj.name]

        loc = obj.location
        x = float(loc[0])
        y = float(loc[1])
        z = float(loc[2])
        creature_angle = math.atan(y/x)
        print(creature_angle)
        new_x = new_radius * math.cos(creature_angle)
        new_y = new_radius * math.sin(creature_angle)
        new_loc[2] = z
        new_loc[0] = new_x
        new_loc[1] = new_y

        ob.location = new_loc
        ob.keyframe_insert(data_path='location', index = -1)
        frame_num = 20
        scene.frame_set(frame_num)

    new_radius -= 4

Here is frame 20:

And frame 40:

It looks like you have more than one problem:
One try using obj.keyframe_insert(data_path='location', frame=frame_num)

instead of

scene.frame_set(frame_num)
    ob.keyframe_insert(data_path='location', index = -1).

Also, you set frame_num = 20 inside your while loop... which should cause an infinite loop.

How to keyframe_insert without moving the object


Jagged edges when baking in cycles? How do you get rid of jagged edges when baking in cycles? Edges are perfectly smooth when rendering but as soon as i bake it gets jagged. Any help would be highly appreciated.

Baking in Cycles does not implement anti-aliasing yet.
Check this thread for more information : https://developer.blender.org/T43388


Render image is blank I'm new to blender. his is my firs render here and my render image is coming out blank. I followed a tutorial on how o set up a scene to render and when nothing was showing up, I read this blender forum to find an answer, but everything seems in place: light, camera is pointing right at he object, clipping is okay.

I don't know what he problem is, all object are render enabled.

Make sure that the object isn't disabled in renders, the camera icon next to the eye icon has to be white for the model to appear in the render,

here is a photo:

edit: I made the mistake of not reading your question all the way through, my apologies, but I will keep this up in case anyone has this problem.

P.S: Have you seen if there are any modifiers on the object(like build)?


I need to simulate the interference of two sinewaves My ultimate goal is to simulate the interference of two sinewaves. They do not have to follow at the moment any specific physical requirement (the wave modifier could be OK).
I thought to proceed by steps and first trying to render 1 sinewave and then 2. For each sinewave I would like to have a 2D representation, like a wave modifier seen from above (e.g. concentric circles on a water surface). I first tried using particles and let them arranged by  a force field emitted by a mesh plane with a wave modifier. Seems ok, but it is very heavy on my PC. So I thought I would stick to the wave modifier only and find some way to render depths and peaks with different colors (a normal jet color map could be OK). I am not an expert so I wonder whether you could suggest a quick way to do this.
After this, I would like to simulate the interference of two waves, just visually, without any matematical calculation (again, imagine the example of drops of water falling on a water surface).
Ultimately, my plane would be to convert whatever I managed to do in 2D, in 3D (say on a spherical surface).
I would appreciate any input :)
thanks !

If you'd like to visualize interference in 3D, that can also be done. The animation below illustrates 5 sine waves interacting with each other in 3D. The coloring is done by taking a slice through the combined waves and assigning colors to the intensity of the wave. Using shaders is fast enough that the images can be generated in real time. This solution is based on an an antenna/radar example here,

Details for visualizing 2 interfering waves on a surface  - (Tested on Blender 2.92)

To visualize 2 waves with interference, some simple geometry is setup for the visualization. The key is using the wave texture. A plane is used to visualize the waves, and 2 spheres are used to visualize and control the origin of the waves.

Shaders are used to generate the visualization of the interference. The wave node texture performs the math for each wave and a math node sums the waves together to see the interference. The full shader for 2 interfering waves is shown below. This shader is named 'wave'

The nodes in the red frame calculate the sine waves and when summed together generate the interference patterns in 3D.
The nodes in white are used to specify the origin of the waves. To help with the visualization, this is done using the two spheres in the geometry that were called Wave Source 1 and Wave Source 2. The text Coordinate node is used to get their origin and then use that to set the origin of the waves.
The nodes in the two blue frames are used to set the wavelength and phase of the waves. The wavelength in blender defaults to 1mm, so it is scaled to meters. The phasing is defined in radians so it is scaled to degrees. If the phasing is animated, the sign will control the direction of travel of the wave.
The nodes in the green frame control how the calculated wave intensity is visualized. This node scales the wave intensity to a value between 0 and 1, then uses a color ramp to make it red where positive and blue where negative. Transparency is used to set the color emissivity to zero where there the intensity is near zero.
Note this shader defines the intensity everywhere. When it is applied to an object, it will show the wave intensity there.

In this example, the shader called 'wave' is applied to a plane called 'surface'. This will show the wave intensity on that plane.

Additional slices can be visualized by adding more planes to the scenes.

The blender 2.92 model for this example is available here -

Extension #1 - Visualizing as a 3D wave

Add a volume for visualizing the waves.

Copy and modify the previous surface shader. The turquoise frame shows the changes for volume rendering.

The math block on the left scales the input to 0..1 so it will work with a color ramp. The color is applied to a 'Principled Volume' color input. This sets to color of the location in the volume.
The math node connected to the alpha is used to scale the density which sets the opacity of the volume.

Adjust light and setting to get desired look.

The blender 2.92 model for this example is available here -
References - See creating mesh on an isosurface

Extension #2 - Visualizing the interference as a surface wave

Turn on experimental features for rendering.

Add a subdivision multiplier to the visualization plane. Use simple subdivision. Set adaptive.

Add a displacement node to the shader.

The blender model for this example is available here -
References

2.8 Adaptive Subdivision

Extension #3 - Multiple wave sources
By adding more wave sources, these kinds very complex wave interactions can be visualized.

This Blend file contains the model used to generate the animation -
This blend file was generated in Blender 2.90

References
References - See http://exnumerus.blogspot.com/2021/02/visualizing-3d-sine-wave-using-blender.html This shows an application in Blender to illustrate how phased array radars and antennas work.


Matcaps and Normal stretching I have been experimenting with Matcaps, and also using procedural textures with Matcap vector mapping. I understand that Matcaps are using Sphere mapping, and so when applied to non-spherical objects, there is stretching.

In this example image, we see a simple sphere and Suzanne with basic procedural noise. Note that on Suzanne's face, brow ridges, and ears, the texture is stretched out.

What I would like to do is get a grayscale mask of this stretching area. So the sphere would be black, and on Suzanne, the previously mentioned areas would be a gradient up to white. As far as I can tell, this would be an area where the normals stay flat.

Is this possible, and if so, how?

Quick Method

Basically, what we want to do is find the Dot Product between the normals of a bounding ellipsoid projected on to the mesh, and the normals of the mesh. First, enable Auto Smooth normals.

Next, add a Normal Edit modifier after a Subsurf Modifier (4 to 5 subdivisions) and set the Angle on the Normal Edit modifier to about 80 degrees. This will give us the approximate projected normals of the bounding ellipsoid.

Finally, add a Geometry Node and take the Dot Product of the (modified) Normal and (original) True Normal inputs (with vector transform) (it doesn't matter).

Result:

To increase the contrast, you can square the output with a Math node.

More Mathematically Accurate, Plus it Doesn't Mess Up Your Normals

The method above finds the projected normals of the bounding ellipsoid using Auto Smooth in combination with a Normal Edit modifier. This has some limitations: 1) the resolution of your map is tied to the number of faces you have, slowing down rendertimes, 2) the Normal texture coordinates are messed up, so to have "normal"-looking normals, you have to use True Normal, which is again tied to the face count, and 3) the map just isn't as detailed as it could be, due to limitations of the Normal Edit modifier.

If you are willing to work with OSL (Open Shading Language), you can avoid all this with some code.

First, we need to figure out a way to project the normals of the bounding ellipsoid on to the mesh (in this case, Suzanne). I found this helpful, if dense, article here. The important part we need to pull out of this are these equations:

  $$y_0=x_0\left(1+\frac{t}{e_0^2}\right),y_1=x_1\left(1+\frac{t}{e_1^2}\right),y_2=x_2\left(1+\frac{t}{e_2^2}\right)$$

where the x's are the coordinates of a point on the mesh, the y's are the coordinates of a point on the ellipsoid, the e's are the axis-aligned radii of the ellipsoid, and t is a certain value that makes everything right (more on that later).

Let's see if this method even works. I drew up a proof of concept in Desmos. You can look at it here. By moving the red dot labeled "Point on Mesh", we can see the algorithm finding the closest point on the ellipse, we just have to manually adjust the t value.

While having to manually find the t value isn't ideal, it is only one variable. We can use a for loop to iterate through a bunch of values and figure out which value best gives a point that solves the equation for an ellipsoid:

  $$\left(\frac{x_0}{e_0}\right)^2+\left(\frac{x_1}{e_1}\right)^2+\left(\frac{x_2}{e_2}\right)^2=1$$

(naming conventions the same as above)

So, what should our inputs and outputs be? We need the Object coordinates as an input to give us the coordinates of our mesh point, and the Dimensions of our object (X, Y, and Z), both vectors. Since we are calculating t with a for loop, we'll need an iterations count, and a step value to set the detail. As far as outputs go, we need a map of the stretch (dot product), and, just for fun, the ellipsoidal normals.

Let's start coding! Create a new text file in the Text Editor (or something else) and name it stretch.osl. Set inputs and outputs, and declare our variables:

#include "stdosl.h"

shader stretch(
    /*Set Inputs*/
    vector Object = P,
    vector Dimensions = vector(1),
    int iterations = 200,
    float step = 0.05,
    /*Set Outputs*/
    output float Fac = 0,
    output normal Ellip = 0
)
{
    /*Point on Mesh*/
    float X0 = Object[0];
    float X1 = Object[1];
    float X2 = Object[2];
    /*Radii of Ellipsoid*/
    float E0 = Dimensions[0];
    float E1 = Dimensions[1];
    float E2 = Dimensions[2];
    /*Point on Ellipsoid*/
    float Y0 = X0;
    float Y1 = X1;
    float Y2 = X2;
    /*t value*/
    float t = 0;
}

Next, we need to figure out how accurate we want to be. Since we don't want our algorithm to take ridiculously long (or fall prey to floating point errors), we need to figure out how many significant figures is reasonable. I chose 3. Unfortunately, OSL doesn't round to a certain number of significant figures, only to whole integers, so we have to write our own significant figures rounding function. Place it at the beginning of the code, below #include "stdosl.h":

#include "stdosl.h"

float sfround(float num, int d){
    num = num * pow(10, d - 1);
    num = round(num);
    num = num / pow(10, d - 1);
    return num;
}

For the next part of our algorithm, we need a way to figure out how close we are to having an accurate t value. As we saw in the Desmos test, when the t value is correct, plugging numbers back in will yield 1. Let's write a small function to calculate this for us. Place it after the variable declarations:

    float onEllipsoid(){
        return sfround(pow(Y0, 2) / pow(E0, 2) + pow(Y1, 2) / pow(E1, 2) + pow(Y2, 2) / pow(E2, 2), 3);
    }

Now we can write our for loop! Place it below the onEllipsoid() function. I've commented in what everything means.

    for(int i = 0; i < iterations; i++){
        if(onEllipsoid() < 1.0){ /*Point inside ellipsoid*/
            t = t + step;
        }else if(onEllipsoid() > 1.0){ /*Point outside ellipsoid*/
            t = t - step;
        }else{ /*Point on ellipsoid*/
            break;
        }
        /*Refine point estimate*/
        Y0 = X0 * (1 + t / pow(E0, 2));
        Y1 = X1 * (1 + t / pow(E1, 2));
        Y2 = X2 * (1 + t / pow(E2, 2));
    }

To finish it off, we need to turn the point we got into a normal. We can use this answer off of Math SE to accomplish this.

    normal elliptic = normalize(2 * vector(Y0 / pow(E0, 2), Y1 / pow(E1, 2), Y2 / pow(E2, 2)));

Now, all that is left to do is to write our answer to the outputs:

    Ellip = elliptic;
    Fac = dot(elliptic, N);

TL;DR - Just Give Me the Code

#include "stdosl.h"

float sfround(float num, int d){
    num = num * pow(10, d - 1);
    num = round(num);
    num = num / pow(10, d - 1);
    return num;
}

shader stretch(
    /*Set Inputs*/
    vector Object = P,
    vector Dimensions = vector(1),
    int iterations = 200,
    float step = 0.05,
    /*Set Outputs*/
    output float Fac = 0,
    output normal Ellip = 0
)
{
    /*Point on Mesh*/
    float X0 = Object[0];
    float X1 = Object[1];
    float X2 = Object[2];
    /*Radii of Ellipsoid*/
    float E0 = Dimensions[0];
    float E1 = Dimensions[1];
    float E2 = Dimensions[2];
    /*Point on Ellipsoid*/
    float Y0 = X0;
    float Y1 = X1;
    float Y2 = X2;
    /*t value*/
    float t = 0;

    float onEllipsoid(){
        return sfround(pow(Y0, 2) / pow(E0, 2) + pow(Y1, 2) / pow(E1, 2) + pow(Y2, 2) / pow(E2, 2), 3);
    }
    for(int i = 0; i < iterations; i++){
        if(onEllipsoid() < 1.0){ /*Point inside ellipsoid*/
            t = t + step;
        }else if(onEllipsoid() > 1.0){ /*Point outside ellipsoid*/
            t = t - step;
        }else{ /*Point on ellipsoid*/
            break;
        }
        /*Refine point estimate*/
        Y0 = X0 * (1 + t / pow(E0, 2));
        Y1 = X1 * (1 + t / pow(E1, 2));
        Y2 = X2 * (1 + t / pow(E2, 2));
    }
    normal elliptic = normalize(2 * vector(Y0 / pow(E0, 2), Y1 / pow(E1, 2), Y2 / pow(E2, 2)));

    Ellip = elliptic;
    Fac = dot(elliptic, N);
}

Well, now that we have the code, how do we use it? First, we need to enable OSL under the render settings.

Next, add a Script node with Shift + A > Script > Script and select the stretch.osl file, or whatever you named it. We need to give it the Object coordinates, and the dimensions of your object. Since my Suzanne object doesn't rotate, deform, or scale, I just copy-pasted the information out of the 3D Viewport (below the transforms in the N panel). If this doesn't work for your situation, it wouldn't be hard to implement drivers. Anyway, just copy the X, Y, and Z values into a Combine XYZ (Shift + A > Converter > Combine XYZ ) node and plug it in.

As far as the iterations and step values go, the default step should be fine; adjust the iterations until there isn't a visible change in the Fac output (it happens really slowly (depending on your step value), so use increments of at least 25 at first).

Now, a word on the Fac output. Black is more distorted, not white, and subtracting the output from 1 doesn't work to make it that way. Here's why: using Suzanne as our example, there are some areas like the ears or the back of the chin where the closest point is facing into the mesh. In the Fac output, this will look like a big black patch. In reality, it is just a negative value, showing a different kind of distortion. If we plug the Fac value into a Math node (Shift + A > Converter > Math ) set to Absolute, we can see that they are just negative values. Here is a GIF switching back and forth:

Anyway, hope this helps. It was fun to work on ;-). Congrats for reading this far!


Scale bone in pose mode without affecting child bone? When I scale a bone in pose mode it will also affect the size of a bone connected to it. How can do it so that the connected bone keeps the same size?

Uncheck inherit scale in the bone properties


Subdivide and re-weight parallel/sibling bones? (or, how to deform-rig lips) I have several lip bones, as shown. They are not linked to each other in a chain, but share a parent and grandparent (maxilla and head).

Each non-corner lip bone is weighted generally like this along the length of the lip:

I would like to have more than 3 bones per lip between the lip-corner bones for finer control of the mouth polys (e.g. 4 or 6). Is it possible to subdivide parallel/sibling bones and redistribute weights between them? Alternatively, can someone point me to an effective way to rig lips (not Rigify plugin because I don't know how to export that)? Thanks!

You can simply select the armature, in edit mode use shift D to duplicate some lips bones, place them where you want them (the duplicated will have the same parent-child relationships), then in pose mode select all lips bones, go to object mode, shift select the mesh, go to weight paint mode and use the weights menu "Automatic assign from (selected) bones".
Make some manual weight adjustments if  needed.


Recursive search for selected vertices i am working on a tool and need to get selection islands in the mesh. I want to keep only the biggest connected vertex selection in the mesh.

I wrote a function that recursively searches a bmesh for connected and selected vertices:

bm = bmesh.new()
bm.from_mesh(obj.data)

_verts = [v for v in bm.verts if v.select]
_edges = [e for e in bm.edges if e.select]

islands = [] # all selection islands

#iterate all selected verts in mesh
for v in _verts.copy():
    #check if that vert is already registered
    if not any([v in i for i in islands]):
        #new selection island
        _island = []

        def get_selected_connected_verts(v):
            '''
            recursive search vertices for connected and selected vertices
            @v : bmesh vertex
            '''
            #iterate all edges linked to the vertex
            for e in v.link_edges:
                #is edge selected
                if e in _edges:
                    #get adjacent vert
                    v_other = e.other_vert(v)
                    #register vert to island
                    if v_other not in _island:
                        _island.append(v_other)
                        #search again
                        get_selected_connected_verts(v_other)
        get_selected_connted_verts(v)
        #register island
        islands.append(_island)

This works great for most meshes. Sadly with higher vertex counts python returns the following error:

RecursionError: maximum recursion depth exceeded while calling a Python object

When i try to increase the recursion limit, the following error appears:

Error   : EXCEPTION_STACK_OVERFLOW
The terminal process terminated with exit code: 3221225725

Theoretically i know that i should be able to make the recursive function iterative... I am just not able to..
 Also, if there is a totally different way to do this, please tell me!
I kindly ask for support of more talented programmers.

Thanks a lot!

Some code from this answer. But adapted for bmesh and the selection aspects of this question.

The principle is to start from selected vertices, and:

Make a dictionary of possible links to other vertices
Iterate available vertices and for each follow all possible remaining paths

The code with comments:

import bpy
import bmesh

def make_vert_paths( verts ):
    #Init a set for each vertex
    result = {v : set() for v in verts}
    #Loop over vertices to store connected other vertices
    for v in verts:
        for e in v.link_edges:
            other = e.other_vert( v )
            if other.select:
                result[v].add(other)
    return result

def make_island( starting_vert, paths ):
    #Initialize the island
    island = [starting_vert]
    #Initialize the current vertices to explore
    current = [starting_vert]

    follow = True
    while follow:
        #Get connected vertices that are still in the paths
        eligible = set( [v for v in current if v in paths] )
        if len( eligible ) == 0:
            follow = False #Stops if no more
        else:
            #Get the corresponding links
            next = [paths[i] for i in eligible]
            #Remove the previous from the paths
            for key in eligible:
                island.append( key )
                paths.pop( key )
            #Get the new links as new inputs
            current = set( [vert for sub in next for vert in sub] )

    return island

def make_islands( bm_verts ):
    paths = make_vert_paths( bm_verts )
    result = []
    found = True
    while found:
        try:
            #Get one input as long there is one
            vert = next( iter( paths.keys() ) )
            #Deplete the paths dictionary following this starting vertex
            result.append( make_island( vert, paths ) )
        except:
            found = False
    return result

obj = bpy.context.object

bm = bmesh.new()
bm.from_mesh(obj.data)
bm.verts.ensure_lookup_table()

bm_verts = [v for v in bm.verts if v.select]

islands = make_islands( bm_verts )

print( len(islands) )
#print( islands )


Force object mapping to remain independent of group instance position When I use object mapping and use an empty to position decals on objects, the relationship is not preserved in linked instance of the group of objects. Is there a way to force the decals to stay in their original location?

Let me explain:

On the left we have a cube and an empty. The blender logo on the cube is positioned using the object coordinates of the empty. Now I grouped the cube and empty, and created a group instance on the right. As you can see in the rendered preview the position of the decal on the linked cube is not the same as the original. Is there a way to make it so?

P.S. Using UV's is an obvious way but as in my particular use-case I have an array of cubes, I will have to apply the array to use UV's. Object coordinates help keep a non-destructive workflow.

Vector math

You can get get rid of the dependence from object's transformation with vector math. Take for instance the location: by subtracting to the empty's object Texture coordinate the location coordinates of the rendered object you find in the Object info node.

Now all your instances will look the same as the group whatever their location is.

Notes:

this works only for location, rotation and scaling of the instances
require more complex math
there is no need of assigning the empty to the group


Addon/Script: Register custom user properties Is there a way to register custom user properties for example a filepath the user can set under User Preferences > File?

Even better would be the possiblity to register a whole new tab in the user preference menu but that is not necessary if it would be complicating my effort.

The filepath properties are stored in bpy.types.UserPreferencesFilePaths, which does not support custom properties (only ID types and Bones do).

Even if it was possible, you couldn't make a property show still - addons can't overrule default layout scripts.

You can use AddonPreferences however, as long as the properties are not supposed to be stored in every individual .blend you work with. AddonPreferences show up in the User Preferences > Addons tab, below the addon info (the addon entry needs to be expanded).


How to run Batch Rename Datablocks Addon? If the button [ Run Script ] does nothing and Alt+P does nothing and right click Run Script does nothing. I don't even get an error message. Do I have to enable something?

This is my first ever attempt at running a python script:

https://svn.blender.org/svnroot/bf-extensions/contrib/py/scripts/addons/object_batch_rename_datablocks.py

Wiki link: Batch Rename Datablocks

In the 3D view, type space then type "batch rename..." :

"Run script" just allows this to be available.

Since this is an Addon (not a regular script) you can make it (the operator and its functionality) permanently available, see: How to install an Addon?


Can I set up one background image per scene? Thanks for click my question.

I got some layout images from my 2D storyboard team.
and i want set up that image per multiple scene in one blend file.

But.. the background image always works across all scenes.

So for me, blender's Background Image function looks useful only for single scene or modeling.

The same is true for ambient occlusion or depth of field.
The 2.8 version of EEVEE should be able to render the sequence for the video with the content shown in the viewport, but I'm afraid that multiple scenes will not have independent post-effects and background images.

Anyway, can multiple scenes have their own background images?

Thanks for reading.

Background images are part of UI data, that means they are saved along with user interface information withing the blend file, as such they cannot be different per scene, because UI data is saved once per file only.

As a side note you can also notice that if you disable the Load UI option when opening a file, background images will be gone.

They can still be controlled on a per-viewport basis, though, so two different 3D scene views can have different visible images, but the list will show the same datablocks.

Blender 2.8 post production effects and settings will probably be part of scene or even layer data, as such they have nothing to do with background image settings and can be independent per scene, as far as I know. Nothing is written in stone yet.

You could try using Empty objects as images as an alternative.


BlenderAndMBDyn installation - Action tab missing I have Blender 2.69 and MBDyn 1.6.1 installed on Ubuntu 14.04 LTS.  I would like to use the github.com/gdbaldw/BlenderAndMBDyn addon for Blender.  The addon goes ahead within Blender but I don't get the 'Actions' tab to select 'MBDyn file', 'Run MBDyn' etc..
Please give any suggestions as to where I can be going wrong.
Tim

If you start blender from a terminal window you should see some errors when you try and enable the addon, if you start blender from the application menu these errors will be hidden.

While the addon says it is compatible with 2.60 my quick tests with several versions show that it requires at least 2.70. It would be worth reporting that to the developer so that they may update the minimum requirements or adjust it to be compatible with older versions.

Waiting for the developer to update the script for older versions may not happen so you probably want to update your copy of blender, which would be recommended in general. It appears that the ubuntu packages for blender have not been updated for a while, you may want to look into getting a newer version. This answer seems to have the info of a PPA that is up to date.


Weird rendered lighting, probably bad topology This is one of my first models, an adjustable wrench. Both Eevee and Cycles produce similar results, which look kinda weird. Adding bevels around the wormscrew hole helped a bit, but now I'm stuck.

It looks like to me you applied smooth shading to the object, but haven't turned on auto-smooth.
Try going into the Properties window -> Object data properties -> Normals -> and check Auto Smooth.
Then fiddle around with the degree slider until all your curved surfaces are smooth, but the flat areas don't have this lighting error. I think the default 30° should work fine in this case.


Timer with uncapped frame rate I have been struggling a ton to get a basic time trial type timer that includes milliseconds.

The kicker is, I REALLY want to have my frame rate uncapped. With that in mind, this solution I found counts WAY too fast (it counts approx 30 seconds every actual second):  Timers and animation frame rate

I'm thinking there may be something to using datetime, but I can't figure it out. If I could just somehow start a timer at 0, then add to it the time between the previous and current frame, I'd be golden. I just can't figure out how to do that.

EDIT: I think I am close with bge.logic.getRealTime()   ...I just can't display it in the text object for some reason. I get "error return without exception set". It displays in the console just fine if I print it instead.

Turns out I've answered my own question. Here's a quick script for anyone who finds this later down the road. Just attach this to a text property and you should be good.

import bge
from datetime import datetime

textObject = bge.logic.getCurrentController().owner
timePassed = bge.logic.getRealTime()
timePassed = str(round(timePassed,2))
textObject.text = timePassed


How to create a simple list in the UI with Python API that would display data from Python? I've been writing scripts for Maya and 3Ds Max, now I'm trying to learn Python API of Blender. So I'm not a beginner in scripting for such applications, but I'm a total beginner in scripting for Blender.
I'm creating an UI for my simple script. I need to have a list in the ui that will update with new items [string "name", float value] during the execution of the script.

I just want to see this in my UI:

name: value
name: value
[...]

I'm not exactly sure how to pass the data from the Python array to the UI list_template.All I've got is this code, that creates a UI in the panel of the scene (based on the template):

class UIScriptPanel(bpy.types.Panel):
    bl_label = "Script Panel2"
    bl_idname = "OBJECT_PT_ui_list_example"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        layout = self.layout

        obj = bpy.types.AnyType( bpy.context.scene.my_data )

        layout.template_list("MESH_UL_scriptActionsList", "", obj, "name", obj, "id")

my_data is registered during register() with:

bpy.types.Scene.my_data = bpy.props.PointerProperty( type = MyPropertyGroup )

and MyPropertyGroup is(based on example):

class MyPropertyGroup(bpy.types.PropertyGroup):
name = bpy.props.FloatProperty(name="name")
id = bpy.props.IntProperty(name="id")

the class MESH_UL_scriptActionsList is the same as in the example. I do not know what to change in it yet..

The script runs, but the list is not displayed.

So mu question is: Is that how the creation of list for UI should look like? If yes, then why is it not working? If not, then how to create a list UI element in Python for blender that would displaye a content of list (or other data structure) from Python code?

Thank You in advance

Ok, I've got it. But still do not fully understand.

bl_info = {
    "name": "Collection Menu",
    "author": "CoDEmanX",
    "version": (1, 0),
    "blender": (2, 65, 0),
    "location": "",
    "description": "",
    "warning": "",
    "wiki_url": "",
    "category": ""}

import bpy

coll_data = [
    ("Option A", "The first option, can be found by searching '1' as well"),
    ("Option B", "You can find this by searching for 'roflmao'"),
    ("Some text", "Some more descriptive explanation"),
    ("Blabla", "Talking stuff...")
]

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

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

    def execute(self, context):
        print("test")
        coll_data.append(("a", "b"))
        bpy.app.handlers.scene_update_pre.append(collhack)
        return {'FINISHED'}

class Actions_List(bpy.types.UIList):
    def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
        if self.layout_type in {'DEFAULT', 'COMPACT'}:
            # You should always start your row layout by a label (icon + text), or a non-embossed text field,
            # this will also make the row easily selectable in the list! The later also enables ctrl-click rename.
            # We use icon_value of label, as our given icon is an integer value, not an enum ID.
            # Note "data" names should never be translated!
            split = layout.split(0.3)
            split.label(item.label)
            split.label(item.description)

        elif self.layout_type in {'GRID'}:
            pass

class MyColl(bpy.types.PropertyGroup):
    #name = bpy.props.StringProperty()
    label = bpy.props.StringProperty()
    description = bpy.props.StringProperty()

class MyScriptPanel(bpy.types.Panel):
    bl_label = "MyScript Panel"
    bl_idname = "OBJECT_PT_myscript"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout

        col = context.scene.col
        idx = context.scene.col_idx

        if idx >= len(col):
            #context.scene.col_idx = len(col) - 1
            text = "(index error)"
        else:
            text = col[idx].name

        layout.template_list("Actions_List", "", context.scene, "col", context.scene, "col_idx")
        col = layout.column(align=True)
        row = col.row(align=True)
        row.operator("object.simple_operator" , text = "All")

def collhack(scene):
    bpy.app.handlers.scene_update_pre.remove(collhack)

    try:
        scene.col.clear()
    except:
        pass

    for i, (label, description) in enumerate(coll_data, 1):
        item = scene.col.add()
        item.label = label
        item.description = description
        item.name = " ".join((str(i), label, description))

def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.col = bpy.props.CollectionProperty(type=MyColl)
    bpy.types.Scene.col_idx = bpy.props.IntProperty(default=0)

    bpy.app.handlers.scene_update_pre.append(collhack)

def unregister():
    bpy.utils.unregister_module(__name__)
    del bpy.types.Scene.col
    del bpy.types.Scene.col_idx

if __name__ == "__main__":
    register()


How to undo a camera binding to a marker? I am doing an animation, and I require to take several shots from multiple angles, and I'm doing it by binding cameras to markers in the timeline. I accidentally binded a camera to an incorrect marker and I don't want to delete the camera. How could I undo this?

Just select the marker from the timeline and press X to delete the marker.
Note: Your cursor must be on the timeline to delete from timeline.


Make an object not cast a shadow in eevee Is there a way to make a single object not cast shadows in Eevee?

Yes, by setting a material to an object and in properties panel choose Materials > Setting > Shadow Mode : None


How to use actuator as sensor to play animation of my character? I have a character that has a walk animation. I assigned a steering actuator to it specifically path following so that they will all meet in a specific place by themselves. I also have a shake animation for my building/plane. I've already set sensors and actuators to it too. If I run it and press enter, the building/plane starts to shake something like that in an earthquake. The thing I would like to do next is when I run it, my characters should only start to move towards their target if the plane starts to shake (that is if enter key is pressed). If no shaking, the characters should just walk in their place. They should only move if shaking occurs. I've been playing around with sensors and actuators but I can't seem to find a solution for this. What do you think could be the best approach for this problem?

Here's my blend file: canteen ver 2.blend

What I would do is give each person a status property.

A sensor tests the status and while it is 0 have them play an idle action.

A message sensor then receives an evacuate message and sets the status to 1.

When the status is 1 play an evacuate action or use steering to seek the evacuation point.


How to connect two sets of vertices with each other I know that I can select and then join 2 verts with Alt+M.
I want to know if there is an easy way to connect a large number of points in pairs or I have to select each pair separately and press the Alt+M?

Update 1
I think it is better to explain my questions with a picture :)
I want to go from the model on the right to the model on the left. Well now I know this is possible by selecting any point on the top plane and connecting it to the bottom plane using the Alt+M keys.

But when the number of these points increases, it becomes difficult. I wanted to know if there is a way to do this automatically?
I tried one of the methods mentioned in the comments. Use the F key to generate the FACE. This method works but there is a problem. It does not create Edges between the points and when you want to subdivide the shape, it gets in trouble.
As you can see in next picture:

This looks like CtrlE Edge Menu > Bridge Edge Loops, 'Blend Surface', with one cut.

If this is not exactly what you're after, have a play with the other settings (e.g. 'Merge') to get the sense of them.


Clear specific animation data Is it possible to remove one specific animation data instead of clear all by python script?

For example, I have set animations on location and scale properties, and just want to clear animation data for location only keeping scale ones.

I have similar situation recently, got thousands of objects and only needing to clear certain channels. I was trying to see if I could find Python script, but apparently Dope Sheet have Summary feature and you can quickly filter out Channels of your selected Object(s) by "Name". So this is super handy as you can search for Scale, and then select all and delete those Scale XYZ channel, or search for X Scale and the summary filter will filter out the X Scale from all selected objects, and then so you can select all from filter and delete those keyframes you don't need.


Freestyle "Material Boundary" not working? I am trying to add an outline around this geometry, that is overlapping a plane. This is not the result I was hoping for. I thought the checkbox "Material Boundary" would solve my problem but it doesn´t really seem to do anything. Please help D: (using the newest version of blender)

This is not an error. Unfortunately, freestyle cannot detect face intersections, even if they have different materials. You can use inset face or a loop cut and slide to try and put an edge there for freestyle to use, but unless there is an edge there or an outline, there will be no freestyle.


What happens to linked objects when you choose to pack external data I usually pack my textures into the .blend file via the "file"-->"external data"-->"pack all into .blend file" command.

This time my Blender project contains objects linked from other blender files and I'm uncertain of what happens if I choose to pack external data.

The question is basically this:
If I choose to pack external files, will changing the original Blender files any longer update the meshes in the blend file to which they have been brought to via linking? Or am I essentially severing the links if I pack the external data?

No, at least in my test, nothing bad happens to the linked files. Linking still works and the textures get packed nicely.

For this kind of stuff it's fast and useful to just make test blends with cubes and spheres to toy around with in order to find out what happens.


3d manipulator not on object, stuck in scene center Whenever I move an object by the transform manipulator in the 3d view, it disappears when I hold it (like normal) but when I let go, the arrows haven't followed the object. It just sits in the center of the scene no matter what.

I assume the Pivot Point for rotation and scaling is set to 3D Cursor. In this mode the 3D manipulator, i.e. the movement arrows, is also placed at the 3D Cursor.

Setting the pivot point to something like Active Element will also move the 3D manipulator to the origin of the active object.

Alternatively, depending on your intentions, you can move the 3D cursor, for example to the active object by pressing Shift+S and selecting Snap Cursor to Active.


How to set vertex radius when using skin modifier? I have this method that I want to use to change the skin size of the skin modifier.

If I do this, everything works fine:

def make_uniform_width() -> None:
    bpy.ops.object.editmode_toggle()
    bpy.ops.mesh.select_all(action='SELECT')
    bpy.ops.transform.skin_resize(
        value=( self.properties.skin_size, self.properties.skin_size, self.properties.skin_size ),
    )
    bpy.ops.object.editmode_toggle()

I can just use: bpy.ops.mesh.select_all(action='SELECT') to change the value on all vertecies simultaniously.

But I want to select specific vertecies to do the skin_resize. So I thought this could work. But I have no access to the vertecies it seems.

def make_increase_width(self):
    bpy.ops.object.editmode_toggle()
    size = self.properties.skin_size
    for iteration in self._iterations:
        for vert in bpy.ops.object.vertecies:
            if vert.index in self._iterations[iteration]:
                vert.select = True
            else:
                vert.select = False

        size += self.properties.width_increase
        bpy.ops.transform.skin_resize(value=( size, size, size ))
    bpy.ops.object.editmode_toggle()

Is there a way to select specific vertecies from editmode?

EDIT:
I tried this, but it's too slow te execute. Maybe I will have to look for another way to change the skin width.

def make_increase_width(self, vein_cluster_object):
    for iteration in self._iterations:
        vein_cluster_object.vertex_groups.new(name='growth-iteration-%i' % iteration)
    for iteration,group in zip(self._iterations,vein_cluster_object.vertex_groups):
        group.add(self._iterations[iteration], weight=1, type='REPLACE')
    bpy.ops.object.editmode_toggle()
    size = self.properties.skin_size
    for iteration in self._iterations:
        bpy.ops.mesh.select_all(action='SELECT')
        bpy.ops.object.vertex_group_deselect()
        bpy.ops.object.vertex_group_set_active(group='growth-iteration-%i' % iteration)
        bpy.ops.object.vertex_group_select()
        bpy.ops.transform.skin_resize(value=( size, size, size ))
        size += self.properties.width_increase
    bpy.ops.object.editmode_toggle()

I found it, I think. This should theoretically do the trick:

def make_increase_width(self):
    bpy.ops.object.editmode_toggle()
    size = self.properties.skin_size
    active_object = bpy.context.active_object
    for iteration in self._iterations:
        for vert in active_object.data.vertices:
            if vert.index in self._iterations[iteration]:
                vert.select = True
            else:
                vert.select = False
        bpy.ops.transform.skin_resize(value=( size, size, size ))
        size += self.properties.width_increase
        print(iteration, size)
    bpy.ops.object.editmode_toggle()

But it's very slow to execute. It seems having this line in the loop bpy.ops.transform.skin_resize(value=( size, size, size )) makes it too hard to do. It will select a maximum of 20 verts for about 60 iterations but somehow it will take far to long for it to run. I'm not sure how come.

@lemon Was kind enough to help me find this answer:

def make_increase_width(self):
    size = self.properties.skin_size
    obj = bpy.context.active_object
    for iteration in self._iterations:
        size += self.properties.width_increase
    for iteration in self._iterations:
        for vert_index in self._iterations[iteration]:
            obj.data.skin_vertices[''].data[vert_index].radius = (size, size)
        size -= self.properties.width_increase

This is outside of edit mode, very fast and exactly what I needed.


Black shadows on Faces, not a normals thing this is the first time I've used this website, sorry if I dont organize the post wrong. I've been using Blender for a couple months now, so I'm not too terribly new, however, There are these weird black shadows on my model and its driving me crazy, as I cant get rid of them. They're not a normals issue, as I've already recalculated them and it's not that. Does anyone know what causes this? Its in object mode, by the way. It happens anywhere.

Its probably a problem with the way I modeled it or something, as it's happening around these sharp edges. Here is it in edit mode.

Here is it in edit mode. Does anyone see anything wrong that I did? I'm sure I did something wrong.
Thanks so much for your help.

This occurs because you have smooth shading applied to your model. To resolve this, ensure affected topologies are selected, go to the Tool Panel T goto 'Shading' section select 'Flat'.

You can also apply an 'Edge Split' modifier, found under the Modifier tab in Properties Panel. Split edges need to be marked, once selected, with Ctrl + E. Dragging the mouse up/down to define amount.

You may also add more Geometry to the mesh. Either manually with 'Edge Loops' Ctrl+R or by adding a 'Subdivision Surface' modifier, also found in the Modifier tab in Properties Panel.


Projecting a Transparent image in blender I am trying to project an image(PNG) with some transparent area onto a plane in the blender, but the alpha area is black. Is there any way to make it transparent?

Make sure your alpha is connected and your Blend Mode is set to something other than Opaque:


Is there a list for blender build-in attributes? Is there anywhere that we could look up the list of build-in attributes on an mesh or object?
for example the object origin?
for use in geometry nodes.

There will be an attribute search included in blender soon.
source: Blender daily
( https://youtu.be/4pPSsAuM8sQ )


Bevel tool creating intersecting faces I am trying to use the Bevel tool to make my cinder block have some slightly rounded edges. When I select the edges or verts and use the tool it makes a weird explosion. Any ideas?

The first thing I would do is delete all the faces on the top along with those nasty triangles and poles... tris and ngons do not subdivide well with bevels.

Try to keep your geometry with quads.

Once you delete the offending faces, select the edge loops you want to bevel, and on the top view extrude and scale. The idea is to create a new set of edges and faces that follow the topology using quads.

Those edges will bevel nicely now...

If you need to bevel the outer edge loops do the same.

After that then just fill the gaps with the best topology you can come up with.


How do I move an object on the y axis infinitely I want to use animations to move this object on the y axis infinitely. Additionally is it possible to add conditions, for example if the object's y axis is past 10 meters than I would want to rotate 30 degrees on the x axis?

Setting the y location of the object to a multiple of the current frame should do what you want, the object will always move as long as the time is moving forward:

As for the condition, a simple node tree like this can be used:

If you want a smooth rotation, then using such node tree should work:

You said:

  Yeah I could do that but then eventually it would restart all over again as the frames have ended, is there a way to do animations WITHOUT using frames?

The move node can be used, it will move the object each execution no matter what the condition are, so it won't reset.


add "align object to view" to addon actually I making some extraobjects, and I want to add the feature "align object to view"
but I don't know how..

I check the Align object to view with Python but I don't understand how apply in my task

here the addon working:  http://pastebin.com/eW0Vu2EQ

thanks for any help

You can retrieve the required matrix from the view_matrix attribute of the 3D View space. It needs to be transposed and values in the 4th row and column be reset. Finally, you may set the translation components to the cursor location to get the behavior in line with the standard mesh add operators:

import bpy
import bmesh

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

    @classmethod
    def poll(cls, context):
        return context.mode == 'OBJECT' and context.area.type == 'VIEW_3D'

    def execute(self, context):

        scene = context.scene

        bm = bmesh.new()
        bmesh.ops.create_cube(bm)

        me = bpy.data.meshes.new("Cube")
        bm.to_mesh(me)

        ob = bpy.data.objects.new("Cube", me)
        mat = context.space_data.region_3d.view_matrix.transposed().to_3x3().to_4x4()
        mat.translation = scene.cursor_location
        ob.matrix_world = mat

        scene.objects.link(ob)
        scene.update()

        return {'FINISHED'}

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

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

if __name__ == "__main__":
    register()

    for area in bpy.context.screen.areas:
        if area.type == 'VIEW_3D':
            ctx = bpy.context.copy()
            ctx["area"] = area
            ctx["region"] = area.regions[-1]
            ctx["space_data"] = area.spaces.active
            bpy.ops.object.simple_operator(ctx)
            break


having trouble with texturing a roof Hi could anyone help me with this roof? i am having trouble making it look good(Specifically applying the texture to it properly) any tips would be appreciated if the problem is with the way i modeled it then tell me what i could do differently.This model is for a game with the normal maps applied in engine it looks alot better with a dark realistic feel to it, but i am currently stuck on the roof this is my first time trying to model and texture a thatched roof of this sort.

Thanks,

You could try re-doing the seams and unwrapping as in the images below so that you are using alot more of the texture.

When editing the UV islands you may find that you will need to flip one of them in the X axis (select island then sclae in the negative X axis, S X -1 ) to get the red ties along the top to line up with each other.

Different Seams but again overlapping islands:


cycles renders fire in single image but not in animation. how to fix? well the thing is: blender renderes my burning text just fine when rendering a single image. but when i render animation the output is black. i checked like 10 different posts on that and nothing helps.

i didnt change anything between the images other than pressing the animation button instead of render.

frame 40 single image render:

frame 1 animation (yes it shows in frame 1. the text glows.)

turns out im just dumb. the animation renders fine, just not the first 3 frames. they are black. i propably just didnt got to frame 1 when testing with single image.

NO NEED TO ANSWER


Randomize the UV of an object with an array modifier? Can I randomize the UV of an object with an array modifier I'm try to make stairs using an array but with same uv texture, I don't like how it looks.

[?

Try V-Offset/V-Offset in Array Modifier.


How to copy animation attributes to multiple objects? Very basic question here, I am afraid.

I have hundreds of shattered pieces of a mesh and I am trying to animate their visibility over the scene.

How can I animate the visibility and render visibility parameter for one piece, then copy/transfer to all the others?

Link the Animation Data of the active object to the other selected objects via Make Links menu:

Create an Empty (or every other type of object) and animate it (according to the scene)
Select all desired objects and finally the Empty to make it the active object
Press Ctrl+L and select Animation Data

Object visibility animation

Note: Since all those objects now share a single Action datablock you can update the animation on any one of the objects and the change will be shared by all the other objects.  If in the future you need to be able to edit the animation of one without affecting all the others, you can use the N-panel pop-out of the NLA editor, or use the Dope Sheet's Action Editor mode and click the Make Single User button (this will make a copy of the action so it is not shared with the others).


How to select each of the segments in my bone for weight-paint? Even though I’m in Edit Mode, I can only select two bones. Except one of them has 4 segments!

Bone weighting only works on whole bones. Bone segments are still just part of a single bone, and are not individually selectable or even separate objects.

Blender will automatically blend each bone segment's transform over the vertices weighted to the whole bone, by proximity to the segment.

If you need to fine tune this more you need to use separate bones, and constrain them to move appropriately (mostly likely using a curve to control them in some way).