Scaling/Rezise in Blender 2.8 Python/Script not working on mesh I am working on a scrip that makes tiles (like for a kitchen floor). I have a script that works perfect on planes for 4 sided tiles. However, I am running into an issues on non-4 sided tiles.

I chose to use cylinders which almost exactly works as needed. But I am hitting an issue on "beveling" (which is just scaling 1 of the faces) the top face of the cylinder.

My code looks at all the faces on the mesh, and

-if it does equal 4 sides, then the script deselects them.

-If it does not equal 4 sides, then runs another check

-If we haven't deleted any faces yet, then it deletes 1 face

-If we have deleted 1 face, then we are on the top face
Up to this point works perfectly together

-Then the script scales in the selected face
This is where it causes issues

The scaling code works fine on its own if I manually select a face first, and also works fine by hand. I'm not sure if it's a bug or something I'm missing but I could use any help my fellow blender scripters can offer.

I'm including just the face adjusting part of the script, so to test my code you'll have to Add > Mesh > Cylinder to test it out.

Thank you!
(see code and images below)

#Import Python
import bpy
#Import mesh handling
import bmesh
#Import vector
from mathutils import Vector

tileBevelZ = 0.85

#_________________________________________Delete the bottom face

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

#number of faces we've deleted
facesDeleted = 0
#our current object
obj = bpy.context.object
#ref to mesh
bm = bmesh.from_edit_mesh(obj.data)

#for each face in mesh
for f in bm.faces:
    #if it's selected
    if f.select == True:
        #if it does not have the number of sides we want
        if len(f.verts) == 4:
            #we dont want to select it
            f.select = False
        # else if it does have the same number of sides
        else:
            #if we have not deleted a side yet
            if facesDeleted == 0:
                #deslect 1 of the faces
                f.select = False
                #increase faces deleted
                facesDeleted += 1
            #else if we increased our counter
            else:
                #make sure it's selected
                f.select = True
                #Delete the face
                bpy.ops.mesh.delete(type='FACE')

#set mode to faces
bpy.ops.mesh.select_mode( type  = 'FACE'   )
#select all
bpy.ops.mesh.select_all(action='SELECT')

#_________________________________________Adjust scale of top face for bevel
#for each face in mesh
for f in bm.faces:
    #if it's selected
    if f.select == True:
        #if it does not have the number of sides we want
        if len(f.verts) == 4:
            #we dont want to select it
            f.select = False
        # else if it does have the same number of sides
        else:
            #make sure it's selected
            f.select = True
            #set mode to vertices
            bpy.ops.mesh.select_mode( type  = 'FACE'   )
            #Scale the face in
            bpy.ops.transform.resize(value=(tileBevelZ , tileBevelZ , tileBevelZ), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)

Another take on getting the result.

Rather than trying to debug what is happening with your question script here is another take to achieve what I believe is the desired result.

Test script, object mode, adds a cylinder, removes bottom face, scales top face.

Bottom and top faces have z component to their normals. This is how they are selected below.

Once selected, the bottom face is removed from the faces collection.

Scaling top face similar to  related question  Using python and bmesh to scale/resize a face in place , in this case,  using bmesh.ops.scale

Notice apart from adding the cylinder to test, there is no bpy.ops used.

import bpy
import bmesh
from mathutils import Matrix

scale_factor = 0.85

# add a cylinder to test

bpy.ops.mesh.primitive_cylinder_add()
ob = bpy.context.object
me = ob.data
bm = bmesh.new()
bm.from_mesh(me)

top_face = [f for f in bm.faces if f.normal.z > 0.5].pop()

bottom_face = [f for f in bm.faces if f.normal.z < 0.5].pop()

# remove bottom face

bm.faces.remove(bottom_face)

# scale top face

bmesh.ops.scale(bm,
        vec = (scale_factor,) * 3,
        space = Matrix.Translation(-top_face.calc_center_median()),
        verts = top_face.verts)

bm.to_mesh(me)
me.update()

Note bmesh.ops.create_cone(diameter1=1, diameter2=0.85) could be used to create the shape, removing the need to scale.

Suggestion, don't over comment code, and consider using if f.select: instead of if f.select == True:


Image not appearing in output folder when rendered For some reason, when I press render and I have my output folder set, it doesn't render it there. How can I save my image to the output folder?

This is to be expected. Blender doesn't render the images to the output folder by default. This is only used when you press the render animation button.

One thing you can do to output your image, is to press F3 in the UV Image editor, and you'll get a promt to save the image. Sadly, it won't automatically save it to your output folder.

Another workaround, is to set the beginning and end frames to 1, and then press the render animation button. In that case, you'll get it rendered out to the folder you specified.


Local Coordinates Assignment I have a modeled SCARA robot in blender, this is moved through the use of a sensor and a python program. The problem now is that my inverse kinematics solved angle does not coincide in run in blender. One possible solution is that assignment of local coordinates in the joints.

Is there someone here can help me out with this problem? It will help a lot. Thanks!

Within the BGE the (parent)-local coordinates can be read and set via KX_GameObject.localPosition.

When you want to read/modify the orientaion you can use KX_GameObject.localOrientation. Be aware it is a matrix.

If there is no parent, the local coordinates match the world coordinates.


A better way to make this car air vents holes? So I'm trying to make a firebird 68 but this air vents in the sides are causing me troubles with the topology, It's possible to do make this a better topology ?

Thanks in advance :D

Suggestions.  An increment in vertex density and use extrude.
The image above is an exaggeration of your subtle situation. Model progression.

Top Ortho.

Loop Cuts.
Delete Vertices and faces.
Shape the hole manually, or with Proportional edit in Edit Mode, or with Loop Tools which is an addon.
Extrusion marked by arrow and difficult to see

User Persp

Extrusion allowing flexible shaping.  You are vents are somewhat like eyelids. They need less height. Add more loop cuts and shape subtly.

Still exaggerated for readability. Image above.  You can be more artistic with technical improvements.  This is an isolated modeling suggestion.  You can see models of hand and eyes to see how many loop cuts can be reused and reduced.


Merge objects with intersecting co-planar faces? I would like to merge intersecting faces of 2/3 polygons:

I selected all objects with A and merged them. I tried the delete duplicate method but that did not fix it. How can I merge these 3 faces so I can apply a material to that side of the object?

In this specific situation you can ...

Add Remesh modifier (Octree 3), Apply
Select all vertices and X Limited Disolve
W Merge by Distance
Select two vertices of hole and X Disolve Vertices

For some reason I lost two corner edges in N-gon (probably to much disolving :) ).  To fix it ...

Select all vertices Triangulate Ctrl+T
Select all vertices and X Limited Disolve again


How to get rid of an already applied solidify modifer When starting scuplting I accidentally applied the solidify modifer to my mesh, apart from creating unnessecary geometry it also caused problems with inner vertices sticking out of the mesh.Is there a way to remove the inner layers of vertices ?

Providing the inner and outer surfaces are not connected you can select one of the vertices on the inner surface and use the Select/Grow option (Ctrl+Numpad +) to grow that selection to include the whole of the inner surface and then delete (X).

In your example you'll need to manually select and delete vertices along the edge where the inner connects to the outer first.


What does Light Portal mean? I've heard a lot about this 'cool' feature in the next release and I wonder what it is. Any infos?

It is a plane that defines where the most of environment light will come into the scene, so the renderer can sample light more efficiently.

Usually speeds up indoor rendering. The sample takes longer time but the noise will clear out after fewer samples.

Multiple light portals can be used, but it's only good to place them on the main light sources - like windows (or a TV if it's the main source of light in a night scene).


How to merge the mirror modifier correctly? So I am mirroring this object so that it merges with it's "reflection", but it does not come out clean. As you can see it is pinched and there is also a gap in there. How can I fix this? I have been having this problem for a while.
Thanks!

you need to use a lower value for 'merge limit' parameter to lower the distance before vertices are automatically merged.


How can I make it so that a texture displacement applies to all sides of an object? I am using a height map as a texture for a displacement in a cube, but the only sides that are displaced properly are the top and bottom. The other sides don't have the texture applied to them, they only have lines that kind of make to look like the displacement is only being applied on the Z Axis. How can I make it so that the displacement shows up on all sides of the cube?

You need to set the 'Texture coordinates' to UV, and eventually choose a UV map:


How to Get Multiple Images as Planes at Once I want to select multiple files in the Windows Explorer and drag and drop them into the blender to get multiple images as Planes.

But I basically notice that Blender creates one Reference object at a time or adds one Background Image in the camera view.

How do I manipulate the blender to achieve my desire? Or add-on?

Thank you in advance.

This was a pretty dumb question.
I just need to select multiple images from the blender's file browser that appears when I run the Images as Planes command.


IK refusing to follow target around Z axis The IK have set up does not follow the target around the Z axis. I am using an Empty as the IK target. You can download the blend here.

Each bone except the bottom one has the following IK constraints;

And the bottom bone;

What have I done wrong?

I deactivated the x-axis limits for the three end bones and the odd error clears up as shown below.

I re-enabled the limits but changed the range from -90 to 90 for all 3 bones and tested it with some fairly exaggerated movements of the curve and the animation seems to behave sensibly.


Exponential distance array How can I create an array with the distances between the objects increasing exponentially? I want something like this:
[].[]..[]...[]....[].....[]
The distance between the objects should increase.

Thx reply ok I made this but only scale object change not distance

Single vert, array modifier, object offset, duplivert.

Animating the scale of the offset object
With the "Add Mesh Extra Objects" addon enabled can add a single vert object. Or by other means.
Since the single vert has no dimensions can array it and only effect the arrayed vert locations.
Add an array modifier to the single vert. Give it object offset add an empty.
Under Properties > Object > Instancing select Verts.
Make the display object you "really" want to array a child of the single vert.  Will now have this object instanced at location of each vert created by array modifier.

In the example image the empty has been given x location 2, and x scale 2.  The duplivert object is default cube with some scale in z.
Some theory.  Assume object is at (0, 0, 0)
>>> loc = Vector() # zero

