Overlay PNG image as overlay in camera view in BGE Is there a way to put a PNG image as overlay in the camera view? I want the cross hairs to show in the camera view in Blender Game Engine.

Blender camera view:

PNG image with overlay:

End product:

If I got it, you could parent a plane that uses the image as texture (textured using alpha), like this:

start enabling the "import images as planes" addon (bundled by default), and import your overlay image

then enable alpha for the texture if needed, and transparency for the material

then look at the camera rotation transforms

and copy those values to the plane, and then move it towards the camera (translating on its local Z), to get:

in the end, here is an example of the camera rotating around a target object, and the view looking through the camera:


Mesh looks OK in wireframe but shading is distorted Imported an OBJ file in Blender 2.91.0. Mesh looks OK in wireframe view and exports OK to other s/ware but weird in all shaded viewport views. Example included shows object Shaded Flat. All surfaces are concaved. A recurring issue for me. Checked normals are OK, checked no modifiers on the object apart from a collision modifier. Searched the net.  Any ideas?

Answer provided by Nathan. Solution was to clear custom split normals in Object Data Properties/Geometry Data.


how do you create a meta-strip (group of strips) in the VSE using python? I want to use python to create a series of strips and group them into a meta-strip.  I have noticed there are several new_ methods on scene.sequence_editor.sequences such as new_clip(), new_effect(), new_image(), new_mask(), new_movie(), new_scene(), new_sound() but there is not one for the meta-strip.

What is the proper API to use to create a meta strip from several other strips?

def make_meta(scn, strip_list):
    # magic goes here

strip_list = make_parts(scn)
make_meta(scn, strip_list)

There might be no low-level RNA method to create or make a meta strip, but you can still use the operator:

bpy.ops.sequencer.meta_make()

Make sure you select all relevant strips before you call it.


Where can I change mixing of an action in NLA? I combined two action strips in the NLA-editor but the forward movement fades in (red curve in the image below)  I would prefer to have this linear. Where can I change this behaviour? Action blending and extrapolation doesn't seem to have an effect.

The relevant setting is Blend In/Out. To ignore keyframes in strips below the active one, turn off Auto Blend In/Out, and set both blend values to 0:

More generally I suggest, for bones that will be animated in a layer, to avoid keyframing it in strip actions in all other layers. Or do it in such a way that the strips don't overlap. That'd save you some headache when the animation mixing gets more complex, especially if there are semi-overlapping action strips. Not used carefully, action blending could cause jerky movement that's hard to tweak.


UV unwrapping wrong placed parts I made this santa doll in seperate parts, cause i figured this would be easier with the shape of it. But now all the parts are obviousy loose even though together in 1 mesh group. So when i unwrap them they come out as loose part in the uv, but i prefer them to be the exact shape of the doll, so the texturing would be easy. How do i get this done? All the loose parts are also wrongly places and turned as you can see... This is useless for texturing and will take me a day to figure out.

Simple, use Project From View when Unwrapping.


How to make a half cylinder? I am having a tough time building a half cylinder and have not found any tutorial showing me how to do that.

Go into top view (Numpad 7), enter edit mode, press B, and box select half the vertices. Then press X > Vertices. You may need to rotate so that the edges align to the grid properly. Once youhave done that, select the four inner vertices and press F. Alt right-click on the end edges and press F to make faces for them as well.


Strange Shadow on mesh? I am doing this Blender Guru turorial. When I look at the metallic text I see this "shadow" on the inner sides of the text (see image). Now I am not certain what is the reason for this "shadow" ? Is it a shadow or did I do something wrong with the UV unwrapping (something that is very new to me) ? My file is here, the textures are packed into the file.

As @Carlo suggest, the straight line is not a shadows, but the texture instead.

By changing size in the Mapping Node, you are distorting the image and the UV Map doesn't match as expected.

If you toggle muteM Mapping Node, your texture is correct.

In the Blender Guru Example, the Mapping Node is applied to the Noise Texture to achieve a "scratchy" effect.


I imported 3D models that was ripped from game file(model-resource), but it has black things around eyes and mouth why is this happening?
Model file is from The Model's Resource, Nintendo model archive

*Edited after seeing comments(thanks!)
I saw your comment and reply, and watched some videos about bsdf, still I got a problem as you can see my pictures below. I somehow erased the shadows, but the eyes became too tranparent and also are looking weird.
I only changed the eyes, not the mouth at all. so the question is on eyes, at this point.

with opaque mode

with alpha blend mode

when bitmap connected to alpha is muted(opaque)

when bitmap connected to alpha is muted(opaque)

in render mode with opaque mode
**Solved, Thank you so much! :D

It seems to be a case of transparent parts rendered as black (this is not a bug, but a feature in material view)

You are in material-view mode and not render mode. When you go into render-mode it should appear correct (if nodes are setup properly).

If nodes are incorrect, It normally is the following:

Its possibly that the alpha output of the image-texture is not connected to the alpha of your principled bsdf.
Edit: As I suspected, the nodes are not properly setup. All you have to do is connect the 'Alpha' output from image texture to 'Alpha' input of Principled BSDF
Note: in the first image below, on the right side, it mistyped "Rendered View". I meant to say 'Material View/Viewport Shading mode'. Its a small mistake, I noticed late.


rigged character's hair/particle system doesn't follow the movements I created a simple male base mesh and put some fur and hair on him. However, whenever I rig the character and try to pose him the fur doesn't move along with the body, which confusing me.
Here is my blend file.

The problem may be with the modifiers order. Make sure that in the 'object modifiers panel' your Particle Systems are below the Armature. See the printscreen below:

I checked your model and I think it demands a little clean up:). You should remove doubles before adding a hair. If you don't you may expect a strange hair behavior on your model. Please check out this topic:
Problems with particle hair in 2.72 (cycles).


Bones not moving in pose mode? When ever I try to move or rotate a bone in pose mode, nothing happens. The bone stays frozen, not moving to any axes, no matter what bone I chose..
I tried rigify ready to use mesh but had the same issue.

Try disabling Manipulate center points.
Here's a screenshot of the option:


Fire simulation not working in eevee 2.81 I'm trying to make a fire simulation for an animation I'm making, but when I bake the simulation I get a strange result.

It works completely fine in cycles,but I want to use eevee because it's a lot faster to render.

There is no volumetric checkbox in blender 2.81, so I can't use that to fix my problems. I've been playing around with the settings of the simulation, but it ends the same. If anyone can help me, I'd appreciate it.

Here is my node setup (just in case).

Here is my Smoke Domain Settings

