v2.6 Primitive method Python code to add circle I'm trying to set up a workflow which involves as many reusable parts as possible.

I've written a vecCircle module which places a circle but it's not working because the example code I used is from a 2.5 doc source and there is no equivalent in 2.6.  I'm using 2.74 and it looks like the API is a 2.6 API - I presume that's right.

The example from
http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Cookbook/Code_snippets/Three_ways_to_create_objects

Includes the code

ob = bpy.context.object

which is an error in my pydev instance due to this being ro in this release. Can anyone tell me how the following should be rewritten? I'm not a python noob but blender Python noob.

def createMeshFromPrimitive(name, origin):
    bpy.ops.mesh.primitive_cone_add(
        vertices=4,
        radius=1,
        depth=1,
        cap_end=True,
        view_align=False,
        enter_editmode=False,
        location=origin,
        rotation=(0, 0, 0))

    ob = bpy.context.object
    ob.name = name
    ob.show_name = True
    me = ob.data
    me.name = name+'Mesh'
    return ob

The snippet you pasted relies on old API calls, and when it is run in a recent version of Blender it will produce the following exception / Error message

TypeError: Converting py args to operator properties: :
keyword "radius" unrecognized
Error: Python script fail, look in the console for now...

Bookmark this link www.blender.org/api/250PythonDoc/, it points at the latest docs automatically. You can also use the help menu.

See the current API page for bpy.ops.mesh.primitive_cone_add, You'll see that now (September 2015) must specify radius1 or radius2, radius doesn't exist anymore. And cap_end is now end_fill_type

Parameters:

  - vertices (int in [3, 10000000], (optional)) – Vertices
  - radius1 (float in [0, inf], (optional)) – Radius 1
  - radius2 (float in [0, inf], (optional)) – Radius 2
  - depth (float in [0, inf], (optional)) – Depth
  - end_fill_type (enum in [‘NOTHING’, ‘NGON’, ‘TRIFAN’], (optional)) –
  - (....)

For the circle example you might use something like this.

import bpy

def makePrimitiveCircle(objName, v, r, f, loc, rot, layers=[0]):
    bpy.ops.mesh.primitive_circle_add(
        vertices=v,
        radius=r,
        fill_type=f,
        view_align=False,
        enter_editmode=False,
        location=loc,
        rotation=rot,
        layers=[(i in layers) for i in range(20)])
    ob = bpy.context.active_object
    ob.name = objName
    ob.show_name = True
    me = ob.data
    me.name = objName + 'Mesh'
    return ob

f = makePrimitiveCircle('pizza', 20, 1.2, 'NGON', (1,2,0), (0,0,0))
print(f)  # does return the new object
# <bpy_struct, Object("pizza")>

# you could use this to specify layers directly..
makePrimitiveCircle('pizza', 20, 1.2, 'NGON', (1,2,0), (0,0,0), layers=[0,3,5])


My background plane disappear when I use game engine This is my blender project before game engine

This is the blender engine result as you can se the plane disappear

this only happens when I use the game engine I can render without proble ms

How I can fix that?

The problem was that the plane was upside down :)


Blender doesn't update/refresh its window How can I get it to update/refresh its window the way it's supposed to? I'm using windows 8 and I was able to get blender to work before, but after reinstalling windows 8 and blender, blender won't update/refresh its window unless I move, resize, maximize, or unminimize it. This makes blender completely unusable. I have already tried reinstalling blender and turning my computer off and on again.

I had a similar, but perhaps not identical issue.

In File->User Preferences->System, changing Window Draw Method to Triple Buffer from Automatic fixed it for me.

I suggest fiddling with all the Window Draw Method options, if that fails.


How do I apply hook modifier to shape keys? Ok, so I figured out how to make my eyelashes for my character to follow the eyelids using the hook modifier. I'm somewhat stuck with applying the deformation as a shape key. For example, when I select the eyelash, the eyelid deforms along with it in object mode. However, I cannot apply it as a shape key in edit mode when selecting the eyelash itself, as the eyelid would not deform along with it. But in object mode it does. Does anyone have a workaround? It's my first time using shape keys.

Used a combination of bones and weight painting and the hook modifier to make the eyelash follow the eyelid. More idiot proof way is to just join the eyelash to the main body mesh via different vertex groups and go to edit mode to create the shape key as usual


From blender to unreal smoothgroup and shading I have an issue with building a low poly model for Unreal.
There is the picture of the model in Substance Designer

The same model in Marmoset

You can see there are some weird crosses all over the model.
The same crosses are in Unreal

The model very simple and I'll be happy to keep it simple. Here is a Blender view

What do you think how can I fix those issues? It is obviously because of smoothgrouping but why then it works in Substance?

You can uneversaly try to export a .obj if you only whant a mesh. In the settings you will find a addon tab that have a unreal import-export feture disable in 2.79 (.psk/.psa)

The problem is usaly that the export are missing information or is procesed diffrent and you will need to deal with it in the other program


What file format should I use for rendering? I am new to Blender and want to render  an image of my object. I see that there are a lot lot lot of file formats to chose from. Which one should I pick?

Animation

It's generally good practice to render to an image sequence first, then combine all the images into a video format after the render is complete. This allows for the render to stop (whether the result of a crash or just canceling the render to use the computer for something else) and still be able to resume by setting the Start frame to the frame after the last rendered and restarting the render.

See my answer here for details.

Stills

As a personal preference I use PNG as a kind of default, but each format has it's advantages. The format you use will also depend on what kind of data you need to keep and how much disk space you can spare.

See the wiki for descriptions and a list of supported image formats:

  BMP    Bit-Mapped Paint loss-less format used by early paint programs.
  Iris  The standard Silicon Graphics Inc (SGI) format used on some Unix OS machines.
  PNG    Portable Network Graphics, a standard    meant to replace old GIF inasmuch as it is loss-less, but supports    full true color
  images. Supports Alpha channel.

  Enable the RGBA button to save the Alpha channel.

The RGBA option is in Properties > Render settings > Output:

  Jpeg  Joint Picture Expert Group (name of the consortium which    defined it), an open format that supports very good compression with
  little loss of quality. Only saves RGB values. Re-saving images
  results in more and more compression and loss of quality.
  Jpeg 2000
    Uses the Jpeg 2000 codec.
  TARGA and Targa raw    Truevision Advanced    Raster Graphics Adapter is a simple raster graphics format
  established in 1984 and used by the original IBM PCs. Supports Alpha
  Channel.

  Enable the RGBA button to save the Alpha channel.
  Cineon    format produced by a Kodak Cineon camera and used in high-end    graphics software and more directed toward digital film.
  DPX    Digital    Moving-Picture eXchange format; an open professional
  format (close to    Cineon) that also contains metainformation about
  the picture; 16-bit    uncompressed bitmap (huge file size). Used in
  preservation.
  MultiLayer    an OpenEXR format that supports storing multiple layers    of images together in one file. Each layer stores a render
  pass, such    as shadow, specularity, color, etc. You can specify the
  encoding used    to save the MultiLayer file using the codec selector
  (ZIP (loss-less)    is shown and used by default).
  OpenEXR    an open and non-proprietary    extended and highly dynamic range (HDR) image format, saving both    Alpha and Z-depth buffer
  information.    Enable the Half button to use the 16-bit format;
  otherwise 32-bit floating point precision color depth will be used.
  Enable the Zbuf button to save the Z-buffer (distance from camera)
  info.
         Choose a compression/decompression CODEC (ZIP by default) to save disk space.
         Enable the RGBA button to save the Alpha channel.
         Because OpenEXR is so new and previews are generally not supported by Operating Systems, enable Preview to save a JPG image
  along with the EXR image so you can quickly and easily see what the
  basic image looks like.
  Radiance HDR  a High Dynamic Range image format that can store images    in floating point (with light brighter than 1.0) - 32bits
  per    channel.
  TIFF   Often used for teletype and facsimile (FAX) images.

Some further notes on a few formats:

PNG: PNG (Portable Network Graphics) is a lossless format, meaning that the data can be reconstructed exactly as it was before being compressed. PNG supports true color color depth. Blender also supports 16 bit PNG, which gives a larger range of possible colors.

Because PNG is lossless, the Compression slider in Render settings > Output only affects the file size (AFAIK, the only disadvantage to setting it to 100 is it might take more CPU time to compress/decompress)

As an example, I saved two pngs, one with 100% compression and one with 0% (Uncompressed). The uncompressed png is 2MB, and the fully compressed png is 18.7KB. The images are identical.
JPEG: JPEG is a lossy format, which means that data can not be reconstructed exactly as it was before being compressed. (see a comparison to PNG here) However, as a result JPEG takes up a lot less file size.

Instead of a Compression slider there is a Quality slider when JPEG is selected as the output format. This refers to how closely the decompressed image resembles the original uncompressed image.

Here is an example. The left most image is a fully compressed PNG (36.3KB), the middle image is 100% quality JPEG (20.3KB), and the right most image is a 0% quality JPEG (8.5KB). At 1:1 they seem pretty much the same, but when scaled up the differences are more noticeable:

OpenEXR: EXR Is a format for HDR (High Dynamic Range) floating point images, and is capable of storing deep color depth of 32 bits per channel. Blender supports Half precision (16 bits per channel) and full precision color depth EXR images (32 bits per channel). As a result, these files can get quite large, especially when using Multilayer EXR). For example, a 201x167 image saved with lossless ZIP compression is 199.1KB

These images are good for keeping every bit of data around (including render passes in the case of Multilayer), which can be useful for compositing.

Note that when rendering a still, the image is stored uncompressed in memory, so you can render an image then save it multiple times in different formats (with different compression ratios).


How to model stiches on a chair I'm modelling a chair in Blender from a reference photo. The problem is that the stitches on the chair are not the right shape. I beveled the edges that represent the stitchings and extruded twice, first inward and then outward. But after applying the subsurf modifier, it doesn't look like the reference photo. Please suggest any way to do this. I'm just a beginner to Blender.

The best way to do what you wish to do is to use a texture, and a normal map. If you still really want to model them you can use an array modifier and a curve modifier. Hope this helps.


How to draw a thin line regularly across a cylinder I have a vase at home that I found challenging for the newby I am in blender. I understand the title of my question is probably not very clear so I found best to share a picture of the vase. The part of the vase I haven't found any solution to draw is the thin vertical line. I tried using bevel but this makes something too regular between the "hole" and the plane surface. In addition, the thickness of the vase has to decrease around the top as the diameter decrease. For this, the best I found is to draw the line with the cylinder completely straight and then to scale the top of the vase by applying first a series of edge loops.