Get the matrix of the object offset object (the empty)
>>> C.object
bpy.data.objects['Empty']

>>> M = C.object.matrix_world

Ok original is at x = 0.  For the next 4 arrayed objects, apply the offset object transform
>>> for i in range(4):
...     loc = M @ loc
...     print(loc.x)
...
2.0
6.0
14.0
30.0


I'm trying to export a character to UE4, but I can't seem to export the shape key animation and bone constraints, how could I get around this? Hello!
I have been working on a character for a project of mine and have encountered a few issues.
Software:
I am using Blender version 2.90.1 and Unreal Engine version 4.25.4.
Model description:
Clothing:
3 shirt pieces (both arms and the collar), a waistcoat, trousers, shoes, and a tie.
Base:
The head and hands (exported from MakeHuman).
It looks like this:
Animations I need imported:
Now he is animated, he has:

A Blinking Animation (a shape key named "blink" that changes from 0 to 1)
The Main Idle Animation (standard rig with IK) (Currently this is being exported and imported fine)
Basic Eye Movement (armature with "Track To" bone constraint). It should be noted that the eyes need to have the basic eye movement but also move with the main idle animation, so that if the head is moved the eyes follow with it while looking around.
These all work as intended inside of Blender but apparently Unreal cannot import shape keys or bone constraints.

What I need to know:

Is there a way to package the shape key animation in an FBX file and import to Unreal Engine?
Is there a way to export the eye movement to an FBX file and import into UE4?
If I cannot use constraints for the eye movement, what is a simple way to achieve the desired effect without them?

Additional Info:
This is the armature that controls the eye movement:

The bones "eye.R" and "eye.L" both have a Track To bone constraint. With these settings (Except for the bone being .R not .L):
As for the shape key animation, it starts the animation looking like this:

Then at frame 63 it is set to 1:

And then at frame 66 it is set back to 0.
In the graph editor I added a "Cycle" F-Curve modifier to make this blinking motion repeat, those settings look like this:

To quickly show how the animation looks in blender I'll link this video

The usual workflow to export animation with constraints is to perform the animation in Blender, then select all deforming bones and bake the animation (Pose mode, pose menu, animation, bake action), visual transform, delete constraints.
In this way you'll export an armature with no constraints that can be accepted by all others softwares.
Be sure to perform the bake on a copy of your file, because it's a destructive edit.


How to utilize material (or object) index behind a refractive material in cycle? The material (and object) index works only when the object is uncovered by other objects. But the thing is the object can be visible behind a transparent or semi-transparent objects. In cycles it seems that if I use refractive material like the glass shader the material/object mask no longer appears in the render behind the transparent object.

The mask result is below:

Let's say I want to color correct the blue torus in composition so I need the refracted part of the object as well. Is there a way to obtain the correct mask for the torus?

I don't think it's possible to utilize material (or object) index behind a refractive material as it is.

Blender is correctly showing the mask of the object that form the camera point of view truly has the material assigned. The squared piece is made of glass, the fact that is somehow showing what's behind doesn't change the material which is made of.

We can try to mask the "perception" of the material, but we'll have to use the rendered image itself, because only there the optic calculation occurs. Think about a deforming glass as the one show below:

The refraction, the dimming of the bounced light, the bending of the geometry, the fact that on the short side of the box you cannot see the torus... are all effects that strictly depends on the characteristic of the material (ior for example) and of the geometry.

What I'm trying to say is that you can't get the mask without actually render the image, beacause is in the simulation that all effects take place.

Maybe one day someone will implement a object id pass capable of taking optics into account, but for the moment I would switch all the lights off, add an emission shader to the interested object and use the rendered image as a mask.

It's certenly not an optimal solution as you'll probably have to set up a parallel blendfiles just for this task.


How can I replace a material from Python? I read this first to get an idea on assigning materials.

How to assign a new material to an object in the scene from Python?

I wrote a script to replace one material with another. It seems to work on an active object but does not replace materials on selected objects if I loop through them. I do not know if it is because the rest of the objects are not active or there is another reason.

How do I correctly replace materials with others?

Code is posted below:

import bpy

def replace_material(object,old_material,new_material):
    """
    replace a material in blender.
    params:
        ob - object for which we are replacing the material
        old_material - The old material name as a string
        new_material - The new material name as a string
    """
    ob = object
    om = bpy.data.materials[old_material]
    nm = bpy.data.materials[new_material]

    print ("ob is ",ob)
    print ("om is", om)
    print ("nm is", nm)
    materialnum = len (ob.data.materials)
    print ("materialnum is", materialnum)

    for i in range(0,materialnum):
        # test if the old material is in the slot and replace it
        print ("running ", i)
        if ob.data.materials[i] == om:
            print ("match found", ob.data.materials[i])
            ob.data.materials[i] == nm

def main ():
    #get a list of objects selected
    selected = bpy.context.selected_objects
    active = bpy.context.active_object
    for obj in selected:
        replace_material(obj,'DEFAULT BASE','Default Base')

main()

Sample blend here:
http://www.pasteall.org/blend/42037

Ok from the above I noticed there are possibly 2 approaches to the same problem.

1) is iterate through the list of available materials linked as data and replace the material. This will not work if materials are linked by Object.

Sample code below:

import bpy

def replace_material(object,old_material,new_material):
    """
    replace a material in blender.
    params:
        object - object for which we are replacing the material
        old_material - The old material name as a string
        new_material - The new material name as a string
    """
    ob = object
    om = bpy.data.materials[old_material]
    nm = bpy.data.materials[new_material]
    materialnum = len(ob.data.materials)

    for i in range(0,materialnum):
        # test if the old material is in the list of used materials and replace it
        print ("running ", i)
        if ob.data.materials[i] == om:
            print ("match found", ob.data.materials[i])
            ob.data.materials[i] = nm

2) Iterate over material slots and replace the material in the slot of the object. This as batFINGER pointed out is a solution wherein whether the material is linked to the Object or Data is irrelevant and hence probably a better solution.

import bpy

def replace_material(object,old_material,new_material):
    """
    replace a material in blender.
    params:
        object - object for which we are replacing the material
        old_material - The old material name as a string
        new_material - The new material name as a string
    """
    ob = object
    om = bpy.data.materials[old_material]
    nm = bpy.data.materials[new_material]
    # Iterate over the material slots and replace the material
    for s in ob.material_slots:
        if s.material.name == old_material:
            s.material = nm

Notes:

1) The above samples do not do any error handling the script will just fail if the materials do not already exists. I wanted this kind of behavior.

2) For brevity sake I have posted only definition of the functions themselves this function can be used for a single object or along with looping to work with several objects. An example of such is shown in the main() function in the question.

Usage:
Suppose you have an object named "Bottle" 2 materials "Red paint" "Blue rubber"
and you want to replace the material "Red Paint" with "Blue rubber"

then you would use:

obj = bpy.data.objects["Bottle"]
replace_material(obj,"Red paint","Blue rubber")


Blender background image stretch fit crop missing? I'm trying to scale the image x,y but there is no way to do it. A quick google search shows a stretch/fit/crop option which I do not see even after scaling and scrolling through the panel. They are suppose to show up under the Back/Front buttons.

According to the Blender manual, the stretch/fit/crop apply to the camera view only. They do not apply to the Top, Left, Right, or Bottom views in the 3D view-port.

I don't have Blender in-front of me to be able to check, however, I suspect those options will only appear when your image is set to display in the camera view (on your screenshot, your image is set to display in the Top view). They might only appear when you are looking through the camera (Numpad 0).

I will verify next time I have access to Blender.


Speed-up animation render which uses a movie texture I have many rectangles which display a movie clip, each starting at different points (offset) in the movie.  During animation render, the info area shows:

  Loading texture-movie.mp4@1234

1234 is the frame number for a particular rectangle.  This message displays about 5 times for all the rectangles that display the movie, each taking about 5 seconds for a total of 25 seconds per frame.

Is there a way to speed-up this part of the render process?

Thanks to the comments from poor and m.ardito.  Using an image sequence instead of a video clip (in this case an mp4) is the best.  Loading each frame (a particular image) took less than 1 second vs 5 seconds with the video.

If you can't use an image sequence for some reason, reducing the video resolution was also helpful, but not near as much and I had to reduce it a lot more than I wanted.

Another performance tweek was to disable "Cache BVH" under the Performance section of the Render tab.  I'm not clear on how this works but it only slowed down my render (about 10 secs/frame).


How to edit inset face after executing inset command I have a mesh with an inset face which looks like this:

The reason I have inset the face is to make a nice edge when adding a subdivision modifier. But if the edge ends up too sharp for my taste, what do I do? I can no longer move the inset face the way it did when executing the inset command... is there a way to easily edit this?

Select the vertices which compose edges and scale.  S
You probably know you can scale in two dimensions.  Lets assume XZ in
your model.
SShift+Y
You probably know you can choose the center point of the scale if
necessary.  Moving the cursor to the bottom middle might be your style. Otherwise you might move the points in z direction.
Otherwise undo or delete your work and inset a second time


Render audio button function and use I was wondering what the "Render Audio" button does and how you use it. Is it at all related to the Speaker object?

The render audio button combines all of the audio tracks that have been created in the video sequence editor into one audio file. This is useful if, say you had an animation that had multiple sounds in it but you rendered it as an image sequence and plan to put the output sequence in another project as part of a compilation. Say you forgot that you were going to create all the audio in the compilation. Instead of putting in the numerous audio tracks in again trying to put them in the perfect place again, you could render the audio from the first project and put it in the second project parallel to the matching image sequence. Also, it probably works appropriately with the speaker object, but I'm not sure at all. I've never tried. ;)

There's a simple example. I probably could have thought of something more realistic, but I hope that helps!


Knee acting weird in walking animation So I got my rig set up right so it doesn't glitch. But now I'm having a weird problem with the knee in the walking animation. If you open the copy of my blend file and run it from frames 40-60 you will see that I move the foot forward at those key frames. Now when the knee moves between 40 and 60 I fully extends straight then bends again in those ten frames. The two key frames don't shift the knee so the leg should go straight so why does the knee do that for a second between the two key frames at 40 and 60?