The issue I was running into was that I needed to use a heat attribute node. Once I added that with the flame attribute, it worked. (I also didn't separate the nodes anymore)

Thank you everyone who helped.


How to use ImageTexture with Blender 2.8 I assigned a material to the character's hair and assigned an ImageTexure.
However, the texture is not displayed and the hair becomes black.
How can this be solved?

This is the UV used for hair.

This is the texture.

Reflected is worked with Specular or Roughness or Clearcoat attributes in principle BSDF. The image texture you assigned is for based color only.

You can use another image texture to tell that hair should be Reflected by changing those attributes.


Render slows down in the last couple minutes Beginner here. I started a few days ago and began using blender 2.8 yesterday. I'm not sure if it's normal but I notice my renders slow down in 2.8 when they're almost done. It didn't happen in 2.79. It's so much that the last 1 minute of time remaining takes 10 minutes. The image is also almost completely rendered, with almost no tiles showing any noise.

I have GPU and CPU rendering set up, my GPU is a gtx1080 and CPU is in i5-4670k at 4.5ghz. Not sure if that's relevant but thought I would add it.

Everything is just simple.

i5-4670k heve 8 logical cores wich one by one render slower that one GPU.

Can see, how GPU overtaking CPU cores. And then they remain, but the GPU is not involved in process. There is also an inaccuracy in the calculation of time.

It would be better if the CPU represented only one tile. I have posted about it on developer.blender.org.

You need to render only by GPU and it will become faster then with CPU.


Revert vertex position to Basis Shape Key How I can revert the position of a single vertex in a shape key to it's position in the Basis Shape Key?

Use Blend From Shape:

Select all vertices whose positions you want to reset,
Execute Blend From Shape, accessible from W, Ctrl-V or Mesh > Vertices menu,
Set "Basis" as shape key to blend from (by default),
Set blend factor to the maximum value 1.0 (by default),
Uncheck Add, so only values from "Basis" will be blended in, effectively reverting all selected vertices' position.


How to show open dialog box that can navigate to blender datablocks How to show open dialog box that can navigate to blender datablocks.
I can show open dialog that can select .blend files, but how to select specific datablock just as 'File->Link' or 'File->Append' does?

Below is the code I am using ( copied from template ):

def read_some_data( context, filepath ):
  print("running read_some_data...")
  print( filepath )
  return {'FINISHED'}

class ImportSomeData( Operator, ImportHelper ):
    bl_idname = "import_test.some_data"
    bpy.ops.import_test.some_data is constructed
    bl_label = "Import Some Data"

    filename_ext = ".blend"

    filter_glob = StringProperty(
        default="*.blend",
        options={ 'HIDDEN' },
        )

def execute(self, context):
    return read_some_data(context, self.filepath)

Thanks!

You need to use bpy.data.libraries. The class has a function load which read the datablock of a blend file.

Here an example of how to draw such dialog box to append either a group or an object.

class open_blend_file(bpy.types.Operator, ImportHelper):
    """Import a .blend file to append model from"""
    bl_idname = "blend.open"
    bl_label = "Import"
    bl_options = {'UNDO'}

    filter_glob = StringProperty(
        default="*.blend",
        options={'HIDDEN'},
    )

    group = BoolProperty()

    def get_lib_groups(self,context):
        l = [];
        if os.path.exists(self.filepath) and self.filepath.endswith('.blend'):
            with bpy.data.libraries.load(self.filepath) as (data_from, data_to):
                groups = data_from.groups;
                # objects = data_from.objects;
                for g in groups:
                    l.append((g,g,g));
        if len(l) == 0:
            l = [("None","None","None")];

        return l;

    def get_lib_objects(self,context):
        l = [];
        if os.path.exists(self.filepath) and self.filepath.endswith('.blend'):
            with bpy.data.libraries.load(self.filepath) as (data_from, data_to):
                # groups = data_from.groups;
                objects = data_from.objects;
                for o in objects:
                    l.append((o, o, o));
        if len(l) == 0:
            l = [("None","None","None")];

        return l;

    lib_groups= EnumProperty(
        name = "List of groups in the .blend file",
        description = "List of groups in the .blend file",
        items = get_lib_groups
    );

    lib_objects = EnumProperty(
        name = "List of objects in the .blend file",
        description = "List of objects in the .blend file",
        items = get_lib_objects
    );

    def draw(self, context):
        scene = bpy.context.scene;
        props = scene.property;
        layout = self.layout;

        row = layout.row();
        row.prop(props,'import_from', expand = True)

        if props.import_from =='Groups':
            if len(self.lib_groups)>0:
                row = layout.row();
                row.prop(self,'lib_groups', text = "Groups", icon = "GROUP")
        else:
            if len(self.lib_objects)>0:
                row = layout.row();
                row.prop(self,'lib_objects', text = "Objects", icon = "OBJECT_DATA")

    def invoke(self, context, event):
        context.window_manager.fileselect_add(self)
        return {'RUNNING_MODAL'}

    def execute(self, context):
        if self.group :
            name = self.lib_groups;
        else:
            name = self.lib_objects;

        if self.group:
            blend_file = self.filepath + "/Group/"
            bpy.ops.wm.append(directory=blend_file, link=False, filename=name, autoselect = True);

            group = bpy.data.groups.get(name);
            if group is not None:
                bpy.ops.object.empty_add(type='PLAIN_AXES', location = (0,0,0));
                obj = get_active_object();
                obj.name = group.name;

                for o in group.objects:
                    o.parent = obj;

                group.objects.link(obj);

        else:
            blend_file = self.filepath + "/Object/"
            bpy.ops.wm.append(directory=blend_file, link=False, filename=name, autoselect = True);

        return {'FINISHED'}


Substitute for Multiply node? I have two render layers.

I am trying to layer one over the other so it creates an inverted effect through the computer monitor.

If you haven't noticed already, my current problem is that the black silhouettes of the character outside of the monitor in the latter render layer cover up the freestyle lines of the characters in the former layer.

Here is my current node setup:

The problem is this node in particular:

The Multiply node only replaces any pixels found in the black area of the alpha mask with more black pixels. I want my nodes to erase all pixels found in the black area of my alpha mask instead.

I will have to use something other than the Multiply node since it currently looks impossible to customize it so it does what I want it to do.

What nodes can I use instead of a Multiply to fix my issue?

EDIT: Here's the .blend:

Keying Node

In this particular case I would use the Keying node to mask out the inverted image.

It will allow you to get the area with the key-color you picked.

.

Then you just have to overlay the second layer after running the Chroma key filter as you already did.


Subsurface Causing Mesh Problems Just started using blender, and naturally the first thing I'm making is a minigun. It looks dope.

Problem is, when I applied the subsurface modifier, I ran into a problem.

And without it...
Nothing.
Any help is greatly appreciated.
Heres the link to the .blend files: https://www.mediafire.com/?1iq489br01zej02

Edit: It can be somewhat fixed by changing the number of subdivisions, but this makes it WAY to high quality.

I downloaded the model and found your problem. You've got hundreds or vertices on top of each other.

What you want to do is select everything live I've done and press W to open the specials menu and press "Remove doubles".

As you can see, you've lost all your sharpness in your mesh. You we're probably extruding faces to make these infinitely thin ones that gave you sharp edges, but there's a better way.

What you want to do when you find an edge you want to sharpen it select it and by pressing Ctrl+E to go into edge crease mode and sharpen edges by pulling your cursor from the edge's origin.

Here you can see I hot a little too excited and did a bunch of edges.


Making indented panel lines for 3d printing I'm quite new to Blender but planning to use it for 3D printing, so I'm looking for a solution which will actually modify the geometry. I have created a couple of aircraft. I need to detail them with some panel lines but I don't know how to easily make an indented straight line.

existing model - https://www.shapeways.com/model/1051048/d21-drone.html?li=my-models&materialId=6

The tools you are asking about are quite simple, you can make loop cuts with CtrlR. Roll your mousewheel to create multiple cuts and use left click to confirm/right click to cancel.

Since Blender can handle ngons, if your shape is a flat hard surface, feel free to cut it. Activate the Knife took with K, click an edge as a starting point and then click another edge as the end point, when satisfied. Press Enter to confirm.

You might also be interested in the Inset tool. This can be useful for giving your faces a bit of distance from the sharp edges so any further modifications don't look odd or modify parts of the mesh you don't want. Press I while selecting multiple edge loops or faces and use your mouse to adjust the inset level.

The Extrude tool is what you will use to create the indentations. Just select the face(s) and press E, you can use your mouse to adjust how far the extrusion goes in/out.

And all of those combined on a simple box model, produces this. Tri's aren't so bad when working with hard surface models but they make editing a pain.

Decent topology is a must when doing 3D printing. See, What exports does blender have for 3d printers?.


Blender models adding extra faces in Element 3d I modeled a logo in Blender and everything is clean.

When I export an OBJ and import it into Element 3d, a few extra edges have found their way into the model.

Any ideas on why this is happening? I have a feeling it's some setting within Element 3d but it could very well be a blender to OBJ issue.

Looks like you have quite a few complex ngons in your model. The OBJ exporter may be getting confused. Before exporting to OBJ, in edit mode, select all the faces (or at least the ones giving you trouble), and hit Ctrl+T, which is 'triangulate faces'. This will convert all your quads and ngons into triangles.

Once converted, ensure those strange edges have not reappeared (and fix them if they do), then export to OBJ once again.


Blender crashes when started from the command line I'd like to run Blender from the command line (like this) in Mac OS, but am running into an error which causes Blender to crash each time I run ./blender (from within /Applications/Blender/blender.app/Contents/MacOS):

Jamies-MBP:MacOS Jamie$ ./blender
ndof: 3Dx driver not found
Read new prefs: /Users/Jamie/Library/Application Support/Blender/2.74/config/userpref.blend
found bundled python: /Applications/Blender/blender.app/Contents/MacOS/../Resources/2.74/python
Fatal Python error: Py_Initialize: unable to load the file system codec
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/__init__.py", line 123
    raise CodecRegistryError,\
                            ^
SyntaxError: invalid syntax
Illegal instruction: 4

The OS also reports that 'Blender quit unexpectedly.'

The error seems to suggest that Blender is looking for Python 2.7, but I thought Blender would always use its own copy of Python 3? If I run which python I get /usr/bin/python, and if I run which python3 I get /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.

If I run $PYTHONPATH the output looks like this:

-bash: /Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old:
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC:
/Library/Python/2.7/site-packages:
/Library/Python/2.7/site-packages/PIL: No such file or directory

I'm not sure whether this is typical or not (there seems to be an No such file or directory error but I don't know if that's related).

What should I do to fix this or investigate this further? Do I need to add python3 to my $PYTHONPATH? This answer mentions other variables, such as $BLENDER_SYSTEM_PYTHON – do I need to change this?

Well the solution for me was to unset my $PYTHONPATH, which was configured to create the output listed above by a line in my ~/.bash_profile file.

When started from the Terminal, Blender now still loads the bundled Python:

found bundled python: /Applications/Blender/blender.app/Contents/MacOS/../Resources/2.74/python

But Python is now able to load the modules it needs. I guess that having $PYTHONPATH set was preventing Blender's Python from being able to load required modules.


How do I make an object always face my camera in the Game Engine? I am making a game in the game engine which you can get the original .blend file and runtimes here. I am trying to optimize the game as much as possible. One of the ways that I'm trying to do that is by turning the bullets into a single plane instead of a complex object. I want one side of the bullet to always be facing the player's camera so that the bullet doesn't look flat from the top, as it would if the plane was fixed to the bullet. I am trying to use the "Edit Object" track to option but none of my combinations work. When I use the track to option the bullets will always fly in one direction or spin around endlessly in one direction above the player's head. Sometimes the bullet will just disappear. My problem is that when it tracks it tries to make the whole object face my camera and it rotates on all axis. I want the bullet to track using the X-axis but only rotate on the Y-axis.

Use a simple cube (or rectangle, or whatever shape bullet you want) for the physical bullet. Parent a plane to your bullet's physics object. Set the bullet to invisible, and the plane's physics type to no-collision.

To make the plane track the camera, you can use the method you mentioned of edit object > track to. However, there is an easier way. You can set a material so that it will always face the camera. On your no collision plane, add a material. You can add your bullet texture, but the only setting that matters to make it track the camera is under the material's "game settings." Select the drop down for "face orientation" and select "halo" instead of "normal." What does this do? I'm glad you asked! If, for example, you were using a picture of a tree, you could use "billboard" to make the tree track the camera with rotation only along the Z. However, "halo" tracks the camera on the X, Y, and Z. You may need to go into edit mode in your plane, and rotate it so that the plane is facing it's X axis, for the face orientation setting to work.

Here is the entire process:


UV Image Editor won't allow me to search for textures I have a 3D tea cup model that I've loaded into Blender v2.78 and I'm trying to access its 2D texture so I can play around with the texture and make some changes to it.

So I had a similar question to this one and I'm struggling to follow the accepted answer because of what I'm seeing in Blender.

When I open that BLEND file in Blender I see:

I've confirmed that the top window is the UV Editor. When I click on the "Icon with a photo" (which is instruction #3 in the accepted answer to that other question, I'm trying to "search for textures", but as you can see it will only allow me to choose View, Paint or Mask:

All I'm trying to do is to extract out the texture to this tea cup, any ideas what my next step should be?

Update

I selected UV Editing layout and see this:

So the options I'm seeing are:

Render Results
Viewer Node
Alexs_Apt_8k.jpg
wooden_fence_texture.jpg

None of these seem applicable to my tea cup!!! Again, I'm just trying to get the 2D texture image of the tea cup model that I see in the Camera Persp screen below the UV Editing window.

Your very top editor is the uv image editor, but to use it you need to drag that whole bar down to see the window - what you think is the uv image editor is actually a node editor, and below that is the 3d view and then the timeline.

Use ctrl-left/right arrow to get to the UV Editor layout, and then use the button next to the 'New' button to browse that available images in the file - if there is an image texture in the cup's material, then it shoudl be available to open.
[![

edit: your material for the cup doesn't have an image node hooked up, and there isn't an image to go on the cup material in the file. Looks like you need to add an image node and then open the image you say you have in the mtl file, or go back to blender render and try to import the object with the mtl intact to get the image in the material.
Image as reference for the UV Image Editor]1]1


'Pack into Blend' doesn't include .Mov Files brand new to blender, having jumped ship from Davinci Resolve/Fusion in order to make a music video in a 3d environment.

Loving the workflow so far, but have hit on one big snag straight away.

The prototype project I have consists of some .PNGs mapped onto surfaces along with a Prores 444 format .mov file (its green-screened/Alpha-Channel footage).

Despite checking the 'Pack into blend' option, whenever I ltransfer the project onto a separate Mac, the Video element is missing. I've of course copied over the video file into the same directory path on the 2nd machine, but I can't figure out how to get blender to relink. I just get a blank block where there should be the video of a singer.

Hopefully someone can help a newbie ! Lots of previous experience with Resolve, Premiere, FCPX, pro Tools etc...just a bit stuck with data management here. The final music video will have around 200 elements that will be imported , so keen to get the asset management correct at this stage.

All help appreciated..

Mov files can't currently be packed

As said in the manual at the Packed Data page:

  Some typically heavy external files, like video ones from the Sequence
  Editor or Movie Clips, cannot be packed in a blend-file.

Your file fall into the Movie clips category, which unfortunately has been exclude from the files format that can be packed. You'll have to copy between folders and update the path.

If you are using an "image as plane", you should browse in the shader editor the image sequence node and change the path from the Open Image icon:


How to have equal size faces Is it possible to have all the faces exact size without losing the shape of the mesh. With or without addon. With the Looptool adon we can have equal spacing in the verts.

My mesh was subdivided and applied. How can i have equal size of faces all over the mesh. In my model top faces are small bottom are big. Any suggestion . Thanks

I don't know if you have a reason to make your loops exactly equidistant, if so, I've missed, with this one.. This is really to reduce geometry, while preserving curvature.
Enable the shipped Add-on 'Simplify Curves' and..

Select, duplicate, and make a new object of one vertical half-loop from your cone (BTW, straighten it out in your chosen plane, and make sure it has verts at directly above and below the object origin)
Convert the profile to a Curve
Call up 'Simplify Curve' from your F3 search menu and tweak to acceptable preservation of curvature
Convert the profile back to a mesh, and Screw modifier turn it back into a cone.

You can save a lot of polygons..

Without that much difference in curvature .. (both examples subdivided once) and if you want to keep the shape flexible, Curves can be given a Screw modifier, before conversion.
This .blend includes some discretionary manual edits to the profile just before spinning .. bevelling vertices at very sharp corners to hold up under subdiv. The simplifying step is from 'Plane_005' to 'Simple_Plane_005'.


Cycles does not show textures So, I DO have the UV unwrapped, looks alright in Blender render, not when I switch to Cycles though ...

Would post the file, its 70 mB though... for some reason,...

EDIT: not sure about how my question is different from the similar question asked, but I did not see any solution in the How to show textures in the 3D View editor? other similar thread/question....

On this vase you have three materials in the material slots tab. As you can see in your screenshot, you are editing the second one at the moment. Trouble is, that material (I know that from the last file you provided in another question Half of my mesh/texture is blurred) is not assigned to any face of your model, that's why you do not see the texture.

Either select all faces in Edit Mode and click the assign button in the material tab. This will assign the currently active material to the mesh faces. Or alternatively, delete the other materials (if you don't plan to use them). Then make sure the image texture node is selected in the Node Editor, and the 3D View is set to textured. That should do.


Mesh to Rig Not Working Correctly I imported an animated rig from a kinect motion software program to blender.
When I connect my mesh to the armature "with automatic weights" and play it the character is twisted around and not right. vertex groups were not assigned right so I manually assigned them but where bones bend they are not right.
Tried disconnecting the bones and reconnecting them but still did not work. What would be the correct way of doing this? Thanks

Automatic weights doesn't always work well. The more complex the mesh, the higher the probability of issues with automatic weights.
Also, if your mesh's normals are not right it can make the automatic weighting a little wonky, so you can try recalculating normals before parenting to the armature (select the mesh, go into edit mode, hit 'A' to select all faces and then 'alt + n' and 'recalculate outside'. Hope it helps.


Select Vertices by Material Color I have a mesh in .obj fileformat which if I render in color looks like this:

I would like to select only the brown/dark colored parts and delete the rest. How can I achieve this ? Is there a select vertices by material color ? Or can I do this differently ?

Thank you very much.

You could select the material slot and then click 'Select', which will select the faces that have this material. Only faces have material assigned, vertices don't.

You can do this in Edit mode only with thanks to Delagone :)


Spin Tool behaves unexpected I import points from a .csv and connect them with a single line. After that I Spin them 360 degrees/steps. Deselect and Reselect all vertices. Click Remove Doubles. Unfortunately the mesh is not only non Manifold but also the resulting non manifold vertices are not constant. Here a screenshot of the upper part, where one can see that not all of the vertices are non manifold.

I did the exact thing already and it worked the first time. I don't understand why it gives me this error. Any help would be great. Thanks

It could be linked to the removes doubles treshold. Try to increase it a little to compensate computation errors when making the spin. (Not sure the 360° spin will be a perfect 360)


How can i export a cylinder from blender to unity3d to be like a unity3d cylinder? In unity3d i make GameObject > 3D Object > Cylinder
And this Cylinder have the components: Cylinder (Mesh Filter), Capsule Collider, Mesh Renderer. I can add the last 2 components to my exported Cylinder from blender but i can't add the Cylinder (Mesh Filter) component. What is Cylinder (Mesh Filter) ? It's just a Mesh Filter component ?

Now i have some problems. I created some Cylinders in blender. All of them i did using Knife Project. And the last step was to click on Delete > Faces. If i'm not clicking on Delete and make delete faces it will not cut the hole.

The first problem is in the first cylinder i created in blender i cut a simple circle hole and it's working fine exported it to unity3d. But the next cylinders i exported for some reason when i'm looking at them from the front they are hollow i see the other side outside but if i'm moving around from the back it's not hollow. Not sure why.

In this screenshot the cylinders i exported and that are in unity3d. The one that is fine is on the left. The others on the right hollow like the hole cut was to the other side but if i will look from behind it's not open in the back:

And back

In general my main goal is to create a cylinder in blender with a hole but big enough like in the first screenshot the right cylinders so i can walk in with my character. But the cylinders should be like those in unity3d but with a hold so i can walk in.

I can't say for certain from the information you've provided, but I suspect that the first cylinder, with the holes through both sides, was created by doing a knife project through the cylinder in wireframe mode, and cut the hole through both sides of the cylinder. I suspect that the other cylinders you made, you used knife project in a different mode, and that the knife project tool only cut the closest surface. To get the hole in the back side, you could either switch to wireframe shading before you do the knife cut, or do the knife cut twice, one for each side. The reason you can see through the wall on the opposite side of your cylinder is because you're looking through the back side of the far wall.

By default, Blender does not use double sided faces, a consequence of which is that in most circumstances, when you look from the backside of a Blender plane, it will not be visible. There are a number of ways that you can address this issue. One is to create extra geometry, so that your cylinder is "double walled", another is to enable double sided faces, as detailed in the answer to this question on Blender stack exchange.


Text on Curve doesn't work right I want to align Text to a Curve using the "Text on Curve" option. The strange thing is that it worked on one curve but not one a different one that is the same but rotated 180°.

As you can see does the upper Text work but the lower one seams to be bugged or something. I tried it with a different Text and Curve (same shape) but it always looks like the one on the picture.

You can download the .blend file here:

@pycoder is right. You have different rotations on the curve and text object.
To double check the rotations, check Axis under Display in the Object context in the Properties area.
Select all objects, then Alt click on the Axis checkbox, to change the property of all objects at once.

The axis will be displayed in the 3D viewport. Notice, how the lower curve is oriented different than all other objects.

The Bottom curve has (0, 0, 0) rotations (image above), but all other curves have different rotations.

If we zero out the rotations (Alt + R), the behaviour of the Text On Curve is now obvious.

Step by step solution

Since we can't apply the rotation of the text. We will have to recreate the curve with the text's orientation.

Duplicate the curve.
Select the text, Shift select the curve, then press Ctrl + Shift + R and select Copy Rotation. We now added a copy rotation constraint to the duplicate curve. They have the same orientation.
Select the duplicated oriented curve and make its visual transform real. (Ctrl + A > Visual Transform)
Remove the constraint.
Delete the (wrong) vertices of the correctly oriented duplicate curve.
Select the curve, Shift select the duplicate curve and join them (Ctrl + J).
Apply the text on curve property.


Why can't I install an older version of blender after uninstalling 2.8? So, I tried to download 2.8 yesterday and it didn't work because my graphic cards are old, so I tried to download 2.79 today and it says that there's a newer version installed and it doesn't download despite the fact I already uninstalled every Blender file in my computer before downloading.

Just get the 2.79 portable version on www.blender.org

Since it's just a .zip file, you don't have to install it, and the first time you open it, it will automatically set itself up in the OS

However I doubt your graphics card are a problem (Blender doesn't require a graphic card to run). You could try updating your drivers, or at least try the 2.80 portable version before downloading Blender 2.79


UV Mapping a simple cube only shows 2 sides textured I can only get two sides of a simple cube to show the UV Map in Blender properly. Here are my steps:

I add a simple cube (ShiftA > cube)
In edit mode, I add seams to unwrap like a cross (see pic below)
A (select all), U > Unwrap
In UV Editor, create new blank image, draw numbers on it with the paint function
in 3D View Editor, change to "Texture view".

All normals of the faces show correctly to the outside (blue lines in picture). I can flip the normals of the faces and then I can see the numbers, but slightly darker than the first two. Also, I can only do that trick on 3 of the incorrect faces. The last face, whichever one it is, flips the normals but won't show the UV map.

I have also tried different UV map textures and pictures (such as the built-in UV- or Color-grid)

How can I unwrap with seams so that I don't even need to consider flipping already correct normals?

It sounds to me like a problem with your lighting: texture viewport mode can do some strange things with your lighting. Try adding a sun lamp illuminating the other side, or switching to rendered or material view with the texture applied in the material. I apologize if I am not answering your question appropriately (I am only going off of your text because my browser won't show your picture). Hope this helps :)


How would I be able to procedurally generate brick tiles like these? I am trying to replicate a pedestrian subway/walkway in my town and have come across an interesting brick texture I've been trying hours to replicate, the wall in question is:

This has been the closest I have got to replicating the wall but as you can see it's still not very close:

Finally, this is my node layout:

Thank you all for the help, and I'd appreciate an explanation of how the nodes work if you manage to do an accurate replication :)

Three ideas, that might help here.

Don't underestimate good lighting. Use HDRIs, to add complex reflections.
Count your brick pattern :). It's 11 bricks high, Running Bond pattern, each brick roughly 1:3 ratio. Read more about the Brick Texture node.
Add depth. Nothing is flat in the real world. Use Bump or Displacement, to make your material feel real.

This material would look boring as hell without the HDRI lighting.

Count and measure the brick pattern :). It's not totally random, it has some rules.

Use at least a simple Bump map to add depth. While still pretty crude, it's better than nothing.


Textures don't show on render https://blenderartists.org/t/textures-dont-show-when-rendering/1151729/2

I've been having trouble getting the textures to show up while rendering a character I've been working on. It'll show up while on the texture view but when I go to render, it'll be completely black or transparent. How do I fix the textures not rendering.

Okay, so here's your problem:

Your image node settings for your textures are set to "Clip" when they should be "Repeat". As you can see by my screenshot, it now works.


How to restore visibility of animation panel? I did something and animation panel(where key frames) now is hidden.
How to restore visibility of animation panel?

Every portion of the window can be configurated rappresenting an editor, the animation-related windows are: timeline, graph editor, dope-sheet, and NLA editor.

You can create a new portion of window by selecting and dragging the little triangle in the up right angle of every portion of window. Right clic on the separation line between two windows to join them.

Check also the upper header (info window), for default templates of windows organization.

If you have the option "back to previous", click it!


Converting texture files in blender using Python I want to write a simple script that scans all the textures files in a folder containing .dds format files and then save them as .tga.
I want to know how I can:

open the texture file
get a reference to the opened texture file
save_as (not save) .tga files (Targa)
close the opened texture file

Manually I can do the following to convert the files:

Open Blender, change to UV Editing mode from default
Click on Open image and load the desired texture image (which is .dds)
Click on Image -> save as Image and select Targa format while saving

Essentially I just want the automation of the above mentioned process!

Thank you for help!

Okay, I figured it out.

image = bpy.data.images.load("filepath_to_source")
image.file_format = "TARGA"
image.save_render(<filepath_to_destination>)

I tried using image.save() function before I posted this question, which raised a Runtime Error:

  Image does not have any image data

and I thought I was doing something wrong. Using save_render() function seem to have fixed it. I still don't know why save() didn't/doesn't work.


Python: How to connect shapekeys via drivers? I managed to make a script connecting the shapekeys of different objects via drivers.

But I don't know how to overwrite an already existing driver. If anybody could give me a hint?

# Add driver from 'selected' object to target 'active' object.
# Target values are shape_key values
#
# ShapeKeys must be named after Object for the script to work:
#
#      selected Object     = Cube
#      selected Shape Keys = Cube_abcd
#
#      active Object       = Sphere
#      active Shape Keys   = Sphere_abcd
#
# 1. Select all object candidates to receive a driver.
# 2. Select 'active' object as driver target.
# 3. Run script.

import bpy

selected_obj = bpy.context.selected_objects
active_obj = bpy.context.active_object
shapekey_list_string = str(active_obj.data.shape_keys.key_blocks.keys())

for obj in selected_obj:
    if not obj == active_obj:
        for key in obj.data.shape_keys.key_blocks:
            if key.name.lstrip(obj.name) in shapekey_list_string:
                if not key.name == "Basis":
                    skey_driver = key.driver_add('value')
                    skey_driver.driver.type = 'AVERAGE'
                    skey_driver.driver.show_debug_info = True
                    newVar = skey_driver.driver.variables.new()
                    newVar.name = "var"
                    newVar.type = 'SINGLE_PROP'
                    newVar.targets[0].id_type = 'KEY'
                    newVar.targets[0].id = active_obj.data.shape_keys
                    newVar.targets[0].data_path = 'key_blocks["' + active_obj.name + key.name.lstrip(obj.name)+ '"].value'

The line skey_driver = key.driver_add('value') will create a new driver, any existing driver will be replaced by the new driver.

You can delete an existing driver before creating a new one using key.driver_remove()

Note that replacing the driver with a new one will leave the driver variables behind, you can remove driver variables with skey_driver.driver.variables.remove(var) or all of them with -

for v in skey_driver.driver.variables:
    skey_driver.driver.variables.remove(v)


Boolean modifier makes dent, not a hole Im using a boolean modifier to make holes for windows on a car, but instead of cutting a hollow hole, it adds to the mesh, making a "dent". Any way around this?

Id like to keep it as a modifier with out applying anything so I can change it later easily if necessary.

The Boolean modifier is supposed to work like that!

In Blender objects are usually full 3D models, with a surface and a volume: in your case, since your car's "walls" are made of only one layer, the Boolean modifier thinks that the object is full, and that the inside of the car is its volume (it doesn't work like that, but it's to make the concept easier).

That's why it makes a dent: it is trying to remove part of the volume of the car.

However, you only want to remove part of the car's door, because you know that the inside of the car is empty, so you need to make the doors thick (so not one layer, but 2 with a volume inside).

The easy fix is a Solidify modifier before the Boolean, like shown in the picture


Simulating and baking post effects I've been wondering if it's possible to bake something like this

to look good in low-poly. I understand that there should be a diffuse map, glossiness map (since buildings are mostly glass), emission map (it's night scene). But is it possible to bake something close to glare that can be seen on buildings?

https://blenderartists.org/forum/showthread.php?157112-Texture-baking-reflections-both-light-and-objects
Providing you are speaking about re-creating this image, here is an idea that is relevant to your use of Glare - relevant part is:

Baking reflections and specular highlights is a bad idea if you want to move the camera, the object or any of the lights. The position and content of the reflections and highlights depend on their relative positions
You should bake the base colours, apply it as a colour map and let Blender calculate the specular highlights dynamically. It shouldn't slow things down too much.

One more piece of reference is this post from the Blender Stack Exchange that asks about baking glass:

Baking is generally used to simulate effects like shadows, lighting, small details like bumps or roughness through displacement maps, bump
maps, normal maps, etc., the kind of thing that is either too complex
or too expensive, or somehow unwanted or not needed to calculate in
real time.
Baking means it will be pre-calculated and become static, so it wont
react when you change the viewpoint. So if you bake things like
transparency or refraction or reflections they will become static, and
seem to be "printed" or "painted" onto the surface of the object and
that is generally not desired.
See here What does "Baking" mean?

If you are using this image as a texture, like a diffuse image on a plane for instance and you want the lighting to dynamically light your scene while the glass would be a glossy color, I would suggest it probably won't matter significantly to have an incredibly high level of detail between objects, you aren't getting that close to buildings. If you are recreating it, then try to avoid baking the gloss if you are doing a moving camera and let Blender do it automatically. If you are just creating a still frame with this image as reference, go for it.
If you are using this direct image as like a background to reflect on something, you would want to enable the Import Images as Planes add-on that comes with blender, choose this file and then you'd have the image already set perfectly on a plane mesh that you can manipulate and use for whatever you need.
As for how to draw different textures to different pieces of the building, either you would create the windows as separate meshes, and apply the glass texture or something I just found this post about using Vertex Paint to draw different textures. Either Vertex or Texture Paint would allow you the control of the emission or glossiness you are looking for, and it will mix all nice with certain settings to make your image more realistic reflectively.
Good luck! If you can clarify what your project is a little more, I'll try and help more!


Measuing an irregular volume from an .stl mesh I'm quite new to blender so please, any help you can give is much appreciated.

I am trying to measure the volume of an irregular object (e.g. a mold of clay) on either a concave or convex surface (such as the back of a hand).

The file is .stl and is a non-solid mesh.

I know that Blender comes with 3D printing tools to take these measurements but I am having problems making the object solid (taking into account the curvature of the surface) to take this volume.

Unfortunately, the surface cannot be scanned alone beforehand to subtract from the surface+clay image.

The ultimate dream is to write a python script to take a user defined area (e.g. the borders of the clay mold) and somehow measure the volume taking the curved surface into account. But at the moment, any advice on how to go about this with blender would be great.

EDIT: Here are some images of the file and what I am trying to achieve. I am trying to measure the indented suface in the 2nd image, taking into account the curvature shown by the side on profile in image 1. (Thanks).

The quick and dirty way would be this:

First use a remesh modifier with a fairly high number of iterations (at least 7), to keep a the fidelity high. The remesh modifier will automatically close off your mesh and make it watertight.
Use bmesh to calculate the volume:

import bpy, bmesh

o = bpy.context.object

bpy.ops.object.modifier_add( type = 'REMESH' )

remesh = o.modifiers[ len( o.modifiers ) - 1 ]
remesh.mode         = 'SMOOTH'   # Remesh type smooth
remesh.octree_depth = 7          # 7 subdivision levels

d   = o.to_mesh() # Create a temporary mesh with modifiers applied
bm  = bmesh.from_edit_mesh( d )
vol = bm.calc_volume()


Is there a way to (Cycles) render fire with no emission? I made a model that uses fire but i want the fire to be just a fire but wont emit any light on the other models. I'm using a Cycles render if that helps in any way.
thank you!

There are a couple of different ways to handle this, depending on the exact result you want. Obviously, if you want no emission at all you can just not include the emission shader in your node graph and just add the "fire" grid (attribute node) onto the "density" grid. It sounds like you want the fire to emit light visibly, just not illuminate anything else?

The easiest way to do that is just use the light path > is camera ray output. Multiply it by your flame grid and it will only appear when viewed by the camera. Here's an example in an otherwise typical fire shader:

"Is Camera Ray" returns 1 if the ray has originated from the camera, zero any other time. By multiplying it with the flame grid, we essentially delete all data from the flame grid for any ray type other than camera.

If you want the fire to illuminate the smoke plume and show up in reflections, but not light surrounding objects (because let's face it, that's slow and noisy) you can turn off diffuse visibility on the domain object:

Since we are using ray visbility here, this will also allow us to skip the volume shader calculation entirely for diffuse rays, which might give some extra speedup.


Gradient in Blender Render I would like to add a brown to blonde vertical gradient to my model's back facing hair. How can I do this in Blender Render?

You can use the blend texture for this.

Go to the textures tab in the Properties Editor. In the material sub-tab (it's open by default), create a new Blend texture.

Change the mapping of the texture to "Object", and select the object that represents the model. Set the X coordinate input to Z (because we want the gradient to be vertical). The other settings don't matter, because the Y and Z coordinate inputs don't affect the output.

Now that the texture is mapped correctly, you can change it's influence (in the influence drop-down accordion). In your case, the texture should influence the color of the diffuse shader. If your material is brown, this texture should make it blonde (yellow-ish) on one end. The color influence is at 1 by default, which is what we want. Just change the color to what you want.

You should now have a basic gradient from blonde to brown. Then, just play around with the mapping and influence (and other) settings, until you get the look you want.


How to model a box with a circular top? I would like to create a cube with slightly rounded edges (less round than in the diagram above though) that morphs into a flat, cylindrical front with a gentle curve towards one end. (The diagram is not to scale at all.)

Start with a box and subdivide (W > Subdivide) it to give yourself more geometry to work with.  Then select the corner edges of the side you want to make circular and hit Alt+Shift+S (scale to sphere) and type 1 (to make it scale it 100% to a sphere).  You will then have to scale it in a little (with S) to whatever size you want.  Repeat the process with the lower edge loops and <100% amounts to get a nice smooth interpolation (do it more than I did in the below GIF to get a higher resolution curve).

To get the rounded edges you can use a Bevel modifier with the limit method set to Angle.  Play with the threshold angle and bevel amount to get the desired look you want.


Cannot see Texture and Shader option in Compositor I am new to blender. I saw in the tutorials to add shader and texture but don't seem to find any such thing after pressing shift + a.

The texture and shader options are only available in the shader node editor, whereas you are in the compositing editor:


Where can I find documentation for the Blender Game Engine? where to look documentation for the following?
getCurrentScene,hitPosition,worldPosition,and others?

The official Blender/BGE API

Check section Game Engine Modules specifically Game Logic (bge.logic)


Emission surface act like a down area light -- Not 360 degree This is a low-resolution rendering clearly showing that the NEON are lighting down instead of all around.  Something should be set differently ?  Something to try ?
The only difference between the 2 rendering (picture) beside the wall texture is that I needed to add more subdivision :  From 4 to 6.  Without these added subdivision, there were black spots in the final rendering.  However, the lighting was defective the same way.
The NEON are set up according to the tutorial of Blender Guru (Regarding NEON part 1 and 2).  I don't mind sharing any information.  I am just currently limited to 128 kbits/s for the next 5 days.

Here, the exact same rendering with another wall texture...  Exact same: Colour artefact because of the 95% JPEG Compression.

The way a surface responds to light depends on the direction that particular point on the surface is facing. The direction of a point on the surface is determined by the 'Normal' of that surface. The Normal can be determined either by the actual surface geometry or this can be overridden by your Normal Map.
In your particular case, the way the surface seems to be reacting to the light, the way the surface seems to be reacting to the light indicates that the normal is generally pointing 'up' and to the 'right' - ie, it's only responding to light from that direction. As this is different to the apparent geometry, this indicates a problem with the normal - especially since the problem goes away when rendering with a different wall texture.
There is a problem either with your Normal Map itself or with how you are connecting the Normal Map to your material's nodes (impossible to say without seeing either the normal map or the nodes).


Setting the Camera view So.. i am designing a GUI.. and I want the camera to point straight at the Rectangle\cube that I am working on so that when  I render the Cube is perfectly straight on sides\top\bottom..
In C4D I would add a camera then go to its coordinates and just zero out all rotation and voila.. when i render Its 'straight on'
How do i achieve this in Blender?
I am an absolute beginner.
TIA !

Use the numpad keys to get the (orthographic) view you want
Numpad 1 = front,
Numpad 3 = side,
Numpad 7 = top,
Numpad 9 = flip (ex: top becomes bottom).
To toggle orthographic and perspective view use  Numpad 5
When you have the correct side, press Ctrl+Alt+Numpad 0 to snap the camera to your viewport view.
To get more specific, select the camera and press N to bring up the tool menu where you can adjust values manually (such as distance).


Adding material to spheres sequentially using Python I have the following script, which I was hoping would add a basic red material to my spheres as they are sequentially created. Unfortunately, the script does not work, in the sense that no material is added to any sphere. Indeed, no spheres are created, but in the absence of "bpy.ops.material.new()" and "bpy.context.object.active_material.diffuse_color = (1, 0, 0)", the script produces spheres.

Could someone please help me tweak the script to make it function as desired?

import bpy, csv
fp = "C:/Blender/Spheres.csv"
with open( fp ) as csvfile:
    rdr = csv.reader(csvfile, delimiter=';')
    for i, row in enumerate( rdr ):
        if i == 0: continue # Skip column title
        # Generate UV sphere at x = row0, y = row1, z = row2, and radius = row3.
        bpy.ops.mesh.primitive_uv_sphere_add(size = float(row[3]), location = float(row[0]),float(row[1]),float(row[2])))
        bpy.ops.material.new()
        bpy.context.object.active_material.diffuse_color = (1, 0, 0)

A snippet of my CSV. spheres.csv

x;y;z;r
2.34;2.45;7.65;0.024
6.78;9.31;6.33;0.0467
3.36;8;1.04;0.3626

Since each sphere's material gets the same properties, I think it's a shame to create a new material for each sphere. Here's my solution, which:

Doesn't use an operator to create a new material, but rather calls a regular function bpy.data.materials.new(). This is faster, doesn't create unnecessary undo steps, and directly returns the material;
Uses next(rdr) to skip the first row, rather than using enumerate and checking the index each and every iteration;
Uses bpy.path.abspath to convert a blendfile-relative path to an absolute path that Python understands;
Separates data conversion from the strings obtained by the CSV reader to the floats you need for Blender;
Uses slice notation to shorten the b.o.m.primitive_uv_sphere_add call;
Follows PEP-8 for readability.

import csv

import bpy

# Create the material
try:
    mat = bpy.data.materials['Sphere']
except KeyError:
    mat = bpy.data.materials.new('Sphere')
mat.diffuse_color = (1, 0, 0)

fp = "//spheres.csv"
with open(bpy.path.abspath(fp)) as csvfile:
    rdr = csv.reader(csvfile, delimiter=';')
    next(rdr)  # Skip column title
    for row in rdr:
        # Generate UV sphere at x = row0, y = row1, z = row2, and radius = row3.
        data = [float(x) for x in row]
        bpy.ops.mesh.primitive_uv_sphere_add(location=data[0:3], size=data[3])
        bpy.ops.object.material_slot_add()
        bpy.context.object.material_slots[0].material = mat


Using an imported model: Why does my mesh look like this? I am using a purchased model, imported as an OBJ. In Blender Object and Render modes, I am seeing a mesh pattern I am not used to seeing on stuff I create myself:

Much of the model, in object mode, has a strange-looking waffle mesh, which affects the render as well as the solid view.  In Object properties, the max draw type is set to solid:

... And portions of the mesh appear in a mix of solid (like the area near the front and cockpit door) and waffle mesh.

I suspect I am about to learn something about Blender: Why does my mesh look and render like this?

Thanks
rg

EDIT : As requested, here is a small portion of the mesh:

The mesh imported did indeed use custom normals. The solution as posted worked perfectly:

You have Custom Split Normals Data added to the geometry, to fix this, while selecting the object, go to Data Tab in Properties Panel, scroll to find Geometry Data, and click Clear Custom Split Normals Data.
enter image description here
More information about this issue: Strange black shading. Cannot fully light mesh. (Cycles)


Use an object as a Driver variable I have a function for a driver that expects 2 objects as arguments, and I can't find a way to set the variable as the Object ID, only a single property of that object. Is that possible?

Using the depsgraph
Since the upgrade to 2.8 the depsgraph is a member of the locals of a driver, as are the variables.  See answer to
How to use different types of data blocks for driver variables?
re setting up a test driver.
As an example, driver is on "Cube".  The object "Lamp" is in scene, and passed as an evaluated object  to the driver via the depsgraph.  The depsgraph can also be used.

def test(*args, depsgraph=None, **kwargs):
    for arg in args:
        print(arg)
    print(depsgraph)
    return -1 # a simple val to indicate working

<bpy_struct, Object("Cube") at 0x7f62fcbefa08, evaluated>
<bpy_struct, Object("Lamp") at 0x7f62fcbf0008, evaluated>
<bpy_struct, Depsgraph at 0x7f62faba6c08>

An example to return minimum global z of all other objects in the depsgraph.  The method of @lemon can be used for the object names. Other options could be tagging them via custom property or name prefix suffix.
def test(self, *args, depsgraph=None, **kwargs):

    z = min(o.matrix_world.translation.z for o in depsgraph.objects
    if o != self)

    return z

Pointerproperties.
IMO the best way to associate an object(s) with another is via a pointer property
bpy.types.Object.driver_obj1 = bpy.props.PointerProperty(type=bpy.types.Object)

which can be assigned via script or UI.
context.object.driver_object1 = context.scene.objects.get("Lamp")


How to batch rename materials or auto assign them to the name of the texture file I'm currently working on porting a section of a world/map from one game to use in source filmmaker. I've managed to import the section I wanted and I'm stuck at a very slow and repetitive process.

What I have is dozens of objects (which I imported directly from my game), the material names were assigned based on the name of the object and the texture was set accordingly.

So lets say an object I imported is called chair, and this object has 3 materials or so. Each material will be named chair.001, chair.002, chair.003, etc etc. Now, the texture files/images are named correctly, lets say the textures are named chairwood chairclooth chairmetal or something of that sort. What I need is to be able to automatically merge the names of the materials with the textures they are assigned, so whatever the filename is the material is automatically changed to it. Several of the objects I have use the same texture file whilst having differently named materials, so you can see why its a royal pain.

Pretty much I need to know if I can do any of the following things with or or without existing addons/scripts or default tools in blender.
1) Can you select/batch multiple materials and rename them to all have the same name?
2) Convert/export textures to have them the same as the material?