Any idea or suggestion would be most appreciated.

Steph.

The Simple Deform modifier is what you need!

Create your profile, extrude it, don't keep the faces on the sides.

Give it an Array modifier, enable Merge and First Last options.

Give it a Simple Deform modifier, choose Bend mode and an Angle of 360°.

Continue to build your section the way you want it to be, it will be replicated all around.

Give it a Subdivision Surface modifier, add edge loops to sharpen the edges, etc...


How do I fix the 'Texface Conversion Problem' message when importing Yo-Frankie files into 2.72 Whenever I open 2.49b - Yo Frankie game level files using an up-to-date 2.72 Blender build I see a message popup that says 'Texface Conversion Problem(see error in console)'

How can I clear this up so I can get to work on getting the rest of it working?

Here's a screen render of the error message.

In short, the game material system between Blender 2.49 and 2.6 has changed a lot: http://code.blender.org/index.php/2011/09/bge-material-texface-changes/

This requires a automated conversion process, which sometimes fails for complex projects like Yo Frankie. You should check the console to see exactly what the problem is.


How to extrude faces with a value of its area? I'm trying to extrude faces in edit mode , each face is separated , extruding values is taken from face area , but the resulting extruding values seems not correct

this is the code

    import bpy
import bmesh
# Get the active mesh
obj = bpy.context.edit_object
me = obj.data
# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)
lm = list (bm.faces)
l = len(lm)
print(l)
for f in range (0,l) :

    bm.faces.ensure_lookup_table()
    bpy.ops.mesh.select_all(action='DESELECT')
    bm.faces[f].select=True
    ar = bpy.context.active_object.data.polygons[f].area
    bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude_faces_indiv={"mirror":False}, TRANSFORM_OT_shrink_fatten={"value":ar*-5})

I find the answer
the problem was in using extrude individual faces command for this operation , when I change it to ordinary extrude for flat objects and extrude faces along normal for curved objects , that solved the problem
I added scale in the end to give that shape
you can change the multiplayer with ar variable in the extrude command to control extrusion value

this is the code

import bpy  #
import bmesh

# Get the active mesh
obj = bpy.context.edit_object
me = obj.data
# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)

for f in bm.faces :
    e = f.index

    bm.faces.ensure_lookup_table()
    bpy.ops.mesh.select_all(action='DESELECT')
    bm.faces[e].select=True

    ar = bpy.context.active_object.data.polygons[e].area
    print (ar)
    bpy.ops.mesh.extrude_region_shrink_fatten(MESH_OT_extrude_region={"use_normal_flip":False, "mirror":False}, TRANSFORM_OT_shrink_fatten={"value":-2*ar })

    bpy.ops.transform.resize(value=(0.6, 0.6, 0.6) )


Simple Inverse Kinematics for a slider? I tried recreating something like this:

https://www.instagram.com/p/Bk1tq1DgMRV/?taken-by=flvio.cc

The head can move on the x and y axis.

The model itself is done, but I just want to move the head in both directions and have the "arm" move along automatically, and I would like to have them constrained.
I didn't find a tutorial that explains this. I never really worked with bones and constraints.

Tell me if this is ok for you:

Create 2 objects: Your cube and your cylinder
Create 1 armature with a small vertical bone for the cube and a long horizontal bone for the cylinder.
Parent the small cube to the long with a ctrl P > Keep Offset.
In Pose mode, give a Bone Constraint > Limit Location to each bone, choose Local Space and click every axis that should be limited.
Now when you move your cylinder bone it should only go up, and the cube bone should follow it and be constrained in its axis


How can an image be posterized in the compositor? I tried to split an image RGB values and re-combined it with rounded values in order to reproduce the results described in this BA Thread.

But instead of a posterized image all I get is an almost black image. Why is that?

The issue was that I loaded an HDR image, with standard images it works as 3pointedit pointed out the value should be reset (I just tried several values before the screenshot was made).

If you are replicating the setup on my BA thread http://blenderartists.org/forum/showthread.php?244118-Cool-nodes-I-didn-t-know-about

then the round value should be 0.1 not 1.0


Rigged model arm deforming body So I've been reading about riggin in blender, just started doing it, and I wanted to rig a simple model.
The problem is that when I move the arms down, the body deforms pretty badlt, and the model doesn't look round and fat anymore :(
Got any tips for a begginer to fix this problem?

According to your pics, you have already explored Weight Paint mode. That's going to be the key. The body is collapsing because of how the automatic weights were calculated. If you look at all that light blue on the torso in your third pic, where the arm's vertex group is active, you can see that there is entirely too much arm bone influence on the main body. Just paint it out so that it is darker blue. Set your weight brush to Draw, and set your Weight setting all the way down, and your Strength setting all the way up, and go over the torso.
You may have to tweak the edges of these zones of influence at some point. Use the Blur or Average brush for that.


Compositor : export output node when we want ? is there a way to save output file , after the "F12" render is done

for example , i created an output node for my passes ,and the way it work is that the passes are automatically saved when the "F12" directly after render is done , no way for me to control when it happend , the only way ai can export thoses files to my desktop is by doing the render ...

what if ive done a 5hours render and forgot to plug in the compositor "use nodes" , the only way to get my passes back is to redo an entire render ? really ? can we choose to export when we want our output ? how ?

thanks

Yes, if it was just a still render image, you can save each passes as a single image:

Just select the render pass, then go to Image > Save Image as

But if you want to render an entire animation without having to "Use Nodes" or even if you want to save the still render image passes as a single image file, you can save the render as an OpenEXR Multilayer file, but consider that the image file size could increase a lot.


Blender how to install builds Hi I have a Windows 10 and have Blender 2.78c installed on my computer but just recently downloaded blender -2.780-git.a372638 build dated for 8/1/2017. After I extract the file I don't see an installer or setup executable. How does a person use the builds for Blender?

After doing some research I discovered that the Blender builds don't have a install file but instead they just have the Blender symbol which is called "Application" with just a click a person can open Blender. I was used to running a set up install file which would load in the program. I just downloaded Blender 2.79 and after extracting the download just clicked on the Blender Icon and the program starts up the application.


How do you set the "current image" as far as bpy is concerned? How do you set the current image ( or current anything for that matter ) from a script or command console? I want to use something like

bpy.ops.image.reload()

which apparently works on the current image.

Unlike 3d view where you can only have one active object no matter how many views are open, the image editor is not restricted to that. From a UI standpoint you could have multiple UV/ImageEditor windows open, and then the concept of 'current image' starts to require more context. This is the case even if you had one image window open, or none when running in background mode. Luckily we don't need to worry about current image, or loop through views.

Use the right API calls

instead of calling operators intended to be called by the UI, it's often more convenient to manipulate Image datablocks directly using the methods provided by the Image class. You can use:

import bpy

# make an alias to increase readability.
images = bpy.data.images

# if the image changes on disk, this should get the new pixels
images[image_name].reload()

# the same can be done using .load()
images.load("/home/zeffii/Desktop/some_image.png", check_existing=True)

As explained in your other question

Don't do this if you can avoid it

https://gist.github.com/zeffii/54410dcbff9b6aa4953d

import bpy

images = bpy.data.images

# say I know I have 2 images, and 2 IMAGE_EDITORS open
# currently none of the image editors are showing any image.
loaded_images = images[:]

AREA = 'IMAGE_EDITOR'

for window in bpy.context.window_manager.windows:
    for area in window.screen.areas:

        if not area.type == AREA:
            continue

        for s in area.spaces:
            if s.type == AREA:
                image_to_use = loaded_images.pop()
                # s.image is the property to set for each
                # IMAGE_EDITOR to tell it to display a certain
                # image by reference.
                s.image = image_to_use


Normals trouble with exporting to Unity Hellow everyone.

I'm exporting simple tent model into Unity. I want both outside and inside of the tent to be 'visible'. I checked double-sided on the properties panel, but in Unity tent interior is still invisible. I can't just flip normals, because then outside of tent would be invisible. I know I could use Solidify, but it doubles vertices number, which is not good for optimalisation.
Is there any other way?

What you're asking for is likely not what you actually want... although it might be.

You can force a shader to render both sides of a polygon, but then the inside of the tent will not be in shadow. This is because polygons are fundamentally one sided. They only have one normal, which only points one direction. This is a little odd to think about, but it might be worth diving into the math... just a little.

Diagram about normals, from Unity

In short, the way a shader determines how bright a surface is, is to calculate the difference between the normal (a line pointing directly away from a surface) and the vector to the light source (a shader typically calculates one light source at a time, and then combines the results). In order to do that, it has to have a normal, and each polygon only has one. The only way around this, is to use the same calculations for the "back" of the polygon, which will make the inside of your tent as brightly lit as the outside. (Unless all your normals are pointing inward, in which case the outside of your tent would be as dark as the inside).

In order to have proper lighting, you have to have another normal... which means you have to have another polygon :-/ Suboptimal, but necessary.

This is not just a Unity thing or a Blender thing, this is fundamentally how all shaders work, both ray-traced and otherwise.

This is why it's so common for games to do things like make the tent closed so that you can't see inside. Then they don't have to have extra polys inside. But if you want your players to be able to see the inside, you have to have another surface (solidify is the right answer).


How to do number-pad actions like: "Number-Pad ." to zoom into an object I use a Mac and the Blender emulator doesn't do those kind of actions, my computer doesn’t have a number-pad function and number lock doesn't perform any number-pad actions. What keys can a Mac user use to do number-pad actions?

In User Preferences, under Input, there is an option to emulate the Numpad (makes regular numbers function as numpad numbers). You can then zoom using the regular + and - keys as well.


how can i fix the this offset rig problem with the hand? so i was making this model for a while now and i rigged it and everything, but for some reason the fingers arent on the bones when i rotate them more than about 20

does anyone know whats going on and how do i fix it?

turns out because i made the parent bone weights ovelap with the child, this caused the problem


How to model a letter K (or any other object made out of transformed copies of itself)? I've elongated a cube and copied it twice. I've then manipulated those two copies to look like the two non-vertical parts of the K, partially intersecting the vertical part. I then tried using booleans to merge the geometries into a single object.