I'm not sure I understand correctly what you mean, but I think the main problem in your walk is that your Hips bone is much too high at frame 40 and 60, which makes your walk not good at all: when the legs spread, it's like the low of the walk sinusoid, the hips are supposed to lower down much more, and thus make the knee bend more naturally, perhaps that's the problem you're talking about?


Modelling car light in game engine I am trying to model car light for my game in blender. I want to change light's color when car stops or starts. I have tried couple of things such as changing emit color of current lights to emulate light source but as they are static material property ,it did not work for me (I can not access them through game engine controller ). I also tried placing half transparent object (which i can change their color through controller) in front of object whose emit property is set. But this did not also work as i can't manage color of half transparent object.

Is there any way easy to do this (changing emitting color of object dynamically)? Or am I missing something in my half-transparent object?

As The basicTroublemaker answered, just use 'ReplaceMesh' in stead of 'Add Object'. This way only the visual apearence will change and nothing else.


How to make smoke made in the smoke simulator transparent? I am using the Physics Smoke Simulator to make a flame, the problem is  that with the flame comes smoke which I don't want. I tried setting the flow type of the emitter to Flame only, but their is still smoke.
How do I remove this smoke or hide it?

As soon I posted this question  I saw where I went wrong.

There is an option in the domain of the simulation called smoke which surprisingly adjusts the amount of smoke produced.


Cycles: Will fire and smoke on GPU be supported in 2.75? Will fire and smoke on GPU be supported in 2.75?
Are there any infos about the roadmap regarding this issue?

No.

I found that if you want a fast facsimile is to use OpenGL render (not in the render menu, rather a the top of the interface).  I rendered 100 frames in about a minute on a black background then "add" layer composition to the GPU smokeless animation.  Looks really good.


blender 2.80 AV sync / frame dropping option I'm trying to edit a video in the blender VSE and, as expected, the playback framerate isn't realtime, which would be fine in a normal situation; however, the audio plays fine, but the frames don't "skip" to catch up with it, so when I pause the video I'm actually in a different place in the sequence than what I hear.

In blender 2.7 this was fixed by using the AV Sync or frame dropping options, but I can't seem to find those in blender 2.80?

It's still at the top of the playback menu but now in it's own drop down sub-menu. It says No Sync by default.


Viewport shading hotkey? Wireframe toggle? There doesn't seem to be a way to assign a hotkey to toggle between wireframe and shaded mode.
I was able to assign a key to the viewport shading context menu, but that requires me to press a key and then click an option, e.g. Wireframe or Shaded. This at least allows me to hide the cluttered viewport Header, but it doesn't save me any mouse miles or clicks.
I was able to assign a key to enable Wireframe Overlay, but that's not what I'm asking about. I want to switch between Wireframe display and Shaded display with a single keystroke... like in every other 3D program I've ever used.

Answer as per users @Emir and @R-800:
Shift+Z to toggle Wireframe on and off, but it's just plain Z to bring up the pie menu.


How to sync audio in blender 2.8? I have a question. How to sync the audio with your actual video in blender 2.8 video editor, because when I found out that blender finally released, I was confused how to sync the audio and the work as I can't find the sync button.

On the bottom left of the screen you will see Playback.. click that and right at the top of that pop up menu is a Synch sub menu.. I just had to find it myself :)


Finger control in BlenRig has been deleted! Ups! I just downloaded the character "Vincent" from the Blender Cloud and BlenRig. I have accidentally deleted the finger controller (The stroke that opens and closes the finger). I tried to undo everything with "cmd, Z" (on the Mac) but the controller is still gone. Would be cool if you could help;)

Eyal

Found it on my own. i just clicked on "Alt H" to unhide the controllers


Why isn't Rigify adding constraints to the bones it generates? I'm new to the rigify add-on and I think that I might be struggling with it. I have the armature that comes with the add-on and if I press the generate button it generates a the rig with the root, arms, face... The issue is when I try to pose the rig, the armature doesn't move because the bones of the metarig doesn't have constraints with the rig.
I'll upload the project, but is only the rigify add-on loaded.(https://drive.google.com/open?id=1I2CZmrD6FTKLtk5t7MBZP9eYOZQcR6BY).
Also, I found the issue in a full modeled model, but it seems to not work on any project.
My blender version is 2.79.

Edit: I found that, for some reason, the bones doesn't have constraints.

The grey bones you see is a predefined armature template riggify uses to generate the actual armature.

The template armature ( grey bones ) are there for you to line them up with your mesh so that when you generate the rig everything is in the right position and you can start weight painting or autoweighting directly.

If you want to see the complete setup you can enable the layers in the armature properties. The bones you start out with can be discarded, these are no longer used beyond the point of generating the actual armature.


Object covering camera lense In real life, when something is very close to the camera lense ,it will block the light , therefore  the closests part of the object to the camera will leave dark areas,like this finger pushing against the lens

However in blender eevee,with HDRI light, no matter the distance between an objet from the camera, it never block the light, luminosity stay the same on every part of the image, how do achieve this effect?

I'm a beginner, yet I think I know your answer.

In the real world, your camera is an object that blocks the light. The Blender camera is more like transparent. Thus, the light is not blocked by it.

Try creating a black plane about the size of the camera, and place it just behind the camera.


Why are solid objects with refraction node so dark? Ok Ive discovered refraction nodes trying to create something like the iOS blur effect - meaning a white blur.

This has worked somewhat with 2d objects, but no matter that the node has the color white when I apply the material to 3d objects the object is too dark -

I don't feel like adding an emissive is correct here. How can I make the blur be white on 3d objects?

It's difficult to be sure without seeing your nodes for the material, but this is most likely due to the way the inner surface is reacting with the roughness of the refraction to refract beyond 90 degrees due to a combination of the angle of incidence of the incoming ray and the roughness. For example :

Depending on your requirement (whether you want the material to actually behave as 'refractive) you could either address this by using the Backfacing geometry input to mix between Refraction and Transparent (effectively hiding the backfaces) :

Or also use the Incoming for for the Normal so that rays are always refracted just for the roughness, not the actual surface angle :


How to do a cloth simulation in Blender? I have the following scene:

I applied the cloth simulation property to the cloth that is floating over the sphere. When the scene is animated, the cloth goes right through the ball.

How do I make a realistic simulation?

First of all you need to create two geometry first are UV sphere and plane. Use shift+a to add a mesh. Now select the plane mesh and go to edit mode (press tab) select all (press a) then press w to call special menu and select subdivide. I prefer to increase the number of cuts to 10 (more are better but slower).

After this you can optionally add modifier subsurf and turn on shading smooth, for better look of the cloth.

Next, go back to object mode and with the plane still selected, navigate to physic tab in the property panel. Select cloth in the first column, third row.

Then select the UV sphere and directly navigate to physic tab again and select collision in the first column, second row.

Now you can start play the animation by pressing alt+a or the play button in timeline. The cloth sims now should start.


Render, viewport "Rendered" preview, and material preview white I've been working on a scene for a while now with no issues. Today, I found that when I rendered the scene, it came out as completely white. Furthermore, the material preview window is also showing completely white.

I've noticed that, until a few samples have been calculated, you can actually see some of the scene/material in the previews, but after just a few samples, the scene goes completely white. Here's a screenshot I managed to take of this phenomenon.

And a screenshot of the material preview, which behaves similarly.

I've checked everything I know to check (which honestly isn't very much) and can't seem to figure out what's up. I've uploaded a copy of my scene (with most of the models removed) to demonstrate the problem here: https://blend-exchange.giantcowfilms.com/b/4535/

Your scene is simply too bright. If you lower the exposure to -10 in the Scene panel, you can start to see the color of the surfaces.

A more permanant fix is to lower the energy intensity of your 2 lamps in the scene, as well as the world HDR map.


How to create a center pivot point for mutiple mesh files? I have a Butterfly which exists out of 7 different mesh files. How can i create one centered pivot point

for this file. So that when i import it into my Compositing software (fusion9) the butterfly has a centered pivot point?

Cause at the moment when i export the .abc file out of Blender --> and i import it into Fusion the pivot point is way of.

So my questions is:

How can i select all the meshes --> and create a pivot point for the whole butterfly?

If you want all meshes to have the same, centred origin:

Select all meshes you want to average the centre from
Snap - Cursor to selected (or place your 3D cursor where you want their centre to be)
Snap - Origin to 3D cursor

I use the "3D View: Dynamic Context Menu" addon to easily find these

You could also join the meshes together with Ctrl+J, depends on the use case I suppose.

I guess in your case for export you might want to move their centre to the origin of the scene afterwards to have their centre be the same in the export


Use composite nodes in blender video sequence editor Can you use composite nodes in blender video sequence editor?

As in, no 3d elements in your scene, working exclusively within the video editing screen layout?

I am currently using Blender 2.76 RC 3.

While you can't use composite nodes directly in VSE strips, you can setup the compositor with an image sequence or video file input without adding any elements from the 3d scene.

Then in the VSE you can add a scene strip which gets the composited render results, so you can mix in audio and use any VSE specific features. You can also setup multiple scenes with different composite nodes and join them all in the VSE.


Transparent glowing material I recently came across this page, in which the creator made the transparent, glowing exhaust effect as seen in the photo on the linked page. The effect is interesting and I want to try and play around with it, or something like it, but I'm not quite sure I understand the method the creator outlined:

  It's an array of 25 planes, each with a circular gradient material fading from transparent on the outside to blue to white on the inside. It's kind of a hack but it works surprisingly well.

I've been looking around for a material, or method to create this sort of transparent effect, without the appearance of an edge if I were to create a conical shape. This might be what I'm looking for to create the desired effect.

So is anyone able to clarify what the quoted description means?

For Cycles render engine, a possible node set up could be this:

With the Texture coordinate node's Object output we are gathering the information about where to place the following texture. Object will use the object's origin, rotation and scale, so the texture will be placed in the middle of the plane.