I've included a imgur link of what I'm trying to explain, maybe it'll be easier to understand what I'm getting at
https://i.imgur.com/GXsb332.png

Using blender internal, the textures can be found in bpy.data.textures. By looping through this you can easily match the texture name to the image it has.

import bpy

for tex in bpy.data.textures:
    if tex.type == 'IMAGE':
        tex.name = tex.image.name

Usually the image name is its filename without extension, if you have image names with extensions, you can use os.path.splitext to remove the extension.

tex.name = os.path.splitext(tex.image.name)[0]


What is the correct python code for pressing "I" and selecting LocRotScale? I have already did a dummy test and all the rest of my code works. The only thing that fails is calling bpy.ops.anim.keyframe_insert_menu(type = 'LocRotScale'), which is what appears if you press I and doing it manually. The error I am getting is:

  File "D:\Blender\2.79\scripts\modules\bpy\ops.py", line 189, in
  call
      ret = op_call(self.idname_py(), None, kw) TypeError: Converting py args to operator properties:  enum "location" not found in
  ('Location', 'Rotation', 'Scaling', 'BUILTIN_KSI_LocRot',
  'LocRotScale', 'BUILTIN_KSI_LocScale', 'BUILTIN_KSI_RotScale',
  'BUILTIN_KSI_DeltaLocation', 'BUILTIN_KSI_DeltaRotation',
  'BUILTIN_KSI_DeltaScal)

The idea of my script is simple, there are 8 coordinates in a list that I want to loop through and apply each coordinate to a cube.

Pseudo code would be:

Frame_set the current frame on the timeline so starting frame would be at 0
I would take the coordinate[i] in the list and apply it to the cube
I would then key the location of the cube for animation
update the current_frame by =+ 4 each time. S0 frame 0, 4, 8... would be the keyframes.

All other steps works, if I comment out step number 3 I would see my cube moving from 1 location to the other, I just need to know how to key each location for animation!

My code is below:

current_frame = 0

for i in range( 0, len( selected_loc ) ): # selcted_loc contains 8 xyz vectors

    bpy.data.scenes["Scene"].frame_set( current_frame )
    moving_object.location = selected_loc[i] #moving_object is just a cube

    #bpy.ops.anim.keyframe_insert_menu(type = 'location') #line that fails

    current_frame += 4

You should avoid ops functions and use the object's attributes and method to achieve your goal. (Ops is slow and can even be context dependant.)

To insert a location keyframe, use the keyframe_insert method of bpy_structs with data_path parameter set to location.

Use the same method for scale, setting the data_path to scale.

In order to keyframe the rotation, you need to know the rotation mode. An objects rotation_mode can either be set to QUATERNION or EULER. The respective parameter values for the data_path parameter are rotation_quaternion or rotation_euler.

Below is a fully working example, given there is an object named Cube.

import bpy
import mathutils

selected_loc = [mathutils.Vector((x, 0, abs(x-5))) for x in range(8)]
moving_object = bpy.data.objects['Cube']

for i, loc in enumerate(selected_loc):
    bpy.data.scenes["Scene"].frame_set(i * 4 + 1)
    moving_object.location = loc
    moving_object.keyframe_insert(data_path = 'location')
    if moving_object.rotation_mode == "QUATERNION":
        moving_object.keyframe_insert(data_path = 'rotation_quaternion')
    else:
        moving_object.keyframe_insert(data_path = 'rotation_euler')
    moving_object.keyframe_insert(data_path = 'scale')


Default color for objects is blue. How do i change that? I installed config for blender and now my default color for objects is blue. How do i change that to standart blender color?

(This is assuming that the blue is not from an assigned  Material Base Color).

If your image is showing your model in edit mode then you can change the default face color in Preferences:

Edit > Preferences > Themes > 3D View > Face > play with color and Alpha values.

Edited to add:

Ok if its not modified in Preferences .........  in the 3D Viewport open the Viewport Shading panel  > Color and if its set to Random change to Material


Character model going crazy after parenting For this first post, I wand to detail a weird issue for my character model. I am new to IK rigs, and I just finished my character. The armature has absolutely no problem. After having parented the model to the armature with Automatic Weights, here's what it looks like.

Hovewer, as soon as I try to move a single leg, here is what happens :

The fist leg does not follow the IK bones, and the other leg stretches abnormally, and the chest follows the deformation. I have absolutely no clue what causes this. I could create a weight map, but my character's UV map has gone crazy too. Should I fix something using the IK parameters?

NOTE : I got several issues while mirroring the bones to the other side. The control bone was absent as I forgot to add .R at the end. I finally fixed this glitch. I think the problem is rather model-related, as the armature does not have any problem.

I can send the .blend file if you wish.

Thanks for your answers.

Thanks a lot for this answer! however, how can I correct the parentage?

P.S. I cannot modify it back to high-poly, because older versions of my model are gone. I will try to weight paint now.


How do I manually set the value of a custom EnumProperty in python? I have a custom enum property which defines the colour channels RGB, or RGBA depending on whether a flag in the addon preferences is enabled. Because the only way I could get this to work was to define the enum items dynamically using a function, I cannot set the default value of the enum. However, I'd really like to enable all the channels by default. Is there a way, and a sensible location in my addon's code that I can set the value of the enum after it has been registered and without requiring user interaction?

This is my EnumProperty:

active_channels = EnumProperty(
  name="Active Channels",
  options={'ENUM_FLAG'},
  items=channel_items,
  update=update_rgba,
  )

This is the function I'm using to populate it:

def channel_items(self, context):
  prefs = context.user_preferences.addons[__name__].preferences
  if prefs.alpha_support:
    return ((red_id, "R", ""), (green_id, "G", ""), (blue_id, "B", ""),(alpha_id, "A", ""))
  return ((red_id, "R", ""), (green_id, "G", ""), (blue_id, "B", ""))

Is there some way I can set the value of the enum in the addon's Panel code or on registration?

Check if a bpy.prop property has been initialized by looking at its custom property "data store".

Have a look at the Getter / Setter examples for bpy.props.  The ENUM_FLAG option enum property is saved internally as a custom property of the same name,  an integer, calculated from each item having an "internal id" of a power of 2 (aka bitwise). 1, 2, 4, 8...  The empty set set() 0, first only 1, first and second 1 | 2, and third 1 | 2 | 4 ...

As an example I've used the items method to show how to alter the data store (the custom property) only if it hasn't been already set.  I've used a scene bool to emulate the addon prefs boolean.

import bpy
from bpy.props import BoolProperty, EnumProperty

def channel_items(self, context):
    prefs = context.scene

    red_id, green_id, blue_id, alpha_id = (c for c in "rgba")
    items = [(red_id, "R", ""),
            (green_id, "G", ""),
            (blue_id, "B", "")]
    if prefs.alpha_support:
        items.append((alpha_id, "A", ""))

    if not self.get("active_channels"):
        self["active_channels"] = 1 | 2 | 4 #rgb
        if prefs.alpha_support:
            self["active_channels"] |= 8

    return items

def update_rgba(self, context):
    print("enum set", self.active_channels, "int", self["active_channels"])
    return None

active_channels = EnumProperty(
    name="Active Channels",
    options={'ENUM_FLAG'},
    items=channel_items,
    update=update_rgba,
)
bpy.types.Scene.active_channels = active_channels
bpy.types.Scene.alpha_support = BoolProperty(default=False)

Note the above will give all for empty selection, as well as the custom property not being set.  To check if bpy.prop is initialized would use

is_init = self.get("active_channels") is not None


Transparent render problem My transparent object show jungle?
Every time I make transparent object there is always a reflection of a jungle. why? how do I get normal transparent object?

In the  "Material Preview" viewport shading blender shows you the object and uses an internal environment map to light the scene.
In the Shading dropdown menu

you can choose which environment map to use

or you can choose to use the scene World

but in this last case you'll need to set the world properly in the node editor (or in the proporties panel).
You also need to have something around and behind the object to reflect/transmit it.


Blender game recording at the wrong time I have a simple animation for a midterm project; someone walks up and pushes dominoes over. I can set something with physics to knock the dominoes over at frame 125, then play the engine and he will walk up and push the dominoes up easy enough. When I record though, the animation will still show those things happening simultaneously, but the keyframes for the dominoes falling over are recorded at frame 270, a very long time after they're pushed over. How can I fix this?

If your issue is simply that all of your keyframes on the dominoes are starting too late, you can easily fix this by using the dope sheet. Select all of the keyframes in your scene by hitting A (or select just the ones you want by using box selection with B, or circle selection with C). Then simply move them closer to the beginning of your timeline. (shortcut would be G).


After merging objects: how to get rid of double faces? I have 2 objects. They have some edges and faces in common (but also some differences of course). I can merge these with ctrl+J. I can then do 'remove doubles' to remove the double vertices.

However, this way I end up with double faces and edges.

For example, I have a face of model A and an edge of model B. The edge of model B is in the same plane as the face of A and the edge of B also goes through the edges of the face of A.

I would like that the edge of B cuts the face of A and its edges, so that the edge of B becomes a part of the edges of the faces of A.
That way I can do further editing on the model.

A 'manual' fix is possible but then I'll have to it over 150 times which is a bit much.

So, is there a simpler automated way to do this in Blender? I've searched a bit around but I don't even know how it's supposed to be named, so all tips are welcome.

The end result will be a 3D-printed lens adapter for a vintage lens so the accuracy of the model is rather important.

Thanks in advance!

Update:
My goal is to merge the light and the dark blue parts.

The boolean operator seems to work fine with basic cubes, but it fails when using it with my more complex model. Depending on whether I set the normal of the dark blue ring on inside/outside it either doesn't work (throws error) or it gives a weird results with only around half of the faces shown. Looks a bit like This recent problem. I've applied scale and normals with ctrl+A and ctrl+N.

As I cannot obtain any good result with the boolean (starting from Blue Fox's file), I propose this editing approach.

The steps below are in the layer #15 of the blend file :

The objects are still separated. Open the faces to be merged.
Relocate the upper mesh and merge the two
Select the upper opposite edges and CtrlE and "bridge edge loops"
The same for the lower opposite edges
And the same for the last opened part, but without the extremities, because of the needed ngones at these extremities
Make faces for the extremities (select manually the vertices and face F)
Remove doubles

This is not a real answer of the question (more or less "how to make the boolean work"), but the job is done. No vertices were moved.

I have noticed these here :

Face centers with no face (maybe construction points ?), surrounded by O
A plane, is that printable (1) ?
And in (2), the inner faces overlap


How to have multiple animations in a blender file, with a multiobject mesh without a rig I have a turret that I have modeled and textured within a blender file. Now this turret is not a single object and is instead multiple objects. Some items are parented to eachother but in general the entire thing is optimized for use in a unity project. The big thing is there is no rig for the turret.
I want to animate the turret popping out of its box, popping back into its box, and firing each as a separate animation. Now I can try and make all of these things happen on one long timeline and do keyframing but splitting them up is useful for their planned export to unity.
Actions do not work, as even pushing them down to the NLA since they reference multiple objects and are pushed down into a single object means that animations will override each other in weird ways. And I can't seem to push down the animation to each object in the NLA without problems happening.
Is there a good way to have multiple compartmentalized animations for a rigless multiobject item within blender? Or is the best method to rig the object and use actions with the rig to animate the object?
If there is a silver bullet I am missing, I would love to know about it so I don't need to rig this turret. However if I simply just need to animate this with a rig I would be open to doing so but would prefer to have confirmation before I jump into that.
This is the file I am working with if you want to better understand my issues. https://drive.google.com/file/d/1gAJmtisM-I_U3U2GDuMYaz1t1gy-cVUv/view?usp=sharing

Using a rig is the best way, expecially for exporting to Unity. It lets you also join all the meshes into one and still be able to control each part individually with a serie of separate actions.
This kinds of rigs are very simple, just create in edit mode a bone for every piece, orient them in the same way as Unity's world coordinates for easier editing.
Establish any parent-child relation you need, and create a root bone which will be the parent of every other branch of bones.
Then select the mesh, shift select the armature, press Ctrl P and choose "with empty groups".
Then select the mesh, enter edit mode select all vertices of a piece (shortcut L), select the relevant vertex group/bone and click assign weight 1.0.
Repeat for every piece.
Don't use "with automatic weights", as the pieces are not supposed to deform.
Don't forget to Apply (Ctrl A) all transformations of mesh and armature before rigging.


Square - Octagon - Circle - Modelling puzzle I'm trying to make a rubber mat that is basically a big flat cube with lots of little holes (cells). It makes sense to me to model each cell and use an array modifier to construct the overall mat.

The problem I'm having is one i frequently run into in other areas too, which is how to add geometry as you go along without creating shading issues.

In this particular example, I need to go from a square outer edge (4 verts) to an octagon (8 Verts) into a circle ( I can get away with 16 verts). I've done this by a combination of extruding and subdividing, which works okay(ish) but generally creates shading and edge loop issues.

My question is - Is there a proper way to perform this kind of extrude and subdivide modelling? Or am I going about it the wrong way completely?

Many thanks in advance!

Sam

in my opinion you are going fine, remember that there are many ways to achieve what you want in Blender, so in this case I see two other possibilities.

Option one:

You can add the flat base geometry.

Select and erase these vertices

Add a mirror modifier like this

And then extrude

Option Two:

Use Boolean

Add a cube

Add a 8 vertices cylinder

Add a Boolean modifier to the cube like this

To look the cylinder in wireframe only, go to Object menu > Display > and set Maximum Draw Type to Wire

Repeat the previous steps with the other geometry, at the end you will have something like this

Now when you're ok with the look, just apply the modifiers and done.


How to create keyframes for Animation Nodes, which I can see in dope sheet? is there a way to create keyframes for Animation Nodes parameters, which are shown in Dope Sheet ?

Unfortunally it is currently a limitation in Blender that keyframes you set on properties of a custom node are not visible in the Dope Sheet.

I suggest you create a controller object in the 3d view that you can animate normally. Than you can use eg the x location of that object to control the procedual animation.

A benefit of this method is that you don't have to have the node editor open to change the value. You can simply move your controller object and see your animation adapting to that.

To get the x location of that object you need the Object Transforms Input and a Separate Vector node.


Why a mesh deforms when I apply Curve modifier? I need to move a mesh along a curve. I followed the steps in this tutorial: http://www.youtube.com/watch?v=4z0AD_iXr1I  because is very similiar to what I want to do, but when I apply the curve modifier my mesh deforms. These are the screenshots before and after:

Thanks for your help!

There are several problems:

The origins of the curve and the object need to be in the same place.
The cylinder is rotated slightly, try rotating it so that it is horizontal.
The curve is scaled and rotated. You can fix this by pressing CtrlA> Rotation & Scale with the curve selected.

Result:


How do I import 3rd party decal packs into decalMACHINE? Man this is frustrating. I've spent an entire day on this and wound up nowhere. I purchased some decal packs at blender market, but I can't figure out how to import them into decal machine. I read the answer to Decal Machine Decal import, but that was no help whatsoever. For one thing there is no "refresh" button in decalMachine's prefs. There's a "reload button" but that didn't do anything either. And although the person asking the question at least seemed to know what folder to copy things to, I'm just too dumb to know that. And sentences like "Accept. Open a file browser, Hold Shift to open the file, Alt to browse  containing directory" that pops up in decal machine's prefs when you hover over the import file button mean nothing to me. "Hold Shift to open the file"? WHAT file? Pack_2_png.zip? PSD.zip? Letters.zip? Which file? And what's this about "Alt to browse containing directory"? What does that even mean? Could someone please pretend you're talking to a four year old and tell me, step by step, how to preform the import once I'm in decalMACHINE's prefs (I at least know how to get to the prefs). But do NOT skip steps or assume I can understand terms that someone new to Blender might not understand. I would be eternally, and sincerely grateful. I'm using decalMACHINE 1.9.4

The folder that was referred in that question is the DecalMachine assets folder, which by default is on C:\Users\[username]\AppData\Roaming\Blender Foundation\Blender\[version]\scripts\addons\DECALmachine\assets\Decals\, or the one you've set under Assets on DecalMachine's preferences.
The folders with "uuid" files are your decals. You can either drop them to the "MyDecals" folder or make a separate folder under the path above.
It also took me a while to find this. Hope this helps!


Join curves with Python by color I'd like to group curves by color, so I'm try to join them together. I used an override from this solution. Everything works splendid inside Blender but in my external program I have

  AttributeError: 'ID' object has no attribute 'data'

This is function:

def curvegroup():
for crvobj in bpy.data.objects:
    if re.match(r'^curve', crvobj.data.name):
        crvs = []
        color = crvobj.active_material.diffuse_color
        for crvobjcol in bpy.data.objects:
            if re.match(r'^curve', crvobjcol.data.name):
                if (crvobjcol.active_material.diffuse_color == color):
                    crvs.append(crvobjcol)
        ctx = bpy.context.copy()
        ctx['active_object'] = crvs[0]
        ctx['selected_objects'] = crvs
        ctx['selected_editable_bases'] = [scene.object_bases[crv.name] for crv in crvs]
        bpy.ops.object.join(ctx)

I am not sure that I understand scene.object_bases so I really don't know why ID object is there and what cause this error.

Another method causes Error: EXCEPTION_ACCESS_VIOLATION

def curvegroup02():
for crvobj in bpy.context.scene.objects:
    bpy.ops.object.select_all(action='DESELECT')
    if re.match(r'^Curve', crvobj.name):
        scene.objects.active = crvobj
        color = crvobj.active_material.diffuse_color
        for crvobjcol in bpy.context.scene.objects:
            if re.match(r'^Curve', crvobjcol.data.name):
                if (crvobjcol.active_material.diffuse_color == color):
                    crvobjcol.select = True

        for selected in bpy.context.selected_objects:
            if selected.type == 'CURVE':
                if (bpy.ops.object.join.poll()):
                    bpy.ops.object.join()

I hope that this script may help you, just pick the curve that has the "guide" color and run the script.

import bpy
import mathutils

#set custom color

#color = mathutils.Color((1,0,0))

#or

#use active's object diffuse color

color = bpy.context.active_object.active_material.diffuse_color

for obj in bpy.data.objects:
    if obj.type == 'CURVE':
        curve = obj
        if curve.active_material.diffuse_color == color:
            curve.select = True
        else:
            curve.select = False

if (bpy.ops.object.join.poll()):
    bpy.ops.object.join()


How to have bone scaling only effective on one action? I have to scale a bone to cheat a bit just to have a more natural feel on one of my actions. But I found out that if I scale a bone in one of my actions, it will  be scaled in all my other actions.
Is there a way to have it not impact my other animations? If not, how can I work around this?

As i understand, All of your actions didn't have any Scaling Keyframes, so when you scale your bone, it apply effect to all actions.
So, all you need to do is go to action editor and add Normal Scaling Keyframes to your action before you Cheat on your actions.

Go to Dope Sheet, Select Ation Editor

Select Scaling in Active Keying set

Press I to add Normal Scaling Keyframe

Repeat to all of your actions


Shader turns black when connected to node group I have a project where I reuse the same material for multiple things.
So, I use node groups; saves a lot of trouble - at first!

Up to this problem I have with node groups:

In 1 you can see, that the logo (white text) is on a black background. This black background should be a node group (and certainly not black).

Here is the Logo Overlay node group:

If I put the node group "ultramarinblau" into the Logo Overlay node group, it does not work!

Only if I add the "ultramarinblau"-node group directly into the Logo Overlay node group, it works:

This behavior is not desired. I'd like to reuse my Logo Overlay node group multiple times with a different node group-input.

What am I doing wrong? Or could this be a limitation of Cycles node groups?

Any ideas are appreciated!

This is because you are plugging a Shader output (green) into a color input (yellow). See What is the meaning of the color of the node sockets in the node editor?

Instead you should add a shader input (green) to the "Logo Overlay" group. Doing this is a little complicated, as you currently can't directly set the socket type without some python. However, it is possible:

Enter the node group (↹ Tab)
Plug the placeholder output of the Group Input node (hollow) into any input socket of the desired type. In this case, green for shader:

Optionally rename the new input in the properties panel (N).

Once this is done, your setup should work.

I don't recommend putting the material output node inside a node group, as this could lead to confusion down the road depending on how the group is used. Instead you might want to plug the mix shader into a Group Output node, and plug the entire group node into the material output in the main node tree.


Save is broken and how to save as mp4? I saved a project, opened it later (solely using video editor, just compiling videos) and it does nothing. It plays, but no sound or video, but when I enter something new into it then it works. Also, how do I save my video as mp4?

In the VSE window, select an item, press N, press the folder icon and relocate your missing file. Do the same for every missing file.

These are the settings for saving as mp4, with H264 codec.


Obtain normal map from specific camera and transformation This may be a long shot, but after researching fruitlessly for about two weeks, I wanted to ask here in the hopes that someone who is a bit more knowledgeable about Blender and computer vision can assist me or at least point me in the right direction. The problem is, I would like to know how I can acquire the normal map specific to a camera and then transform it based on another camera.

The scenario is, let's say we have stereo cameras; Camera A and Camera B. We would then want to obtain the normal map A' that comes from transforming the normal map of a view point A (Camera A) to another view point B (Camera B). Then perform matching in two normal maps: A' and B, similar to SURF or SIFT for finding the correspondences between these two normal maps.

The limitations I have encountered are:
1) How to acquire the normal map (camera specific) without baking?
2) How to transform that normal map (once acquired) to Camera B?

