Custom Properties value in Animation Nodes I'd like to directly control custom properties of my empties and bones in Animation Nodes tree, to avoid location, scale and rotation manipulation. "Object Attribute Input" doesn't work, even after using copy data path.

My workaround is to create empty with scale controlled by custom properties, and this scale attribute is used in Animation Nodes tree, but I hope, I can do it .

You can use expression node to control property of object. Use ctrl+shift+alt+c on a property to get code. use that code inside expression node to get or set the data.

For example an object Empty has two custom properties A and B. We can get value of A
using bpy.data.objects["Empty"]["A"]. Similarly we can set value to B using bpy.data.objects["Empty"]["B"]=x where x is the data we provide.

Or you can replace the object name and property name by,


Bake texture problem As you can see in the image, after the bake was complete, some of the faces of my 3d object looks full in black, but you can see in the 3dview that faces have an texture on it. Any idea why this is happening?

Im a new user of blender, so for sure im doing something wrong.

Thanks.

Sometimes, while modeling, you get normals that are inverted. This can happen especially when working with the boolean modifier and other functions, where Blender isn't sure that you want to have the normals recalculated.

By going into edit mode, selecting all your vertices with a, and pressing ctrl + n, Blender attempts to make all of your normals point "outward" from what it thinks the inside of your model is. You can also go to through the menus: Mesh -> Normals -> Recalculate Outside.

I'm pretty sure that the texture will only appear on the "outside" of the mesh, which is why after you baked it, some parts where black and not rendering correctly.


Curve after Array modifier messes object dimensions ROAD_ARRAY_before:

ROAD_ARRAY_after:

There is no way I can make a Curve Modifier after an Array Modifier behave. Object dimensions are completely messed up, which makes the creation of an exactly scaled object impossible.

Of the two blend-files attached, in the ROAD_ARRAY_before file, you will see that I have created a Path curve (NurbsPath) of length 100 m, which I have edited so that is swerves a bit towards the negative Y axis (down, as seen in a Top Ortho view). I have also created a 10x10 m plane, which I have duplicated 10 times along the X axis using an Array Modifier. Please notice that the dimensions of the plane array are 100 m length along the X axis, and 10 m width along the Y axis.

In the other blend-file, ROAD_ARRAY_after, I have added a Curve Modifier after the Array, in order to have the arrayed plane follow the curve. As you may see (preferably in a Top Ortho view), the plane object has been deformed (arbitrarily?) to a width of 144.818 m (along the Y axis)!

(I should mention that I was careful to apply rotation and scale during all operations, so that they are set at 0 and 1 correspondingly).

Any attempts to change the dimensions of the plane array to an array of 10 m width (along the Y axis) are futile from now on, as you may confirm by trying either to change the dimensions in object mode or scale the object in edit mode. Scaling in object mode manages to reduce the width of the object to an approximate 10 m, but the reported units of the Y-axis are completely wrong.

Am I missing something, or is there a bug in the combination of Array with Curve modifiers? Similar issues appear to be reported on the web, along with assertions that the behavior of these modifiers has been corrected in current versions of Blender. Not so, as far as I can tell.

Any feedback would be greatly appreciated. Such precise dimensioning is very useful in my work (3D modeling of transportation networks, in the context of Environmental Impact Assessment).

The radius of the control points of the curve are 14. Set them to 1.


Add Solidify Modifier to a plane with a different image on each side I have a plane with an image on each side. The shader uses a Geometry node with Backfacing. I want to give the plane a little thickness and I tried that by using a Solidify Modifier which did give the plane thickness. The issue I have is then both sides of the plan use the same image and I need to have different images on each plane.
How it should look

With Modifier

Material Nodes

When you use the solidify modifier, you are giving the object "faces" with their normals pointed outwards. This means that in the new "box" you create, all the "backfacing" faces are facing the inside (so you cant see them). You can either apply the modifier and add a different material for the different faces (as desired), or you could select the face you want to be different and flip the normals on it.


Python: Placing objects around a spheres surface with proper rotation i have a script to duplicate an object, and place the duplicates at random coordinates around a spheres surface, and then point those objects away from the center of the sphere. It almost works but the calculation for the rotation of the objects is off by just enough for it to not look good at all.

I've search a lot for what i am doing wrong, but the very few solutions I've found are very out of date.

Here is my code, assumes sphere is at 0,0,0 world coordinates:

def PlaceSpike():
    worldLocation = Vector((0.0,0.0,0.0))

    radius = 2.4

    latDeg = randint(0, 360)

    lonDeg = randint(0, 360)

    scale = 0.1

    #Create new object to be used
    pin = DuplicatePin( 'Spike', bpy.data.objects['Cone'], bpy.data.materials['pin'], 'Diffuse BSDF', Color((1.0,0.0,0.0)))

    latRad, lonRad = radians( latDeg ), radians( lonDeg )

    x = cos( latRad ) * cos( lonRad )
    y = cos( latRad ) * sin( lonRad )
    z = sin( latRad )

    location = Vector((x, y, z)) * radius

    locationFromWorld = location + worldLocation
    scale3D = (scale, scale, scale)

    aroundZ = Quaternion( (0, 0, 1), lonRad )
    aroundY = Vector( (0, -1, 0) )
    aroundY.rotate( aroundZ )
    aroundX = Quaternion( aroundY, latRad )

    rotation = Quaternion( baseRotationQuat )
    rotation.rotate( aroundZ )
    rotation.rotate( aroundX )

    pin.scale = scale3D
    pin.location = location
    pin.rotation_euler = rotation.to_euler( 'XYZ' )

for x in range(10):
    PlaceSpike()

Here is what it looks like:

I'm having a very hard time figuring out what to do, I'm not even sure anymore if i am doing it the right way and would appreciate the help, thank you.

You can use Euler rotations (as they usually are in the UI).

The trick is to know from what these rotations will start, considering your coordinate system (longitude, latitude).

Longitute starts along the X axis.
Latitude around Z.

Also, Blender rotations are clockwise, so you need to minus the latRad (as math convention is counter clockwise).

So, from the image in your question, as the spike is up, you need to place it along X rotating 90 around Y and remove the latRad.

x = cos( latRad ) * cos( lonRad )
y = cos( latRad ) * sin( lonRad )
z = sin( latRad )

location = Vector((x, y, z)) * radius

locationFromWorld = location + worldLocation
scale3D = (scale, scale, scale)

pin.scale = scale3D
pin.location = location

pin.rotation_euler = Euler((0,(pi / 2)-latRad,lonRad)) # << Euler rotation from the given angles


Does Blender have a method to a get PNG-formatted bytearray for an image via Python? In Blender's Python, I can get the raw bytes that make up an image into a bytearray, like so:

    image = bpy.data.images[0]  # Pick any valid image you like.
    pixels = bytearray([int(p * 255) for p in image.pixels])

But, instead of raw pixel data, I would like to get a bytearray containing all the bytes of a PNG-format image.  This can be compressed or uncompressed PNG, but I need the bytes to represent a valid PNG format as if for saving to a file, not raw pixel data.  Ideally I'd like to get these bytes without actually saving them to disk, and without modifying the user's image if possible (for example they may think the image is a JPG or something).  How can I do this?  Does Blender have a PNG data format helper function that I could use without disturbing the user's image?  If not, is there a code snippet that will convert Blender's internal image representation to PNG format?

I got this working based on Python code from Stack Overflow here.

Here's the version of that code adapted to work inside stock Blender 2.77a:

import base64
import zlib
import struct

def img_to_png(blender_image):
    width = blender_image.size[0]
    height = blender_image.size[1]
    buf = bytearray([int(p * 255) for p in blender_image.pixels])

    # reverse the vertical line order and add null bytes at the start
    width_byte_4 = width * 4
    raw_data = b''.join(b'\x00' + buf[span:span + width_byte_4]
                        for span in range((height - 1) * width_byte_4, -1, - width_byte_4))

    def png_pack(png_tag, data):
        chunk_head = png_tag + data
        return (struct.pack("!I", len(data)) +
                chunk_head +
                struct.pack("!I", 0xFFFFFFFF & zlib.crc32(chunk_head)))

    png_bytes = b''.join([
        b'\x89PNG\r\n\x1a\n',
        png_pack(b'IHDR', struct.pack("!2I5B", width, height, 8, 6, 0, 0, 0)),
        png_pack(b'IDAT', zlib.compress(raw_data, 9)),
        png_pack(b'IEND', b'')])

    return 'data:image/png;base64,' + base64.b64encode(png_bytes).decode()

Example usage:

print(img_to_png(bpy.data.images[0]))

This will print out a PNG-format data-URI of the image, regardless of what format the image is within Blender, and without altering the user's image.  I suggest using a very small image to test with, so the test output is not overwhelming when printed to the console.