The following node, Vector Mapping, is tweaking a bit the scale of the texture upon the Z axis, as we are going to use a spherical gradient, while what we need is more like a half ellipsoid.

First Color Ramp is needed to adjust the feather of the texture border, second Color Ramp gives the shades of color to the emission node.

Last step is to mask out the emission shader using the first Color Ramp node output as the mixing factor fwith a transparent shader (don't forget to increase the trasparency bouces to at least the number of planes in the array)

Note: to increase the realism, I suggest to work upon the emission intensity rather than the color:


Rigging this mechanical claw. Could do with some help I've been trying to create a mechanical claw machine and decided it might be a good idea to start rigging. I've set up the bones too and I've got them parented to an extent but I can't figure out how to pin the blue points so that when I move the bone within the shaft (red bidirectional arrow), the claws grip inwards (green arrows).

EDIT: There is a piston within the shaft that would move up and down. Up to keep the claw open and down to close claw grip. to make it clear - there is no constraint contradiction.

a

Any help would be greatly appreciated. Rigging is somewhat new to me so guidance to appropriate tutorials would help.

Thanks!

I'm not a very sophisticated rigger, but this looks to me like a 2-bone IK Chain, like an upper and lower arm.

This is a single armature

B_Susp, B_Pole and B_IK_Tgt are parented to Root
B_Grab has an IK Constraint, target B_IK_Tgt, Pole B_Pole, Length 2, so as to include its immediate parent, B_Susp.
B_IK_Tgt has a Limit Location Bone Constraint in its Local (i.e Root's) space, so it can only move up and down Root's axis, with stops to prevent it from going too far.

Hunks of mesh are directly (Bone-Parent) parented to the bones:

The Cylinder to Root, its Piston to B_IK_Tgt, The Suspension Arm to B_Susp, and the actual Claw to B_Grab.

Once one arm of the claw is working, B_Grab, B_Susp, and B_Pole can be duplicated and rotated 120 degrees around the Root Axis in (Armature) Edit Mode. This may throw their roll .. ShiftN Recalculate Roll on X-tangent fixed it for me. My first arm was constructed Z-up, in front view.

The meshes can be AltD instanced round to follow, and re-parented to their respective bones.

I'm sure someone knows a way of taking the bones and meshes round together.. maybe they can suggest that, or an altogether better way.

As I said, I'm no expert in the bureaucracy of locking rigs down properly, creating good interfaces for animators, etc, but perhaps this is enough for a mechanism that works.


How do I copy bones from one armature to another? I have 2 armatures. I want to copy one subset of bones from the first armature to the second -- in Edit Mode -- in order to have the same bones, same names, same transforms on the second armature.

What I have tried:

A) in Edit Mode, Ctrl+C the bones from the first armature, CTRL+V to the second armature also in Edit Mode. This doesn't work because Copy/Paste will actually copy the entire Armature Object in Object Mode, and will paste a new object with all the bones.

B) in Edit Mode, Shift+D to duplicate the bones in the first armature, then try to unparent them from the first armature and parent them to the second. But I couldn't figure how to unparent the bones from the armature, all the unparenting options I could find would only unparent the bones from their current parent bone, but they'd stay inside the first armature.

Is there any way to do this in Blender or am I going to have to manually rebuild all the bones, one by one, on the second armature?

You were correct with your unparenting strategy. The shortcut to seperate a Bone is P. Then select your separate armature and Shift select the armature where you want the object to be and press Ctrl+J


How to set a different background color for each node editor I often work with two Shader Editors side by side to work on Object and World nodes. Is there any way to change these background colors to get it more distinguishable? Other suggestions are welcome too.

It is a bit janky but you could use a Frame node, set it to a custom color, uncheck Shrink in its properties then stretch is as far as you can with a node.


How to eliminate visual artifacts in rendered output when using the Speed Control effect? I'm composing a 2D video from two different sources, with the final product being at 30 FPS.

One of the sources was recorded at true 30 FPS, and the video & audio streams have the same number of frames when I add the Movie/Sound strips.

The other source, however, is slightly off: the audio came in at 14,726 frames and the video 14,876 frames.

So I added a Speed Control effect attached to the video strip, and set the speed factor to 1.010 (14,876/14,726). When I preview the video in Blender, the audio and video are synced up perfectly and the video looks just like the source.

The problem is that when I render the video, it ends up containing visual artifacts like jitteryness and sometimes even speedups and repeats that aren't synchronized with the audio (sorry, this is hard to describe in words). The audio track itself is fine. I thought it might be a problem with the output format, so I tried a few different ones, and found this happens even if I render to a set of images (I simulated playback using Windows Photo Gallery).

The artifacts disappear if I remove the Speed Control effect, but of course, the video & audio are no longer in sync.