However, when I try unioning two objects, one disappears. I've looked and it seems to be because of the duplicated geometry (the fact that I copy and pasted it?), but I can't really help it here, and remove duplicates removes 0 vertices.

How do I properly merge three objects that are transformed copies of one another?

Add a cube and Z upscale it;
Copy it with Shift+D;
Move the copy +1 grid step along X axis and shear it;
Combine the two cubes;
Use mirror modifier.


Physics Animation Sequence with Transparent Plane I would like to save my physics animation in a PNG sequence with the landing plane transparent.  I have an object that is landing on a plane.  This plane needs to be transparent in the PNG animation sequence.  I've seen posts with the "Film" tab, but I don't seem to have this in verion 2.79a.  How do I do this?  Thank you.

Film tab appears with Cycles Renderer (here v2.79a):

The "Transparent" option in Film tab is for the background only. For any mesh to be transparent as well, you have several options. Make sure you select RGBA in the PNG options in order to include the transparency.

define the material to be transparent:

uncheck the object from rendering:

make it invisible to camera:

I am sure I am missing some other means! Note that all those methods may have side effect like shadows etc.


How to setup shaders for semitransparent mirrors? I would like to produce a box with an effect like this one : http://www.thisiscolossal.com/2015/07/guillaume-lachapelles-mirror-dioramas/

I have been trying to create a mix shader between glossy and transparent to achieve this effect, but it didn't gave me anything close to this...

Any ideas on what shader to use ?

Thank you ! :)

This would be for the box containing the scene.

With the geometry node backfacing information you can make an object that is transparent from the outside but glossy on the inside:


What is "Z Direction" in Force field? Hi. I'm doing some particles following guided line work.
And I was wondering the function of "Z Direction" in force field which is applied to curve(=guided line).

What is the exact function of z direction? I assume that might be the direction of the force.
But when I change the direction from +z, -z, I don't know exact difference there.

Any answer would be great. I'm so curious about that but no one could answer me...
it bothers me.. a lot....

Thanks.

The Z Direction setting is within the Falloff section of the Force Field settings and as such it defines how the force reduces in strength as you move along the z-axis. With it set to 'Both' it will decay in both directions, set to +Z in the positive direction only and with -Z in the negative direction only.

Note also that the rate of falloff is determined by the 'Power' - with the Power set to 0 the force will always be distance^0 which will equate to '1' and so no actual falloff regardless of your Z Direction setting. Use a power of '1' for linear falloff, '2' for exponential fall off (such as with natural forces, gravity, etc.).


Subtract an array object I am working on micro patterns. I want to subtract an array object from a cylinder using Boolean modifier. It is simply subtracting squares from a cylinder. Can someone please simply guide me through with steps such as;

1- Create the array

2- Select array object you want to subtract
etc.