I assume using opencv to find the correspondences between the two normal maps would be the easiest part, so these two questions are most important for me at the moment. Also tips on how to apply this in cycles/Sverchok would also be very much appreciated.

In Cycles, the Normal pass can be enabled in the render by enabling the Normal pass in the Render Layer properties - however, this is in World coordinates, not Camera coordinates. To convert the Normal into Camera space we can use the Vector Transform node. This isn't possible with the actual Normal render pass but we can add an additional Render Layer and configure that to generate the "camera-space normal" render.

In order to do this we first need to create a material which will generate the normal in camera space. This can be achieved with the following nodes :

This takes the geometry Normal (in World space) and transforms it into Camera space via the Vector Transform node (notice how it's set to 'Normal' mode, with World to Camera). This then drives the Emission Shader node to generate the output.

In order to generate this as an additional pass for the whole scene we need to add a Render Layer and set its Material Override to the new material shown above - so that all objects are rendered with this material.

The output of that Render Layer will now be available in the compositor and represents the Normal In Camera Space.

This can then be repeated for both cameras (you can actually use Render Layer 'Views' set to Multi-view to render both cameras automatically).

In order to transform the result into the opposite camera space we need to apply a transform to the generated normal to rotate by the difference in angle between the cameras. For this I've made an assumption that you already know the angular difference between the cameras and that the rotation is purely in the horizontal direction of both cameras - ie, in the same way our eyes in the same horizontal plane.

For this we can simply rotate by the specified angle around the Y axis using some vector maths :

Here we're transforming the R element (x-axis) to cos(angle)*R+sin(angle)*B and the B element (z-axis) to -sin(angle)*R+cos(angle)*B - effectively a rotation matrix - and leaving G (y-axis) unchanged. Set the Value node to the angle of rotation (the angle between your cameras) - in Radians.

This can produce the following result (slightly different to the unrotated result) :

Blend file included


Problem while exporting .svg file in blender When attempting to export an SVG out of blender, I get this error:

The line that says "DLL load failed: %1 is not a valid Win32 application" gives a clue. You can find it documented at https://docs.blender.org/manual/en/dev/troubleshooting/python.html#mixed-python-libraries-dll-s

A simple fix is to delete or rename "C:\Users\\AppData\Roaming\Blender Foundation\Blender\2.79" and restart Blender. Then you will need to reinstall or re-enable all your addons.


Select Dynotopo field and check it as true I would like to select the dynotopo and place a check into the field, yet I can only find a toggle script. bpy.ops.sculpt.dynamic_topology_toggle()
I'm not sure where I am going wrong. All other sculpt options seem to work.

All objects have the use_dynamic_topology_sculpting property, which allows you to check whether or not dynamic topology is activated. Therefore your script could look like this:

import bpy

active_object = bpy.context.view_layer.objects.active

if active_object.mode == "SCULPT" and not active_object.use_dynamic_topology_sculpting:
    bpy.ops.sculpt.dynamic_topology_toggle()


Blender red material and transparent My mesh is red and transparent, I do not know what to do to return it to the normal state

Your viewport material's alpha is not set to 1, that's why your object is semi-transparent. Click on the Color field and set the Alpha to 1.

The red color might come from backfaces. You can either recalculate normals with SHIFT + N or deactivate it in the overlays :


How can i join vertex of the same bezier? I have to complete a 3d job and I think that for this piece it is best to use bezier or curves. I am a little novice with these tools and I can't find a way to draw "a bridge" between some vertices.

I tried with the F key but it does not let me connect them and it is not enough just to join 2 but it would have to be 4: (with the photos I hope that I understand better).

The piece is somewhat complex and I only manage to do it on the one side. My idea is to avoid  polygonal modeling as much as possible.

You can only make a cyclic curve, there is no way to join it multiple times as far as I know.


Clipping through stl file of porous material I've an .stl file of a cube of a porous material. The material is basically many overlapping spheres. Since I imported it as an .stl file, it is one object to blender.

I want to have an animation, that clips through the material. Can anyone help?

I tried using outside lamps and camera clip, but then the inside is not illuminated. Also, once a sphere is "cut open" by the clipping, you can see through it. I don't want that. Solidify doesn't do the job, because the spheres have different radi.

I also tried using a mixed shader with emission/diffuse and light path, so the spheres would illumiate each other, but that doesn't work, because the whole strucutre is one object to blender.

You will want to use a boolean modifier.  Start by adding a cube that overlaps with your object.  Select your object, go to the modifiers tab, and add a boolean modifier.  Set the target object to be your cube, and select 'difference' as your operation.

Before modifier:

After modifier:

In this screen shot I've set the cube draw type to wire so you can see what the modifier does.  You could simply move the cube to a different layer.


How can I get the scene polycount in python? Is there any access in the python API to get the total scene (or object) polygon count?
This info is already displayed in the status bar, but is this info exposed in the python API or do I need to manually loop through all objects and count the faces?

OK twitter to the rescue!
Here's my solution:
bpy.context.scene.statistics(bpy.context.view_layer) gets you the same string as shown in the status bar, so to get the triangle count this just needs to be parsed:
s = bpy.context.scene.statistics(bpy.context.view_layer)
tris = int(s.split("Tris:")[1].split(' ')[0].replace(',', ''))

This is obviously dependent on the view, so it only includes the visible objects in the current view layer.
If you only want to know the tris of a specific object you can hide everything else or just enter edit mode.


Why am I getting these strange artifacts when importing an MDD file? So, I'm trying to import a .mdd animation from C4D to Blender.

What it should look like:

What I'm getting:
The animation is here, but the normals are messed up.

Strange artifacts:

The .mdd was imported using mesh deformer. Any idea why this is happening?

The user M.O.Z.G on render.ru has solved this problem for us.


Browse for an Image and assign it as a texture in python? I'm creating an addon for browsing for an image and creating a texture from it.

I could get Image path from the user but I stuck in how to apply the image to the object as a texture.

In original Blender The images disappear from the preview if it's misplaced, renamed, or deleted after texturing the object. See image one. After browsing  to that image, Once again its come back in Blender. See image two.
Here is my code:

bpy.types.Scene.MyPath = StringProperty(name="Browse Image:",
   attr="custompath",# this a variable that will set or get from the scene
   description="simple file path",
   maxlen= 1024,
   subtype='FILE_PATH',
   default= "")#this set the text

class TexturePanel(Panel):
   .
   .
   .
   .
   self.layout.prop(context.scene, 'MyPath') # creates Browser in panel
   .
   .
   .
   .

See the Image two left side of the blender marked in blue color for browsing to the image.

How to apply this? Or how can we texture in Python?

one

two

You could use a callback to detect changes to the filepath field:

def update_texture(self, context):
    print("New image:", self.MyPath)

bpy.types.Scene.MyPath = StringProperty(name="Browse Image:",
   attr="custompath",# this a variable that will set or get from the scene
   description="simple file path",
   maxlen= 1024,
   subtype='FILE_PATH',
   default= "",
   update=update_texture) # callback

In that callback, you would texture the mesh. It really depends on your situation how to go from here, since there could be UV mapping or Cycles textures.

In case of a mesh with UV mapping, note the difference between

bpy.context.object.data.polygons[#].material_index, which tells you the # of the material (ob.data.materials[#])
and the image assigned to a face for UV mapping (ob.data.uv_textures.active.data[poly#].image).

You may wanna add a new material to the mesh object:
ob.data.materials.append(mat), which you need to create beforehand: mat = bpy.data.materials.new(...)

Or use an existing material?

Active material slot's material: ob.active_material

First slot's material (if there is one):

try:
    slot1 = ob.material_slots[0]
except KeyError:
    return
mat = slot1.material
if mat is not None:
    # there is a mat in first slow and it has a material

You can load your image from filepath as image datablock and assign it for UV mapped meshes to uv_textures...image, or figure out the index and assign to Polygon.material_index (or both).

Find the index e.g. like:

def material_index(me, material):
    for i, mat in enumerate(me.materials):
        if mat == material:
            return i
    else:
        return None # or -1 or 0??

You may wanna look at the code of the Material Utils addon, which transfers material assignments from Polygon.material_index to UV editor (uv_textures...image) or the other way around.