Am I doing something wrong here (I'm new to Blender)? Is there any alternate method to accomplish this? I need something that works reliably and efficiently as this isn't a one-time-only project.

(I also found there appears to be issues doing soft cutting with the Speed Control effect -- I may be misunderstanding how to do that -- so my goal at this point is to first convert the entire video source on its own, and then do all the cutting in the final step.)

I'm using Blender 2.68a. I tried using the latest dev build from today (same result), and also 2.57b, which not only had the rendering problem, but also didn't look right in the preview. I'm running Windows 7 x64. Here's the .blend file I'm using.

Here are sample renderings of part of the video: from 2.68a and from 2.57b (each file is ~4.5 MB) -- sorry I can't upload the source as the file is over a gig, but it should be obvious from those videos what's supposed to be happening (listen to the mouse clicks). Before someone asks, yes, this also happens when I render the full video (in fact, that's how I discovered it in the first place). I was able to reproduce problems in short sample clips as well, though not as severe as those two examples.

You are experiencing decompression problems with your source video. Try generating proxy timecode (the proxy vision file not required), or convert the file to a less heavily compressed format.


Trying to figure out how to make a gun animation with multi part gun I'm just starting with animating in Blender and i'm wanting to make a simple gun reload. I have 2 guns to work with but both are in multiple parts, ie. Slide mag receiver and handle. and i'm not sure how to bind them all together but still allow the mag and slide move independently. Any help would be appreciated and a little more in depth instructions would be awesome.

This is a broad question indeed, but sounds like proper parenting is all you need. Parent all your objects to logical groups of objects, like sleigh, magazine and so on. Create an empty around your gun, and parent gun, sleigh, magazine and all other to this empty.


Imprecise FBX Animation I've made an animation for my unity game. The problem is that every-time I export it the exported animation is imprecise at the feet of my character.

I already tried to set the "Simplify" in the export settings to 0, but nothing changed. I also tried to disable "All Actions" and "NLA Strips", and  applied the scale on the armature and the mesh.

Here are my export settings:

A quick video for better explanation here: https://youtu.be/2veA3o-hGUA

I don't know the problem and this issue is killing my game because its visible at some points :c.

I've encountered this issue myself, I'm not sure if it's Blender or the FBX format, there are things you can do to help mitigate the problem by adjusting the "Sampling Rate" value or "Simplify" value, there are also settings in Unity that may help as well try changing the Keyframe Compression to "Optimal" or "Off" in the Inspector tab. Other than this I haven't found any other solutions myself.


How do I show the modifier stack panel when I work in the full screen area mode? As the title, I wonder if I can use a shortcut to show the modifier stack panel without toggle the full screen area mode.
Thanks!

there is no defined "shortcut" to do that, and since blender window areas are by definition "non blocking" there is no way to let a "modifier stack panel" to jump in your fullscreen area mode, but you have alternatives, at least 2, imho:

reshape a layout to look as desired, ie calling it "fullscreen", set up like this:

use a separate window just for the "modifier stack panel", if you really wish it to go over your fullscreen area. You can duplicate the main window, and then reshape the secondary one to just show the "modifier stack panel", like this:

In linux it's easy to set this secondary floating "panel" as "always on top", but each OS has or can have similar utilities, so that you can always see it even when focus is on the background, fullscreen, area, like this:


(Brand new to Blender) Background image wont render with model Firstly, I apologise, I know this gets asked a lot and I've read through other answers, but I'm still not getting it. As far as I can tell I've done everything right. Can anyone see what's missing? That's a model of a moa that I'm trying to drop into a short film, but at this stage I'm just working with a still for the sake of colour matching. Basically, I hit "render" and just get the bird without the background... like I said in the title, I'm brand new to Blender so it's probably something fundamental.

Thanks in advance.

Background images do not show up in the render. They are typically used as a reference for modeling. There are a few ways to handle this, but the easiest, by far is to use the import images as planes add-on. Press ( ctrl + alt + U ). Select add-ons, and then type image into the search bar. enable import-export: import images as planes.

At the bottom of the mesh menu (shift + a -> mesh) should be the option to add image as plane. After you successfully perform this part, the rest should be self explanatory.

I noticed in your picture that you had your rendering set to Blender Render. Blender had 3 different render engines. Blender Render is the default engine, but it considered outdated, and is only kept as legacy software. It is best to set the render engine to cycles. The results are more realistic and more modern.


Text Editor Scripts not available in the Python Console - but are available to scaling drivers Summary - Background

Created a text drivers.py file in Gedit
Opened drivers.py in Blender Text Editor
Selected [x] Register

Summary - Issue

The scripts are available to my scaling drivers

No problem there

When I try to run a test value in the python console I get the error

NameError: name 'driver_Combo' is not defined

Summary - Question

Do I need to do something to make the (external) scripts available in the Python Console ?

Full Details

Just recently started learning Blender.

I am using driver scripted expressions for [ Transform ] [ Scale ] of objects.

I was creating (and testing) scripts in the Python Console:

all good with achieving my driver scaling
scripts created in Python Console were not being saved with my .blend

Now I have moved them into the text editor:

Created a text drivers.py file in Gedit
Opened drivers.py in Blender Text Editor
Selected [x] Register

This is the content of drivers.py

import bpy
from math import degrees, radians
from math import pi
from math import sin

# def function
def driver_Combo(time):
   radius = max(abs(sin(radians(time))),abs(sin(radians(time+90))))
   if time > 360:
      radius = 0
   return radius

# add function to driver_namespace
bpy.app.driver_namespace['driver_Combo'] = driver_Combo

I'd like to have the scripts available in the Python Console to test values.

How do I make the scripts available ?

Thanks.

All good, you have the file "drivers.py" (correctly with the py extension) registered already you can simply

import drivers
drivers.driver_Combo(..

or

from drivers import driver_Combo

in the py console


How do you cast very dark shadows? I'm working on a space scene in blender and I've run into an issue with my shadows. In normal planet scenes, the shadows on the planet are so dark you cannot see the rest of it. With mine, even when I turn the sun lamp off or put it on 0 it's still not dark enough to hide the rest of the planet.

I checked to see if it's the settings but from the looks of it, everything seems fine, so I'm really at a loss.

I've used a UV sphere to make the space scene like in this tutorial if it helps at all: https://www.youtube.com/watch?v=uWSeBoIDJV4&t=551s

I'm starting to get the hang of blender but I'm nowhere near being a pro so please include screenshots to help explain your solutions to this problem.

If your doing a space scene, there isn't an atmosphere to emit or bounce light. therefore make sure the world's light is set to absolute black and from there you have full control of the lights that comes from our sun or your main light source.

Tip: set the size of your sun to something between 0 - 0.05, it makes it sharper and gives the illusion of a very huge object, study the physics if you want to understand why that happens.

Till next time


Set driver variable ID-block using python I am trying to build up a scene using python to copy objects and their drivers. The object to copy is a simple cube which has the Custom Property prop and a driver for its x-location. The driver consists of a Scripted Expression which references to the variable var, which is just the Single Property prop of the cube. So when I change the value of the Custom Property prop of the cube, I change its x-location.

To copy this cube, I wrote the following python script:

import bpy

def main():
    scn = bpy.context.scene
    cube = bpy.data.scenes['Scene'].objects['Cube']
    copy_loc_x = 2
    copy_obj(scn, cube, copy_loc_x)

def copy_obj(scn, obj, prop):
    # copy object and set a custom property
    copy = obj.copy()
    copy.data = obj.data.copy()
    copy['prop'] = prop
    scn.objects.link(copy)

if __name__ == '__main__':
    main()

This works perfectly to copy the object and set a new property for the copy, but the copy remains at the same x-location as the original cube. The reason for this is that the variable var of the copy still references to the Custom Property prop of the original cube.

How do I copy the cube, so that its driver variable is automatically referenced to its own Custom Property, just as Shift-D would do? Or, if this is not possible, how do I set the ID-block of a driver variable using python?

Assuming you only have one driver, and that one driver has only one variable, you can do this. after copying the object data:

copy.animation_data.drivers[0].driver.variables[0].targets[0].id = copy

If you have additional drivers and / or variables, you'll need to find better logic to access these. If you can upload a blend file, it will be easier to tell what the best method is.


UV mapping for exporting blender textures to unity I am using UV mapping for exporting textures to unity. Firstly i map the object with smart uv mapping and then bake it. After that I save the image as png;  add it into material as texture of object in unity.

With that process should I save and export blender file again after mapping objects or can i just use texture files directly? How unity understand UV maps if I just add textures as png files? I am assuming composite nodes are not exported with that method. Are there any method for exporting composite nodes?

And are there any easier method?

You have to export your model again once you UV mapped it, because unity will not be able to get the UV data as your model don't have them.


advice on how to reduce the polygon count for this twisted structure (made using simple transform) I'm working on a mirror made out of twisted pieces of metal for a game. However the current number of polygons is far to high does anybody know of a good way to reduce the number of polygons without creating very ugly artifacts within this mirror?

The blender file can be found here

One way would be to use the decimate modifier to lower the poly count od your model and maybe add a smooth shading to hide some glitches :

the reduction result :

the model ( with smooth shading ) :


Rigging low poly Head I want to turn my Head with the Head bone. But somehow the Head cannot turn to -180 degrees. Which kinda makes sense but I want my Head to turn 360 degrees. What went wrong?
-Lathano

Negative angle values mean rotation in opposite direction i.e. clockwise/counterclockwise. Hence, -180 deg is back from 180 to 0. A 360 degree rotation doesn't need negative angles.


Copying object without dope sheet data How do I make a copy of an object without coying any of its dope sheet data? So the new object should have an empty dope sheet.

After copying, you can unlink the action fron the object, by turning the dopesheet into an action editor and pressing the X button near the action name to unlink it.


save location vector of an object i like to measure the distance a object has traveled over time. But i fail already at saving the current vector.
The result for test and location are always (except first frame change where test =
At any other frame change test and location show equal results. Where is my mistake?

import bpy
from mathutils import *
from math import *
test = Vector((0,0,0))
def my_handler(scene):
    global test
    print('test:'+str(test))
    location = bpy.data.objects['cube1'].location
    print(location)
    test = location

for i in range(len(bpy.app.handlers.frame_change_post)):
    bpy.app.handlers.frame_change_post.pop()
bpy.app.handlers.frame_change_post.append(my_handler)

An example "print" result:
test:

test:

The print statement worked fine for me. My approach would be to collect the positions in a list and iterate at the last frame over the list to determine the length.

import bpy
from mathutils import *
from math import *

test = Vector((0,0,0))
locations = [] # list to hold all locations between start and end frame

def my_handler(scene):
    if scene.frame_current == scene.frame_start:
        locations.clear()
    if scene.frame_current == scene.frame_end:
        total_len = 0
        for i in range(len(locations)-1):
            d = locations[i] - locations[i+1]
            total_len += d.length
        print("length %f" % total_len )

    location = bpy.data.objects['cube1'].location
    locations.append(Vector(location))
    #print(location)
    #print(locations)

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


Blender Cycles Jagged Edges On Basic Shapes I'm fairly new to Blender and just wanted to create my own mockup for my designs but I'm having some trouble with these renders. I tried looking for solutions but a lot of examples seemed to be doing something far more complex than what I'm doing.

As the title says, I see some jagged edges these images even when they're not zoomed in. I did an a smooth shade on both squares and used Edge Split after. The square in the far left does not have a modifier while the one on the right has a edge split modifier.

Material-wise, I only used Principled BSDF. The background color is #000 with specular and roughness turned down to 0. While the squares have the default settings.

I understand that it's a raster so pixelation will occur once you start zooming it way too far. But as it is now, I can see the jaggedness even when it's zoomed out. So I was just wondering if there's a way to smoothen these jaggedness.

I would appreciate any help in getting this thing sorted out. Thanks again in advance.

Blender File

Google Drive File

For future reference, the general preference here is to use Blend Exchange

I think this is a combination of anti-aliasing and the very fine angle and sharp contrast. Which is why even at high quality settings of 300% and 1000 samples in your file, it is still happening.

Here I see it (when zoomed out a bit):

Here I don't (100% scale). Or at least it is hard to detect without my eyes going funny:

I would suggest that the filter (anti-aliasing) needs adjusting for this sort of scene. Have you tried playing with the Render/Film/Pixel Filter values? I found that 2.0 looks better and 2.5 is the best. More than that and it starts to get fuzzy.

Quality is sufficient at maybe 64 render samples, which makes testing lot quicker than with the 1000 that you have. Using a Render Region (under Scene/Dimensions panel) to restrict rendering to the bit you are interested in also helps a lot with speed of testing.

This is 300%, 64 samples, pixel filter = 2.5, viewed at 100% (press 1 in render window):


How to create UVs for a number of duplicated objects I created an object and duplicated it a number of times and arranged them in a specific order but forgot to unwrap the original object .Now I have about fifty of them without UV or texture .Is there any way to unwrap them easily and apply texture? I cannot create UVs for each of them beacause I have made some differences in each of them (like length, width ,etc ) .So is there any way of getting the work done quicker?

You could pick one object as a template and setup the material and texture.

After that select all objects which should get the material settings assigned and add the template as last object to you selected object (must be the active object).

Ctrl-L Opens the Make Links Popup

Select Materials, after that open the Popup again and select Transfer UV-Maps.

Video Tutorial on Make Links
Documentation


Copy vertex shape key information to a different object I have a face and an empty space behind the eyes (to render it in anime style), the connection between the eyes and the empty space has the same number of vertices and in the same positions, I made a shape key in the face to blink an eye, is there a way to copy the vertex information of the shape key to the empty space object?

I tried with transfer shape key but since they don't have the same number of vertex it doesn't work

I would go like this: create a copy of the mesh with shape keys, delete all the vertices not interested by shape changes, delete the corrispondent vertices in the empty space mesh, connect the copied vertices (with the same shape keys) to the empty space mesh: ctrl J to join the two meshes, then delete double to connect the two separate parts.


Need to understand how to show reflected light well with cycles I want to show light reflected from a flat, mirror-like surface onto a diffuse surface. I noticed that even when everything else looks good, the light reflected from the mirror is 100% fireflies. When the roughness is increased a bit, they smooth out quickly to what I would expect. NOTE: mirror is flat - this is not a caustic issue. However, that is the direction I'm going next. Also, I'd like to see how well Blender can do - "just use another rendering program" is not helpful here.

Is there a concise yet accurate way to explain why this happens? I'd like to understand as much as possible.
Is there some particular setting (beyond just "Samples") that I can use to improve the reflected light pattern smoothness (for a given render time)?
Could Light Portals be used to reduce render time for smooth reflected light?

The images below are 100 samples. 1000 doesn't really fix it.

I have found that this answer by @gandalf3 seems to address part of my question already - but I'm still interested in trying everything I can within Blender, before resorting to those measures.

Edit: This Blender Cookie is the best discussion/tutorial I have found so far on ray tracing and nodes in cycles. The .blend file is here.

So a ray from the camera hits the "floor" at a certain point (pixel) indicated by a tiny cube. Actually, in the case of a mirror (specular reflection) a similar number of rays from that point would reach the light directly and by reflection. So we can't just say there are "fewer rays". There is something more here.

DIfferent areas require very different number of samples. Words describe my impression of how much noise in the direct lit areas, direct shadows, and reflected lit areas.

The .blend file is here.

This is pretty much the worst-case scenario for backwards path tracing.

On contact with the diffuse plane the ray could go in literally any direction, and only a tiny fraction of those directions will hit the glossy object at the right place and angle to rebound into the smallish light source.

To see why increasing the roughness of the glossy material helps, look at it from the point of view the ray right after hitting the diffuse plane:

As you can see, the area which the ray can hit and still find the lamp is much larger even with only .1 roughness. In addition, MIS probably can do a bit more to direct samples to the lamp when there is some roughness and the ray doesn't need to bounce at an exact angle (as is the case with specular reflection).

Note that with enough samples it does eventually converge (in this sense these aren't fireflies so much as noise). Here's a render with 10000 samples:


How to check if node property is not None while iterating through materials? I'm running into a no attribute error while iterating through nodes and nodegroups in some blend files.
Error:
AttributeError: 'NoneType' object has no attribute 'name'
How would I check if objects has no 'name' property and skip it?
   for mat in bpy.data.materials:
        if mat.use_nodes == True:
            for node in mat.node_tree.nodes:
                #check if no has attribute name
                if node.type in ["GROUP"] and node.node_tree.name == 'NodeGroupName':

An attribute can be None
The error NoneType has no attribute is a common error seen in blender scripting .  For example it can be the case that context.object is None
To the OP would recommend editing the title of question to reflect this error message more-so.

Error: AttributeError: 'NoneType' object has no attribute 'name'

thrown by node.node_tree.name == 'NodeGroupName'  is informing  node.node_tree has the value None.  Can test for this being the case, ie
if node.node_tree is  None:

as opposed to
if hasattr(node, "node_tree"):

Both will be true when the node tree is None
It is actually a strange case that the code in question would throw this error, as I'm not aware (yet) of how to add a group node and have no linked node_tree.  Speculate this is the result of deleting a node group from bpy.data.node_groups that was a node of a material node tree..
hence the last line of question script could be
if (node.type in ["GROUP"]
        and node.node_tree
        and node.node_tree.name == 'NodeGroupName'
        ):

since chaining ands ceases on first False
Using getattr
Since we pretty much would treat either the same using get attribute with the third argument default
node_tree = getattr(node, "node_tree", None)

will be None in both cases.  IMO this "trumps" using both the has node tree then has name attribute test.  None has nothing, if we know it's none testing further for attributes would seem superfluous  Can also ensure that if  a node tree is not None it will have a name. bpy.types.ShaderNodeTree.name
Test script
Using the above with the "double test" for a node being of 'GROUP' type check it has a non none node tree.
Make a dictionary, with keys matching node group name containing a list of material name , node name tupples.
import bpy
from bpy import data
from collections import defaultdict

# all the group nodes in blendfile
print(data.node_groups.keys())

group_nodes = defaultdict(list)
# create a look up dictionary
for m in data.materials:
    if m.use_nodes:
        for n in m.node_tree.nodes:
            nt = getattr(n, "node_tree", None)
            if nt and n.type == 'GROUP':
                group_nodes[nt.name].append((m.name, n.name))

print(group_nodes)

Output.
File with 1 node group "Test_Material", 2 materials "TestMat" and "TestMat.001".
The node group is used in both materials with name "Group" in both.
['Test_Material']

defaultdict(<class 'list'>, {'Test_Material': [('TestMat', 'Group'), ('TestMat.001', 'Group')]})

Notes:
Beware of equating to True or False in tests.  By default python  equates most types to True or false. Some examples of false are None, the integer 0 and an empty list []
Methods like hasattr return either True or False
if hasattr(foo, "bar") == True:

if foo.bar  exists this reads somewhat akin to
if True == True:

instead simply use
if hasattr(foo, "bar"):

Changing above slightly to return boolean false instead of none when the node has no node_tree attribute, if nt: will be false in both cases, but we can discern between the two.
        nt = getattr(n, "node_tree", False)
        if nt and n.type == 'GROUP':
            group_nodes[nt.name].append((m.name, n.name))
        if nt is None:
            print(f"{m.name}:{n.name} node_tree is None")


Cycles Green screen? How would I make a green screen that has absolutely 0% reflection, and does not cast or receive shadows? I tried making a plane and making a material and changing the background color, but every time there would be a reflection on the objects in the scene.

This is what the Holdout shader is for:

This shader affects the alpha channel when Transparent is enabled in Render settings > film.

If you really want to create an actual "greenscreen", then see Node for setting render colour, regardless of lighting


Lining up the model to a .FBX file So I have a .FBX file of someone running and I have a simple 3D object and I want to apply the .FBX file to the 3D figure. But the problem is, the start of the .FBX animation is a different pose then the 3D figure. What I'm asking is, how do I get the 3D figure to line up with thwe .FBX file? Thanks!
Here's an image.

It sounds to me like you are going to have to repose the object that you are lining it up to. 2.81 Has the new pose move tool in sculpt mode that will make that easy if it is not rigged. However, if you want to pay for something like Auto rig pro, you could have that pose fixed in not much more than a minute the easy way.


Applied Subdivision Surface Modifier To a Mirror Modified Model The Model Enveloped in on Itself So I was doing a fairly simple model of a Glock hand gun. I had already applied a mirror modifier to the model, that I had so far (which was the grip). Then I applied the subdivision surface modifier. At the point where the mirrored part of the model and the "real" part of the model met it collapsed inside of itself. Bellow will be a picture of the model. I would really appreciate it if someone could tell me how to fix this so I can get back to working on my model. Also the picture is the bottom part of the grip, it may looks like two smaller grips, they are supposed to form one. But like I said it collapsed in on itself.

Thanks, Nova

Your model seems to have faces at the border between the two halves, so to Blender it looks like they are separate.

Remove these faces
make sure that the mirror modifier is above the subsurf modifier
make sure that Merge is enabled for the Mirror modifier


Eye rig not following body rig properly I am really struggling with this issue. I have two eyes as separate objects to a character and want to parent the eye control and target bones to the head bone so that they can move with the character. No matter which way I parent them, the rig starts behaving really strangely in pose mode and doesn't even switch back to default pose on right click. I have parented both eyes to the correct eye bone.

Any advice on this issue will be really appreciated!

Instead IK I would uso Track To because if you use IK and parent it to the head you will get that all the body is going to move


Combining Video Editor Scenes in One Scene I am trying to create an animatic in blenders Video Sequence Editor and I have found a tutorial by a Mathieu Auvray on the Project Gooseberry youtube page where he shows a feature where you can import different VSE scenes into one scene.

However, when I followed his tutorial, I noticed that a few things he clicked on that weren't in any of the versions of Blender I could find.

Here was Mathieu's screen:

Here is mine in all my blenders:

Is there a plug in I am missing, or a setting I haven't turned on?
I have been googling it for a while and have been coming up empty.

The gooseberry project uses a development branch of blender that has some modifications that haven't been applied to the main blender development yet. This is one change that is currently only in the gooseberry branch.

You can compare the code for the relevant panel in gooseberry branch and the master branch to spot the change. There are also other supporting code changes elsewhere to get that to work, see this commit.

There are gooseberry builds available to download from blender daily builds or you can look at building your own version of blender.


Water Simulation not rendering the right way Water is not looking like it should With Glass

You have several options to refine your outcome.

Most important for fine results: Increase the value for final resolution.
Increase values for smoothing and smoothing subdivisions under Fluid Boundary.
Use a Smooth Modifier on your water object. Values like Repeat: 50 may be necessary.


Extruding, other side does not have face As you see in the picture, after extruding the bottom face, it seems to simply move up. There really is no bottom face now. Sorry if it's hard to understand. I need it to have two faces instead of one. One on the very bottom, and one where it's extruded. I know you can extrude the bottom edges and then merge them, but is there any easier way? I don't want the bottom face when I extrude it to be one-sided. I think Maya actually creates a new face.

Thanks!

If you extrude a face connected to other faces, the extrusion will leave a hole.

But if you extrude a disconnected face, you will have a solid shape. If you press Y to disconnect the shape before extruding it, you will make it solid and have that bottom face.

EDIT:
But, beware, if you do this, you will get weird geometry. Things might not be connected the way you want. I feel a little dirty, doing it. :)


strange distort with simple pose on basic cilinder On the left what it looks in a simple youtube demonstration. cilinder with a 3 bone rig
On the right what happens to a cilinder when i try the same in blender.

Anyone any idea why?

You might have the origin set wrong. Try selecting the cylinder and pressing the key you have set to search (I have space but you might have to go into edit-preferences and set it to something). Then search for "set origin" and press "origin to geometry".

My other guess is that there is something wrong with the weights. Try removing the armature and adding in a new one. Select the model and then shift+select the rig and press ctrl+p "with automatic weights".

It also seems like your bones are a bit too far out. Maybe try moving them/scaling them inside the model before applying the weights.


Cannot place the forearm on the correct low position while I'm playing with the armature I'm a blender newbie and I'm trying to animate my first character on blender. Actually I'm playing with the armature, but it seems to me that Blender uses a confusing procedure for this matter. Anyways ,as you can see from the attached pictures, I'm not able to move the right forearm to the correct low position. Can you explain to me why?
Please go to this website :
http://www.psychonews.it/pics/
and check these pictures :
2014-12-07_19-08-52.png ;
2014-12-07_19-09-22.png ;
2014-12-07_19-09-45.png ;
thanks.

Select your one of your arm-bones while in pose mode, and press R. You can then rotate that bone using the mouse. The bone rotates according to your screen, so go to front/back(numpad 1/ctrl + numpad 1) view to get straight rotation.

To go from the images you posted to what I posted, you need to rotate the upper arm and the lower arm =)

Image I posted:


Creating Transparent Water Droplets in Cycles I have been working on a project where I need to add some transparent water droplets on a bottle but they render completely white. I have tried using many different shaders to achieve this effect but nothing has worked so far.

I have tried adding a glass shader, I have tried using a transparent shader, I have tried using a refraction shader, and I have tried using a combination of these.

I am starting to wonder if it has to do with my lighting, I am just using a basic 3-point lighting system.

I would really appreciate any help that is given.

Glass Shader

The Glass Shader (Glass BSDF) with it's default settings is a very good shader for water droplets in Cycles:

You will need to upload your blend file in order for me to determine exactly what is causing yours to be white. Uploading to PasteAll is very convenient and easy: http://www.pasteall.org/blend/


Create a plane that always fits the camera viewport I'll try to keep it clear: I want to use a background in Blender and for that I use a plane that I want always to fit the camera viewport.

I wanted to do it cleanly, so I put a plane at the same location and orientation as the camera and now I want to move the plane along the camera axis and change it's scale to always fit the viewport (what you can see in the camera view).

I used cos and sin with the FOV of the camera to move the plane but I didn't have anything correct (not so good at math...) and I don't get how I can have the plane to always fit the viewport (fill it entirely).

There is a plugin by tobbew to do exactly what you ask: create camera image plane

"it creates a plane and sets up some drivers so when the distance from the camera (-z) is changed the plane is automatically scaled to cover the screen and gives it a cycles material so i'll just have to load the texture"

Once the plugin is installed, all you do is select the camera and run the plugin (press the space bar and start typing camera):

And it creates a plane in front of the camera. If you move the camera the image plane will always follow it. If you move the plane away or closer to camera it will also rescale automatically.

here's the blenderartists.org thread for additional info.


Move camera to existing camera (with keyframes) I created a scene and picked some camera positions with individual cameras. Now I'd like to create one camera which "stops by" at all these camera positions in different keyframes.
Is it possible to align a camera to another camera, basically aligning the camera by location and rotation (and as a bonus - the camera settings, like wide-angle/tele settings or aperture?)
When I try to apply a location I get this error:
Objects have no data to transform

I'm sure there is a hidden trick? ;-)

You can use Constraints for this.
Consider you have three 'Target' cameras : Target1, Target2, Target3 - and one 'MoveableCamera'. On the MoveableCamera, add a Copy Location constraint for each of the targets (1,2,3) and also a Copy Rotation constraint for each of the targets. In each case set the 'Target' object to the respective target camera.
All that's then required is to adjust the Influence of each constraint to move the MoveableCamera towards each of the locations and rotations that you desire. The Influence can be keyframed as for other properties.
For example, to move the camera to Target1, simply set the Target1 influence to 1.0 and the others to 0.0. To move between two targets simply set the first (in the constraint list) to 1.0 and then vary the second towards 1.0, depending on how close to that target you want.
For example, to move the MoveableCamera to 1/3rd of the way between Target2 and Target3, set Target2's Influence to 1.0 and Target3's Influence 0.333.


How do I change the size of the bounding box without it effecting the object selected? I want to make the bounding box to have a nice fit around the object e.g the cube when you first open Blender.

anytime I import objects into blender, the bounding box seems to always be bigger the object I imported. I tried resizing the bounding box by pressing "N" and then the XYZ Euler and the dimensions the subcategory below it, but it always affects the object within the bounding box also.

I've had that trouble a lot with imported objects, and also those I've exported as .obj , and every time, it's been caused by some fragment of mesh that's somehow got into the project or obj file.  They've usually been a considerable distance away and expanding the boundary box significantly

The solution was to press 'A' to select everything in Object mode, then examine anything I couldn't account for that was hi-lighted.

You might have to search around in Ortho View in each of the three axis and also zoom back quite a way to see them.  Try ENABLING ALL LAYERS and pressing SHIFT-C to force the view to encompass every object in the entire Blender file.  Something foreign is in there otherwise the boundary box wouldn't be wanting to reach out to enclose it.

The offending item(s) are often unapproachable in that you cannot make them appear larger as you try and zoom in on them.  They can be just a dot.  Get as close as you can, select it, so it's the only object selected, and delete it!

I usually create my own models these days and haven't struck the problem for quite a while and have no files with that sort of stowaway with which to experiment again.  I'm sure those extras were separate from legitimate meshes because I don't remember ever having to go into Edit Mode to 'part' (P) them first before deleting them.

Hope this solves your problem - it's annoying when imported elsewhere because those fragments could be seen following the main object around like a distant bird, as though stalking!


Smoke partially cut out of render I have a smoke simulation that appears fine in the 3D view. However, when it is rendered, a section of the smoke is cut out. The render is done in cycles with Blender version 2.78. Changing the position/angle of the camera changes the shape that is cut out. I have 2 render layers set up, and the problem is occurring on the layer titled "dust"

Here is the blend file and pictures of the problem.

The camera end property does not extend to the end of the domain. The far plane clips the domain cube.

Increase the camera's clipping end property to fix this problem.


Plane image gets smaller when in render view When switching to render view my image plane gets shrunk in x axis. How can i keep original measurments from material view port?

http://g.recordit.co/jxtr81sqTT.gif

The issue you are having is the image texture node is set to clip, not repeat (fourth menu). This means that the image will not be repeated to fill up the rest of your UV map, since your UVs don't cover your entire texture (which is fine). It appears that the viewport automatically tiles the images, but the render will use the node settings.


How to make a bone active? I am trying to select a bone and make it active in 2.80, so I can run an operation on it (connect it to its parent), the bone gets selected, but does not get active, as shown in the picture, when active, the name of the bone appears in the interface, anyone has an idea what might be the problem here?

Here is the code I use…

bone.select = True;
bone.select_head = True;
bone.select_tail = True;
bpy.ops.armature.parent_set(type=‘CONNECTED’)

Thanks in advance
Gilles

API properties.

Set the active bone with arm.edit_bones.active = bone.  However propose there is no need to use the parenting operator, can rather set the properties, parent, use_connect

Python console code with armature arm in edit mode.

>>> arm
bpy.data.armatures['Armature']

>>> bone = arm.edit_bones["Bone"]
>>> bone2 = arm.edit_bones["Bone.001"]
>>> # active edit bone
>>> C.active_bone.name
'Bone.001'
# set active edit bone
>>> arm.edit_bones.active = bone
>>> C.active_bone.name
'Bone'
>>> bone2.parent = bone
>>> bone2.parent.name
'Bone'
# check if connected.. nope
>>> bone2.use_connect
False
# connect
>>> # connect the bone
>>> bone2.use_connect = True
>>>


Killing Blender processes So I'm currently using Java's ProcessBuilder to run Blender Python scripts for rendering in the background and that's working fine. However, I would also like to abort Blender at any time, and unless if I'm mistaken, killing the blender.exe processes would be the best method of doing this.

So I tried using the destroy() method on the process that runs Blender, only to find that Blender actually starts two processes. Using the destroy() method only kills one of the two processes (and not the one that's doing the actual rendering). Does anyone know of a good workaround or another method of implementing a render abort? Thanks!

On Windows, you can kill Blender easily by opening the task manager,then selecting "end process".
You would not need to use python.
Here's a pic:

You can access task manager by pressing CTRL+ALT+DELETE.
On Mac, you can do just about the same thing, just this is done in the activity monitor Instead.


Cycles render is too bright I cannot seem to create a night time effect in a simple scene. Evee renders the scene as too dark and no matter what I do Cycles render is too bright.

I have tried:
1) Disable all lights
2) Zero emission strength of all emissive materials
3) Disable ambient occlusion
4) The environment strength is 0.1
5) Tried to tweak and lower some settings under Cycles Lightpaths.