Appearance and disappearance of an object in an animation My question is: how do I make an object (or any other thing, force field in my case) appear in a scene at the certain time during the animation, affect the soft body, and then disappear? Thank you (Note that I don't mean that the objects just visually appear and disappear, but, uhhh... disappear completely with all their properties and effects on other objects).

You can set the transparency of the object to none in the object material panel and keyframe it. Then turn transparency to full in another part of the timeline and keyframe it.


Blender fluid on animated mesh problem My task is to make character out of water. The goal is to make it look like its emiting very little fluid and slowly drip to the ground while running. To do that I need to emit fluid from an animated by armature mesh. I know it is possible to fluid sim follow animated mesh via Export Animated Mesh option however when I tick that fluid starts to emit like crazy instead of gently dripping from the mesh. This is very annoying. Does anybody knows any workaround or way to fix that?

this is what I want to achieve (on animated mesh)

This is what I really get

The first one was non-deformed mesh with Inflow Local Coordinates

The second one was deformed mesh with Export Animated Mesh

Thanks for any help!

I don't know exactly why your mesh is emitting as much fluid. First of all try to apply scale: CTRL+A > Scale.

And for full control over dripping you can use Speed value under Domain settings. Also you can change Viscosity preset to Honey/Oil, drips will be "heavier" thus slower.


Why is blender using so few resources Right now I am doing the final render on my light-saber and previously when I would render objects with around 1000-3000 samples depending on the complexity it would take maybe an hour but now blender says it will take 69 HOURS to render this light saber and only uses 2000 samples. My system hardware consists of a GTX 970, 16 GB of RAM and an Intel i7-4790k CPU running currently at 4.5 GHZ .I am just very confused why on the render it says that it is only using around 18.37mg of ram when I have 16 GIGABYTES. I've set blender to high priority in Windows Task Manager and im just confused on why its using so little resources and why is it taking so long to render everything.

Fixing this should be a matter of setting the sampling back to 2000.  I think you accidentally put in 4,000,000 instead.  It is possible that you have "Square sampling" selected.


Modeling question, tiki torch. I had an idea strike me the other night of modeling an exterior scene, which I know how to model except for the tiki torches. I tried the cast modifier and it does not work well, at least not with a grid object set to x=8, y=8. I can work out everything that would run the z axis, but the mesh that would weave between the "fingers" of the z axis going across the x axis (while in front ortho), I'm not sure how to achieve the correct affect. I've included a reference photo from the yard to help clarify if there is any misunderstanding. I want to "weave" my mesh along the x axis between the adjoining objects if it's possible.

This could all be done with curves.

Starting with a circle curve

Then add another curve for the vertical elements, give it some extrusion.

Make an array and use a curve modefier to guide the array around the circle curve.

Create another circle, subdivide it and weave it around the verical elements.

Duplicate that curve and rotate it to create the torch.


How do I get a particle system to generate meshes for polygon hair? I've been searching for an answer for quite a long time now but I haven't found the solution yet.. My problem is that I'd like to use Cycles' hair particle system to generate meshes (in my case planes, which have fur textures on them) instead of Blender's hair thingy.

I'm trying to optimize my mesh as much as I can, because it's going to be used in a game engine.

So what I'm trying to achieve is kinda something like this in this video: https://www.youtube.com/watch?v=6Wi4-fdeYyM

Thank you in advance for your help!

I've been playing around and it looks like my previous thoughts were taking me to the right direction, except I forgot to do something.

Like Gliderman said, creating a group out of multiple hair textures works, and even if you just add them as an object.

By doing this, and the reason why I was so unsure in my steps is because when you add them you get something like this, instead of the nice hair.

What you have to do this, play around with the velocity (ye right, this is so trivial, but somehow so managable to not be cared of..).

After turning up velocity's Emitter Object's values, you get closer to your desired results:


Why is this bake wrong on one side of the X axis? I'm trying to bake down some textures for use in a different engine.  I've got a problem I haven't seen before.

I'm showing a rendered preview so you can see it's not the mat nodes, and a textured preview so you can see that the bake is completely wrong on one side, and one side only, of the face.

Things I've already checked:

It is all one object.  The object has no modifiers.  There is no UV overlap.  Other than the boundaries for the eyes, mouth, and neck, and the fact that the eyelashes and eyebrows are separate meshes, the mesh is manifold (ie, normals are all continuous and facing the correct direction.)  The model has smooth shading, with autosmooth disabled.  I've cleared custom normals.  Rotation/scale/location have all been applied.

The only clue I have is that it warns me that there is no active image for one (unimportant, not really shown here) material, even though that material definitely does have an image texture, referring to the image, as the active selection.

What else can I check here?  http://www.mediafire.com/file/ucj6r1fqypr7dou/bakesFace2.blend/file is the file, although sorry, it is pretty large.

Edit: I've resolved this issue-- I thought, "hey, I should probably stitch those UV halves together" and lo and behold, afterwards, it baked right.  But still interested in why this occurred.

I guess you didn't select the good UV Map in the Data panel, i.e. the one that has been used in the Node Editor for your face material, as you can see on this screenshot:


Clothes on character deform when posing I've been trying to rig this character I made, but his sleeves keep clipping into his arms. I tried using the weight paint with no luck, although I'm new to blender so I'm probably just not doing it right. If anyone could take a look and help me, it'd be greatly appreciated!

File download:
https://drive.google.com/file/d/1pwAWNtHNoZQqR0a16x20eeXyXb78do0y/view?usp=sharing

Unfortunally there's a bit less Information in your question and - AFAIS - not any object in your uploaded file?
So a real general answer...

If you are starting with parenting, maybe you're looking for Parenting with armatures?
Creating Bones for Rigging in Blender

Maybe the problem is cutting in cloths in ellbow and popliteal?
Then IMHO the better solution is using Cloth physics.
A workaround will be using additional bones for sensitive parts.

You can learn much about using weight paint on different bones, if you import a Make Human character (I'm using collada to import) and study the dependicies...

I hope it helps.


How to disable confirmation dialogs for simple operations I have just started using Blender (for video editing), and I have run into one thing that just drives me crazy.

Whenever I try to do even the most trivial operation, there is a popup asking to confirm that I want to do it. There is no purpose for this, as there is an undo feature, and it is a constant annoyance.

Is it possible to disable this feature? If so, how?

About the save confirmation you could try this addon Simple Carnival Save File No Confirmation


Part of the Interface disappeared while I was sculpting today a part of my interface disappeared while accidentally hitting a key combination I don't remember. The interface only changed in Sculpting mode and it only changed in this project, it's back to normal when I open a new project. Is there a way to fix this?

I think you pressed CTRL + SPACE. The shortcut maximizes the view of the window you are hovering over.

Note : If you emulate a 3-button mouse, the shortcut is ALT +  CTRL + SPACE.

Press this combination again to go back to normal.


Using a hint/information-bar like the trasformations are using The transformation-operators of blender are showing some hints/informations on the header of the 3D-View. This hints/informations are replacing the default layout-elements of the header (template_header(), VIEW3D_MT_editor_menus, template_header_3D(), …). I want to use this bar in my operators. But i can't find any information about this bar.

Does someone know how to uses this bar?
If not: Does someone know how this bar is named, so that i maybe can find the solution in the startup-scripts / blender c-code?

I might could prepend a very long label to VIEW3D_HT_header and remove it after executing/aborting the operator. But this seams to me like a messy workaround.

Thanks.

You do this by using Area.header_text_set()

Here is an example using the Modal Operator template:

import bpy
from bpy.props import IntProperty, FloatProperty

class ModalOperator(bpy.types.Operator):
    """Move an object with the mouse, example"""
    bl_idname = "object.modal_operator"
    bl_label = "Simple Modal Operator"

    first_mouse_x = IntProperty()
    first_value = FloatProperty()

    def modal(self, context, event):
        context.area.header_text_set("Well see? Its working...") #add text to header
        if event.type == 'MOUSEMOVE':
            delta = self.first_mouse_x - event.mouse_x
            context.object.location.x = self.first_value + delta * 0.01

        elif event.type == 'LEFTMOUSE':
            context.area.header_text_set() #on confirm restore header to default
            return {'FINISHED'}

        elif event.type in {'RIGHTMOUSE', 'ESC'}:
            context.object.location.x = self.first_value
            context.area.header_text_set() #on exit restore header to default
            return {'CANCELLED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        if context.object:
            self.first_mouse_x = event.mouse_x
            self.first_value = context.object.location.x

            context.window_manager.modal_handler_add(self)
            return {'RUNNING_MODAL'}
        else:
            self.report({'WARNING'}, "No active object, could not finish")
            return {'CANCELLED'}

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

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

if __name__ == "__main__":
    register()

Note that using header_text_set without an argument restores the header to default.


How can i create a 3d curve/saddle shape? I have tried and failed to use the Bezier Curve tool to create a 3D saddle shape only managing to bend a plane in one direction.

Is this the best way to do so and how should I go about doing it?

This is the shape i'm trying to create:

Thanks

Bezier curves are not the proper tool for this, curves are useful mainly for extrusion based geometries, or sections-swept-along-paths shapes.

NURBS surfaces may be closer to what you need, though they will require some considerable manual modeling work, and they are a half-baked tool in Blender that wont help much.

You may also model this manually using meshes and subdivisions, but again will require a lot of manual modelling and not necessarily yield a mathematically accurate surface.

The best way to model such thing is using the builtin addon Add Mesh: Extra Objects Python script

Start by opening File > User Preferences > Addons then search for Extra and activate the Add Mesh: Extra Objects addon.

Then in the 3D View press Shift+A > Add > Mesh > Math Function > Z Math Function

According to Wikipedia the mathematical function for a simple Saddle Point surface is Z = X^2 - Y^2 so in the operator properties change the input formula to the desired function using Python notation which should be (x**2 - Y**2)


'Edit Edge Flow' equivalent in Blender? I'm a professional Maya user that switched to Blender less then a year ago.
The "only" thing I really struggle with is the command "edit edge flow" that most 3d software have.

Here's an expample in modo: https://www.youtube.com/watch?v=I-4_U8ceIqM

Essentially, I think the tool works by looking at the average of the normals and adapting the edges or vertices to the area flow.

Something similar is the smooth vertex, but it doesnt smooth the vertex, it pushes the vertices in a way that follow the area flow:

If we take this as an example, let's imagine we remove the 3rd dot. If we then add back a dot, its position would be changed and placed into a straight line, breaking the flow. With the command "edit edge flow" on that point, we would have the position back to normal. This would work both on an area or on a single point.

For your specific example Subdivide Smooth seems to be the answer.

For everything else there is Smooth Vertex that you already know or perhaps Laplacian Smooth, if you need finer control over mesh volume.


beveling 2D cutout shapes not working as expected I have a picture I am trying to 3D print a copy of.

First I took a picture, then I converted it to an svg and loaded it in tinkercad. Then after some failed fiddling I saved the file as an stl and loaded it in meshmixer. From there I cleaned it up and selected each part of the image and raised the edges up to give them some depth.

After a test print I felt it needed smoother edges, so I downloaded blender to try beveling it. After I figured out how to import and move it, I selected all of the faces on a single section (colors) and hit bevel. I'm not sure what happened but I can't get the edges to round out at all, it seems to just want to focus on a few points at intersections and move them about.

What am I doing wrong? I am VERY new to 3D modeling and learning as I go, so be warned that I don't know much of the terminology.

Practice on some geometry that isn't this scene first, to get the hang of how bevel works and how to select the right geometry quickly. Bevel doesn't magically know what you want to bevel, you probably want to select the edges to get the right kind of bevel.

This is what you'd get if you bevelled using faces, it's probably not what you want:

But this is the bevel with edges:


Smooth icon, left bar 2.8. Doesn´t work like 2.7 Iam getting back to blender after some years (I was just modelling ocasionally for simple figures, getting back again).

I used to use "smooth vertex" on 2.7 to make cleaner and flatter faces on the mesh as I was modelling, It helped to maintain from the beginning a nice model for 3d print, or clean faces in any ways. The "smoothed" vertex located into a better position if required.

Now I can see the "smooth" icon on the left but I can´t select it. :(

What am I missing?

Select the wanted vertices.

Select the smooth button on the left.

Then left click on the 3D view and drag the mouse left or right.

Additionally, the operator panel allows to set the smooth value manually.

Note: a long click on the smooth icon makes appear another operator which is 'randomize vertices'.


Change object pivot point orientation For some reason the pivot point on my object has become rotated (other objects show normally oriented pivot points). I have to set the "transformation orientation" (see the bottom of my screenshot) to be able to see it though. Does anyone know how to change it back? That is, change it to be aligned with the "world orientation".

This is intended behavior, if you are using Local Coordinates the transform gizmo orients itself to match the object local coordinates.

If the object is rotated so is the pivot, to match the objects orientation.

Either clear the object's rotation if it is not wanted (Alt+R), apply it so it becomes part of the object geometry (Ctrl+A), or use Global Orientation instead.


Can threading.event be used as an event in an modal operator? I am trying to use the event from a thread as an event in a modal operator, is this possible using the bpy.types.Event somehow?

Or do I have to set a timer and check if the event is true?

No, there's no way to pass it to the operator's modal method, so you can't mix both event types. Using a Timer is a better option.


Hide panels with python How to hide panels with python? I want to make quick hiding for better viewing.

Here is what I want to hide:

Currently the Python API can't handle opening and closing panels (it's not exposed).

Related: Is it possible to expand/collapes all panels in a region with a keystroke or shortcut?

The only thing you can do with python is to toggle by calling operators:

bpy.ops.view3d.properties()
bpy.ops.view3d.toolshelf()

They need the right context though, so they need to be called from the 3dview area or the context needs to be overwritten. This will toggle all panels in all 3d_views inside window:

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        context_copy = bpy.context.copy()
        context_copy['area'] = area
        bpy.ops.view3d.properties(context_copy)
        bpy.ops.view3d.toolshelf(context_copy)


Grayed out object in the Scene Collection For some reason, one of my two light objects has become gray and no longer appears in the scene.  It has XYZ coordinates, but when I look for it I don't see it.  How can I "un-gray" it so that it becomes usable again?

Click this little Funnel icon in your browser to open the Filter setting,

see if this Icon is on or off. You probably set the light to be Invisible in the viewport, i.e. the Monitor Symbol, and then reset the filters to just show the icons for visibility, i.e. the Eye.


Text does not stay center aligned in game engine My text is aligned at right in the game engine even if I aligned it at center.

Here is my text:

These are the properties:

And when the game is launched, it is aligned to right.

One obvious thing would be to convert it to a mesh. I recommend you keep a copy of the original object. Select your text in object mode, then hit Alt+C, and convert the text to a curve, then hit Alt+C again to convert the curve to a mesh.


How best to create angular pipes for a set? I want to create a set of pipes in a modular manner that can fit together later like this image:

I was wondering how someone would best approach this. I would more importantly like to know how to create 45 degree extrusions without guessing like I normally do with these types of things... thanks :)

Making the straight pipes is easy my main concern is making the angled ones, and later on they are not "just right", and things don't fit together so well later..

You don't say what version of Blender you are using, but for a number of versions, Blender has included an add-on that produces several types of pipe joints: elbows, Y-joints, T-joints, C-joints, and N-joints. In versions up through 2.72, this add-on had to be explicitly activated in the add-ons tab of the User Preferences, but since 2.73, the add on has been activated by default. So you may not need to create a new set of pipes. To modify a pipe, see my answer to question 33692

Otherwise, this question appears to be a duplicate of question 27386. One aspect, though, about your image that is not referenced in either the question, or my answer, is flanges on the pipes. Upon some consideration, my personal approach to the flanges on straight pipes would be to model the cylinder, and where I wanted a flange, to locate four loop cuts around the cylinder, scaling the center two edge loops out to make the flange, and moving the other two edge loops towards the flange. Where I was using two fittings to make a joint, I would place the fittings so that there was a gap between them about the size of the flange. I'd then select the two edge loops on either side of the gap, bridge across the gap, and extrude the bridged faces out to make the flange.


How to save a render image as JPEG with white background instead of default black background at alpha transparent areas? My render image has a transparent background and when i save it as PNG RGBA every thing is OK. But when i want to save as JPEG format which doesn't support alpha transparency, save it as black backgroud at transparent areas.
How to save a render image as JPEG with white background instead of default black background at transparent areas?
Just like when i save the render image as PNG RGBA format and open it in GIMP and save as JPEG format which change transparent background to white.
Is anyway in blender without using Nodes?

No, but it's quite simple to do with nodes..

In the compositor (press ⎈ Ctrl← Left arrow), enable Use Nodes in the header and add an alpha over node (⇧ ShiftA> Color):

The color in the top slot is the color which will be used instead of transparency.

Now transparency will be automatically filled in with white (or whatever is in the top socket) when the scene is rendered.


How to subdivide part of mesh but not apply the modifier? I want to subdivide a mesh so that it won't become all round, but I also don't want to apply a subdivision. I am open to all ideas. Is there any way to subdivide part of a mesh, and keep the hard edges?

The Subsurf modifier has no controls for limiting it to only part of a mesh. So if you want want to use that modifier, instead of some other techniques listed below, you are left with the top two options.

Split the mesh. In edit mode, select the part you do not want to have subdivided and press P > Selection. Now just add the modifier to one of the two objects.
Keep hard edges. There are many ways to achieve that, holding loops (just edge loops added near important edges) are a common option, but you may be able to use edge creases. This question is a good resource for those methods.

If you don't need to use the subdivision surface modifier then you have more options left open to you though modeling.

Add loop cuts with CtrlR
Subdivide only selected parts of a mesh with the Subdived operator. It is can be found in the tool shelf, from the 3D view header Mesh > Edges > Subdivide, or in the specials menu W > Subdivide.
Knife tool. you can use the knife tool to selectively add more edges where needed (also very useful for controlling edge flow).
Bevel. Can be immensely useful for adding holding loops. It is a great tool any time you need more detail in a specific spot.

Vertex connect Path J is a less common but still useful tool that adds new edges by simply connecting the selected vertices.


Creating Trees and Grass for unity ? How to add alpha layer to Vertex Colors? Ive been working for quite some time in small scene for unity, the scene is in a forest so there is plenty of trees and grass Im creating in Blender.. Im using the same technique in both cases, baking a high detail mesh into low poly planes and using these planes to populate the tree branches or making bushes of grass.

Everything is perfect, but Unity uses Alpha Vertex values to figure out how much those planes will swing with the wind, but Blender apparently doesnt have this feature!! So my tree branches planes and grass swing as a full object, I cant make the bottom vertex fixed because Unity considers they all have the same alpha value.

How can I work around this problem? Ive been looking in the internet for sometime and cant find a solution.

Thanks

If you use one of the recent nightly builds of blender

you can use the Blender Vertex Color Master Addon to get access to alpha channel.

From my quick experiments, the FBX exporter supports vertex colors. They show up in Unity. I couldn't text the animation because you didn't mention what shader you were using.


Can’t select Boolean object after beveling it—bug? I want to bevel the side edges of the selected boolean. You can see I have another Boolean above and sort of around it (they are not joined). At this point, these three Booleans work fine. Time to bevel the edges...

Just for reference, when I hide the Boolean, nothing is there. Seems obvious—but this will make sense in a second. Ok, let’s bevel.

The bevel isn’t working how I want—ok, well I know, let’s try applying the scale.

What on earth? Ok, the bevel is now working but it looks like we have overlapping geometry now? Merge by distance. Nope. Ok, well, let’s select the main Boolean object and check it out.

Ok hold on—I simply clicked on the main object and now it’s all one object? Strange.

Fine, let’s tab into edit mode. But the Boolean object isn’t selectable now. Not even in wireframe.

Ok, let’s flick into local view.

Tab to Edit mode and...

Gone. At this point, I can’t even select the Boolean object again. I just have to restart the file. I can go back to non-local object mode and stare at the glitchy overlapping geometry but that’s it. What is going on here?

Thanks everyone,

John

Got it.

The solution is to pull back your Boolean object’s bevel offset. Set it back just a hair under the clamp overlap threshold (to 0.015m in my case whereas 0.016m caused the clamp overlap to kick in). To speculate on why: when clamp overlap is turned on and at maximum it might be creating overlapping vertices where the bevels meet. It reminds me of how sometimes when beveling for smooth round edges you get an odd crease in the middle which is also mitigated by reducing the bevel offset to just under the threshold (Chipp Walters talks about this in his Nitrox 3D series).

Hope this could help someone in the future, Happy Blending!

John


How to twist radial vector to make spirals? I'm trying to create a procedural rainbow spiral in cycles like this:

The reference created by rotating the center vertex with proportional editing on, then assigning material slots to multiple colours. I'd like to have something more adaptable, like controlling number of turns and number of iterations of colours.

My attempt at a procedural texture led me to the radial vector which currently has a simple setup like this:

Which then gives something like this:

I have read related questions from Create procedural spiral pattern and How to Twist a Procedural Material? but I'm currently at a loss as to how I could integrate my colour ramp to the nodes given.

Any help would be greatly appreciated, Thank you!

In order to produce a spiral effect, you need to effectively rotate the 'banding' based on the distance from the centre, 'wrapping' around at 1.0 back to 0.0 to continue the pattern.

This can be achieved as follows :

Note the lower branch of nodes - the Dot Product, Power, Multiply nodes. The Dot Product with both inputs set the same will generate the square of the distance from the origin. The Power(0.5) node takes the square root, resulting in the actual distance from the centre. The Multiply node can be adjusted to control the "tightness" of the turns of the spiral.

The Add node then adds this distance into the offset around the spiral - effectively rotating further around the centre the further away from the centre, while the Modulo(1.0) function allows the values to wrap around from 1.0 back to 0.0 to continue the pattern.

Note that I've also added an Add(1.0) and second Modulo(1.0) node - this is to allow for negative rotations to allow the spiral to be twisted in either direction (the normal Modulo function produces odd results when presented with negative values - the additional nodes correct for this - see https://blender.stackexchange.com/a/122489/29586 for more of an explanation for this).

I've also added a Multiply after the radial Texture node. This allows the number of repetitions of the banding to be adjusted. Stick with whole numbers to avoid breaking the pattern - eg, 3.0 will produce 3-times the number of bands.


Rendering image with lens distort node and transparent background I try rendering my image as a png with an rgba channel but when I put on the lend distortion node in the compositer it makes it have a black background.

I guess that's because this node is not a simple deformation node, it also affects color (if Dispersion is used). But you can use something like that :


Starting an animation on the birth of a particle or using animation nodes? I have a problem with the particle system.

Context:

I have a cube that emits particles. On another layer, I have 3 objects that change shape over time. I group the 3 objects and use the group in the particle system. The result is that the emitter emits the objects using the timeline to drive the grouped objects animation. That is logical.

Question:

What I am looking to do is have the objects start their animation sequence when they are emitted from the emitter, not based on the timeline. So that as each object is born, the animation is seen individually. The particle system gives me a very natural particle animation that I like, it is just that I cannot control when the grouped object animation starts.

I have had a look at the AN tutorials and I am struggling to understand. I figure that if I can create an AN animation for each object, maybe one of the particle nodes can drive the birth of the animation.

I would be very grateful for any thoughts.

Solution

This can easily be achieved by subtracting the birth time of each particle form the time input of the required animation.

Lets assume that your animation is a simple 180 turn around the z axis, then I can just generate the rotations as follows:

What happens is when you subtract the birth time of the particle, the time of the animation becomes zero at the time of its birth and it linearly and continuously increases. Other complex and advances animations and scenarios can be achieved on the bases of the previously described concept.

Appendix

In case you don't know how to make a group like particle system, here is a simple a node tree that does exactly that:


repeating set of operations for all selected objects individually I wrote a short script which performs multiple operations on a selected objects, and some of those operations depend on the objects position. I have 100+ identical objects in different positions and I would like to apply this set of operations on each object. If I select all of the objects, is there a way to then iterate through each of the objects in this selection?

Apologies if this is a bit vague, I am fairly new to coding so I hope I am using the correct terminology. I was thinking perhaps all the selected objects could be put into an array and each one could be selected by incrementing the array index after performing all the operations.

Edit: For example

def execute(self, context):
    for object in bpy.context.selected_objects:
        bpy.context.scene.objects.active = object #was missing this part
        bpy.ops.object.convert(target='MESH')
        bpy.ops.object.editmode_toggle()
        bpy.ops.mesh.select_all(action='TOGGLE')
        bpy.ops.mesh.edge_face_add()
        bpy.ops.object.editmode_toggle()
        bpy.ops.object.origin_set(type='ORIGIN_CENTER_OF_MASS')
        bpy.ops.object.editmode_toggle()
        bpy.ops.view3d.snap_cursor_to_selected()
        bpy.context.space_data.pivot_point = 'CURSOR'
        bpy.ops.object.editmode_toggle()

    return {'FINISHED'}

This seems to only apply to the last object selected even though multiple objects are highlighted.

Update: I was missing "bpy.context.scene.objects.active = object". Adding that at the start of the loops fixes the problem.

import bpy

for object in bpy.context.selected_objects:
    object.location.z += 0.1 # Do whatever you want to the object


Why am I missing nodes in the 'Add node' menu? I have the problem that my blender hasn't updated correctly and is stuck on version 2.78 while it says that it has version 2.79, the issue is that I'm missing nodes like image textures and diffuse BSDF and the whole shaders option in the 'Add node' menu.

There are three possible causes;

1- The render engine might set to Blender Render (also known as Blender Internal) instead of Cycles. Materials work very differently in each of the render engines, and are not interchangeable.

Blender internal does not use shaders, Cycles does.

To learn more about the difference between render engines read:How is Cycles different from Blender Internal? and Cycles vs internal vs game engine
2- The node editor might be set to a different mode.

There are three different modes for the node editor and they use different kinds of nodes.

By default the node editor is configured for compositing .

Change to the Material node editor (and make sure that the Use Nodes box is enabled).

:

More info:

https://www.blender.org/manual/editors/node_editor/introduction.html#node-tree-types

https://www.blender.org/manual/editors/node_editor/editor.html
3- If Cycles is not available in the render engine list, then it needs to be enabled in the System Preferences>Addon List (Access the system Preferences window by pressing CtrlAltU)

Look for the Cycles Addon in the render section, enable it using the check box and then save the user settings to enable cycles permanently.


Weird cross hatching when I loop cut When I add a loop cut I get this cross hatching effect. If I add one to the other side as well, then the whole object gets that effect. I've tried changing the shading from flat to smooth, and back. I've recalculated normals, I've removed doubles(0). It doesn't seem to affect the render at least, but i'm not sure if it'll affect anything else like the materials. Or is it just a random glitch that wont do anything else. I've restarted my blender and it didn't take it away either, so I'm lost.

It's not a random glitch, it's called Z-fighting. It happens when 2 or more faces occupy the very same space. Then Blender doesn't know anymore which of the faces should be in front and which ones should stay in the back. It also means that you need to clean your topology.

One method of checking for problems is to be in Vertex- or Edge Select Mode with nothing selected and hit CTRLSHIFTALTM to select all edges and its verts that share more or less than two faces.

Here are 4 cross sections. The left one is how it should be. It has a clear inside and a clear outside and is the desired outcome. Every edge only shares two faces.

The second and third one have an internal face where it won't show from the outside. But  CTRLSHIFTALTM will highlight all verts or edges that are connected to that face. This little rascal will also prevent you from recalculating normals correctly.

The fourth is where Z-fighting will occur. While it's not visible, there's now 3 small faces on top of one larger face because I scaled them to 0 on the x axis. And since they're not the same size, removing doubles won't do anything.

Sadly, it's perfectly possible to create Z-fighting topology that the mega shortcut won't detect. Just add a cube, duplicate it without moving it and then scale it down a bit on a single axis.


Is it normal to have these reflections when full global illumination on? Please see the both renders below with limited and full global illumination, I like the way full global illumination brighten up the things and details, but I am having weird reflections on the glass surfaces? is this behaviour normal and correct realistic result or i am doing something wrong? thanks for the help

Blender file here,

I am using cycles, Subsurface modifier at 3 for the glass objects to render

Yes

Where are that reflections coming from?

Not from the chocolate material. While in your modeling there is actually a small gap between the mousse and the glass cup (this mess up IOR calculation, but that's another story...) that would surely create additional reflections, those are not caused by that.

If you make the chocolate object completely diffusive (or delete it), you'll se that the effect is still there.

Let's erase the object, leaving only the cup and put a small red ring near the base of the cup.

We see that on each stripe (reflectons) is coloured by the red ring. This means that the light travel through the glass object with the path (more or less, I'm not an expert of optics) that is highlited in the image below.

Notice how cutting away the half of the ring that is behind the glass make the red stripes disappear. This is because the reflex is just what the faces (opposite to the camera) of the glass cup base are pointing to.

Let's put a small object:

On the right, inside the black circles there is a small green spot. By maginifing the image we'll see...

...Suzanne!

I'm quite sure it is upside down, as when you look yourself in a spoon... we can run another test by pushing the lower faces of the base behind the plane surface. So the ray will hit a diffuse shader and should reflect nothing:

Why there are so many?

Because for each camera ray the light path is slightely different due to the different incident starting angle. At the end of the path they are probably "diverging", so in a small portion you'll be able to see (distorted) the whole surrounding.

Is this a physically based effect?

Yes it is. You can see it in glasses with a thick base.

Here's a comparison between two different angles.

Why choosing "Limited Global illumination" instead of "Full Global Illumination" don't show them?

Because Limited Global Illumination has lower number of "Max" & "Glossy" samples. That factor is ruling after of many light bounces the simulation is stopped. If they are set to a value lower than the noumber of bounces that the light need to travel to get out of the glass, you'll not see any full reflex from that ray. There would maybe some light path that would be able to get out of the glass even with few bounces, but increasing the values, would give higher chances, so it is more likely to se lot of reflexs.

Conclusion:

The effect is phisically based. Full Global Illumination's setting  as espected helps in making the scene to look more  realistic, as it takes in account more bounces.

Suggestions:

There are some materials who use the "Add Shader" node that isn't energy conservative, so it can lead to non stichtly-physically based behaviours.

When a fluid is stiched to the walls of a glass container, it is better to deal with interfaces as the link in my comment shows to get a "true" IOR effect. Notice that with that method, you'll also will get rid of the reflections, as the light is reflected (as in real life) towards the mousse, instead of bouncing all around trought the glass volume:


Proportional Editing Falloff Anyone know of any scripts or tutorials to create a new falloff type?  I'm thinking something along a sine wave.

Here's a screenshot.  I've got a lattice attached to a text, and I want to add a sinusodial falloff to modify the mesh.

Warp Modifier with Texture of your choice including sinusoidal.

There exists three or more modifiers that are relevant.

the wave modifier
the warp modifier which can take a texture such as a sine texture.
the displace modifier

Other techniques

weight painting and weight modifiers
texture to affect modifiers

Above is the warp modifier in action.  Rather plain ... no texture.

Closeup Fall Off with texture. Image Above.

Warp Modifier with Wood Sine Texture. Image above.

The warp modifier produces results similar to user gestures of

proportional editing.

The blue cube has a high vertex density.  The from and to are animated in rotation.

Results of the wave modifier. Sinusoidal influence. Image Above.


Can I turn a procedural displacement into geometry? I was following this tutorial to create procedural rocks: https://www.youtube.com/watch?v=UFsVzDXYOKw

It gives some really nice results (that I admittedly don't fully understand), the only problem is that those results only exist when rendered.  The only thing physically there is the sphere that the many, many nodes get applied to. My ultimate goal is to export the rocks to a game engine, so they need to become actual geometry as at least a first step.  But it's not clear to me how I'd go about this.  Any thoughts?

Yes, you can.

But you need to use different modifiers for this.

First, remove subsurf and use multires+displacement:

You need to use multires for simplicity in creating normal map for game engine. With normal map you can create a detailed object without complex geometry, that important for game engines.

For creating normal map, unwrap your object (U), crate material and put image for baking in it, and in render settings select normal type and press bake.

After baking, save resulted image and setup it as normal map. Now you can remove multires, apply displace (for basic shape) and export your model in game engine.


Is it possible to animate textures scale? Is it possible to animate texture scale on an object?
I have created a node to scale my texture for my object.
I stretched the object, and to avoid stretching of the texture, I created a node. Now I try to keyframe the Y scale of the texture, without success.
I clicked i and choose locrotscale, and that didn't do the job.
What am i missing here? If I can animate the scale of a texture on an object, how do I do so?

Add a mapping node to control your texture node. The scale values can then be animated by adding keyframes.

for blender internal the same principle applies:


Modeling/sculpting hand beginner doubt here!
I've been staring for this hand for a long time and have no idea how I could sculpt that.
Does anyone have any tips for me? I've been modeling for a really short time, so anything is helpful!
Thanks a lot in advance!!!

You can use your pictures as references, create a plane and subdivide it:

Extrude it up, extrude the fingers:

Rotate the front face or use the Shear tool, then continue to extrude and rotate:

Begin to work on the thumb:

Give it a Subdivision Surface modifier, change the topology appropriately:


Trying to swap vertex with uv by script Basically, I want to create a tool that can swap between one vertex coordinate with specialized UV data named 'SwappedUV' for whole vertex in active object (if not exist, it'll create new UV layer instead)

import bpy
import bmesh

def swapOnAxis (axis):
    C = bpy.context
    o = C.active_object.data
    bm = bmesh.new()
    if C.active_object.mode != 'EDIT':
        bm.from_mesh(o)
    else:
        bm.from_mesh_edit(o)

    uv_layer = None
    name = 'SwappedUV'
    if name in bm.loops.layers.uv.keys():
        uv_layer = bm.loops.layers.uv[name]
    else:
        uv_layer = bm.loops.layers.uv.new(name)

    for f in bm.faces:
        for l in f.loops:
            luv = l[uv_layer]
            # apply the location of the vertex as a UV
            luv.uv.x, l.vert.co[axis] = l.vert.co[axis], luv.uv.x
            #print(l.vert.co[axis])

    if C.active_object.mode != 'EDIT':
        bm.to_mesh(o)
    else:
        bm.update_edit_mesh(o)

    bm.free()
    o.update()

class SwapOnXOperator(bpy.types.Operator):
    """Change X Position of verts with UV data SwappedUV"""
    bl_idname = "myaddon.swaponx_operator"
    bl_label = "SwapUtils Operator"
    bl_options = {'UNDO'}

    def execute(self, context):
        swapOnAxis(0)
        self.report({'INFO'}, "Sucessfully swap UV data")
        return {'FINISHED'}

class SwapOnYOperator(bpy.types.Operator):
    """Change Y Position of verts with UV data SwappedUV"""
    bl_idname = "myaddon.swapony_operator"
    bl_label = "SwapUtils Operator"
    bl_options = {'UNDO'}

    def execute(self, context):
        swapOnAxis(1)
        self.report({'INFO'}, "Sucessfully swap UV data")
        return {'FINISHED'}

class SwapOnZOperator(bpy.types.Operator):
    """Change Z Position of verts with UV data SwappedUV"""
    bl_idname = "myaddon.swaponz_operator"
    bl_label = "SwapUtils Operator"
    bl_options = {'UNDO'}

    def execute(self, context):
        swapOnAxis(2)
        self.report({'INFO'}, "Sucessfully swap UV data")
        return {'FINISHED'}

class SwapUtilsPanel(bpy.types.Panel):
    """Docstring of SwapUtilsPanel"""
    bl_idname = "VIEW3D_PT_Swaputils"
    bl_label = "SwapUtils Panel"

    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_category = 'Tools'

    def draw(self, context):
        layout = self.layout
        row = layout.row(align=True)
        row.alignment = 'EXPAND'
        row.operator(SwapOnXOperator.bl_idname, text = "Swap X", icon = 'COLOR_RED')
        row.operator(SwapOnYOperator.bl_idname, text = "Swap Y", icon = 'COLOR_GREEN')
        row.operator(SwapOnZOperator.bl_idname, text = "Swap Z", icon = 'COLOR_BLUE')

def register():
    bpy.utils.register_class(SwapOnXOperator)
    bpy.utils.register_class(SwapOnYOperator)
    bpy.utils.register_class(SwapOnZOperator)
    bpy.utils.register_class(SwapUtilsPanel)

def unregister():
    bpy.utils.unregister_class(SwapOnXOperator)
    bpy.utils.unregister_class(SwapOnYOperator)
    bpy.utils.unregister_class(SwapOnZOperator)
    bpy.utils.unregister_class(SwapUtilsPanel)

if __name__ == "__main__":
    register()

Actually, this plugin works properly. But why it takes 4 steps to make the selected mesh returning back to it initial state? Is there something I miss?

PS: I'm fairly new to scripting in blender

Look like i'm just understand with the concept of loops in blender.

What i'm not aware is one vert can be referenced on more than one loop (and it's pretty common).

So, the solution for this is make sure that the code do not touch the same vertex index (by making a list):

def swapOnAxis (axis):
    C = bpy.context
    o = C.active_object.data
    bm = bmesh.new()
    if C.active_object.mode != 'EDIT':
        bm.from_mesh(o)
    else:
        bm.from_mesh_edit(o)

    uv_layer = None
    if 'SwappedUV' in bm.loops.layers.uv.keys():
        uv_layer = bm.loops.layers.uv['SwappedUV']
    else:
        uv_layer = bm.loops.layers.uv.new('SwappedUV')

    dict = []
    for f in bm.faces:
        for l in f.loops:
            luv = l[uv_layer]
            v = l.vert
            # make sure that we haven't do it on the same vertex
            if (v.index not in dict):
                luv.uv.x, v.co[axis] = v.co[axis], luv.uv.x
                dict.append(v.index)
            else:
                luv.uv.x = v.co[axis]

    if C.active_object.mode != 'EDIT':
        bm.to_mesh(o)
    else:
        bm.update_edit_mesh(o)

    bm.free()
    o.update()


Install new Python modules from within Addon (without sudo/admin privileges) I am working under Blender 2.90 installed by snap.
If I try to run
subprocess.check_call([bpy.app.binary_path_python, "-m", "ensurepip"])

or
import ensurepip
ensurepip.bootstrap()

from within my Addon, I get told, that the site-packages of my Blender's Python are read-only. Is there any way to circumvent this?

Thanks to all the help, I was able to piece together a fully automatic solution that works at least on my system (tests on other Linux and Windows machines planned). It looks something like this:
import bpy
import sys
import importlib
import subprocess

# Blender's Python executable
pybin = bpy.app.binary_path_python

def add_user_site():
    # Locate users site-packages (writable)
    user_site = subprocess.check_output([pybin, "-m", "site", "--user-site"])
    user_site = user_site.decode("utf8").rstrip("\n")   # Convert to string and remove line-break
    # Add user packages to sys.path (if it exits)
    user_site_exists = user_site is not None
    if user_site not in sys.path and user_site_exists:
        sys.path.append(user_site)
    return user_site_exists

def enable_pip():
    if importlib.util.find_spec("pip") is None:
        subprocess.check_call([pybin, "-m", "ensurepip", "--user"])
        subprocess.check_call([pybin, "-m", "pip", "install", "--upgrade", "pip", "--user"])

def install_module(module : str):
    if importlib.util.find_spec(module) is None:
        subprocess.check_call([pybin, "-m", "pip", "install", module, "--user"])

user_site_added = add_user_site()
enable_pip()
# All the modules you need, that don't come shipped with Blender
modules = ["module1", "module2", ...]
for module in modules:
    install_module(module)
# If there was no user-site before...
if not user_site_added:
    add_user_site()


looping animations inside a project without copy pasting keyframes I was wondering is it possible to for example make a cube move left and right and fix that animation to the object so that it keeps moving left and right regardless of whether I have created fixed key frames? I think the physics options com closest to what I'm trying to get at but that works of course a little different.
I would like to for example loop complex animations infinitely in a file so I can meanwhile create other animations that aren't looped inside the same file without having to constantly add keyframes whenever the project becomes longer.
I would guess that's possible because in a game a turret might have a looped animation inside the game for movement

To make an animation cyclic, select the action in the Dope Sheet and press shift E > Make Cyclic.


Translucent material (a sheet of paper) with image texture? How to create such a translucent material (a sheet of paper) with some image texture? In the photo I'm directing the sheet towards a lamp and able to read what is printed on another side. What is the best way to achieve this within Blender?

You can use the transmission input on the principled shader in cycles for this.
To distinguish the one side from the other you can use the input node Geometry Backfacing. Adjust the ramp node to get the thickness you are looking for.

If you need to color your translucency this could be a way to solve it. Allowing some of the light from the backside pass by adding in a Translucent shader and then mix this. By using a mix node the energy from the incoming light will be handled more correctly than with an add node.

I hope that the Principled shader will get support for color transmission in the future.


Change default_frames_limit trough Text Editor script I want to change the default_frames_limit in the movie clip editor. I found a script in a addon that does exactlie that:
clip = bpy.context.edit_movieclip
clip.tracking.tracks.data.settings.default_frames_limit = 10

But it just works from within the movie clip editor, not from a text editor script.
How could I change this value from a different context?

Its the clip associated with the space.
Similarly to a text in the text editor, an image in the image editor, what is known as the context.clip in the movie clip editor, is the clip assigned to the space.
To the python console:
Loop thru the screens to find a movie clip area and return its active space.
>>> def get_clip():
...     for s in D.screens:
...         for a in s.areas:
...             if a.type == 'CLIP_EDITOR':
...                 return a.spaces.active
...     return None
...
>>> mc = get_clip()
>>> mc
bpy.data.screens['Default.002']...SpaceClipEditor

The active clip of that space
>>> clip = mc.clip
>>> clip
bpy.data.movieclips['Batman_(1966)_S01E01.mkv']

>>> clip.tracking.tracks.data.settings.default_frames_limit
0


Cycles: glossy material is too dark I am new in Cycles render engine and node edit, now I want to try a simple scene with a bright steel.Here is my scene: The plane behind camera has the same angel as the camera because the cube is specular reflection to light.The strength of it is set to 1.600. However, it do not make any affect at all.

As you can see in the second screenshot, I want the render result(Bottom left) is as bright as the one in Preview(right, although i do not think the preview is bright enough, think of the steal, it should be more closer to silver). And the texture of the steal don't have any affect is a mystery for me as well(I want some scratches on the cube just like an anpolished steal in the real world), do I make a mistake in the node editor?

I have found my own way to solve my problem, I do not know if it is the best way.

Here is the result:


riggify face rig makes the eyes so error I use riggify to rig my character.
and his eyelids look so bad.

I used MAYA for years. There is a function on MAYA is I can choose an individual point to control its weight.
I don't know if blender has the same function.
or someone can help with riggify rigs?
Thanks a lot.

In edit mode you can select a vertex, in the "N" properties panel you will be able to read its weight values in the "vertex weights" tab. If more than one vertex is selected you can copy the values of the active (last selected) vertex to the others.
When I use Rigify face rig, I generally add a correction shape key in order to flatten the eyelids and the lips, using drivers to automate the shape keys effects.


using subsurf modifier to object with boolean undoes boolean I know what the correct answer to this is, which is don't use boolean modifiers lol. Unfortunately, I learned that a little too late... Anyway, my problem is not the common boolean and Subsurf problem where it deforms my mesh, the problem is that when I add the Subsurf modifier it just makes the shape I used to make the boolean reappear... super strange. I'm using the bool tool btw.
I'm a newb just fyi, so the topology is not what I would like it to be. still learning.
If anybody has a solution that involves me not redoing an entire mesh, I would be greatly appreciative!!!
Thanks!

The reason might be that the Sudivision Surface modifier creates additional geometry that makes the boolean fail because of overlapping vertices/edges/faces. Just try to slightly move the boolean object to avoid that.


Basic question about Merging faces I'm a beginner with blender so this is probably a very basic question.

I have this basic model below. I've ended up with a lot of unwanted geometry that I want to simplify.
I wanted to start by merging the two selected faces below but no matter what I try to delete or merge it just destroys the geometry.

How can I achieve what I want to do (which is combining all of the unwanted geometry, either starting with this merge or some other way?)

Select the faces you want to merge, press Del or X and click limited dissolve.


How to model a turtle's shell starting from a circle/ using a circle? I'm trying to model a turtle's shell. I wonder how I can start with a Circle and create the shell?

Add a Circle and set its vertices number to 10.

Scale and rotate it to fit the picture using snapping tool (click on a magnet icon and set its type to Increment). Hold down Shift while rotating to do it precisely. [In this case i rotated a circle 18 degress]. Being in Edit Mode select the whole circle (A), then pres W-->Subdivide.

Delete one half of a mesh and give it a Mirror Modifier. Extrude the vertices to fit the reference image.

Apply a Mirror Modifier and then add a Subsurf Modifier. Select the outer edges and press Alt+Shift+S (with a cursor snapped to an origin point) to make them spherical.

Now set the pivot point to Individual Origins. Select the faces as pictured below, then press I and I again to inset the individual faces. Repeat the process with other faces.

Select the edges as pictured below, press G then Z. Select all edges and sharpen them using Shift+E shortcut.

Give it a proper shape using Lattice Modifier and proportional editing. Give it some thickness using Solidify Modifier.


Principled BSDF shader missing in node editor (2.79a) everytime i open my saved project the Principled BSDF shader disappear from the list in node editor.

But in new tab it appear in node editor. i don`t know what to do (is that a bug)

It's 2.78 version, you launch old version, that doesnt support principal BSDF shader:


Weird shading effects when rendering at long distance I'm trying to render a cityscape, but I get some weird dark patches on the buildings all the time. The scene is just conceptional, so it's all without textures or fancy reflections/ transparacy. The buildings are also really simple (most of the time just cubes)

It kind of looks like the effects you get when you have two faces at the same position, or your normals are screwed up. (It's neither of those, I already checked that.) On the buildings close to the camera it's just a little dark lining along some of the edges here and there, but the further the faces get away, the worse it gets and somtimes a complete face is completely dark.

Meddeling with the light sources or shadow functions doesn't seem to do anything (except disabeling either the "cast" or "receive" shadow option for the material, which stops the effect)

Oh, one more thing, it all really started, once I increased the maximal clipping distance (the city is qite large), even though I don't know if that is the source.

Does anyone have an idea how to fix this?

Pic here

Blend file here

If you change the start clip distance on the camera to a higher number the black edges disappear.

The reason for this has to do with how blender approximates the calculations for the Z-Depth within the clipping distance.

It's very well explained here: http://blendermama.com/black-faces-error-from-camera-clipping.html

In this other link: https://discoverylinux.wordpress.com/2011/10/08/guida-eliminare-il-flickering-in-blender-2-5/ the author recommends keeping the start and end clip distances to contain only the geometry in the scene for better precision.


Add movie as separate audio/video track? I have the top window selected as video editing and the bottom window set as video sequence editor.
When I add a movie to the video sequence editor, it imports as a combined track with audio and video combined on one line. Without closing the project, if I add the same movie file to the same video sequence editor, it now imports as separate audio and video tracks. I have tried different movie clip sources and get the same result.
Is there a preset that causes this and/or is there a magic handshake that separates the first import, video from audio.
I am using Blender 2.76 on Linux Mint 18.
Reset to Factory Defaults then CtrlU to save and all works now as expected.

OK this is weird. I installed this same Blender version 2.76 on another machine also running LM 18 directly from the Software Manager and it behaves as expected. The movie clip is added as separate video and audio lines.
Thinking the "troubled" machine had a corrupt Blender install, I uninstalled and reinstalled Blender, also directly from the Software Manager, and I get the same wonky results where the audio and video files appear to be superimposed on the same line.
If I add the same video without closing the project, the second time it loads as separate video and audio tracks.
solved:
Reset to Factory Defaults then CtrlU to save and all works now as expected.


ImportError: No module named 'Blender' I'm new to Blender scripting (and to python too), I started to try to use it but I already get some error...

  Traceback (most recent call last):
  File "", line 1, in
  ImportError: No module named 'Blender'

This is my script...

import Blender

I know this sounds ridiculous, but I cannot find the solution...

It looks like you are following a tutorial/code written for Blender 2.49 or lower. However, if you are running that code in a current version of Blender 2.50 and upwards there is no module named Blender. That's why you get that Import Error.

A good place to get information about the current API and Blender script writing in general is the current documentation. It contains :

Blender/Python Quickstart: new to blender/scripting and want to get your feet wet?
Blender/Python API Overview: a more complete explanation of python integration
Blender/Python Addon Tutorial: a step by step guide on how to write an addon from scratch
Blender/Python API Reference Usage: examples of how to use the API reference docs
Best Practice: Conventions to follow for writing good scripts
Tips and Tricks: Hints to help you while writing scripts for blender
Gotcha’s: some of the problems you may come up against when writing scripts

...and a whole lot more :)


Some meshes that have textures import just fine but others come in all solid pink When I import my meshes with textures some import just fine, but others,  just come in all solid pink.
I tried saving all the textures then importing but all my models but they just become solid pink.
Even the armatures don't load right

Pink textures are because there is no file at the path where the texture is loaded.
Switch to the Image Editor and view the image that doesn't work. Press N (or select View > Sidebar in the menu) to open the sidebar and pick the "Image" tab. You should be able to see the path plus a "Can't Load Image" message.

Either click the folder icon to browse for the image you want, or put the image file you want at the location shown in the path and hit the reload icon.


Why when I try to add a point to the curve bezier I duplicate it When I try to add a point to the curve bezier ( by selecting one of the two endpoints, then holding Ctrl and clicking LMB). Sometimes Blender add a point other times Blender duplicate the same point. The photo shows the duplicate point by selecting one of the two endpoints then holding Ctrl and cliking LMB. Why?

Consider

You may be unintentionally creating a new disconnected subcurve of the entire curve object.  This happens when the active vertex is not an endpoint of the curve.  Curve objects can have many disconnected subcurves. Flexibility and Complexity.
First select an end point of the curve.  Next control-click  the location  where you want the new point to be. The new point can be moved immediately after.
Optionally Click two points and subdivide to add a new point if that suits your needs better.  The new point will be in the current curve.  Subdivide is on the menu or keystroke w.


Why does dragging the middle mouse button sometimes translate my selection instead of rotating my view? I don't know what's causing this, but sometimes when I have faces or vertices selected in edit mode I will drag the middle mouse button to rotate my view but it will translate the selection instead. I don't press G or anything. Is there some Blender shortcut I'm not aware of that I'm activating by accident?

Try changing the mouse. The mouse might be faulty


Smooth a curve in mesh while maintaining its current angle? I've got a panel here which needs smoothing off but I'm not sure how to do it? The second image is rendered and you can clearly see the edges. It is supposed to look somewhat like the panel in the 3rd picture which is the real bed.

I've supplied the panel pre-bevel and pre-inset as well as the one in the pictures below in the .blend.

You can add a subsurf modifier on your object. You will need first to triangulate your mesh (manually of with modifier as you want) since ngon will give strange results around the holes.

Before

With subsurf

Ngon problem with subsurf

Triangulate


Texturing inside of model black I have a model of a head. I didn't model the inside of a mouth or anything so it's just a hole in the mesh. When I render it, I can see the texture that I applied to the outside of the mesh on the inside. All I want is for the inside of the mesh to be solid, non-reflective black. How can I do this without screwing up the outside texture?

Use the "backfacing" output from the geometry node (input section).

The output will make the side of the face in which the normal is pointing equal to 0, and the other side (back) equal to 1. This can be used in a mix node.

Note: make sure that all your normals are facing the right direction (crtl+n)

Try this nodes setup.


Particles not responding to size changes (please excuse my noobiness, this could have a simple answer)
I can't get the particles to actually respond to the scale selector that is now nested under the Render tab. In older blender versions, there was a size slider under the emission tab. With the new update, I have found that it is now under render, no worries. The problem comes here, no matter how I change the scale slider, the particles don't change in size and just remain way too big.

Each time I played the simulation again after changing the size.
Anyone got any ideas?

Set Render As to Object and link it to a new created object (looks like you need a sphere). Path (Hair) and Halo (Emission) do not contain any geometry data so you can't scale them.


Sculpt tool wont work ( Red Cursor) Hi this is my first post, I have a problem as my textures  work in modelling mode but when I switch to sculpt mode my brushes or textures both don't work. Anybody know the answer?

Thanks

You need to click your object to active select (Yellow outline not orange) the object you want to sculpt in object mode. Any other selections(orange outline) will not be sculpted in sculpt mode.

See here for more on selecting: https://docs.blender.org/manual/en/latest/scene_layout/object/selecting.html

You can change your shading mode in the upper right corner.


Dark Mist Causes Strange Colors I have made mist in my scene,and it works great when it's white mist, but if I try to darken the color, I get all sorts of strange colors appearing in the background of my scene. How do I make the strange colors disappear?

My node setup

My scene without mist

Light Mist

Dark mist makes weird colors appear in the background

The Mix shader needs to be changed to an Add shader.

I don't know exactly how these each work, but depending on what color you want your mist to be, different mixing methods work better.


Storing a python list as a scene variable What is the best practice way to store a python list defined in an addon as a scene variable in Blender?

Using

global mylist

doesn't work because the variable is not a Blender-specific type and therefore not saved after a button click operation completes.  I would like the list to exist in the Blender environment so that I can access it from future function calls.

My current solution is to use Blender Collection Properties, with my own wrapper functions, but this seems kind of excessive:

bpy.types.Object.CP_list = bpy.props.CollectionProperty(type=bpy.types.PropertyGroup)

def CollectionProperty2list(CP, numerical = False):
    new_list = []
    if (numerical):
        for elt in CP:
            new_list.append(float(elt.name))
    else:
        for elt in CP:
            new_list.append(elt.name)
    return (new_list)

def list2CollectionProperty(mylist, CP):
    CP.clear()
    for elt in mylist:
        CP.add().name = str(elt)  # stores string for numerical or string input
    return()

storing:

list2CollectionProperty(py_list, obj.CP_list)

retreiving:

py_list = CollectionProperty2list(obj.CP_list)

Storing a list as an ID property

# assign a list
>>> C.scene["mylist"] = [1, 1, 1, 1, 1, 1]
>>> C.scene['mylist']
<bpy id property array [6]>
# save file, reopen
>>> C.scene['mylist'].to_list()
[1, 1, 1, 1, 1, 1]

This will work for lists where all items are of the same type: strings, ints,  floats or booleans (booleans as ints).

Could try using your methods above as getters / setters  ... but I don't think get is available for bpy.props.CollectionProperty.


How to composite in a background picture? This is a diagram:

Look at the background carefully...

This background was made in compositing: http://www.filedropper.com/xtruder22

However, I wanted to know whether I could put a better background gradient from a .jpg or .png file? e.g.: http://www.shoutot.com/stockimage/black-gradient-background.jpg http://fc07.deviantart.net/fs71/f/2013/042/c/3/gradient_toshiba_background_by_daproba-d5uo24e.png

Many thanks

Another option is an Alpha over node:

Add an Image node (ShiftA> Input > Image) and open your background image:

To crop or scale your background image to fit your render, add a Scale node (ShiftA> Distort > Scale).
Set the Coordinate Space to Render Size, and set the scale type. If your background image is larger than the render, you probably want to crop it. (select Crop) However, if it is smaller and you want to scale it up, select Fit:

Connect the nodes as shown above.


Node editor lagging / unresponsive and imprevisible Moving and arranging nodes has been a pain from 2.68 when I started using blender. With official and other builds. I have inverted the mouse to use LMB for selection and translation which is aggravating: RMB still works!?, still laggy, but for LMB I have to wait with mouse pressed over a node ~1/2 sec to be possible to drag the node. Otherwise simple click is not selecting the node. After successfully selected the node remains behind the mouse at every move.
Moving a node close to any margins of the editor window snaps the node far away on the grid, outside of the visible area.Which is especially annoying when creating new nodes as they get generated usually close to the borders.
Also the create node menu is slow to display.
This situation is the same on 2 computers that I use for graphics and is not depending on viewport shading.
I post here just in case someone has a suggestion to test. If not I will submit the bug.
Thanks

Yes!It was my fault from the beginning.
At some point long ago I have changed these settings in Preferences/Input
1.The lag is caused by Drag Threshold and Tweak T. With 3px (minimum allowed) the lag disappears. I supposed & tested that their function is to smooth out drag behavior in mesh editing and slider controls but did not expect to affect the nodes in the editor.
2.The snapping was by Continuos Grab which I use also in 3dMax. And that behavior in node editor is a bug.

  Drag Threshold
      The number of pixels that a User Interface element has to be moved before it is recognized by Blender.
  Continuous Grab
   Allows moving the mouse outside of the view (for translation, rotation, scale for example).  source: http://wiki.blender.org/index.php/Doc:2.6/Manual/Preferences/Input


Workaround for Resuming Fluid Simulation Suppose I have a fluid simulation I have just baked and want another second of it.

Are there any drawbacks to applying the fluid simulation to the mesh (in the modifiers tab) then having that new mesh act as a fluid?

Both the answerers at Is it possible to pause and later resume a fluid sim bake? and How to resume baking fluid simulation? say it is not possible to resume a fluid simulation.

EDIT: The only drawback I can think of is the velocity it is moving at. However, that means that both stationary fluid and fluid moving in  a single direction can be resumed (there is a setting to set initial velocity)

EDIT 2: Now that I think about it, it is possible to split a single mesh into multiple smaller meshes. This way it is possible to set a different initial velocity for all the fluid parts.

In Blender version 2.81+ now Mantaflow fluid and fire simulator is used which gives you the option to pause and resume fluid and fire bakes.


Images as Planes, can not see the image on the plane How do I import a *.gif though gimp, onto a plane, in blender. Once I import the image file onto a plane, how do see the image on the plane.

Blender does not support .GIF files you could e.g. export to .PNG from Gimp (PNG has also lossless compression and transparency) For all available formats see Formats.

The easiest way is to enable the Import Images as Planes addon. You find it in the menu: File / User Preferences.

After enabling use File / Import / Images as Planes

To see the texture you need to set the viewports shading mode to Texture:

Behind the scenes the addon has created a plane added a material with an image texture you can check this in the materials properties:

Note: For best performance the dimension of a texture should be a power of 2 (128x128px, 256x256px etc.)


Setting "dynamic = off" keyframe for multiple active rigid bodies at once. I have multiple active rigid bodies which start to animate at frame 1 which is too fast. So to keep them still until the collision I want to keyframe "dynamic = off" at frame 1 and then change it to "dynamic = on" at 1 frame before collision.

However I can't find a way to do it unless I individually click every rigid body and set their keyframes. This is problematic as there are more than 100 rigid bodies and now I am asking if there is a way to set keyframes for all of them at once.

try this:

Push space and just click the option called "Copy game physics properties to selected" And then it will copy the game physics to all selection one frame before they collide in your animation.

Good luck!


How can I make my water not look like ink? I'm working on a small creek including animated water (using a fluid domain). While I'm satisfied with the baked flowing animation of the water, I don't really like how it looks. Here's a render:

It's way too opaque (nontransparent), I would like to have a more cristal-clear type of water. I've cranked up the brightness of the sun, but as you see, that only increases the brightness of the reflection. I've tried using fill lights from different angles to brighten up the scene, which works to some extent, but the texture still looks like ink. So I'm looking for help on how to make it look more like clear water.

Here's my current texture:

Maybe im just too late right here, but anyways.

You need to mix a glass shader (put 1.35 IOR) with a transparent BSDF and you're done, or if you wanna go beyond and have a photorealistic water looking, you can do it by combining the Principled BSDF and transparent BSDF.

Change these settings on the Principled Shader:

Roughness to 0 or 0.05 (depending on the type of water, if dirty, clean, etc)
IOR to 1.35
Transparent to 1 or 0.9 if dirty and such (you can also play with the colour and the transparent bar to add some color to the water)


Blender 2.8 Multires Sculpt with texture on In the newest build of 2.8 as of today (June 8th 2019).
I am trying to sculpt an object while also having a specific texture show on the same object. I cannot find any way to do that. As soon as I switch to sculpt mode I get some sort of matcap material and I cannot get a texture to show up in any renderer under any settings I tried. Is there I solution?

EDIT if you want to take a stab at solving this please make sure you have an object with Multires modifier applied to it.

EDIT 2 Looks like it's a bug that's been reported already
https://developer.blender.org/T63581

I'm not sure if this is what you are looking for, but if you change to Lookdev, you will see your texture.

Good Luck


Python Render Specific Frames I'm new to blender scripting and with the api change in 2.56 I'm having difficulty finding relevant information. I'm trying to render 8 non-consecutive single frames to pngs. They are the same scene and camera, I'm just trying to get different angles of an object for creating sprites for a game. I found this tutorial but it's out of date.

I hate to ask for code because it's almost going to be the whole script, but it would be apreciated. I would be just as happy with a some direction on getting started though.

Try setting the frame and then rendering it.

bpy.ops.render.render() is an operator which renders the current scene.
bpy.context.scene.frame_set() is an operator which sets the scene frame.

Here is a simple example:

import bpy

scene = bpy.context.scene
fp = scene.render.filepath # get existing output path
scene.render.image_settings.file_format = 'PNG' # set output format to .png

frames = 5, 9, 17

for frame_nr in frames:

    # set current frame to frame 5
    scene.frame_set(frame_nr)

    # set output path so render won't get overwritten
    scene.render.filepath = fp + str(frame_nr)
    bpy.ops.render.render(write_still=True) # render still

# restore the filepath
scene.render.filepath = fp


Baked texture is way darker than render in cycles I've been searching for quite a while for a solution but can't seem to find what I'm doing wrong or if it's even possible.

I have a scene with models which are all fitted with materials (just diffuse colors) just the way I like it. I've been rendering until I was satisfied with the way it looked. My plan was then to bake everything so that I had a texture that resembled the render so I could use it in a game engine.

Now the result is disappointing because the baked texture is way darker than the render itself. I think it maybe has to do with ambient occlusion settings? If I uncheck Ambient Occlusion, the result stays the same.

What am I doing wrong? (images attached)

Thanks in advance!

What you want is setting up your scene for the game engine ? If you dont use any texture then the only thing you need to bake is the ambiant occlusion pass and shadows and use them for diffuse intensity. Also you can't use AO option in the game, it is only affecting the view port.


How to copy transform orientation to object's rotation? Is there a simple way to copy a custom transform orientation to an object's rotation vector?

There is a command "Object / Transform / Align to transform orientation", but what I need is kind of "inverted" version of it.

I created an animation to make it clear what exactly I mean.

Now I join one object to another in order to inherit its rotation. And doing so I feel stupid. I'm sure there is a simple way, but I just can't find it.

Please help.

I've contrived some code to do the trick. Please don't laugh on the lame-code - it works. :-) Maybe somebody will find it useful.

If you want to use it, just save the the text below as the "align_to_to_inverted.py" file, and then install it as an add-on. And you will have the "Align to Transform Orientation inverted" command in your Object menu. It's tricky to insert it in the "Object > Transform", so let's let it be there =).

To use it, in the Object mode select the source object and then the target object (if you want to copy source object's rotation), and execute the command. Selction will be reset, but the target object will remain active.

If you want to align to Transform Orientation, select the only target object, and execute the command. Note that you must set some custom transform orientation. Built in orientations, like Global, View, etc, will not do.

# align_to_to_inverted.py
# The script will align active object to selected one (if there is another selected object).
# or it will use current custom Transform Orientation (if any).
# It changes object's rotation values, but leaves its orientation intact.
# (c) LIII A.S. Mechanic Kharkov

bl_info = {
    "name": "Align to Transform Orientation inverted",
    "description": "Operator to set object's rotation as another's or current custom transform orientation.",
    "location": "Object menu",
    "version": (0, 1, 1),
    "blender": (2, 76, 0),
    "support": "COMMUNITY",
    "wiki_url": "https://blender.stackexchange.com/q/110894/23172",
    "warning": "",
    "category": "Object",
    "author" : "Mechanic. Kharkov."
}

import bpy
from mathutils import * # yes, I know

class AlignToTOInverted(bpy.types.Operator):
    """Aligns active object's rotation values only to selected or TO"""
    bl_idname = "object.align_to_to_inverted"
    bl_label = "Align to Transform Orientation inverted"
    bl_options = {'REGISTER', 'UNDO'}  # Enable undo for the operator.

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

    def execute(self, context):

        trg = bpy.context.active_object
        print("trg: %s" %(trg))

        #find source object
        src = None
        for o in bpy.context.selected_objects:
            if o != trg:
                src = o
                break

        if not src:

            #try to find current user Transform Orientation
            #but this will work only in 3DVIEW space.
            mco = None
            try:
                co = bpy.context.space_data.current_orientation
                if co:
                    mco = co.matrix
                    print("Using Ttansform Oientation %s" % (co.name))
                    print("matrix= %s" % (mco))
                else:
                    print("No Ttansform Oientation found")
            except:
                mco = None

            if not mco:
                self.report({'ERROR_INVALID_INPUT'},"No source object selected\nYou have to select two objects, or be in a custom Transform Orientation.")
                return {'CANCELLED'}

            # ger src natrix, and transposed
            msrc = mco
            trs = msrc.transposed()
            q = trs.to_quaternion()

        else:
            # source given as object
            print("Source object: %s" %(src))
            # ger src natrix, and transposed
            msrc = src.matrix_world
            trs = msrc.transposed()
            q = trs.to_quaternion()

        #now we rotate trg back to apply zero rotation
        mtrg = trg.matrix_world.copy().to_3x3()
        mtrg.rotate(q)
        mtrg = mtrg.to_4x4()
        trg.matrix_world *= mtrg
        #deselect all but trg object
        bpy.ops.object.select_all(action='TOGGLE')
        #select trg as active object
        trg.select = True
        bpy.context.scene.objects.active = trg
        #apply this as default rotation
        bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
        #and now rotate back to src rotation
        q = msrc.to_quaternion()
        mtrg = trg.matrix_world.to_3x3()
        mtrg.rotate(q)
        mtrg = mtrg.to_4x4()
        trg.matrix_world *= mtrg

        return {'FINISHED'}

def menu_func(self, context):
    self.layout.operator(
        AlignToTOInverted.bl_idname)

def register():
    bpy.utils.register_class(AlignToTOInverted)
    bpy.types.VIEW3D_MT_object.append(menu_func)

def unregister():
    bpy.utils.unregister_class(AlignToTOInverted)
    bpy.types.VIEW3D_MT_object.remove(menu_func)

# This allows you to run the script directly from Blender's Text editor
# to test the add-on without having to install it.
if __name__ == "__main__":
    register()

    # test call
    #bpy.ops.object.align_to_to_inverted()


How to correct scale autocad file in Blender I have a autocad file and imported in Blender. After click the Import button i dont know the size is small or large. After going to outliner and selecting the mesh and click the dot button i can view my plan. But its cut off when pan and cant see the units in Feets. How to get the exact scale and units in Blender as compare to Autocad file.

Imported converted in Blender

Autocad File

In order to have correct lengths you need to define and convert units correctly. In any computer software package lengths are measured using floating point numbers that do not have any meaning on their own like for example 15.758, or 3, or 250.5. In one way or another a unit like a meter, a nanometer, a foot, a lightyear or anything else needs to be assigned to the numbers so for example 1 becomes 1 meter, 2 becomes 2 meters and so on. In different programs or even different contexts using the same software different units are used. They need to be converted correctly.

First of all you need to know what units are used in the files you have. Then you also need to choose what units you want to use in Blender:

When you know these two things - the units in your files and the units you are using in Blender - you will know if you need any conversion when importing.

For example: the interior designers I work with are used to working in millimeters, however I work in meters in Blender. I ask them to export the drawings in meters to DXF and they do so. I do not need to adjust anything and get the scale correctly when importing.

If they exported the drawings in millimeters I would need to set the unit scale to 0.001 when importing because a millimeter is 0.001 of a meter.
Same goes for feet - I would set the unit scale to 0.3048 if I chose to work in meters.

You could also scale the units. If it's feet that need to be converted to meters you would select the imported curves and hit s followed by 0.3048.


Black Spots and Corruption During Mesh Edit When I operate on my mesh, black spots and glitches appear. All the normals are aligned correctly and the UV is clean with everything in the right place. Here is an example of what happens when I seperate some faces;

Notice the triangular blotches on the edges.

Here is an example of subdivision on the mesh;

And again, similar corruption occurs when I delete doubles. I have no idea what could be causing this. Can anybody help please?

All right I don't know. I guess the problem bred from the software I used to extract the model (Ninjaripper). It created a weird data layer of normals information (sharp-edge, smooth-face, etc) which doesn't show up in the viewport edit. It makes precious little sense to me, and the man-pages aren't very clear on the subject at all.

The fix as I mentioned above is to remove the data layer before editing, then replace it again afterwards.

Run it up the flagpole...


Electron plane reflection I need to reflect a plane of electrons from the surface as presented in the video. It is now displayed as a filled circle. When the first part of the circle touches the surface it should get immediately reflected, but right now it waits until all other parts hit the surface. In another word, the circle should behave as a pulse of light.

Youtube video

This workflow will work for your filled circle and an reflexion angle equal to the incident angle.

Use Mirror Modifier

To create the reflection we can create a double of the electrons with the mirror modifier.

You need to set the origin of the electrons object on the surface of the reflecting face:

Select the reflecting face and set the 3d cursor to its surface with shift+s -> Cursor to Selected, then go in Object mode, select the electrons and press Ctrl+Alt+Shift+C -> Origin to 3D cursor.

Now you can add a mirror modifier to your electrons and select the correct Axis to have your electrons mirrored under the reflexion Plane

Animate with ShapeKey

We can't animate the object with normal keyframe since we don't want to modifie the origin point set on the reflexion plane.

You can do an animation with shapekey.

Create a first shapekey of the electrons far from the reflexion plane. And create a second shapekey by moving your circle with 3D manipulator and 'Normal' Selected as transform orientation.

Like so your electrons will move with the correct orientation. Already here if you sweep your shape key value, the animation is correct but you still have the mirrored electrons under the reflexion plane.

Hide the Electrons under the plane

To hide the Electron I created a big cube with some subdivision that incorporate electrons under the reflexions plane. Be sure to make it invisible to your render.

To your Electrons, add a Boolean Modifier, set the Operation to Difference and the Object to your newly created Cube. And voilà your electrons are now only under the reflexion plane.

Result:

Here is the blend file I created if you want to play with.


Hair won't bend in a specific direction as if something is blocking it I've been trying to comb a hair on a model with no luck so far. I just did this yesterday on 2 other models where everything worked fine. This time when I try to comb the hair particles, it won't straighten and starts to deform into curly curves, as if something is blocking it in the air. This happens on some strands only but it is enough to ruin my character completely.

I first thought it's maybe because of hair dynamics and collision but
1.) there is no collision on the body
2.) this happens with hair dynamics turned off. And when I deleted the body, rig etc (everything), the hair still curled this way.

In fact, hair dynamics is the only saviour as if I wait and let the hair fall down, it will straighten but this isn't a viable solution.

Second try

Same method and settings are working on another model

After i posted the comment i found the solution..

In particle edit mode press n for the sidebar and in the tool panel is the deflect emitter checkbox.

Uncheck that and you can do what you want with the hair.


Strange artifacts in material transparency (viewport) I wonder what's causing this kind of problems and how to get rid of it. I tried to remove doubles and recalculate normals but these don't work. Any ideas?

Realtime renderer alpha artifacts

I think is related to the way polygons are drawn from the viewport engine.

To make the viewport render faster, the algorithm doesn't take into account whether a face is in front of another, leading to such artifacts. It happens quite the same in other realtime engine like Sketchfab viewer (see Why order matters section). This is pefectly understandable: the software should perform much more calculations if it should not takes into account only the face visibility but also the alpha depth.

See in the image sequence below how till I'm stacking the quads one above the other in order (latest on top) all works well, while switching their position leds to wrong results:

At the end, it seems more important the order in wich faces are "stored" in the file than the alpha&camera-distance factor. The artifacts in the picture comes from a that. Some faces are drawn in front of other even if they are behind.

There are some freshly implemented viewport alpha options for cycles, like BGE's ones, but despite their promising names, they don't work (yet).

Here's a reel of the options in BGE:

While in Cycles you can only see a difference when "Add" is enabled

I personally think developers are "working on it".