-If there is anyone who could do it since there are around 625000 squares you will probably need a computer with at least 32 GB ram capacity (I can't). However it is a simple 5 minute work and I would appreciate help a lot.

Thank you.

I played a bit with this task, creating the basic setup. The screenshots are kinda helpful, but don't tell the full story yet. So in essence, I've created a flat plane with the microstructure on it, and a cylinder wall with the structure on it. Both use the same mesh, all you need to model is this here:

It's a cube with the top face deleted, and then three faces extruded out of that. The cube has the desired 100 um size. Using arrays with the merge option turned on, and the merge tolerance set to something really low like 10 um, you'll get the flat plane with the structure. If you need that with a circular cut around it, you can use one boolean. I didn't do that so far, as I'm not sure where this is going yet.
The sidewall is the same mesh, just one additional modifier added after the arrays: The Bend modifier. I used an Empty to control the direction. And this is what it looks like on the cylinder:

The Blend file is here:
Based on your own model
Edit Updated Blend file is here:
As stated in the comment section, I cannot upload the file with modifiers applied, as there is a limit of 30 MB at https://blend-exchange.giantcowfilms.com, and the resulting file is 32MB. By the way, how does blender crash on your end? Because if what you see is Blender freezing for a while, that's just because the modifier calculation takes a long time. On my machine 30 seconds, and this is a real beast. So if that's the case for you, just be patient  :)


How to rig a rotary counter? I would like to know if is possible to create a simple python script to rotate these dials. What I want is something like this:

The first ring from the left is rotated around the Y axis by 40 degrees and when it reaches 40 degrees, the second ring is also rotated by 40 degrees and so on.

It could possibly be done with a Copy Rotation constraint but what i'd also like is to create a sudden shift of the dial every 40 degrees or so.

Drive rotation of Empty2 by the rotation of Empty1

In Properties panel (N to toggle):

Right click on Y-Rotation axis of Empty2 and select Add Single Driver.

In the Drivers section of the Graph Editor:

Add a variable yrot, set Object to Empty1 and type to "Y-Rotation".
Set driver scripted expression to: pi * ((180.0 * yrot / pi) // 40 * 10) / 180.0

This will give you an increase of 10° on Y-Axis of Empty2 for every 40° on Y-Axis of Empty1

Looking at your image you'd do this for the Y-Axis of your empties.

If you need increments of 10 on different rotation speeds, change the 40 in the above formula to i.e. 50

You can chain empties setup like this by making the next empty always driven by the previous. So the variable you add should be chosen from the correct object. The formula stays the same.

The main driving power behind this step-wise driving is the // floor division operator, which does integer division.


Is it possible to make a modifier with a python addon? Is it possible to make python addon as a modifier?

I just would like to make some deformation modifiers. But I know only python.

No, the modifier API is currently not exposed via Python.

Arguably, Python is too slow to do realtime operations on mesh data which can have millions of faces.

Though there is some possibility of something faster using Python, NumPy for example or maybe eventually even PyPy.


Can't hide object which particles are based on, without losing particles To clarify i'm not in this instance trying to hide emitter. The emitter oblong shape with arrow is supposed to be there. The particles are all based on a torus shape so all the little pink coins are based on that but i want to hide from render the large torus i have elsewhere on the screen. I un-clicked camera under ray visibility but then lost both the particles and the large torus. Thanks for any tips.

Select the large torus.

Blender 2.7x

Press the M key and change the layer it lives on.

Then in render layers Shift-Select the layer you chose to remove that layer from being render.

Blender 2.8x

Go to the Object Properties panel.

De-select Show in renders

To explain this, the properties you are changing ar only for the instance you selected, not any instances that are generated by the particle system.


localOrientation on rotary inverted pendulum I am setting up a rotary inverted pendulum in bge. If you look at the picture below, the body rotates around the z-axis and the pole is linked to the base with a hinge. I am having trouble getting the angle of the pole as it falls down. Using pole.localOrientation.to_euler() I get a vector of angles x, y, and z. I thought the angle I was looking for would always be on the y-axis, but it seems to alternatively switch between x and y, and I cannot figure out why. Below is an excerpt of the output of pole.localOrientation.to_euler() where it switches between x and y. (I thought maybe it could be when z goes negative or positive but I have found occurrences where it is not the case)

I think this is the result of the conversion to Euler coordinates.

Your values are too close to the pole of the "coordinate sphere". Little precision errors have large influence on the calculation of the rotation between angles around X and Y. It behaves like a compass near one of the magnetic poles. The direction can't be determined exactly due to the near pole.

You might need a different way to determine the axis around Z. I'm not that familiar with Euler. I suggest to use a different order.


How do I attach a few cubes via script. Blender 2.79. Pic => How to attach a lot of cubes to the nearest vertices of a certain object using a script?
I want to attach red cubes to the nearest vertices of yellow objects using a script.
Suppose red cubes belong to the group "GroupA". And these cubes need to be attached to the nearest vertices of the yellow object

I need your help.Thanks!

Download the blend file and test the script (updated)

in order to parent the cubes

import bpy

def conectando(vertice, objeto):
    cd = main.data
    cd.vertices[vertice].select=True
    bpy.ops.object.mode_set(mode = 'EDIT')
    bpy.context.scene.objects[objeto].select_set(state=True)
    bpy.ops.object.vertex_parent_set()
    bpy.context.scene.objects[objeto].select_set(state=False)
    bpy.ops.object.mode_set(mode = 'OBJECT')
    cd.vertices[vertice].select=False

print("*"*50)

#get active object
main = bpy.context.active_object
mat = main.matrix_world

bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.select_all(action='DESELECT')
bpy.ops.object.mode_set(mode = 'OBJECT')

vertices = [v for v in main.data.vertices]

conectar=[]
for ob in bpy.context.scene.objects:
    if ob.type == 'MESH' and not ob.name == main.name:
        # select object in order to join at the end
        #ob.select_set(state=True) # select object in order to join at the end
        distance = []
        for c in vertices:
            v = c.co
            loc = mat @ v #matrix world of vertex co
            distance.append([(loc-ob.location).length, c.index, ob.name])

        distance.sort()
        conectar.append(distance[0])

for c in conectar:
    conectando(c[1],c[2])

import bpy

print("*"*50)

#get active object
main = bpy.context.active_object
main_coords = [(main.matrix_world @ v.co) for v in main.data.vertices]

#move other mesh objects to nearest location in active object
for ob in bpy.data.objects:
    if ob.type == 'MESH' and not ob.name == main.name:
        ob.select_set(state=True) # select object in order to join at the end
        distance = []
        for c in main_coords:
            distance.append([(c-ob.location).length, c])

        distance.sort()
        ob.location = distance[0][1]
        print(distance[0][1])
            #$print(ob.name + str(tuple(ob.location)))

#join all objects
bpy.ops.object.join()


union modifier deletes part of object I have a problem with a python script for generating an object consisting of
two parts combined with the union modifier.

This is a stripped down part of the code:

import bpy
import math
import mathutils
from mathutils import Vector, Matrix

####################################################################

verts = [
    Vector((0.0, 1.6738300323486328, 0.0)),
    Vector((0.0, -1.6738300323486328, 0.0)),
    Vector((3.849679946899414, -1.929069995880127, 0.0)),
    Vector((3.849679946899414, 1.929069995880127, 0.0)),
    Vector((0.2250913381576538, 1.455641746520996, -0.3000001907348633)),
    Vector((0.2250913381576538, -1.455641746520996, -0.3000001907348633)),
    Vector((3.6170783042907715, -1.6805357933044434, -0.2999999523162842)),
    Vector((3.6170783042907715, 1.6805355548858643, -0.2999999523162842))]

faces = ((0,1,2,3), (7,6,5,4), (1,0,4,5), (3,2,6,7), (0,3,7,4), (2,1,5,6))

origin = Vector((0, 0.0000, 2.0))

# Delete all
bpy.ops.object.select_all(action = 'SELECT')
bpy.ops.object.delete()
for item in bpy.data.objects:
    bpy.data.objects.remove(item)
for item in bpy.data.meshes:
    bpy.data.meshes.remove(item)

# Create mesh and object
name = 'klotz'
me = bpy.data.meshes.new(name+'Mesh')
obj = bpy.data.objects.new(name, me)
obj.location = origin
obj.show_name = True

# Link object to scene and make active
scn = bpy.context.scene
scn.objects.link(obj)
scn.objects.active = obj
obj.select = True

# Create mesh from given verts, faces.
me.from_pydata(verts, [], faces)
# Update mesh with new data
me.update()
bpy.context.scene.update()

# Rotate local object coordinate system
rot_mat = mathutils.Matrix(
    ((0.0000, 1.0000,  0.0000, 0.0000),
    (1.0000, 0.0000,  0.0000, 0.0000),
    (0.0000, 0.0000, -1.0000, 0.0000),
    (0.0000, 0.0000,  0.0000, 1.0000)))

# Rotate object vertices in opposite direction
me = obj.data
me.transform(rot_mat.inverted())
bpy.context.scene.update()
# Update object matrix applying rotation
obj.matrix_world *= rot_mat
bpy.context.scene.update()

nasen_w = 0.5
nasen_d = 0.6
nasen_h = 0.3  ## <== sensitiv to nasen_h
nasen_pos = Vector((0.5579, 0.2000, 0.15))

bpy.ops.mesh.primitive_cube_add(location=nasen_pos)
nase = bpy.context.active_object
nase.scale = (nasen_w/2,nasen_d/2,nasen_h/2)
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
bpy.context.scene.update()
nase.matrix_world = obj.matrix_world.normalized()

# union of klotz and nase
if 0:
    modifier = obj.modifiers.new('Modifier', 'BOOLEAN')
    modifier.object = nase
    modifier.operation = 'UNION'
    bpy.context.scene.objects.active = obj
    bpy.ops.object.modifier_apply(apply_as='DATA', modifier=modifier.name)

    bpy.context.scene.update()
    scene = bpy.context.scene
    scene.objects.unlink(nase)

As shown, the script generates two object, a flat truncated pyramid
and small box.

When I try to combine these two object with an union modifier by replacing the

if 0:

in the last code block in line 79 with an

if 1:

the truncated pyramid vanishes, leaving a small piece, which looks
like the difference of the two objects, not the union.

Also I get error messages:

group 0x7f145b12ecd0 is unclassified!
group 0x7f145b12ebf0 is unclassified!
group 0x7f145b12ecd0 is unclassified!
group 0x7f145b12ebf0 is unclassified!

This error is sensitive to the height of the box. If this height is
equal to the height of the pyramid (the upper and lower faces are then
coplanar to the upper and lower faces of the pyramid) the error
occurs, if I change the height a little bit, in line 68 for example:

nasen_h = 0.3  ## <== sensitiv to nasen_h

to

nasen_h = 0.2999  ## <== sensitiv to nasen_h

the error vanishes. The error is also dependent of the coordinate
transformations (rot_mat) and the postion (origin) of the object.

I tried this with blender version 2.76 and 2.68a. I also checked the
normals of the two objects, they seem to be ok. Has anyone an idea,
what I'm missing?

Many thanks!

It appears you're stretching the limit a bit with the accuracy of the Boolean modifier here. Your two objects have identical height and positions, which confuses the modifier as to which part is in and which is outside the intersection area.

If absolute mathematical accuracy isn't all too important to you, you can easily solve this by moving the box object a tiny bit on the Z axis - as you already discovered.


UV texture repeating but shouldn't be? I'm trying to add a single uv image texture on one part of my model. I have unwrapped using smart uv project, added the image texture node and plugged it in to base color and added the image in uv and placed it. And while the image does appear, it ALSO appears in multiple other places.

I don't get it, because not only is the image not showing on the other UVs, I've even moved everything OFF the image itself, so I'm not sure how it's even mapping to that part.

See below for images of what I am seeing. I have also included a link to the file if you want to take a closer look.

Link to file: Blender file example

Actually you think that the other parts of the mesh won't have the texture displayed because they are off the image in the UV/Image Editor but you need to know that the image is actually repeated as a pattern, that allows you for example to create seamless repeated pattern textures. So you need either to move your other faces on a transparent part of the image, or even don't unwrap these other faces of your object, or as suggested by bstnhnsl, choose Clip mode instead of Repeat in the Image Texture node.

Here is an example of an object that has the same image repeated on another face, while it looks like this other face is off the image:

If I increase the size of my mesh in the UV/Image Editor, you can clearly see what I mean:


How to apply transformations to empties? In Blender 2.81, I have a linked collection, and I want to apply a transformation over it. In the UI I just select the empty , so when I scale, translate or rotate the empty the liked data experiences the transformations too.

By the other hand, to do it with bpy, for objects is:

# object.type = 'MESH'
object.data.transform(transformMatrix)

But when I try to do it over an empty type:

# empty.type = 'EMPTY'
empty.data.transform(transformMatrix)

I get the error: 'NoneType' object has no attribute 'transform' because the empty's data property is None.

Is there a way to apply the transformations over empties? If there isn't how can I archive the same results?

  I need to keep the collection linked because the source file changes quite often.

Thank you.

I found a solution:

You have to modify the empty's location, scale and rotation properties with the information contained in the Transformation Matrix. If you used vectors to build the Transformation Matrix, just apply them:

# For location add the vectors
empty.location = empty.location + traslationVect

# For scale assign the vector
empty.scale = scaleVector

If you have the transformation matrix you'll have to build the vectors based on the matrix's elements

PS: I didn't dive into rotations.


Combining Multiple UV Maps for export I have a model which has 3 UV maps which I need to export to another 3d program(modo) but am unsure how to go about it. I need to export as a .obj file but do not think this can handle multiple uv's. Is there a way to merge these maps into 1 map? Please be gentle as I am a beginner with blender and still feeling my way.

TIA

Cheers
Damo

Blender has an add-on for Combining multiple UV maps into one. Texture Atlas.

The addon Documentation has some tutorial Videos on how to do that.
https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/UV/TextureAtlas


Is there a good/industry methodology to setup folders in blender projects? I need a good way to organize my blender project files in the project folder.  I've tried a universal texture folder (any movement and things get lost), I've tried to include a texture folder in the project folder (lots of duplicates with other projects)

What is a good methodology to set this up and easily transferred to another person or team or GIT.

After many tries I guess there simply isn't a universal method that just works out of the box with every Blender project (or with any project that involves cooperation) imaginable.

It all comes down to the nature of the project itself. Rendering still images or movies might have different requirements than creating game assets.

The universal texture folder might be a good idea at first glance, but once you start altering those textures (painting seams, baking dirt/worn edges) those textures become project- and even object-specific. So once you make changes to the base textures, you might them store in a project-specific area of your file system anyway.

Subfolders within the project folder keep things organized well enough within the Blender project, but they don't necessarily work for export to game engine formats.

Then there's always a difference between working on projects locally on your Computer, in a local network or over the Internet.
If you work locally on your Computer but still want to share the work with other people, you would at least have to share a method how to set up the project folder (that's nothing special to Blender). The same goes for office-like LAN setups, both should be well-organized.

Collaboration over the Internet is a whole different story. The first thing that comes to mind is "hey, let's set up a git/cvs/mercurial repo". It's a good idea in general although there are virtually no distributed version control systems that deal well enough with binary files out of the box (the only one I know of is Perforce but it's not free and requires good hardware to run well).

IMHO the best method to share your work Blender has to offer without any additional work is to pack external data into the .blend file itself. Once you've done that you won't have to think about what to pack into the repo or where and how to store data in a manner that it would work over all setups. The only thing you have to remember is to clean up your file every now and then.


How to add noise to background image? I made a  video in blender. It is basically a short clip with an animated character and a still background image. I am rendering with Cycles and I have set the render seed to be generated for each frame separately. However, I feel like my video seems faker, just because, contrary to the character, there is no noise in the background image. Is there a way to add noise to the background image and to make it change every frame?

First create a texture in the properties window:

To add the texture in the compositor use an input>texture node, and select the texture you've just created:

Then overlay that on to the background image. You can control the size and shaprpness of the noise by adding a value node and a blur node.

(click on the image to enlarge)

To make it change from frame to frame you can keyframe the values.

Another note: try other forms of noise like Clouds, Musgrave or Stucci to find the texture pattern that matches that of your rendered model's


Translucent shadow (ceramic material) I am trying to create ceramic material, similiar to the one on the picture:

However I can't figure out, how to add shadow from behind the ceramic part. Translucency nor SSS don't do the trick.

As you can see there is no shadow comming from Suzanne's chin.

Any idea?

Folowwing your advices, this is the result:

And here is the node tree

This (poorly lit) example manages to get the kind of effect you're after. This is a question where a screenshot of your node setup for the glass material would really help.
The first thing to understand is that your bowl is not ceramic. Ceramic is neither transparent nor translucent. The effect you're after comes from translucent/opaque glass. But before you go diving for the Glass shader think about combining a Glossy and Translucent shader for volume, with SSS to further scatter light over the surface area.
Also key is the light source. I positioned a Sun lamp behind my bowl to give me the shadow through the bowl as you have done. I can also adjust the Sun's size to increase or decrease the shadow's edge within the bowl. (There's also a little Ambient Occlusion in the scene but this shouldn't affect the bowl shadow).


White outlines around characters from sun lighting So, I'm trying to make a minecraft scene and every time I put a sun in the scene it puts a white outline on the characters.

Consider changing the alpha representation for a texture with transparency.
Try both choices

Straight or Premultiplied

Located in the texture settings image panel.


Workaround for offset of linked collection? (Blender 2.8) Linking

Suppose I have a source .blend file with object "A" within collection "A-Collection", "B" within collection "B-Collection", and "C" within collection "C-Collection", pictured below:

Then I link all three collections, separately, into a single new separate .blend file, pictured below:

Note that for each linked collection, the linking process created a new empty and sortof "parented" the collection to that empty.  Presumably that's useful since it allows rotation and translation of the collection within the destination (i.e. "consuming") .blend file, but it seems to be offsetting the empty based on the origin of the source .blend file's axes.

In other words, since "A-Collection" was offset in the source file at x=0, y=-4, and z=-2, it gets imported/linked with a parent empty offset from its geometry by offsets x=0, y=+4, and z=+2.

Question

Is there any way to (1) have it create the empty at the bounding box center (or similar), or (2) manually change the offset of the empty, post-import, to be something more reasonable?

I know I could create a new empty in the consuming file, set its parent to be the linked collection, and use the new empty for rotation, but that approach has the downside of having to find and select the new empty every time I need to rotate, rather than just selecting the collection itself.

edit: Another workaround is to move the linked object to the origin, right-click that linked collection instance in the layers hierarchy, and select "Instance to Scene" to create an instance of the instance.  That approach leaves behind the original instance as an unwanted artifact, but it could be moved into a "throwaway" collection and hidden.  (still not a great approach, though)

TL;DR: Set offset for a corresponding source collection in properties>object>collections  to control where collection will be placed with respect to empty when collection is instanced

It is possible to provide the offset for a selected collections in source file. Offsets can be set for a source collection in Collections Panel of Object Tab of Properties editor

Properties > Object Properties > Collections

If location of collection in source file is 4 units in x axis, then set offset of x (in properties>Object> collections) 4 units. By setting offset we can control how far collection instance will be with respect to it's parent empty(also called Instancer).

Where new collection instances can be create by using add menu or by setting collection in instancer panel of empty object

Collection are the powerful feature introduced in blender 2.8. Blender supports linking nested collections as well. Instancing new collection is equivalent to adding new empty followed by choosing desired collection in instancing panel of object properties.

For collections in action and workflow check the following video from Blender Conference
Creating blender demos glowing tigers and tortured creatures - Daniel Bystedt


Incorrect IK behaviours I am rigging a robot for some personal training, and I got into a very weird issue while rigging the legs.

Here are my two foots, both are parented to the right bones, rigged to their respective Target and all this stuff. But one is acting like if it was parented to the target, while the other reacts like if it was just copying the Target's rotation (which is what I want the other to do).

I double checked all possible parameters that could cause this on each bones of both legs, and I'm still unable to explain why this is happening and how to fix it...

Have a look at your upper leg bones.

On the bone properties tab under inverse kinematics, there are the settings for bending limits and stiffness that are used by the IK solver to calculate the end positions/rotations for the bones.

Your left upper leg has different settings than the right here.


Set active image node with python There's any way to change it directly by Python, or there's any way to set by Python what node image is the active to display in viewport (Textured) and bake?

Here is an example that creates a Texture Image Node for the material Material with Python:

import bpy

node_tree = bpy.data.materials['Material'].node_tree

node = node_tree.nodes.new("ShaderNodeTexImage")
node.select = True
node_tree.nodes.active = node

The new node is selected and made the active node of the node tree.


How to effectively animate a "lasso"? I am currently making an internship in the field of chemical research, and as part of this internship I want to use Blender to make presentations.
I recently started using Blender, I understood some basics but not everything ..
For example, I would like to animate a "lasso" but I think to do it very badly because I spend a lot of time to have a very imperfect rendering and I am sure there is way to make much faster and much more effective.

Here is what it gives in frame 1:

http://i64.tinypic.com/2dj0yrl.jpg

Then in frame 94:

http://i67.tinypic.com/2r2y9uq.jpg

Well, here we are very far from a pro render (the axis in gray should be fixed on the torus, the curve is ugly ...) but the overall idea of what I would like to do is present.

For now I tinker (it's really the impression that it gives me) with a bezier curve and hooks. Can you tell me how to get to my goal?

I thank you for your response in advance,
Rota.

I propose to use curves, parenting and hooks to do that.

The red ring have to move along (say) X
The gray tube is like pushed and unbent to the horizontal
The blue tube is translated along the gray tube

We can use a curve modifier to constraint both tubes to follow a curve.

But we also want that it unbend along its own size.
So the circular part of the curve have to be pushed on right. We do that using a hook to the ring of the corresponding control points.
The hook influence is set to 0.2 in order to avoid these points to be pushed right at the same speed as the other objects (an influence of 1 would have been the same speed).

From that, the blue tube is simply parented to the ring.
But the gray tube needs to move along from the ring but except its last part which needs to stay stuck on the black sphere.
So instead of parenting it, we use a hook again on all vertices except the last ones (the one near the black sphere which is simply placed near it). These vertices are set in a vertex group used in the hook modifier:

Though, this setup is very specific to this left/right movement.


How would one animate blinking lights in viewport OpenGL render? The goal: to animate blinking emission materials (Christmas Lights from a distance) in viewport materials view.

My attempt: When I manually change the emission strength, the changes are visibly reflected in the viewport. Therefore I keyframed the emmission strength to blink on and off every few seconds.

The problem: The changes in emmision strength are not reflected in an OpenGL render. This approach works beautifully in cycles, but not in OpenGL.

Cheers, Dan

Note - Everything here is with reference to rendering, using OpenGL...

Method 1 -

The Diffuse intensity slider cannot be keyframed in my version (2.77a) but the Colour circle's slider can.
(See the note below)

Set the slider at the desired colour and level and keyframe each setting using "Constant Interpolation" (Select all it's keyframes in the Dope sheet and press T)

Unlit bulbs will then be seen in their reflective (specular) state.-

Method 2 -

Bulbs can be rendered invisible intermittently by keyframing the 'master' bulb's eye icon in the outliner.
Simply copy/paste one master-bulb's keyframes into any others.  Displace as required.

This method can still provide an unlit bulb by duplicating it and shrinking that a little so it's a separate and unlit version.  Each time the illuminated bulb becomes visible, it's unlit counterpart is hidden just inside it's circumference -

The reflection on the ground plane is actually coming from a point lamp located inside both bulbs.  Keyframes from the outer and illuminated bulb are copied into the point lamp. (See "For Newbies" below)

Method 3 -

When multiple sequences are involved, sometimes it's simpler to just block bulb(s) from view using a large slotted mask, or individual (cubes?) around each bulb.  They can be switched from mask to invisible, or simply moved out of the way.  A slotted plane was used here...

Method 4 -

Use the "Noise" feature in the Graph Editor.  The curves are more a graduated flickering though, although this affects reflection (specular) more than the bulb itself.

For Newbies - referring to method 2 -

Initially, the point lamp won't have an appearance in the Dope sheet for copy/pasting.  Step the timeline cursor to frame zero and keyframe it's eye icon in the Outliner first.

Repetitive keyframes can either be 'cycled' in the Dopesheet or duplicated and those moved on to the end of the original sequence.  Select all of those and duplicate them again so you then have 4 sets of keyframes, then 8, then 16, 32, 64 etc.
Within a minute, an impressive number of repetitive keyframes can be produced.

-================-

NOTE -   For Method 1 above -

When switching between full emission and none in the Material slot -

Don't tick the shadeless box.  Instead use zero and maximum values in the "Emit" slider and set interpolation (T) to "Constant" for all keyframes.

If the lights don't flash when animation is playing, stop the playback, select the lazy bulb and advance the timeline cursor. When it's in a switched-on phase, tick the Shadeless box on and off.  In my machine and Blender vers (2.77a) this kickstarts the blinking process.

The attached Blend file can be used to test if the Diffuse sliders suggested will work on your own machine and version of Blender.  Use the kickstart suggestion to get Layer 1 working properly.  Layer 6 uses a slotted plane.

Both are best viewed through the camera. (np Ins key)


Images as Plane turned Wireframe Per the title,
Working along merrily when some accidental keyboard press really muxed things up. I've imported two images as planes, for a front view and a side view. They were, when switching to rendered or Material Preview shading modes, perfectly usable some moments prior.
However now, it's like I am perpetually viewing the two in Wireframe mode. That is, my images as planes, which functioned perfectly, now seem fixed in wireframe regardless of the chosen Shading(the one accesses with the Z hotkey on the keyboard in 2.8+).
I can no longer see my images.
Thoughts? Thanks in advance.
Gif illustrating the issue:
https://gyazo.com/829774d112c9b1e4e47f0511ab959366
A final note, I've gone into object Properties and verified that under "Viewport Display" the setting "Display As" is set to Textured.

Thank you everyone for the suggestions. For the moment I'm going to re-import the images and clone the appropriate dims/rot/scale/pos values from the anomalous set. Couldn't say what happened here to be honest but thanks all the same. Hope everyone enjoys their day.

In "Object Data" properties, please check that :

Only Axis Aligned isn't checked
Opacity isn't set to 0


Array and curve modifiers without deformation I watched some youtube videos, they making some educational basic animations for kids. I want to make some similar videos for my channel. But I didnt find a solution for curve array modifier. My objects always deformed. I got some solution with dupliframe path animation but. I try to make just like this video :

https://www.youtube.com/watch?v=8pTcxkvXo8A

It doesnt look like a path animation(dupliframe) I think. It seems array and curve modifier. as if he making offset change. Any advice ? Thank you. (Sorry for bad english )

https://imgur.com/CwqxD7e

If you use the curve modifier to deform an object, yeah, it's going to get deformed.

If you don't want that, one work around is to not use a curve modifier to directly deform the object, but to instead use an armature that follows the curve.

I'll start by removing my curve modifier and applying my array.  I've already seen that this array fits my curve about right like it's supposed to (not quite guaranteed.)  Then I'll create a new armature and a bone for each blob.  Eyeballing is fine.  Once I made a few, I selected a bunch and shift-d duplicated, so it was easy.

I've disabled inherit scale on all of my bones (by selecting all of them and alt LMB on the checkbox, in properties/bone/relations.)  I've also parented them all to a single bone, pointed downwards just so I can see it, which is non-deforming.  This is my control bone, and I'll move the balls simply by selecting this bone and scaling it.

Time to parent the mesh to the armature with automatic weights.  Then I had my constraints:

I'm using a clamp-to constraint that will translate my bone's position along the X axis onto the length of the curve.  Once I've made one of these, I can copy it to all of my deforming bones using "copy constraints to selected bones" which I just access from the spacebar search.

It won't be anything near right in default pose, because the clamp-to doesn't work quite the same way as a curve modifier.  But just select your control bone and scale it down some.  At a scale of .27, the array about fits the curve.

And to draw the blobs closer, scale your control bone even smaller than that.  Or, to change the position from which the blobs seem to spawn, move the control bone in the X axis.

I'm sure there are other ways to do this.  This only took me five minutes though.


I want to copy animation data but I don't want to use CTRL+L, how can I do that? I have a dozen objects in my scene right now. I have one of them moving along the Z axis. I want to copy that movement to the other objects. Right now I'm being told I should use CTRL+L to link animation data from the one object to the rest. However, I later want to be able to manipulate the individual objects further, but when I do that, it copies that change to all of the objects, because their animation data is linked. How can I copy the keyframes from one object to many others without using the Link Animation Data command so that I can manipulate them individually after that?

You can use CtrlL to give the same animation to all the objects. Then when you want one of these objects to have its own, press U (Make Single User) > Object Animation.


Project Rendering in Black and White? I am brand new to blender and have been working on some really basic things. When I look at it in solid mode everything is in color but when I look at it in the material preview mode, render preview mode, or when I render it out the whole thing is in Black and White. Under Output Properties, the color is set to RGBA. If anyone could help that would be great. Thanks!

Hi @TobiasPenner and welcome. When I opened your Blend file I noticed that the two plains have a white emission material and the cube has the default light-gray. So when you say you viewed as colour I am not sure what you mean. You may have changed a few things before submitting the file, but maybe if you showed an image of the different modes it will help.

Anyhow with your blend file if you want to add color to the cube and see in Material preview mode you will need to do the following:

Change your cube to view as a solid object (it is displayed as a wireframe).

Assign a color in the material properties of the object


How do volume shaders interact with light? In this answer I would like to understand
What does it mean in Node Editor that light will interact with volume?
I would like to see a few pictures showing the difference/meaning.

Some shaders determine what happens when light rays are reflected or emitted  by the surface of an object.

But what happens to the light when it goes through, or inside the object, is determined by the volume

In blender, volume can be used as part of the material on objects, or for the world.

There are many uses for volume shaders, like creating clouds, smoke or a hazy atmosphere and volumetric lighting or to simulate liquids or glass.
The main concepts to understand are Scattering, Density, Anisotropy and Absorption.
Scattering
The reason we see rays of lights on a dusty, or hazy environment is because there are suspended particles on the air that reflect the light.

Photons are scattered when they collide with particles. When light travels through a volume in a certain direction, photons are deflected in other directions when they collide with particles. This phenomenon is called scattering.  How frequently light is scattered by particles both depends of the particles properties (mainly their size) and their density in the volume (how many particles/molecules are in one unit of volume)

(https://www.scratchapixel.com/lessons/procedural-generation-virtual-worlds/simulating-sky/simulating-colors-of-the-sky)
Density
Determines how thick the volume appears to be. More particles (or a denser environment) will result in less light travelling through, and more light being scattered .
Anisotropy
Controls the look of the scatter effect depending on the direction of the light passing through it.

Positive values let the ray scatter in the direction it is traveling, while negative values cause the ray to scatter opposite of its travel direction.

For positive values, rays mostly get scattered along the direction of the ray that entered the volume. Negative values mostly scatter into the opposite direction. Anisotropy of 0.0 (center) will result in random scatter directions. Depending on the density, rays might not get scattered at all.

(from: https://www.blenderdiplom.com/en/tutorials/all-tutorials/582-cycles-volume-scatter.html)
Absorption
Light is absorbed as it passes through the volume, a black liquid like black ink will absorb all of the light passing through it, for example. A glass or liquid can act as a color filter by absorbing some colors and letting others go through unfiltered.

How to make glass clear at overlapping point

Practical examples:
Light passing through an object with Volume scatter (suspended particles, like smoke, haze, dust, smoke)
Atmospheric lighting in cycles

or light being emitted inside a volume

Fire and smoke:

How to create fire materials using the new Principled Volume node that visually look the same as the "old method" of fire materials?
Volume absorption makes the object transparent but absorbs light which passes through it. It can be used whenever you need a material which absorbs light, such as water or colored glass.
Here's an example, the liquid has no color, but the volume absorption node makes the light that goes through it be red:

fluid in a glass

Further reading:
https://www.scratchapixel.com/lessons/advanced-rendering/volume-rendering-for-artists


How do I add a Freestyle Line-Style to a Freestyle Line-Set using python script? I have the following code that turns on freestyle, adds a Line-Set, and adjusts parameters for that Line-Set.

What I can't figure out is how to add a new Line-Style to a Line-Set, and adjust it's parameters.

sceneR = bpy.context.scene
freestyle = sceneR.render.layers.active.freestyle_settings

sceneR.render.use_freestyle = True
sceneR.render.line_thickness = 10
sceneR.svg_export.use_svg_export = False
freestyle.use_smoothness = False

#Set a lineset for the visible lines
LineSetV = freestyle.linesets.new('VisibleLineset')
LineSetV.select_by_visibility = False
LineSetV.select_by_edge_types = True
LineSetV.select_by_face_marks = False
LineSetV.select_by_group = False
LineSetV.select_by_image_border = False

#Set the lineset variables
LineSetV.select_edge_mark = True
LineSetV.select_crease = False
LineSetV.select_silhouette = False
LineSetV.select_border = False
LineSetV.select_contour = False
LineSetV.select_suggestive_contour = False
LineSetV.select_ridge_valley = False
LineSetV.select_external_contour = False
LineSetV.select_material_boundary = False

I hope it is not to late but everything related to the linestyle / lineset is in the documentation. Your code is right, you just missed the class member. The cool thing is that you don't need to add something :)

Blender 2.79

The Freestyle line class class bpy.types.FreestyleLineSet(bpy_struct)

https://docs.blender.org/api/2.79/bpy.types.FreestyleLineSet.html#bpy.types.FreestyleLineSet

The linestyle class class bpy.types.FreestyleLineStyle

https://docs.blender.org/api/2.79/bpy.types.FreestyleLineStyle.html#bpy.types.FreestyleLineStyle

You can even add modifier or use nodes.

import bpy
from mathutils import Color

sceneR = bpy.context.scene
freestyle = sceneR.render.layers.active.freestyle_settings

sceneR.render.use_freestyle = True
sceneR.render.line_thickness = 10
sceneR.svg_export.use_svg_export = False
freestyle.use_smoothness = False

#Set a lineset for the visible lines
LineSetV = freestyle.linesets.new('VisibleLineset')
LineSetV.select_by_visibility = False
LineSetV.select_by_edge_types = True
LineSetV.select_by_face_marks = False
LineSetV.select_by_group = False
LineSetV.select_by_image_border = False

#Set the lineset variables
LineSetV.select_edge_mark = True
LineSetV.select_crease = False
LineSetV.select_silhouette = False
LineSetV.select_border = False
LineSetV.select_contour = False
LineSetV.select_suggestive_contour = False
LineSetV.select_ridge_valley = False
LineSetV.select_external_contour = False
LineSetV.select_material_boundary = False

# Set the linestyle
LineSetV.linestyle.color = Color((1.0, 1.0, 1.0))   # Color
LineSetV.linestyle.thickness = 2.0                  # Thickness

Blender 2.80

Same with this version

FreestyleLineSet

https://docs.blender.org/api/current/bpy.types.FreestyleLineSet.html#bpy.types.FreestyleLineSet

LineStyle

https://docs.blender.org/api/current/bpy.types.FreestyleLineStyle.html#bpy.types.FreestyleLineStyle


Highway overpass with modifiers I am trying to make an overpass type motorway with modifiers. Currently I am using one curve for the overpass and another version of that curve that has been flattened on Z axis. Then I use the Curve and Array modifiers to create this highway. I can use Shrinkwrap with the Vertex Group option to snap the bottom supports to the bottom of the motorway. Apart from that I don't know how to make it more believable. The different parts of the supports should change height and position according to the height of the curve, instead of just the top part stretching upwards like I have it. Are there any other techniques to create this kind of structure without modelling and positioning everything manually? Thanks!

OK I achieved a more or less satisfactory result by using multiple Shrinkwrap modifiers, and a hidden duplicate of the motorway geometry that the bottom vertices of the top parts of the supports are shrinkwrapping to. The middle parts of the supports are snapping to the top parts, etc...


I only see a outline of a square I only see a outline of a square in my editor type area. I'm very new to blender and I clicked some thing to do this, and ctrl z doesent work. If you can help that would be appreciated!

You are in Wireframe mode. change shading mode to Solid, upper right hand corner of 3D window:

.............and welcome to the forums :)


Are there any advantages of bigger/smaller tiles While rendering is there any difference in performance with smaller or bigger tiles. Also are there any other effects of changing the tile size, wouldn't a smaller tile size be better because you can see the render result faster?

There are two considerations involved with tiled rendering:

There is some overhead when switching tiles. Larger tiles = fewer tiles = less switching = less extra processing time.
Smaller tiles render faster (which reduces the likelihood that one tile is left rendering at the end, leaving all the other processors idle *)

You must find a balance between these two factors (In other words, you don't want all your processing time to be spent switching between tiles). The optimal tile size for you will probably be specific to your scene, hardware configuration, personal preferences (e.g. sacrificing a small amount of speed for larger/smaller tiles), etc.

See Best Tile Size for Blender Internal Renderer and Cycles for some examples.

* this assumes you have more then one processor/core in your system.


Blender Cloud textures for commercial purposes I have noticed there is a blender cloud service that offers textures, hdris etc...can I use them later in a project with commercial purposes?

All textures are licensed as CC-0. Free to use anywhere, for any purpose.

From: https://cloud.blender.org/p/textures/

The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.
You can copy, modify, distribute and perform the work, even for
commercial purposes, all without asking permission.

From: https://creativecommons.org/publicdomain/zero/1.0/deed.en


Cryptomatte aliased/jagged edges output Is there a way to get antialiased output on cryptomatte?

The colored image as shown in the question is the output from the picker image of the cryptomatte node. This image is used to quickly pick an object or material from the cryptomatte data. It is not the actual matte.
After picking objects and materials the anti aliased mask will be available from the matte output of the cryptomatte node. This is answered in more detail in Cryptomatte - Clean edges


my picture is just grey and white I loaded a file and the 3d model is white. I looked at different hoping to find a preset that will give the model color but I couldn't find it.

I then went to UV/editing to put an image in, but there was no color either.

It looks like you haven't added a material to your model. You need to add a material, create an image texture node referencing your texture, and connect it to the base_color of the Principled BSDF that appears.

The material can be added by clicking on the +New button above the shader editor (while the mesh is selected), or in the materials tab of the properties panel (on the right, its icon looks like a checkered sphere). You can add the image texture node by pressing shift-a and choosing texture>image texture.

If you want a shadeless texture in EEVEE, use the Emission BSDF node from the shift-a>shader menu.


Creating a panoramic, shaped backdrop with UV project modifier I searched around this place and found a lot of interesting things, but no real answer to my problem so I'm hoping somebody could give me some hints.
So, this is kind of a reversed thing to this cgmatters tutorial, where they create rooms from pictures. I want to depict an architecture (room1) in another, smaller room (room2). Basically room2 ist completely different geometry, but painted/textured in a way that he looks like room1. An optical illusion, comparable to an Ames Room, if you will.
https://en.wikipedia.org/wiki/Ames_room
There is a very easy way to do this, and that is the uv project modifier with a camera as projector that has the same angle of view and aspect ratio as the one that took the shot of room1. The results are great, I attached some test pictures at the end.
This however leads to extremely different texture resolutions. The sides of the room are high res, the center however is compressed much more by the wide angle (3mm lens) and becomes pixelated.
Unfortunately it seems not to be possible to project panoramicaly from a panoramic camera (as opposed to perspective or orthographic). Maybe I just didn't find the right settings?
Another idea that i really liked was to make the walls of room2 transparent, place room2 inside room1 and then bake what you see through them from the camera to this mesh. Unfortunately I only managed to do that from each planes normal, so it gets a cristalline distortion effect, basically every face has its own perspective. (picasso would have liked it) Is there a way to bake transparency from the viewpoint of the camera, not the normals?
My last idea was to use a bunch of renders, like you would do a stitched panorama. Render, turn camera, render...etc. I could use the rendered files for texture extraction techniques like the ones in cgmatters video, but honestly, that seems tedious.
I would appreciate your insights in this and suggestions for possible solutions.
Thanks in Advance
I made a scene to demonstrate what i want to do.

Room 1 is to be depicted on the geometry of room 2

View of Room 1

View of Room 2 using a wideangle projection. this works, but quality is low

View of Room 2(B) using an equirectangular rendering of Room1 as texture. It is not mapped correctly by the UVProject modifier

View of Room2(D) using baked transparencies as texture. These are rendered from the faces normals and thus all "see" through the walls from a different angle.

Explanation why I want to do this, in case you want to know.
What I want to do is create a diorama (in real life), like you would find in a natural history museum. This diorama shall depict a scene in a large building, much larger than the actual space the diorama will be contained in. This is what diorama creators usually do, only that it is a building, not a landscape. The classical method would be to carefully transpose photographs or sketches from the real landscape onto the curved alcove of the diorama and paint over this sketch and grid. But we live in the 21 century and i am no painter, so I have a model of the room, made in blender, and i want to create a texture, that is distorted in such a way, that, if seen from the right position, it will give an illusion of the architecture. he easiest way to imagine this is to imagine the diorama alcove as made of glass. You would then just use what you see through the diorama wall as its texture.
Pictures: older version of the demonstration
Room1 Front View

Room1 Wide Angle Render

Room2 with picture #2 projected onto it, top view

Room2, seen as room1 in Picture#1

I found out how to use an equirectangular image as a projected texture for projection mapping type scenarios. Maybe it's helpful to someone else, so i'll share it here.

Render an equirectangular panorama of the scene. This needs cycles and the camera set to panoramic instead of perspective.
Save the rendered image.
go to the thing you want to project on, go to the Shading-Environment and create a new Material.
add an "Environment Texture" Node and drop your Equirec-Render into it. Plug that into your Principled BSDF, or, if you don't want shadows and stuff, an Emission Node.
add a "Texture Coordinate" Node and connect it's object socket with the "Environment Texture"-Nodes vector socket.
add an "Empty" and place it at the specific location that is supposed to be the center of your projection. (in my case the place where a visitor would stand to see the diorama)
In the texture coordinate node, choose the empty for the "Object" field.
Tweak the projection by moving or rotating the empty.
Slab the material on anything you want to project onto.

The Node Setup. The projektor2 object is the empty defining the source or center of the projection

the diorama. The selected empty is the texture coordinate input


Cut a model into two models by intersecting with a third model I have a cube puzzle i want to model:

It is basically a cube intersected by 12 spheres.

Rather than model each piece individually (which would be really painful) I would like to model a cube, make a bunch of spheres of the right size, position them correctly against the cube, and then "cut" the cube with the spheres (probably using mirroring to avoid extra work).

Here's a screenshot of the model I've got.

I'd like to "cut" the cube pictured along the place where the sphere intersects it. The end result I'd like to get is two pieces that add up to a cube, but have that partial-sphere cut going through the middle of it.

Is there any way to do this in blender?

I'm really new to blender, so the more specific you can be in how to do it, the more helpful it will be. I've been reading a ton of tutorials, but I'm not trying to become a blender expert, just trying to get this one model for a project I'm working on!

Thanks!

You can use a Boolean modifier.

create 2 different objects (i.e. cube and sphere), and position them where you like the "cut" to happen:

Add a Boolean modifier to the cube:

Set object to sphere and operation to difference:

Apply modifier and delete the sphere:


How to make a complex selection of an image over a cylinder top/bottom face and extrude to make a coin Right now I'm trying to sculpt a cylinder face that I have made with 200 vertices and a very subdivided triangle fan cap top, but this gets too laggy for my PC and it's still very ugly.

I wonder if there is a way to make a selection of an image like in photoshop and just bring out that part. I'm trying to make a coin with a logo on it to 3D print.

As said in comment above, this could be done with texture displacement, like this:

of course the provided texture is probably not trimmed enough but you get the idea.

Note: I used a default circle, then filled with about 500 vertices, then subsurfed 5 times... which brings you about 1000x vertices, otherwise your coin face will be much more rough than this... of course it's damn slow.

Another way could be to vectorize the b/w image to svg (eg: use inkscape), then import svg into blender and then extrude... then add a cylinder "body", refine, and try exporting to .stl and similar.

eg., it could end like this

Note:the vertices count could be somewhat smaller in this case, but as usual, the more detail, the best results. In this case you can't easily smooth using subsrf, though... you could need a lot of mesh adjustment to correct (very) bad topology.

You have to find the best settings, it also depends on 3d printer resolution, of course...


Follow path offset field can't be keyframed, generates error There is a camera following a path, and when I press I while over the Follow Path > Offset field, it throws an error of F-Curve with path 'contrains["Follow Path"].offset_factor[0]' cannot be keyframed, ensure that it is not locked or sampled, and try to remove F-Modifiers. There are no F-modifiers and it isn't locked or sampled. It has a Limit Rotation constraint on it as well but removing that doesn't help. How can I resolve this?

I downloaded your .blend file and found that if you uncheck the "Fixed Position" box, you can keyframe the "offset" value and it works fine.

Hope this helps!


Too Many Samples = Unrealistic? I've tried experimenting with the amount of samples, the size of the tiles, etc.

Do you think TOO much samples may make it too, like, just too clean?

What do you think would be a good preset so you JUST remove the noise, and it (the image) isn't TOTALLY clean.

I have to post links due to file size:

http://imgur.com/bJ5AAnc

http://imgur.com/iiSLf3A

You see how it's like almost too many samples? I only messed with the blurs and glow effects on PDN, but you know what I mean?

Maybe its just because I'm visually justified to darker scenes?

No. Larger sample numbers make the image more accurate. If images appear to lack variation and imperfections, (I assume that's what you mean by clean) you can manually add them. This may include

Particle systems in the air for dust
Manually added light 'shafts'
scratches on surfaces
fading, or slightly different shades of colors
high amounts of randomness (not weirdness, RANDOMNESS)

All of these can go to make sure your picture look less 'perfect' although most of the time, you don't need to add them.
It all depends on how closely the final will be observed, and how critical your audience is. (or how dirty, being the opposite of clean, you feel comfortable with.


Using Transparent Background with Volume Scatter everyone. I need your help with. I'm trying to use the Volume Scatter feature with a transparent background in Blender Cycles. I have transparency turned on if that's what you are wondering,but every time,the background isn't transparent like I want it to be. Please help!

I hope that this isn't a duplicate question.

I figured out how to get a transparent background while using Volume Scatter. Easy to say that it was purplexing as Edward Nigma's riddles,it finally came to me. The answer to this giant enigma which has puzzled me for months.

The first thing you do is create a plane and enlarge it to surround your camera. The next step is to extrude the plane above your camera. I personally did this step by extruding to Z: 8.00000. Finally,you enable the Shadow Catcher in the object settings and press Shift+LMB to view the object and Shadow Catcher scene at the same time.

Render the scene with Volume Scatter with the Shadow Catcher scene,then the Shadow Catcher background will be transparent. I hope my answer will help those later in the future.


Why can't I collapse the screen? I tried to collapes the screen by pulling the thing onto the new screen. However, it isn't doing anything? I don't know why not. I also can't open the properties tab. When I push "n" it doesn't open the right tab. (I want to open the particles tab)

When selecting the 3 diagonal lines, make sure your cursor is a cross hair and not arrows. you should see the screen turn gray and an arrow appear and that is when you should let go of the mouse.

To open the properties tab, make sure that your cursor is in the panel before pressing n.


How to switch render source (VSE or Camera)? If you create a scene for the Video Sequence Editor and start working on a project Blender will render the output from the VSE. But if you want to later switch it to render your 3D scene again (the camera output) where is the setting to select the source?

Usually I keep a separate .blend for VSE edits so I don't need to switch, but I feel like I ought to learn how to do this as it's pretty basic. I would expect to find this in the Render context but I see no place to specify the source.

Thanks.

If there's anything in the sequencer, blender will render from there by default. If you don't want to render from the sequencer even if there are strips, disable Sequencer in Render settings > Post Processing:


How can I extract the rendering as images on the hard disk instead a video file? Now I'm using ffmpeg in the Output properties and it's making one video file format.
How can I make that it will also create 120 images of all the frames on the hard disk type png ?
When I'm doing CTRL + F12 it's rendering one video file on the hard disk but I want also that it will create 120 images of the frames.

change the file format to whatever image format you wanna use. Then when you're done with that you can convert the images into a video using the built in video editor


Wrong shading as a result of "bisect_plane" in bmesh I am using a test script, I took it from here How to cut a mesh into smaller pieces with python?.
The problem is that, the sliced meshes at the cut are creating unpleasant shading, I think the problem is in the recalculation of vertex normals.

I did triangulate the mesh then run "bisect_plane", I got the same problem.

Is there anyway that we can make them smooth during/after "bisect_plane", with a script.

I would like to thank @Lemon for his suggestion to use "DataTransfer" modifier How to create a seamless low poly terrain with displace and multiple planes?, from programming/mathematical point of view, this solution is not optimal. It is an approximation, in addition it is a work around and recalculating normals that is supposed to be done already.
I did try the "DataTransfer" modifier, for sure it gives much better result, but the problem of wrong shading at the cut does exist still.

I have made a picture to demonstrate that. Please note with "DataTransfer" I tried all parameters with different values, such as "Mix Factor", "Mix Mode", etc.

I am a programmer and from programming point of view, the moment you make "bisect_plane" you can have the proper normals at the cut. There must be some boolean value in the function prototype "bisect_plane" indicating how the normals should look like at the cut and the normals do not change after leaving edit mode.

I can write code that has nothing to do with blender to make the cut and have the mathematically correct normals, but it would be great to have it within blender to see the result directly.

I think this can be a feature request to blender community.

Following the comments in the question and the edit of it, here is a script that automates the cuts and smooth normals to the original.

The principle is the following:

Copy the original mesh
Set a data transfer modifier on the copy targeting the original
Cut the copy
Remove double vertices (because the cuts may create doubles and these doubles explain what is shown in the edited question)
Apply the modifier

The code is commented below. But if the comments are not clear enough, please tell.

import bpy, bmesh
from math import pi
from mathutils import Vector

#Utility: test if obj exists and is a mesh
def MeshObject( obj ):
    return obj is not None and obj.type == 'MESH'

#Utility: go in the specified mode, call the lambda and returns to previous mode
def InMode( obj, mode, call ):
    prevMode = obj.mode
    result = None
    try:
        bpy.ops.object.mode_set( mode = mode, toggle = False )
        result = call()
    finally:
        bpy.ops.object.mode_set( mode = prevMode, toggle = False )
    return result

#Cut the mesh and gets the normals for the vertices created during the cut
def CutMesh( obj, cuts ): #Original code from CoDEmanX

    bm = bmesh.from_edit_mesh( obj.data )

    for (plane_co, plane_no) in cuts:
        #Adds a bisectrice following the cut
        result = bmesh.ops.bisect_plane( bm, geom = bm.verts[:] + bm.edges[:] + bm.faces[:], plane_co = plane_co, plane_no = plane_no )
        #Gets the created bm edges from the result
        edges = [e for e in result['geom_cut'] if isinstance( e, bmesh.types.BMEdge )]
        #Splits the mesh according to these edges
        bmesh.ops.split_edges( bm, edges = edges )

    bmesh.update_edit_mesh( obj.data )

#Select all
def SelectAllVertices( obj ):
    for v in obj.data.vertices: v.select = True

#Get selected objects
def GetSelectedObjects():
    return bpy.context.selected_objects[:]

#Removes double vertices at the normals positions
def RemoveDoubles( obj ):
    bm = bmesh.from_edit_mesh( obj.data )
    bmesh.ops.remove_doubles( bm, verts = bm.verts[:] )
    bmesh.update_edit_mesh( obj.data )

#Duplicate the object
def DuplicateObject( obj, scene ):
    newObj = obj.copy()
    newObj.data = obj.data.copy()
    newObj.animation_data_clear()
    scene.objects.link( newObj )
    return newObj

#Duplicate the mesh and add a data transfert modifier to the copy
def DuplicateObjectAndDataTransfert( obj ):
    copy = DuplicateObject( obj, bpy.context.scene )

    #Auto smooth is needed as if not, the normals will be lost when the modifier will be applied
    copy.data.use_auto_smooth = True

    #Create the modifier, keeping mainly the default options
    mod = copy.modifiers.new( "Data transfer", 'DATA_TRANSFER' )
    mod.object = obj
    mod.use_loop_data = True
    mod.data_types_loops = {'CUSTOM_NORMAL'}

    #The copy is now the selection
    obj.select = False
    bpy.context.scene.objects.active = copy

    #Returns both copy and its modifier
    return copy, mod

#Creates cut objects from the selected object and normalize their normal to the original
def CutAndNormalize( cuts ):

    obj = bpy.context.object

    if MeshObject( obj ) and obj.mode == 'OBJECT':

        #Creates a base copy of the original object
        copy, mod = InMode( obj, 'OBJECT', lambda: DuplicateObjectAndDataTransfert( obj ) )

        #Cuts the copy according to the given cuts
        InMode( copy, 'EDIT', lambda: CutMesh( copy, cuts ) )
        InMode( copy, 'OBJECT', lambda: SelectAllVertices( copy ) )
        #Separates loose parts from the copy
        InMode( copy, 'EDIT', lambda: bpy.ops.mesh.separate( type = 'LOOSE' ) )

        #Get the objects created from the previous separation
        createdObjects = InMode( copy, 'OBJECT', lambda: GetSelectedObjects() )

        #And for each of them
        for createdObject in createdObjects:
            #Activate it
            bpy.context.scene.objects.active = createdObject
            #Select all...
            InMode( createdObject, 'OBJECT', lambda: SelectAllVertices( createdObject ) )
            #... in order to remove double vertices created by the cuts
            InMode( createdObject, 'EDIT', lambda: RemoveDoubles( createdObject ) )
            #And finally apply the data transfer modifier
            InMode( createdObject, 'OBJECT', lambda: bpy.ops.object.modifier_apply( modifier = mod.name ) )

print( '---------------' )

scale = 0.4
cuts = []
cuts.extend( [((i * scale, 0, 0), (1, 0, 0)) for i in range( -5, 5, 1 )] )
cuts.extend( [((0, i * scale, 0), (0, 1, 0)) for i in range( -5, 5, 1 )] )

CutAndNormalize( cuts )

Note1:

The result is not totally perfect where the cuts have created very small non quad polygons.

Note2:

I've tried to set the custom normals "manually" by affecting them directly. But I failed to do it. What happened is some per-face normals were wrong. I don't know why... if someone knows, please comment.


Pyserial and Arduino every Time new Connect problem I have a potentiometer and I want this to change the location of my cube. My script run is on the cube, connected to an "Always" actuator with True Toggle.

My problem is this line:

ser = serial.Serial('COM6',9600, timeout=1)

The script throws an error: ser is not defined

This line is read every Time, so my arduino must connect every Time. I need to perform a new connect every second, but I want float move.

So I try this, because the serial line is only executed once:

import serial
import time
import bge
import bpy

cont = bge.logic.getCurrentController()
ob = bpy.data.objects["Cube"]
scene = bge.logic.getCurrentScene().objects["Cube"]
own = cont.owner
PSerial=own['SerialVerbunden']

print (PSerial)
if (PSerial==False):
    ser = serial.Serial('COM6',9600, timeout=1)
    time.sleep(1)
    count = 0
    own['SerialVerbunden']=True

a = int(ser.readline().strip())
print (a)
count = count + 1
scene.worldPosition = [a, 0, 0]
ob.location = scene.worldPosition
ob.keyframe_insert(data_path="location", frame=count)

The script throws the error mentioned above: ser is not defined.

Yes this is true, because it is loading and at the end it forgets.
The variable count have the same problem. It can't count.
But how I can solve it?
If I write a while loop, so I cant see my cube is moving, Blender freezes.

I strongly suggest you separate connecting from communication. Do not forget you should execute a closing when the connection is not needed anymore.

Basically you need this three operations in this order over multiple frames:

establish a connection
communicate (receive/send) via connection
close connection [which seams not to apply at serial)

I suggest to implement it that way:

import serial
import bge

INTERNAL_PROPERTY_CONNECTION = "_connection"

listener = bge.logic.getCurrentController().owner

connection = listener.get(INTERNAL_PROPERTY_CONNECTION)
if not connection:
    connection = serial.Serial('COM6',9600, timeout=0)
    listener[INTERNAL_PROPERTY_CONNECTION] = connection

# your communciation
a = int(connection.readline().strip())
cube = bge.logic.getCurrentScene().objects["Cube"]
cube.worldPosition.x = a


Particles Don't Show A Material Hi I am trying to make a fire simulation with embers. For the embers, I created a sphere and put a material on it that changes color depending on how fast the embers are going. The color should go from yellow to orange (which is the color the original sphere is), but for some reason the particles turn out white. I thought it might be that I had the emission too high, but eventually I disconnected the material from the sphere entirely, but the particles still turn out white. No matter what I do, it doesn't change. Anyone know what could be happening?

Here's a picture (with the actual sphere in the back):

Yes, I actually had two spheres in the project, I had the wrong one selected. Thanks!


change pivot-center in image. Video Editiing Using the Video Editing I'm try to animate a picture rotating it. Looks it's only possible with pivot centered. A Youtuber tutorial show someone rotating imagen from the corner... I can't find how change the pivot possition to animate jpgs in Video Editing...  5:15  https://www.youtube.com/watch?v=x_dy4yMSJSw&list=PLjyuVPBuorqIhlqZtoIvnAVQ3x18sNev4&index=12

Thanks, very much. JR.

I watched the video, I think the rotation happens always using the center of the VSE video output. In the video the overlay image position is such that its lower left corner happens to be roughly at the overall frame center, so rotation seems to happen pivoting on its lower left corner,but is just a coincidence.

Edit: The image is not rotated itself. The image has just an offset that moves it to the upper right corned. Another (green) "trasformation" strip is applied to the image, and that green strip is what is rotated.

Her is what I think it happens:


How to move vertices while modeling? I used a plane to start to make a character. When I started to convert it into 3d the I can move any of the vertices on the global x or z directions, but I cannot move any of the vertices on the global y axis, even when the Transformation orientation is switched to global.

A copy of the blend file can be found at:

https://www.mediafire.com/?2b7jks1q6dqy1bu

and here is a screenshot illustrating the issue.

I'm not quite sure how the mesh has got like this, but essentially I think the mesh has been scaled (in object mode, I think) so it has zero thickness (in the object panel the 'z' scale value is '0') which I think is why you can't move anything in edit mode. Any movement is being 'squashed' back to zero.

To fix this you can go to object mode, select the mesh and press Ctrl+A> Scale. This 'applies' the scale, resetting the scale values to '0' but leaving the mesh appearance unchanged.

This question may help, though applying scale can be a complex subject:

Why are the longer edges being beveled more?