Nothing seems to affect the render. Here is the blend file in case it is needed

You probably didn't turn off Ambient Occlusion in the Scene context menu. Do that (and only that) and you get this:

Also, if you change the background color to black (AFTER turning off Ambient Occlusion in the Scene context menu), the entire scene will be black (which will not happen when it is on). This signals that changing the background color will now affect ambient lighting


Can an armature be added to a curve? I've got a tentacle, made from a cube with an array modifier (fit curve modifier) and a curve modifier:

I'd like to add an armature to the tentacle and incorporate it into a character.

Is it possible to add an armature to my current setup, without applying all of the modifiers?

Consider using

The Spline IK Modifier.
Vertex hooks, where the hooks are bones of an armature.


Particle velocities not working as expected I'm trying to create a foam based on particles velocity.

Here is a folder with some tests of the problem.

Cycles particle info node implement colour of velocity to a instanced spheres very... wrong (opposite to the display of velocity inside particle system), but if connect output of velocity to normal channel of material it seemes to display colours right. But it is not a solution...
How to use this node to proper colour of material?

Feeding the velocity into a Math or a Color Ramp node will be averaging the X,Y,Z values of the vector and this can produce unexpected results - especially where you have a mix of positive and negative values.

Instead, you can use a Vector math Dot Product node to determine the magnitude of the Velocity by passing the Velocity into both inputs of the Dot Product (which will give the magnitude of the velocity, squared) and raising to the power of 0.5 (to square root it - to get the speed) and using this Value output as a scalar representing speed. This can then be passed through a Math node to scale it and on to a Color Ramp to generate a colour based on the speed.


How do I cut text through an object? I am making scoreboard to 3d print and want the "Player 1   Player 2" to be a window for a light behind it. I tried the knife project and also a boolean with no luck. Can anyone help me out here?I want to cut the lettering all the way through. Thanks

You need to create a solid 3D mesh out of the Text to get the Boolean Modifier working.

Select the text mesh and drag it up (z axis) a little. Use a solidify modifier and adjust its thickness until the text mesh goes through the Scoreboard mesh (you don't need to apply it).

Select the Scoreboard mesh, add a Boolean Modifier, select "Difference" as operation and "Text" as the object to use for the modifier.

Here's the .blend file with unapplied modifiers:


SheepIt upload warning, Files not found I started using SheepIt today and I tried uploading my first .Blend onto it. After I uploaded it, I got this error message. I had already used the Find Missing Files Function, and the Pack All in .Blend Function to get these files into the .Blend, but it still thinks these two files are missing. Does anybody know what to do? Thanks!

I use sheepit too!
This error comes up when you are missing image files, caches, or other external sources which are required in the rendering process. In this case, I would check the box in Blender under File > External Files > Automatically pack into .blend.
This should do the trick.
If not, then you would have to take the image files and pack the into a .zip file with the blender file. You would have to make sure that the image directory in Blender for the images is set to local in the file, so that it would find it on any computer. (Which is how sheepit works.)


Pulling in one edge of a cube. I cant get the right movemen Hello all I am trying to learn some basics to Blender modelling. I want to make a snooker table. Currently I am making the cushions which hang over the edge of the table.

I just want it to be simple so I want the cushion to be just a triangular shape 2 inches high.

I've made the cube fit along the table and all I want to do is move the bottom left edge (from the view in my pic) inwards on itself so that the cube isnt square anymore (eventually i'll make it more detailed something like this:

I've tried hotkey "G" when in vertex,edge and face select edit mode. But I can't get that darn corner side to pull inwards.

Annoyingly I can do the opposite side, so I could have already made it opposite and then rotated it, but that makes me think doing it that way would be really annoying if I was trying to make some highly detailed objects (such as robotic infantry, spaceships , etc etc for games) in the future.

Here is the screenshot that I hope shows what I mean. I'm really new to Blender and so I hope im just missing something simple. Many thanks

NOTE: To be very clear of what im trying to achieve exactly here... The highlighted edge in my screenshot needs to be pulled on Y-axis so that the bottom face is smaller on Y. BUT the bottom-right corner needs to stay exactly where it is (ie. at right-angle with the rest of the cushion). Hope that makes sense. thanks

not sure to understand, are you trying to do this?

I used the visual transform widget to make it easy to understand, but you could do the same using GY and grabbing to the desired amount that edge over Y.


Object becomes unaligned after constraining and moving objects -I was trying to follow this tutorial on Blender constraints. I tried to simplify it to two objects and two empties. The cylinder at the origin works fine. With the smaller cylinder, I added a Track To constraint to the Empty on the origin, and I added a Child Of constraint to the outer Empty. However, when I move the outer Empty down, the smaller cylinder becomes unaligned with the setup (the empty and cylinders don't make a straight line like the piston in the tutorial does). Does anyone have ideas on fixes?

-What I think is the problem is that the Child Of constraint in the smaller cylinder keeps it -5 units in the y direction from the outer empty, causing problems. I thought the the tutorial used the same  constraint and did fine.

I found that I needed to remove all constraints on the cylinder, set its origin to the empty's location, and then put back the constraints (I skipped that part from the tutorial on accident).  So from what I learned, an object's origin is important in constraints.


Why don't I see the UV map? I had done my material work on an older version of Blender (2.7).

Now I updated my Blender version, my older mesh had several materials, but now I can only see one.

Why I only see one material? When I select one image of the older, its unwrap right so all is there where it should be, when there was this picture on this place, but when I go to the UV Image Editor I can't see the unwrapped mesh.

The window on the left is the Image Editor you need to use the new UV Editor to see the unwrap.


How do place an image to the side of a cube using the Python API I am trying to map an image to the side of a cube (just one side) and I'm having trouble figuring out how to do this with the PythonAPI.

I tried something similar to this: tutorial but it warps the image so that it covers the whole cube.

The reason I'd like to use the python api is that I'm going to be doing this for thousands of images. It would be nice not to do it by hand :)

Any help/tips/pointers would be greatly appreciated!

Here is python code which might serve as a start: http://web.purplefrog.com/~thoth/blender/python-cookbook/texture-one-cube-face.html

import bpy

def apply_image_to_face(template, fname):
    imgs = [ img for img in bpy.data.images if img.type=='IMAGE' and img.filepath==fname]
    if len(imgs)<1:
        img = bpy.data.images.load(fname)
        print(img.name)
    else:
        img = imgs[0]

    tex = bpy.data.textures.new(fname, 'IMAGE')
    tex.image = img

    obj = bpy.data.objects.new("capybara", template.data)

    mat = template.data.materials[1].copy()

    tslot = mat.texture_slots[0]
    if tslot is None:
        tslot = mat.texture_slots.add()
    tslot.texture = tex
    tslot.texture_coords = 'UV'

    obj.material_slots[1].link = 'OBJECT'
    print(obj.material_slots[1].link)
    obj.material_slots[1].material = mat
    print("argh "+obj.material_slots[1].link)

    return obj

# this needs to be the template object.
# It needs to already have a UV map.
# The first texture slot is for most of the cube.
# The second texture slot must exist and we will fill it with a newly-created material for the image
# one of the faces must already be assigned this second material.
template = bpy.data.objects["template"]
# template = bpy.context.active_object

obj = apply_image_to_face(template, "/home/thoth/art/drawing-practice/totoro.png")
obj.location= (0,1,0)
bpy.context.scene.objects.link(obj)

You have to have a template object named 'template'.  That object has to already have a UV map.  It has to have two materials.  The second material will be cloned to make the per-image materials.  At least one of the faces on the template object must use that second material (otherwise it never gets used to paint anything)

Blender 2.75a has a bug where when I set the material_slot[1].link = 'OBJECT' it does not stick.  It reverts to 'DATA' right after I assign material_slot1.material .  A fix for this is already in the tracker and will probably be in the next release of blender.

The code above would have to be adapted if you have your own RGB pixel data instead of a file in the filesystem.   Change out the part that does bpy.data.images.load(fname) with something like getGradientImage() from this bathymetry script:

def getGradientImage():
    """rainbow gradient image"""
    rval = bpy.data.images.get("gradient")
#    print(rval)
    if rval is None:
        rval = bpy.data.images.new("gradient", 1, 6)

        rval.pixels = [
            #R,G,B,A,
            1,0,1,1, # magenta
            0,0,1,1, # blue
            0,1,1,1, # cyan
            0,1,0,1, # green
            1,1,0,1, # yellow
            1,0,0,1, # red
        ]
        # if we don't pack the image into the .blend, it will be lost when you re-load the project
        rval.pack(True)
    return rval

Of course, you'll want to give each data set its own image name instead of "gradient".


Blender reverses X-axis when exporting Z-forward When I export object as it is - in Right handed system, everything exports fine. When I try to export to use object in Left handed system, I set Z-forward when exporting and now interesting things happen. It flips Z axis as would every sane person expect, however it also flips X-axis.

You cannot export to left-handed system in Blender (not with default 'orientation toolkit' used by most exporters at least). As @sambler said, this only performs rotations (and uniform scaling).

Note that switching something as complex as a Blender scene from right to left handed coordinates is a nice little nightmare (think about animations, parenting, etc.), afaik nobody ever seriously worked on this topic so far.


How to evenly divide a face when loop cut doesn't work I have a face. It is rectangular, but has extra vertices linking it to surrounding faces. From what I've read, these extra vertices are likely the reason why loop cut (my go to tool for this type of thing) doesn't work.

Reading up on it, it seems the go to answer to work around this is the knife tool. However, it doesn't give me the fine control that I want. The knife tool will only give accurate cuts by snapping to the middle of an edge, unlike loop cut which can be used to make clean straight lines anywhere on a face.

Is there a way to make the knife tool more accurate so it can consistently make straight lines at any point on the face like loop cut normally does? Or is there a better solution?

In my example I started with a plane with 5 vertices, so loop cut doesn't work:

I selected the upper edge, pressed W to subdivide 3 times.

Make the same with lower edge, then select a pair of vertices and press J to connect and divide the face.


Prevent object from casting shadow in Eevee How do?
One answer says to set Shadow Mode to none in the settings of the material, but this doesn't work in this case for some reason. The light is spot.

FOR EEVEE:

make a material for the object and go to material properties > setting > shadow mode > none

Edit: Use contact shadows for small distances. if you want good shadows make the clips start of the light smaller and shadow resolution higher!
contact shadows are only for very small details that resolution of shadow map can't cover.


Extending ridge around part of an object I would like to extend the raised ridge along all the length of leg to go all the way around the front (the round bit with 5 holes in it) and join up with the edge on the other side of the leg again.

My first thoughts were something along the lines of selecting the vertices around the front, shrinking the selection to the width of the edge then extruding it but I'm unsure how to accomplish this with my limited Blender skills.

Any pointers in the right direction would be much appreciated.

STL file of the design in the link bellow

http://www.thingiverse.com/thing:613877#files

If you can live with the awful topology of the mesh here are the rough steps to accomplish modeling that ridge:

Lets start by sanitizing the mesh first

Select these vertex and move your 3D cursor there with Shift + S Cursor to selected

Exit edit mode and move the center of the object to the cursor with Shift + Ctrl + Alt + S > Origin to 3D cursor
Now that your Arm object has a sane center move it to the scene's origin (coordinate 0,0,0)

Now lets make the object symmetrical

Add a vertical plane at the object/scene origin

Scale it so it reaches the whole object
With both selected enter edit mode on the arm object, and in top view use the operator Knife Project to cut your whole geometry in half. Use the option cut through for best results
Now delete half of the mesh, making sure you delete all the small faces along the symetry axis

Now you can add a mirror modifier to the object so you only have to deal with half of the mesh and model part of it. Blender will take care of the symmetry

Modeling the ridge

Now delete this part of the mesh

Select the border of the round part an duplicate it with Shift + D

Scale in inwards towards the cursor by pressing . then S to scale and Shift + Z to keep it from scaling in Z direction
Separate the scaled edges into a new object with P
Now use the Knife Project as described above with the plane to cut it into the mesh
Enter edit mode again and you can select these faces

Extrude them until they reach the desired height

Exit edit mode and add a new plane at exactly the height of the top of the round part

Scale it so it covers the whole object and use knife project again to cur a new loop on the mesh

You can now bridge these edges with F and start closing your geometry

Extrude the sides up. Make sure the surrounding vertex are vertically aligned with the remaining ones so they lign up

Done