Question about verticles!(new on blender) Hello guys anyone knows what is actually the difference between verticles when you build an object-->modifier subdivisional surface and--> smooth shading?
Also can i change the object verticles if i already created? thanks!

If I understand correctly, your main question is what the difference is between smoothing an object via a subdivision surface modifier and via smooth shading.

A subdivision surface modifier smooths an object by taking each face and dividing it into smaller faces, and then smooths the result. You aren't able to edit the vertices generated by the modifier without applying it. However, you are able to edit the original faces still, and the modifier will update accordingly.

Smooth shading doesn't actually change the vertices of your object. What smooth shading does is tell blender to reflect light off of the surfaces as if they were smooth. If you take a default sphere and set the shading to smooth, all it does is tell blender to reflect light off of the object as if it was a perfect sphere and not made up of flat faces.

Often both a modifier and smooth shading are used together, although not always.

With blender, you can almost always edit the vertices of your object with no problems. There are a few cases where it's not a good idea or not easy to edit them, but they are scenarios you won't encounter for a while.


read the source of any tool ( operator ) As you read in the title, i want to read the source of any tool,
but more expecificly i want want to read the code the kinfe_tool.

I can´t find the source to that tool, why??
(i have already try to use the edit operator addon, to serach for operators source)

Please help :D
thanks in advance

Not all operators are written in python, and so you won't be able to get the source from them.

Fortunatelly, Blender is open source and you can look into the source code.
In case of the knife tool, you might want to check this folder:

https://git.blender.org/gitweb/gitweb.cgi/blender.git/tree/HEAD:/source/blender/editors/mesh


Can I render a normal map into a diffuse texture? I'm still very new to Blender, learning what I can while I try to edit models for an outside application (Miku Miku Dance).  My textures are poor and I'm looking for ways to improve them.

Is there some way that I can use tiling normal maps created by a third party and burn them into a diffuse texture?  I'm talking about using the normal map to generate shadows onto an image that I can then edit into an existing diffuse texture.  Keep in mind that these are not normal maps that I generated from the model, but instead represent a deeper level of detail than I could with my simple mesh.  It seems like the sort of thing Blender could do.

As a newb, any details (keystrokes etc) are appreciated, but I can of course use Google as well as anybody else can.

First solution (more complex)

The tiled aspect of the normal map needs a specific UV map (I'll call it "tiled"). And your diffuse texture needs its own UV map (I'll call it "UVmap").

Making "tiled" is the first point : if your model is complex or if its "natural" UVmap is very curvy, it will be hard to handle how to tile it correctly without unwanted deformations.

As an exemple :

The base model (here a plane), and its UVmap :

Add a second UV map (1) and eventually rename it "tiled" (2), then scale it (3) in order to give the tiled aspect

For the example I used this normal map :

Setup your material nodes (here I have put a noise texture but that can be what you want ; there is a lamp in the scene but it is not mandatory)

Add a "UV map" input node and set it to the "tiled" UV map (1)

Connect it to your normal map image texture (2)

Set it as a normal map (3) and connect to the normal input of the shader

Add an image texture for the bake (4) (I presume you have create an image for that) and remember this node needs to be selected when you will bake (the selection defines it as the bake target)

The bake itself :

Make sure your "standard" UVMap is selected for rendering :

Go to the rendering tab and bake section. Click the bake button.

Second solution (simplier)

Make a tiled texture from your normal map texture (using for instance the "small tiles" filter in Gimp).

The principle is the same as above but you'll need only one UVMap as the normal map is already tiled.

Third solution (simplier too)

With one normal map, simply configurate your material like this, using a vector mapping the defining the values (here 10) for the scale :


When I move or scale objects, keyframes are being added When I move, for example, my camera's view to a different place on the timeline, keyframes are being added even if I don't press i. Same thing if I move or scale an object. It never happened before, so I've probably changed a setting but I don't know which?!

Seems like you accidentally enabled Auto Keying. In the Timeline, uncheck the first icon (the circle) of the animation controls :


Emit particles from boolean intersection I would like to emit particles from the boolean intersection between a cube and an irregularly shaped object. The end result is like this:

So, I need to emit particles only from the yellow area. The particles are a group of tiny rocks, they need to be randomly emitted. I tried using the grease pencil to select certain areas (creating a bezier curve from pencil), but this would get time-consuming really fast, and besides, I could not get it to work. Note: I asked a previous question to create the cube, here was the methodology:
Previous Question

EDIT 1: Here's the file link: Link.

Easiest way would be to just select all faces with the yellow material in Edit Mode, there is a button under the Material Slot list to do that, and duplicate them.

Separate those duplicate faces into a new object and add a particle system to it. You can make the Emitter invisible to rendering, and also make it wireframe in the viewport.

Another way is to use Vertex Groups. Just select the yellow faces as above and create a new Vertex Group to which you add the selected vertex. You can then use that vertex group to influence the particle emission by assigning it ti the Density field in the Vertex Groups section under the Particle system settings.

Have in mind that Vertex Groups are not an unequivocal way to define face selections, so some "bleeding" is expected if you select all vertex.

Also see Assign Particle System to parts of a mesh


set uniform weight on component I am struggling on one simple task. I want to set weight of an object. When I assign a bone to it, Blender gives it a random weight map. I want 1.0 everywhere, but whatever I press nothing happens. I also tried painting manually but, although I don't like the method, it doesn't work either.
Thanks in advance.

For this kind of mechanical weight-assignment..
Through the 'Vertex Groups' panel in the object's Data tab

Select the vertices whose weights you want to modify
With the relevant group selected in the panel, set the value in the slider beneath it, and hit 'Assign'.

Or, in Edit mode, Vertex.. ( it might help to have 'Vertex Group Weights' checked in the Overlays, to see the weights as colors)

If the  active vertex is in an existing vertex group, then the Vertex Weights  dropdown will appear, as shown

Set the weight of the active vertex, in the indicated group.
Hit 'Copy' to copy the weight to the other selected vertices

Or, in Weight Paint mode..

With Vertex Masking switched on, and having tabbed out to make your vertex selection and back again, if necessary
Hit ShiftK to fill the selection with the current Brush setting.


Water simulation appearing boxy I'm keeping up with a tutorial but when creating the water it has a boxy shape to it. Almost like pixelated art, and this is not the result I'm looking for. The subdivision modifier is not helping, nor the fluid resolution as it keeps its shape.
 As shown above, from the side.
I would need help making this fluid look more like fluid, less boxy so to say.

Set the Viewport Display from "Preview" to "Final".


I need to make the vertices of a mesh follow a path / curve so that the mesh deforms as it follows the path? Edit: During an animation. I do not mean an extrude but animating the vertices of a mesh along a predefined path curve.

I have a mesh and a complex path curve. I'd like to make each individual row of vertices on the mesh follow the path. I don't know how to do this.

I currently have animall and standard latest version of blender. I can add any other extension i need to complete this task as it is crucial to the project i am making.

1) i have a custom path curve in two dimesional space (the third dimension is locked, static)

2) i have a mesh perpendicular to the path curve (mesh is in x - z and the curve is in y - x)

3) I want to make the mesh follow the path curve to get a nice animation of a piece of endless track rolling down a production line

http://imgur.com/a/D15Ty

Ignore the curve atm it's just a test curve. I want the mesh to deform according to the shape of the curve so i can fake the physics and make a fast and neat animation of a rather complex motion by making the path curve by hand.

I want the vertices of a mesh to follow the path (mesh deforms as it follows the path) with all vertices with the same Y coordinate moving in the same way.

edit: some styling.

Press SHIFT + “C” to center the cursor.

In Front View (Press “1”) Press Shift + “A” and add a plane. Tab into Edit Mode and press CTRL + “R” and add a healthy number of Loop Cuts by scrolling your Mouse Wheel.

Tab into Object Mode and add a Bezier Curve by pressing SHIFT + A. Then Rotate the Bezier Curve 90’ on the “X” Axis. Press “R” “X” 90.

Select your Plane and add a Curve Modifier. In the Modifier Pane choose the Bezier Curve as the "Object"either with the “Eye Dropper” or enter in the name of the Bezier Curve.

Move (Animate) the Plane on the “X” Axis.

A Bezier Curve with more segments and a Sub Surf Modifier on the Plane.


How do I get the knee to bend? I'd like to bend the knees when I move the control bone. They are stiff, how can I fix that? It's not seeable in the pictures but there is a pole bone on the right side.

Have you linked the bone and your mesh? if so have you selected automatic weights when doing so? ( just the way I like to do it )

If you don't want to use automatic weights, just select the parts in the mesh, in the editor mode, and the bone, then link them.
( I'm not a pro, please take what I say with a grain of salt, it might not work! )


Custom squash and stretch without spline length ratio When I add a hook, calc_length() is calculated without modifiers.

I don't fully understand the purpose of calc_length() now, because it no longer appears to be functional.

Is there any other option to create custom squash for cartoon characters without spline_length?

Array modifier fit to curve.

Am of the opinion that Spline.calc_length() would only return the length of the non deformed local coordinates of the curve. It is unaware of what of many objects it is the data part of... trying to bend it out of shape with modifiers and shapekeys etc.

Fortunately can estimate the length simply and quickly using method below.

Add an arbitrarily small "unit" object, could be single edge, or two verts,  to the scene at the location of start of curve and assign it an array modifier and fit to curve. Using defaults of array modifier, it is as long in X direction as the curve.  The smaller the size of unit object the better the precision of estimate.

A little cube set to fit the length of curve

Now at any time the estimated length of curve is given by the array modified "unit" object's x dimension.

Dragging a hook on curve changes dimension of cube.  UI update a bit sluggish, but you get the gist

This can be attached to rig and hidden.


How to popup simple message box from python console? How can i popup message box from python console ? something like message('test').

One way to do this is by using a operator and the self.report() method. Here is a example

import bpy

class MessageBoxOperator(bpy.types.Operator):
    bl_idname = "ui.show_message_box"
    bl_label = "Minimal Operator"

    def execute(self, context):
        #this is where I send the message
        self.report({'INFO'}, "This is a test")
        return {'FINISHED'}

bpy.utils.register_class(MessageBoxOperator)

# test call to the
bpy.ops.ui.show_message_box()

This will show a little message box up in the top tool bar and really isn't efficient for a bigger/longer message.

Another more efficient way of displaying a message box is window_manager.popup_menu() here is an example script:

import bpy

def ShowMessageBox(message = "", title = "Message Box", icon = 'INFO'):

    def draw(self, context):
        self.layout.label(message)

    bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)

#Shows a message box with a specific message
ShowMessageBox("This is a message")

#Shows a message box with a message and custom title
ShowMessageBox("This is a message", "This is a custom title")

#Shows a message box with a message, custom title, and a specific icon
ShowMessageBox("This is a message", "This is a custom title", 'ERROR')

You can see hear I made a custom message box method called ShowMessageBox() this is what the method will show starting from the first example to the third:

Hope this helps! (sorry for the super late reply)

EDIT for 2.80

UILayout.label(text="") requires text to be a keyword argument.

self.layout.label(text=message)


Cannot find the knife tool (already in editing/ modeling mode) I apologize for the rather silly question; I've been looking around to see why the knife tool (or the rest of the extended tool box) does not show, but I could not find any solutions online.

I've attached a picture that should help clarify the issue.

Please let me know if I need to provide anything else.

Don't think the knife tool is available for metaballs. Should convert it to a mesh before.


Joining different UVmaps from different objects I have 7 separated objects with different UV maps, but since i want to export to unity i would like to join all the UV in order to reduce draw calls keeping the objects separated. Is it possible?

You can't combine the UV maps of multipe objects in Blender. Officialy the the TextureAtlas plugin only supports lightmaps (the link could be outdated).

But wait Gleb Alexandrov made a promising tutorial:

  John Carmack from id Software used megatexture. You use megatexture.

game-level-texturing-texture-atlas

Related Unity Links:

Draw Call Minimizer
whats-the-best-way-to-reduce-draw-calls


Using ctrl alt s to change b-bone size I've been trying to change the width of b-bones using Ctrl+Alt+S shortcut, when I do that it just selects hp support info instead of allowing me to change width.

Open User Preferences Ctrl+Alt+U
Switch to Input Section.
Type in search Transform

Under Pose you will see the shortcut that is associated with bone transform.


Eevee shadows and lighting in viewport different from final results I've always used cycles engine in blender 2.79 but when 2.8 was released I tried to switch to eevee since it take less time to render and it looks good
but the problem with eevee is the lighting looks very good in the viewport but when rendering the scene the shadows looks off and not like in the viewport.
Viewport :

Render result :

I thought that there was a problem with the HDRI since it casts light as well but when I turned strength to 0 the render results were the same.

Blender version - 2.83.1
Render engine - Eevee

I figured it out the Sun's interactive point doesn't change place in final render result when I move it so I have to rotate the main sun


Do "make install" on different Linux sytem than the one used for "make bpy" I have successfully built Blender-2.80-Beta as bpy (as in make bpy) for linux in Ubuntu 18. Also when i do make install on the same system i can sucessfully use import bpy.

However i don't know what the best approach would be to install the bpy-build to another different linux system. For me it is not really an option to also do the "make bpy" on that other system, since that system has very limited resources (400MB of free hard disk space)

Some approaches i can think of:

Is there maybe a (automatic/manual) way to do make install with
changed directories for python3.7, ... etc. ?
Or is there a reasonable manual way to install? (The library is only bpy.so and the 2.80 Folder right?)
Or can i maybe build to a virtual environment, install there and then
copy the whole environment to the other linux system for it to work there?

I have tried copying bpy.so and the 2.80 folder to the other-systems site-packages but while it reads printTest.py it cannot use import bpy as seen in the picture:

Thank you for any help!! :)

This is not really an answer, not my knowledge either.
Wanted to add this as a comment, but I don't have enough reputation to do so.
I asked Campbell Barton several years ago about how to build blender so I could share my builds with people that used a different distro than I did, and this is what he replied:

There are a few issues here, First is with general libraries - if the
users doesnt have those exact libraries, blender wont start. To find
the libraries blender depends on do...
objdump -x blender.bin | grep NEEDED
You can do this too, it will show all indirect dependencies too.
ldd blender.bin
There are 2 ways to go about this,
*) statically link all libraries
*) include the libraries and use LD_PRELOAD_PATH to ensure they get found, this requires a wrapper script. to set the environment
variable.
Statically linking libs is best if you can, but for that you will need
".a" files, so not libpython3.2.so --> libpython3.2.a
however not all libraries come with static versions by default... it
can be a hassle to get them all.
There are docs on static linking libs, you can check online for more
info.
Also be sure to static link libgcc_s.so.1 and libstdc++, gcc has some
options for this.
once you have this sorted out the main remaining problem is linking
against libc, since you cant run blender on and older linux distro if
you linked with a newer glibc (normally called libc.so.6).
To workaround this you need to link against an older glibc, This can
be done by setting up a chroot environment that uses an older libc. or
simply by using a VM with an older linux distro installed, both are a
hassle :S.
Try google: linux link against older glibc
It comes up with some useful links.
Note that for our official linux builds we have a chroot with some
older libs installed so blender loads on older linux installs too.

Hope that helps!


Custom Ui Columns In A Box I want to put columns in a box, apparently I don't know how I can do this.
I have got the following code:
        split = layout.split(factor = 0.75)
        col = split.column(align = True)

        col.label(text = "select your armor here", icon = "OUTLINER_OB_ARMATURE")
        col.prop(obj, "ArmorHelmetEnum", text = "Helmet")
        col.prop(obj, "ArmorChestplateEnum", text = "Chestplate")
        col.prop(obj, "ArmorLeggingsEnum", text = "Leggings")
        col.prop(obj, "ArmorBootsEnum", text = "Boots")

        col = split.column(align = True)
        col.label(text = "")
        col.prop(obj, "helmet_color", text = "")
        col.prop(obj, "chestplate_color", text = "")
        col.prop(obj, "leggings_color", text = "")
        col.prop(obj, "boots_color", text = "")

It's not in the Box as I would like it to be. I googled it but I haven't found a good answer that has helped me.

You have to insert the Box component before the split.
        box = layout.box()
        split = box.split(factor = 0.75)
        col = split.column(align = True)

        col.label(text = "select your armor here", icon = "OUTLINER_OB_ARMATURE")
        col.prop(obj, "ArmorHelmetEnum", text = "Helmet")
        col.prop(obj, "ArmorChestplateEnum", text = "Chestplate")
        col.prop(obj, "ArmorLeggingsEnum", text = "Leggings")
        col.prop(obj, "ArmorBootsEnum", text = "Boots")

        col = split.column(align = True)
        col.label(text = "")
        col.prop(obj, "helmet_color", text = "")
        col.prop(obj, "chestplate_color", text = "")
        col.prop(obj, "leggings_color", text = "")
        col.prop(obj, "boots_color", text = "")
```


Inset Tool Modal Map missing For speeding my modeling workflow I created a ergonomic keymap explained here.
But the inset tool doesn't have the Modal map like the knife tool. Which allows you to remap his shortcut when activated. How can I access or create this option?

Here you go just search for keypress and the letter " i " in the search box.
You will find it under mesh category.


blender renders nothing i've made a bus model for my little project, on the earlier version of my model it renders just fine, on this version it just doesn't show up in the renderer, just pitch black,on materials and texture its fine, render just shows nothing, here's a screenshot and my .blend file that might help you to understand my problem

You turned off the Combined Layer Pass in the scene

Go to the Properties Editor > Render Layers Tab > Passes and activate the Combined layer pass


update text after edit mesh with handlers I need to update my text every time I alter my mesh in edit or object mode or if I edit the Tool panel.
I use this script:

# [snip]
# line 308
def update_scene(context):
    obj = bpy.context.active_object
    if obj.is_updated or obj.data.is_updated:
        handle_add(self, context)
        print("%s - Object data is_updated (pre)" % obj.data.name)

def handle_add(self, context):
    VIEW3D_OT_ADH_display_text._handle = bpy.types.SpaceView3D.draw_handler_add(
       draw_text_callback,
       (self, context),
       'WINDOW', 'POST_PIXEL')

def handle_remove(context):
    _handle = VIEW3D_OT_ADH_display_text._handle
    if _handle != None:
        bpy.types.SpaceView3D.draw_handler_remove(_handle, 'WINDOW')
    VIEW3D_OT_ADH_display_text._handle = None

class VIEW3D_OT_ADH_display_text(bpy.types.Operator):
    bl_idname = "view3d.adh_display_text"
    bl_label = "Display text"
    _handle = None

    @classmethod
    def poll(cls, context):
        return update_scene not in bpy.app.handlers.scene_update_post

    def execute(self, context):
        st = context.window_manager.show_text

        handle_add(self, context)
        bpy.app.handlers.scene_update_post.append(update_scene)

        st.enabled = True

        return{'FINISHED'}

class VIEW3D_OT_ADH_remove_text(bpy.types.Operator):
    bl_idname = "view3d.adh_remove_text"
    bl_label = "Remove text"

    @classmethod
    def poll(cls, context):
        return update_scene in bpy.app.handlers.scene_update_post

    def execute(self, context):
        st = context.window_manager.show_text

        handle_remove(context)
        bpy.app.handlers.scene_update_post.remove(update_scene)

        st.enabled = False

        return {'FINISHED'}

But when I run the script like that, the console shows the following error:

line 312, in update_scene
NameError: name 'self' is not defined

If I add self in the update_scene arguments, another error shows in the console:

TypeError: update_scene() missing 1 required positional argument: 'context'

I have not managed to solve this problem, which is likely an easy fix. How can I do that please ?

The error NameError: name 'self' is not defined is pretty self explanatory, you are using self as a variable name and it has not been defined at the point you are using it. self is a variable name normally only used within a class definition while you are trying to use it in a module function.

self is normally defined to point to the object that the current function belongs to. In the context that you are trying to use it, it will be the first argument sent to the callback function, meaning it should point to the object that will be handling the callback.

I think to achieve what you want, try adding a variable to the scene object that holds a list of data that draw_text_callback draws (See the example for CollectionProperty), your update_scene maintains the list and draw_text_callback goes through it to draw what it needs to.

The second error is because you can't add another parameter to the function used for scene_update_post as it must match the single argument prototype that is defined to be used.


Does PNG files size affect video output file size? I’m creating 15 second animations with approx 500 frames (1280x720) at 24FPS resulting in 20Mb file size. Similar videos online are well under 5Mb even under 2Mb. I’m currently video editing using the default blender settings for 720p MPG4 H264 with no audio. I tried various video output settings to reduce file size but there is a noticeable drop in quality.

My initial PNG renders are at blender’s default settings but with 100% compressed RGB (no alpha) with each image about 1.2Mb. Would compressing these images further in blender or using other programs etc reduce the video output of these images? Or is there no correlation between the PNGs and MPG4 file size?

Either way, what are the ideal PNG and video output settings within blender to reduce the final video file size whilst maintaining the same quality? Or should I be compressing the videos further using an external program?

Yes...and no.

First of all, I would 100% recommend that you render at the same resolution that you plan to make your video unless you're planning on using AI Upscaling. Doing otherwise would result in the same effect that zooming really closely into an image produces - you start seeing the individual pixels.

Video files will always be smaller than the summation of the frame outputs. That's because videos don't actually store every single frame as an image, they instead use algorithms to store some frames and record what changes between different frames. Rather than trying to explain this myself here's a good short video explanation for this by Tom Scott on Youtube.

From my experience (and it should be noted that I've done some video editing using Adobe Premiere in the past, but nothing professionally), you shouldn't need to further compress the video - MPG4 will already compress the output to be much much smaller.


blender camera from 3x4 matrix In computer vision, the transformation from 3D world coordinates to pixel coordinates is often represented by a 3x4 (3 rows by 4 cols) matrix P as detailed below. Given P I need code to return a camera in Blender.

This is the inverse of my previous question 3x4 camera matrix from blender camera

Context where this shows up

This is useful for e.g. Augmented reality where 3x4 cameras are computed from real imagery using computer vision / structure from motion algorithms which are then used in CG to render registered synthetic models. Right now I want to employ multiple real images to be used as multiview reference for detailed 3D modeling.

Some Details

An image pixel $(u,v)$ is generated from world $(x,y,z)$ coordinates through a 3x4 matrix using projective coordinates:

$$kx = PX$$

where $k$ is a constant, $x = (u,v,1)^t$, $X = (X,Y,Z,W)^t$, $P$ can be decomposed as

$$P=K[I|0] \begin{bmatrix}
R & T\\
0^\text{T} & 1
\end{bmatrix} = K[R|T]$$

and $K$ can be decomposed as

$$K=\begin{bmatrix}
\alpha_u & s & u_o\\
0 & \alpha_v & v_o\\
0 & 0 & 1
\end{bmatrix}$$

given that:

$$f=\text{focal length}$$
$$\alpha_u=\frac{f\times u\text{ pixels}}{\text{unit length}}=\frac{f}{\text{width of a pixel in world units}}$$
$$\alpha_v=\frac{f\times y\text{ pixels}}{\text{unit length}}=\frac{f}{\text{height of a pixel in world units}}$$
$$u_o=u\text{ coordinate of principle point}$$
$$v_o=v\text{ coordinate of principle point}$$
$$s_\theta=\text{skew factor}$$

I need to generate a Blender camera from this.

Preliminary Research

I could certainly detail this up further in terms of all the coordinate systems and work out the solution myself if need be, but I'm looking to reuse well-tested shared code.

Libmv conversion code from internal to blender camera: libmv/src/ui/tvr/tvr_document.h

Directly related to:
What is blender's camera projection matrix model?
3x4 camera matrix from blender camera

Other related questions:
How can I get the camera's projection matrix?,
How to find image coordinates of the rendered vertex?

I wrote the function get_blender_camera_from_3x4_P to do this, listed below.

    # Input: P 3x4 numpy matrix
    # Output: K, R, T such that P = K*[R | T], det(R) positive and K has positive diagonal
    #
    # Reference implementations:
    #   - Oxford's visual geometry group matlab toolbox
    #   - Scilab Image Processing toolbox
    def KRT_from_P(P):
        N = 3
        H = P[:,0:N]  # if not numpy,  H = P.to_3x3()

        [K,R] = rf_rq(H)

        K /= K[-1,-1]

        # from http://ksimek.github.io/2012/08/14/decompose/
        # make the diagonal of K positive
        sg = numpy.diag(numpy.sign(numpy.diag(K)))

        K = K * sg
        R = sg * R
        # det(R) negative, just invert; the proj equation remains same:
        if (numpy.linalg.det(R) < 0):
           R = -R
        # C = -H\P[:,-1]
        C = numpy.linalg.lstsq(-H, P[:,-1])[0]
        T = -R*C
        return K, R, T

    # RQ decomposition of a numpy matrix, using only libs that already come with
    # blender by default
    #
    # Author: Ricardo Fabbri
    # Reference implementations:
    #   Oxford's visual geometry group matlab toolbox
    #   Scilab Image Processing toolbox
    #
    # Input: 3x4 numpy matrix P
    # Returns: numpy matrices r,q
    def rf_rq(P):
        P = P.T
        # numpy only provides qr. Scipy has rq but doesn't ship with blender
        q, r = numpy.linalg.qr(P[ ::-1, ::-1], 'complete')
        q = q.T
        q = q[ ::-1, ::-1]
        r = r.T
        r = r[ ::-1, ::-1]

        if (numpy.linalg.det(q) < 0):
            r[:,0] *= -1
            q[0,:] *= -1
        return r, q

    # Creates a blender camera consistent with a given 3x4 computer vision P matrix
    # Run this in Object Mode
    # scale: resolution scale percentage as in GUI, known a priori
    # P: numpy 3x4
    def get_blender_camera_from_3x4_P(P, scale):
        # get krt
        K, R_world2cv, T_world2cv = KRT_from_P(numpy.matrix(P))

        scene = bpy.context.scene
        sensor_width_in_mm = K[1,1]*K[0,2] / (K[0,0]*K[1,2])
        sensor_height_in_mm = 1  # doesn't matter
        resolution_x_in_px = K[0,2]*2  # principal point assumed at the center
        resolution_y_in_px = K[1,2]*2  # principal point assumed at the center

        s_u = resolution_x_in_px / sensor_width_in_mm
        s_v = resolution_y_in_px / sensor_height_in_mm
        # TODO include aspect ratio
        f_in_mm = K[0,0] / s_u
        # recover original resolution
        scene.render.resolution_x = resolution_x_in_px / scale
        scene.render.resolution_y = resolution_y_in_px / scale
        scene.render.resolution_percentage = scale * 100

        # Use this if the projection matrix follows the convention listed in my answer to
        # https://blender.stackexchange.com/questions/38009/3x4-camera-matrix-from-blender-camera
        R_bcam2cv = Matrix(
            ((1, 0,  0),
             (0, -1, 0),
             (0, 0, -1)))

        # Use this if the projection matrix follows the convention from e.g. the matlab calibration toolbox:
        # R_bcam2cv = Matrix(
        #     ((-1, 0,  0),
        #      (0, 1, 0),
        #      (0, 0, 1)))

        R_cv2world = R_world2cv.T
        rotation =  Matrix(R_cv2world.tolist()) * R_bcam2cv
        location = -R_cv2world * T_world2cv

        # create a new camera
        bpy.ops.object.add(
            type='CAMERA',
            location=location)
        ob = bpy.context.object
        ob.name = 'CamFrom3x4PObj'
        cam = ob.data
        cam.name = 'CamFrom3x4P'

        # Lens
        cam.type = 'PERSP'
        cam.lens = f_in_mm
        cam.lens_unit = 'MILLIMETERS'
        cam.sensor_width  = sensor_width_in_mm
        ob.matrix_world = Matrix.Translation(location)*rotation.to_4x4()

        #     cam.shift_x = -0.05
        #     cam.shift_y = 0.1
        #     cam.clip_start = 10.0
        #     cam.clip_end = 250.0
        #     empty = bpy.data.objects.new('DofEmpty', None)
        #     empty.location = origin+Vector((0,10,0))
        #     cam.dof_object = empty

        # Display
        cam.show_name = True
        # Make this the current camera
        scene.camera = ob
        bpy.context.scene.update()

    def test2():
        P = Matrix([
        [2. ,  0. , - 10. ,   282.  ],
        [0. ,- 3. , - 14. ,   417.  ],
        [0. ,  0. , - 1.  , - 18.   ]
        ])
        # This test P was constructed as k*[r | t] where
        #     k = [2 0 10; 0 3 14; 0 0 1]
        #     r = [1 0 0; 0 -1 0; 0 0 -1]
        #     t = [231 223 -18]
        # k, r, t = KRT_from_P(numpy.matrix(P))
        get_blender_camera_from_3x4_P(P, 1)

Tests

I got an image with known 3x4 projection matrix P. This can be from a computer vision dataset (usually following the conventions of the Matlab camera calibration toolbox), tracked set, or by generating P from a blender camera as in 3x4 camera matrix from blender camera
I ran the above algorithm for such P, obtaining a camera in Blender.
The dataset I tested with has 3D reconstruction data as well
Numpad 0 gives the camera view. I confirmed that it looks like the photo
By adding a background image to the camera, I noticed that the 3D model projection is spot-on.

Remarks

This code is meant as a basis for a general solution. Modify this if you follow different conventions.
Only unit aspect ratio (render option) is supported for now.
The camera representation might sometimes look odd, but the only thing that matters is that it generates the right image.


How to invert vertex colors in Blender? So there is no built-in functionality to invert vertex color o.O

How can I invert vertex color on an active object?

This is all that is needed, and the way I prefer to access vertex colors. It works in any mode:

import bpy

obj = bpy.context.active_object

for ipoly in range(len(obj.data.polygons)):
    for idx, ivertex in enumerate(obj.data.polygons[ipoly].loop_indices):
        ivert = obj.data.polygons[ipoly].vertices[idx]
        col = obj.data.vertex_colors.active.data[ivertex].color
        obj.data.vertex_colors.active.data[ivertex].color = tuple(1-x for x in col)

If you want UI button add it with this micro addon (save as .py file into addon folder):

bl_info = {
    "name": "Invert Vertex Colors",
    "location": "3D viewport > Header > Paint menu in Vertex Paint mode",
    "version": (0,1,0),
    "blender": (2,7,6),
    "description": "Inverts vertex colors of active paint layer",
    "author": "Jerryno",
    "category": "Paint",
}

import bpy

class InvertVertexColors(bpy.types.Operator):
    bl_idname = "paint.invert_colors"
    bl_label = "Invert Vertex Colors"
    bl_description = "Invert vertex colors of active paint layer"

    @classmethod
    def poll(self, context):
        try:
            return context.active_object is not None
        except (AttributeError, KeyError, TypeError):
            return False

    def execute(self, context):
        active = context.active_object
        for ipoly in range(len(active.data.polygons)):
            for idx, ivertex in enumerate(active.data.polygons[ipoly].loop_indices):
                ivert = active.data.polygons[ipoly].vertices[idx]
                col = active.data.vertex_colors.active.data[ivertex].color
                active.data.vertex_colors.active.data[ivertex].color = tuple(1-x for x in col)
        return{'FINISHED'}

def menu_entry(self, context):
    self.layout.operator("paint.invert_colors", icon='IMAGE_ALPHA')

def register():
    bpy.utils.register_module(__name__)
    bpy.types.VIEW3D_MT_paint_vertex.append(menu_entry)

def unregister():
    bpy.utils.unregister_module(__name__)
    bpy.types.VIEW3D_MT_paint_vertex.remove(menu_entry)

if __name__ == "__main__":
    register()


bevel shader not appearing in 2.79 on Mac I have seen tutorials showing the bevel shader in Blender 2.79b. I cannot get it to show up in the shader menu even after doing a fresh install of Blender. I wonder if it is a Mac issue. I am running Mac OS high sierra 10.13.6, AmD FirePro D700 graphics cards. In the shader node editor I am going Add:Input... bevel shader should appear between Attribute and CameraData but it doesn't.

Cycles Bevel Shader is an experimental feature introduced after the release of Blender 2.79.

It is available in experimental trunk builds post release but not in official ones.

It is to be introduced to general public as a new Blender 2.8 feature as stated in the release notes.

It should also be used sparingly since it is computationally heavy and resource hungry. In most cases it is preferable to use geometry based solutions since it is cheaper to render then the shader, unless you encounter issues or glitches with complex geometry.


How to create a Round Edges Effect on an object? I'm able to import an object into Blender which was created in MagicaVoxel. The object keeps the desired texture in Blender and looks like this in Edit Mode.

I want to add a "Rounded Edges" or "Rounded Grids" effect onto this object so it looks similar to this:
The result should be useable in Unity as well.
Other solutions from this site like How to create a "Rounded Grids" effect like in MagicaVoxel sadly don't work.
I've tried to work with Normal Maps and UV Mapping but these approaches apparently didn't work due to the shape of the object and due to the fact that it comes with material.

If you create a new default UV map for an object, each quad face is given the entire UV canvas.

Disclaimer here, I think this only happens if you have first deleted every other UV map on the object, otherwise the previous UV map just gets duplicated to the new slot.  So if you are confident that you can unwrap your object again, it should be easy at this point to find or create a normal map that will give us this effect.  I just grabbed one from image search results for educational purposes.
You can create a second UV map to do a full unwrap if needed, so for argument's sake I'm using the UV Map node to draw from a specific UV map for this.

Hopefully this works for the Unity workflow, or at least gives you some ideas.


Merge a curve with an object How can i merge a curve with an other mesh? It doesn't work with  ctrl+j - Error: no mesh data to join.

Is possible to do that?

I created a lightbulb and the filament is made from a curve and i want to merge it with the other parts.

Indeed there is no mesh-data if your object is a curve.
If you just want to move them together parenting the filament to the bulb would be a great non destructive option. Otherwise if you don't need to modify your filament anymore you can convert the curve to a mesh Object > Convert to > Mesh from curve and after that join the two meshes with Ctrl + J


Exporting models to Adobe Dimension I have a question about changing units when exporting to Adobe Dimension. When I export basic cube 2 m x 2 m x2 m from Blender 2.8. as a OBJ file and import it in Adobe Dimension, the cube has 2 cm x 2 cm x 2 cm. It is one hundred times smaller. Why doesn't have it same dimension? If I try to exchange the cube with FBX file, the scale of the cube is same ( 2 m ). I supose that universal format for exchange models between 3D aplication is OBJ file. Any explanation?

According to https://en.wikipedia.org/wiki/Wavefront_.obj_file :
"OBJ coordinates have no units[...]"

This means that it is up to the importing application to decide what a unit is. It could be yards, kilometres, centimetres etc. If you know that Adobe Dimension uses centimetres then you need to export it as such.

You can set the scale to 100 in the obj exporter for instance.

The obj file format can be opened with a text editor to review how the object is exported.


What is the the ASC-CDL node? The color balance node in the compositor can be switched to use the ASC CDL

How is it used?

How is this different from Lift/Gamma/Gain?

How do the Offset, Power, Slope options affect the image?

#ASC-CDL stands for the American Society of Cinematography's Color Decisions List
It's designed to create a standardized protocol to share basic color correction data across different systems from different vendors. It is a protocol that can be applied to either scene referred linear or log-like encoded imagery. The following outlines scene referred as Blender’s reference space is scene referred. Care must also be taken regarding white points and chromaticity, as using the CDL on work encoded differently to your reference will yield randomly different results, and the CDL is not a means to uniform grading changes alone. Reasonable advice is to not grade work prior to compositing, and grading should be the very last step of a pipeline.
It should be noted that applying the CDL on linear and log-like data has two completely different results. They include:

Log-like data will change contrast on slope adjustments, while linear will change exposure. Multiplication is a power function on log, and a scale on linear.
Log-like data will change exposure on offsets, while linear will literally be uniformly offset. Offsets are multiplication on log, while simple addition on linear.

The functions that the ASC-CDL node provides in blender are:
#SLOPE , OFFSET and POWER:

Slope:

Scene Referred Data is multiplied. 0 remains unchanged. Slope can be any number greater than 0. Default Value is 1. Corresponds to a uniform exposure adjustment when Power and Offset remain untouched.

Offset:

Data is added. Raises or lowers overall brightness. Offset can have positive or negative values. Default value is 0
Note: Blender's CDL node currently allows for negative values via the strange "Basis" entry box because of Blender's decision to not permit negative values in the UI. (It is best to leave this one untouched, unless you absolutely know what you are doing).

Power:

Data is multiplied by itself ^ amount of times. Power can be any number higher than 0. This function is considered "non-linear", as it changes the shape of the transfer function. The default value is 1
To expose the values and do precise numeric editing of any of the values click on the color box at the bottom of the big color circle to expose the RGB values used for the node's transform operations:

NOTE The CDL works only via RGB values. Working on HSV or HEX does not work correctly due to their nonlinear encodings. Also, the input to the CDL node must be scene referred RGB ratios. No other colour encoding model will work, so avoid any transforms in your node chain that change the format from RGB.
Even though the node in Blender is arranged differently, the order in which the transformations should be executed is SOP
The final formula to calculate combined transformations is then:
Slope= input x slope
Offset= (input x slope) + offset
Power= ((input x slope) + offset) ^ power
Also note that blender does not provide functionality to affect saturation as part of the CDL node. To control saturation on scene referred data a custom node group needs to be created to operate after the CDL node. Maybe a topic for a new question.
#Difference with Lift, Gain and Gamma
Lift, Gain and Gamma vary in definition between different systems and manufacturers.
In the case of Blender's color balance node, it is vaguely defined like this on the manual:

Lift Increases the value of dark colors. Gamma Will adjust midtones. Gain
Adjusts highlights.

There is no explanation on what that means, and where the thresholds for shadows or highlight begin or end.
The Code
To appreciate the nuances of the difference, it helps to look at how the formulas behave, and in particular, behave with scene referred data.
Here's the code for the ASC-CDL node:
float x = in * slope + offset;
return powf(x, power);

And here is the code for the Lift, Gamma, Gain node:
float x = (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain;
return powf(srgb_to_linearrgb(x), gamma_inv);

So aside from looking like mumbo jumbo gobbledygook, I'd encourage you to look at the line in the Lift, Gamma, Gain operation where it takes the linearrgb_to_srgb(in) - 1.0 value. Sadly, aside from an extremely myopic function name, there is a subtract from one, and an addition to one in there. This is the tell-tale mark that some bad assumptions are at play.
The Mangling
This speaks volumes about the nature of the formula. That is, it is display referred the moment you make grotesque assumptions about the values you are feeding into it. In this case, the 1.0 represents a maximum assumed value.
Of course, in scene referred imagery, there is no such thing as white, no such thing as black, and no magical values you can lean on that mean anything in particular. Cycles generates just such scene referred values, and as such, feeding a Cycles render through Lift, Gamma, Gain will not only not work at all, any results it delivers will be absolutely and critically broken beyond belief.
So, using Lift Gain and Gamma only works on information with a range of 0 to 1, making it unusable for those trying to work with higher dynamic ranges with much larger values.
The CDL has no such limitation. It can work on RGB values of any range.
Many formulas passed down through Stack Exchange and other sites with information all too frequently assume things about RGB that shouldn't be assumed. While Lift, Gamma, Gain is one such display referred assumed formula, there are many other traps like this. The AdobePDF specification lists many of them, and many of those formulas have sadly ended up in scene referred image manipulation applications. Screen, Overlay, Hard Light, Soft Light, etc.? Yes... all display referred and all will mangle your imagery.
The Standard
Beyond the basics of the formula simply not working, the ASC-CDL is a canonized function defined by the Academy. That means there is a specific specification that stipulates that in order to call itself the ASC-CDL, it must abide by the specification. Further still, because of this, you can find ASC-CDL transforms in many different applications. Unlike Lift, Gamma, Gain, if an application chooses to implement the standard, you can be reasonably sure (bugs notwithstanding) that it is identical across applications, assuming the caveats in the introduction are held to; different input data formats will yield different output even with identical CDL values.
Use and Reuse
Finally, because the ASC-CDL is a referential baseline, you can also find unique applications for the ASC-CDL, such as the ability to apply hand-crafted ASC-CDL values into a colour management system such as OpenColorIO, enabling an imager to quickly use Looks they have generated previously. Not only are you able to use a variety of different techniques to achieve this, as expressed in the previous notes, you can be quite certain that the formula is the formula you expect.
#But where is the "List" part of the Color Decision?
Even though ASC-CDL nodes in other apps have the ability to save their settings into a file, so that it can be used across different programs and vendors, Blender does not offer such capabilities yet. Manually creating an .XML file with the data is possible, and the color decisions translate (and can be reversed) across platforms. The beauty of this is that if you are saving to OpenEXR with no color correction baked into the image, you can set looks that can be reproduced on other systems. Or if the color correction has been baked into the image in an EXR file, it can be reversed on other systems for further grading.
How to create the text file would need to be the topic of other question.
In the end, it is up to an educated imager to be aware of the upside and pitfalls, and choose their tools based on solid foundational knowledge.
For more information on wide dynamic range rendering please refer to this post: Render with a wider dynamic range in cycles to produce photorealistic looking images
See also Mike Most's discussion about the CDL.
Main source used: ASC-CDL_Release1.2 by Joshua Pines & David Reisner, 2009


What does this red line across my shader node mean? I am unsure what this red line linking the input and output of the node signifies in the below image.  Can anyone tell me what it is?

That means the node is muted and isn't taking any part in calculations. To unmute it, select the node and press M


Render Result vs Viewer Node I am pretty new to blender and I am sure someone has asked this question before.. but basically I am following along with this tutorial and I added all these nodes in the compositing view.. Basically whenever I render my image or animation it doesn't have any of the nodes I added... like color or a little bit of blur etc... Here is an image of what I want it to look like vs how it is rendering...

I want my final animation to look like the centered image.. but whenever I render it looks like the bottom left image.. I am sure there is some small detail I am missing or something... Please help me!!!!

The Composite Node(or the Render Result) outputs to the image editor and is your final render and is where you save from. The viewer node is used as a backdrop for the compositor. It's not intended for a final render but rather to preview the render result allowing you to more easily adjust compositor settings.

Also in the compositor make sure you check Use Nodes and Backdrop. The backdrop is used to see what is inputted into the Viewer node.

Viewer Node: https://docs.blender.org/manual/ko/dev/compositing/types/output/viewer.html

Composite Node:
https://docs.blender.org/manual/ko/dev/compositing/types/output/composite.html


How to rig a chest lid I have never made any rigs or used bones before, but I need to do an extremely simple task. I have modeled a chest, and I simply want to rig it so that I can open and close it with a click and drag of the mouse. Here's the chest:

And I want it to open like this (in this case I'm using R+Y with 3D cursor at pivot point)

One possibility:

Add a bone that begins in the rotation axis. Any other object will do as well because I don't use a rig but simply a parent/child.

Parent the bone to the top of the chest and the bottom of the chest to the bone.

Lock the location of the bone and two of the rotation axes (depends on how your bone is rotated).

Now you can select the bone and press R to open and close the chest independent of the chests position or rotation.

Note that you don't even need a third object for that (bone). If the top's origin is on the rotation axis then you can parent directly and lock position as well as two rotation axes.


Rig pose of proxy armature isn't saved I've linked a (collection with armature) of an animatable character from blender cloud. I have made a proxy of the rig and am able to pose the character, but when I save it and reload the .blend-file the characters pose is reset! Why isn't the pose saved. I thought by making it a proxy it is not anymore linked to the original character file and savable!?

This is due to protected layers on the armature. https://docs.blender.org/manual/en/latest/animation/armatures/properties/skeleton.html#protected-layers
Also, keyframing your poses is always a good idea, and quite the opposite of hacky. If you aren't keyframing your poses you're hanging by a thread, and opening yourself up to various ways of losing said posing, this being only one of them!


Why doesn't my script work on all of the vertices of a mesh? So, I wrote this script to read UVs from a mesh and use the values to position the actual vertices on the same coordinates, but in 3D space, here's the script:

import bpy
import bmesh
from mathutils import Vector

obj = bpy.context.active_object
me = obj.data
bm = bmesh.from_edit_mesh(me)
uv_layer = bm.loops.layers.uv.verify() #get the uv layer
bm.faces.layers.tex.verify() #get the faces inside the uv map

for f in bm.faces: #for each face get the value of X and Y and transfer it to the 3D vertices
    for l in f.loops:
        luv = l[uv_layer]
        if luv.select:
            l.vert.co.xz = (luv.uv*200)-Vector((100,100))
            l.vert.co.y = 0

bmesh.update_edit_mesh(me) #update the mesh

It works fine, but it only works in a portion of the mesh, not it's entirety, and I don't know why, can someone shed a light on this subject?

Oh nevermind. All I had to do was remove the line: if luv.select: so that the script doesn't verify if the uv layer is selected for all vertices.


How to make a chinese doggy bag? Hello,
I'm new with this program and I really need your help!!
I'd like to make a doggy bag like this image, without food.
I could find some tutorials making box but I would like to make the bottom round and the top opening part in square.
Is there sweet somebody who can explain me this easily please??
That would be so lovely!
Thank you :)

You could do it this way:

Create a plane and subdivide it twice.
Bring the additional edge loops close to the borders.
Extrude down the whole plane and recalculate the normals with a ctrlN.
Remove the bottom, select the rim and press W > LoopTools > Circle to make your square a circle (if you don't see the LoopTools you need to activate the addon in the Preferences).
Now your bottom is a circle, rotate it on the Z axis so that it's correctly aligned.
If you give your object a Subdivision Surface modifier you'll have a smooth object but your top angles won't be sharp anymore. To sharp then back create some additional edge loops with some ctrl R.
Remove the top faces.
Close the bottom with some extrudes, then a merge: alt M > At Center.
You can add a Solidify modifier to give it thickness.


New blender update doesn't let me render in MP4 After Blender 2.79 dropped, I can't seem to render in MP4. I have attempted to use the FFmpeg video option they added, but no matter what I choose in the encoding tab, even presets, the render always ends with a useless unreadable file.

Does anyone know what I have to do to fix this?

Windows does not understand a file without an extension at the end of the name.

In this case (an MP4) you need the name of your file to be name.mp4 for example.

To have blender assign an extension to the name automatically enable File Extensions


How can i export my 3D animation for 3D video? I have simpe 3D animation. I want to view watch this animation with 3D glasses and 3D projection. How can i convert to my 3D animation?
Look at the picture for more information: PICTURE
http://directetnet.com/wp-content/uploads/2015/06/3d-film-indir.jpg

Picture:

In that case, here-

Looks like it works in Cycles and Eevee, but the rendered viewport display in Cycles is very broken, and has been a bug since March 2019; https://developer.blender.org/T62582
It does render (F12) OK by the looks of it.
It outputs 2 images from the L/R cameras in 'Stereo 3D' mode, so you'll have to join them into a single Anaglyph image.
If you use 'MultiView' mode it will output an Anaglyph image, but you need 2 cameras in the scene, with '_L' and '_R' suffixes on their names, and you'll have to manually set their position / convergence.

Cheers
Mark


How to create a node group with a custom node tree? Is there a way to make node groups with a custom node tree? The option is grayed out in the node menu. I checked Sverchok's implementation, but it also seems like they don't support node groups.

There's a reference implementation for a custom Node Group for CustomNodeTrees, used in Lukas Toenne's object_nodes branch. While part of it is compiled, the UI is implemented using bpy's PyNodes ( A CustomNodeTree, same as Sverchok / AnimationNodes ).

If you are comfortable with Python then having a reference implementation may be enough, the whole concept is a little complex to try to convey as a single answer because it involves describing many sub problems. In short, it is possible, but it's not trivial. you'll have to deal implement a few things:

How does a node Group behave when copied/duplicated
Implement the code to generate a node Group from the selected nodes
Creating a NodeSocketInterface (What's that?!)

Most of these can be copied almost verbatim from the reference implementation but others will likely need some modifications to fit with your own CustomNodetree type.

Alternate implementation

In Sverchok we recently pushed a new group node implementation (codename Monads): see anything imported by /nodes/basic_data/monad.py. Warning, expect some complex dynamic programming.

It takes a slightly different approach, it is not final but includes a lot of the same functional Operators / UI behaviour:

socket recast
delete socket
rename socket
make nodegroup from selected.

I don't consider this a reference implementation, but it may be of some interest.


Blender installation causes error regarding the creation of an AppData folder I just downloaded the installer for Blender. When I tried to install Blender, everything worked, up until I received this error:

I don't have any previous versions of Blender installed. Any help?

I have solved this rather annoying issue. What I did was edit the Security settings for "SYSTEM." By default all options are set to "Deny," which is preventing the installer from editing the AppData folder. By allowing SYSTEM the "Modify" property, the installer can successfully complete the installation of Blender.
NB: It also happens to the Desktop folder too, same fix.


How to get better rigging view I was practicing rigging. So I picked up a model from internet and started rigging but I can't see the armature through hand.

After enabling X-ray armature can be seen, but only in object mode, when I went to edit mode it was like as it was. Then I turned of wire-frame but that wasn't that much helpful.

After changing object mode:

After changing edit mode:

I have tried wire-frame too. What should I do ?

Disabled wire-frame for hand, disabled x-ray for armature.

It looks like the hand also has X-ray mode on, so the two are interfering. Go into the object menu of the hand, click display, and then uncheck X-ray.


Operator (Add Round Cube) doesn't work I can't change parameters e.g. size, location, rotation.

If G. Garone's answer doesn't work and none of your operators work, then i have another possible solution. I've had this happen a few times to me already, using 2.8.

Just press F3 in the 3D view, then search for "Load Factory Settings". Click on it, and the problem should be fixed. Be sure to go through your settings again, enabling add-ons and changing whatever you need. Don't forget to save the settings afterwards!


What image format encodes the fastest, or at least faster? PNG is too slow When rendering [in 2.80], I have discovered that video streams save much faster than rendering to PNG files. This is frustrating to me because I have learned that the safety of image frame rendering then compiling them is well worth it. But the difference between maybe one hour and days in rendering time isn't worth it, even considering the problems that may be encountered.

Q: Is there a faster format to use than PNG?

TL;DR If you want to work in a scene referred workflow you should use OpenEXR. It's also the quickest to save, especially for large renders. I'd recommend to use it with the PIZ lossless codec when rendering in Cycles, since it can compress images with (subtle) noise particularly well.

Let me begin by saying not all image formats are equal, so comparing just the time required for encoding wouldn't necessarily give you a reasonable choice. There are four parameters that are usually of interest when it comes to choosing the right image format for the task:

Bit Depth
Compression
Alpha (Straight vs. Premultiplied)
Encoding Performance

The bit depth is relevant because it determines how much information the image can actually hold, which directly influences the dynamic range your image can have. OpenEXR and Radiance HDR can store 32-bit per pixel in each channel, whereas JPEG has only 8-bit. Naturally if you render the frames you don't want to discard a majority of the information, therefore a higher bit depth is desirable. However storing the raw bits would result in very large file sizes, which is why compression is also relevant.
Compression can be lossless or lossy. The former allows to reconstruct the original values as is. Lossy compression leverages that the human perception doesn't notice slight quality degradation. It can therefore reach higher compression ratios. Whether lossless or lossy compression is faster to store isn't possible to say in general. Using a lossy compression likely results in fewer bytes that have to be written, but the compression algorithm may have a higher computational complexity. This is why the speed of saving the image is also depending on the size of it. PNG, as you noticed, is notoriously slow and has a poor compression ratio. An image format with lossless compression, a high (enough) compression ratio and fast encoding would therefore be preferable. A lossy compression may also be useful if disk space is of the essence and quality loss isn't a concern.
Another area where image formats differ is the alpha. Some image formats don't support it at all and those that do use either unassociated alpha (also called straight alpha) or associated alpha (also called premultiplied alpha). JPEG for instance doesn't have an alpha channel, PNG uses unassociated alpha, OpenEXR associated alpha. While unassociated alpha allows to store occlusion ("transparency") it cannot model pixels that are simultaneously emissive and semi-transparent which associated alpha can. This is why the latter is suitable for VFX/Compositing and the others are not. For more information see the following answer by Troy Sobotka.
The only image format which is a good solution to all four aspects is OpenEXR. It supports 32-bit depth, good compression (lossless and lossy codecs), associated alpha and good encoding performance. In Blender it also allows you store all your render passes, which is very useful for compositing and a scene referred workflow.

While OpenEXR may be the best choice for the job, is it also one of the fastest solution?
I've written a script which measures the time it takes to store an image in all the image formats Blender offers. Unfortunately Blender's Python API doesn't offer a way to hook into the encoding step, which is why the measurements are for the time required to save the image to disk. Since I/O isn't constant time due to scheduling, the controller, read/write access patterns and usage by other software, the script saves the image(s) multiple times for an average save time as well as the standard deviation to get an impression how strongly the results vary. The following measurements were all made on a Samsung 840 Pro SSD.
Performance comparision with highest quality settings
For the first experiment an HDRI in four resolution is loaded into Blender and saved saved using every image format available. For each format the settings have been set to maximize output quality. The error bar represents the standard deviation.
Remark 2020-06-22: The results may not be representative for every input. Additionally the image formats supporting lossless codecs have the maximum compression ratio set. This increases their encoding time compared to the lossy formats.
All image formats

All image formats except for PNG

The measurement confirms your impression that PNG's performance is pretty terrible at maximum compression. OpenEXR is the fastest out of all the options for the data set it was tested on. Since OpenEXR has also the most desirable properties of all the image formats, it is the best choice. The test use only one codec for OpenEXR though, which is PIZ. Further measurements that compare the available codecs of OpenEXR will give a full picture of the performance.
(Update 2020-06-22) Performance comparision with default compression ratio
Mechalynx criticized the choice of the compression ratio for PNG in the original measurement. Hence, I've repeated the evaluation on the same data, but every image format uses Blender's default compression ratio and quality option. The color channel for the output is set to RGB for every format and the bit depth to the maximum. Note that the maximum supported bit depth varies between formats.

The default amount of compression for PNG is 15% in Blender, which results in greatly reduced saving time compared to the maximum compression in the previous measurement. However, PNG is still among the formats that saves the slowest, even with the default compression settings, for the particular data used in this test.
OpenEXR comparison of codecs
We have established that OpenEXR is one of the best choices among the file formats Blender offers. Next we can take a closer look at the different codecs and which of the lossless and lossy codecs are the fastest.

The lossless PIZ codec seems to be significantly faster on the tested data than the other codecs. It also creates the smallest file size for this particular file at 16500 x 8250 among the lossless codecs with 453.8 MB. DWAA seems to be the fastest among the lossy codecs and it had the smallest file size with 107.2 MB for the 16500 x 8250 image. The last measurement contained a significant outlier for the PXR24 codec which skewed the results.

The script
In case you want to run tests on your own hardware, you can find the script here.
Example for testing on HDRIs
# HDRI can be downloaded from https://hdrihaven.com/hdri/?c=indoor&h=machine_shop_01
filepaths = [
    "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding\\hdris\\machine_shop_01_1k.hdr",
    "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding\\hdris\\machine_shop_01_2k.hdr",
    "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding\\hdris\\machine_shop_01_4k.hdr",
    "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding\\hdris\\machine_shop_01_8k.hdr",
    "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding\\hdris\\machine_shop_01_16k.hdr"]
file_settings = [BMP(),
                 IRIS(),
                 PNG(),
                 JPEG(),
                 JPEG2000(),
                 TARGA(),
                 TARGARaw(),
                 Cineon(),
                 DPX(),
                 OpenEXRMultilayer(),
                 OpenEXR(),
                 RadianceHDR(),
                 TIFF()]
result_directory = "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding"
benchmark = BenchmarkImage(filepaths, file_settings, result_directory, measurements_per_file=3)
benchmark.run()

Example for testing OpenEXR codecs
# HDRI can be downloaded from https://hdrihaven.com/hdri/?c=indoor&h=machine_shop_01
filepaths = ["K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding\\hdris\\machine_shop_01_1k.hdr",
             "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding\\hdris\\machine_shop_01_2k.hdr",
             "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding\\hdris\\machine_shop_01_4k.hdr",
             "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding\\hdris\\machine_shop_01_8k.hdr",
             "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding\\hdris\\machine_shop_01_16k.hdr"]
file_settings = [OpenEXR(exr_codec="DWAA"),
                 OpenEXR(exr_codec="ZIPS"),
                 OpenEXR(exr_codec="RLE"),
                 OpenEXR(exr_codec="PIZ"),
                 OpenEXR(exr_codec="ZIP"),
                 OpenEXR(exr_codec="PXR24"),
                 OpenEXR(exr_codec="NONE")]
result_directory = "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding"
benchmark = BenchmarkImage(filepaths, file_settings, result_directory, measurements_per_file=3)
benchmark.run()

Example for rendering and measuring the current scene
file_settings = [BMP(),
                 IRIS(),
                 PNG(),
                 JPEG(),
                 JPEG2000(),
                 TARGA(),
                 TARGARaw(),
                 Cineon(),
                 DPX(),
                 OpenEXRMultilayer(),
                 OpenEXR(),
                 RadianceHDR(),
                 TIFF()]
result_directory = "K:\\Bugs_and_Features\\StackExchange\\2019_08_12_performance_encoding"
benchmark = BenchmarkProject(file_settings, result_directory, measurements_per_file=3)
benchmark.run()

For the charts you need matplotlib in Blender. I would recommend to create a venv using the same Python version as Blender uses, install matplotlib in the venv, then create a directory with subdirectories modules, addons, presets and startup. Copy the modules from the venv into the modules directory. Now add the parent directory to Blender's Scripts file path in Edit > Preferences > File Paths and you should be able to import matplotlib.

Update: File size comparison
As suggested by Troy, we can also show that OpenEXR produces significantly smaller file sizes than PNG.

The chart compares the file size of images saved as 16-bit PNG with maximum compression and 16-bit OpenEXR with DWAA (lossy) and PIZ (lossless) codecs.
The file sizes are:
1024x512  :   3.02 MB (PNG),   0.82 MB (OpenEXR - DWAA),   1.70 MB (OpenEXR - PIZ)
2048x1024 :  11.80 MB (PNG),   2.87 MB (OpenEXR - DWAA),   6.52 MB (OpenEXR - PIZ)
4096x2048 :  46.03 MB (PNG),   9.74 MB (OpenEXR - DWAA),  25.23 MB (OpenEXR - PIZ)
8192x4096 : 176.68 MB (PNG),  32.71 MB (OpenEXR - DWAA),  96.13 MB (OpenEXR - PIZ)
16500x8250: 657.86 MB (PNG), 107.19 MB (OpenEXR - DWAA), 352.64 MB (OpenEXR - PIZ)

Evidently OpenEXR also beats PNG in file size, with DWAA creating files that are approximately 72-83% and PIZ 43-46% smaller than the PNG on the tested images.
Although the strong increase in file size makes it hard to read precise values from the chart, they should give a general impression of the required storage. The following one shows the file sizes for all file formats in the same configuration as the timing chart. J2K refused to save the largest resolution, which is why there is no value at 16500 x 8250.

(Update 2020-06-22) OpenEXR vs PNG for baked textures
Since there's been a discussion with Mechalynx in the comments about how well suited OpenEXR is for baked textures, such as normal or displacement maps, I've investigated this as well. One claim was that the original benchmark may not be representative for other types of image content. I've modified the script to evaluate the file size and saving time for baked images. It is also available on GitHub. The following test compares the saving time and required file size for a normal map baked from a high resolution mesh.

In the evaluated data OpenEXR consistently beats PNG in encoding speed. Furthermore, OpenEXR produced smaller files at equal bit depth for all codecs (excluding None which doesn't compress). The lossy codec DWAA produces smaller files than PNG even at 32-bit.
The measurements are just a sample and do not prove that this holds for all or a majority of the input data. Further evaluation on a well designed data set would be necessary to draw a generalized conclusion. However, there is a strong indication that OpenEXR provides better encoding speed and smaller file size compared to PNG when an appropriate codec and comparable bit depth are used.


How to make light shine through a prism? I'm trying to make a scene like this:

But no matter how I mess with the bounce settings in cycles; the light just isn't coming out of the other side of the prism:

BlendFile
What am i doing wrong?

It was the "indirect light" in the "clamping" section of the "scene" properties tab.  It needs to be set to 0 for light to go through the prism.  I do not understand why it is so dark that that happens though.


Deleting Grease Pencil Keyframes I recently started working with the Grease Pencil and can't seem to figure out how to tweak and edit the keyframes of Grease Pencil. I want to be able to move them around on the timeline, but I'm not sure where to do this.

Normal action-based animations have the action editor where I can move the keyframes around. The grease pencil doesn't appear to have anything like this. Additionally, when you delete all of the strokes on keyframes, the markers don't disappear on the timeline. This is going to get messy fast if I can't fix this.

I'd rather not have to delete entire layers just to remove markers on one frame of the timeline.

To be concise:

How do I remove these?

Thank you!

You can use the Dope Sheet editor to shift or delete the keyframes for the grease pencil:


How to cut the rope? We have two cars and a rope, made using cloth simulation, that is stretched between them. These cars are moving in opposite directions to each other. The rope should be tensioned when the cars start moving, and then it should be pulled away from one of the cars.

I can make the rope, using cloth simulation, select the vertices at the ends of the rope and add pinning, and then vertex parent them to the cars. But how can I make this tearing of the rope?

Make a vertex group for each end of the rope and use a hook modifier to attach it to each car.  As you animate the car to move backward the rope will tighten with the cloth sim.  To release it just set a keyframe to set the object to none making the rop fall.


Blender 2.8 Principled BSDF : Getting emissive? material when trying to assign hex color as base color I'm populating spheres off of a csv file and in theory adding a hex color as the base color from the same spreadsheet. While I've looked at other questions that make it clear that a RGB-> hex is problematic due to color management and gamma, that isn't my current problem.

I'm using the Principled BSDF shader and getting an emissive material by default when my emission is set to 0 and I'm using a dielectric material...  Any help is appreciated.

import bpy, csv

def hex_to_rgb( hex_value ):
    rgb = list(tuple(int(h[i:i+2], 16) for i in (0, 2, 4)))
    r = rgb.pop(0)
    g = rgb.pop(1)
    b = rgb.pop()
    return r, g, b

def add_material(obj, material_name, h):
    material = bpy.data.materials.get(material_name)

if material is None:
    material = bpy.data.materials.new(material_name)

material.use_nodes = True
principled_bsdf = material.node_tree.nodes.get('Principled BSDF')

if principled_bsdf is not None:
    principled_bsdf.inputs[0].default_value = (*hex_to_rgb(h), 1) #RGBA
    principled_bsdf.inputs[4].default_value = (0) #metallic =1 dielectric=0
    principled_bsdf.inputs[7].default_value = (0) #roughness
    principled_bsdf.inputs[17].default_value = (0,0,0,0) #emission

obj.active_material = material

path = "//points_hex.csv" #opens hex color spreadsheet

with open(path) as csvfile:
    content = csv.reader(csvfile, delimiter=',', dialect='excel')
    hexcolors = []
    names =()
    for i, row in enumerate(content) :
        if i == 0: continue #skip header
        id = row[0]
        x,y,z = row [1], row[2], row[3]
        group = row [4]
        h = row [5]
        bpy.ops.mesh.primitive_uv_sphere_add(radius = 0.5, location = (float(x), float(y) ,float(z)))
        bpy.context.active_object.name = id
        obj = bpy.context.object
        newmaterialname = (str(h)+ "_G" + str(i))
        print (newmaterialname)
        add_material(obj, newmaterialname ,h)

The RGBA values have to be normalized to a $\left[0,1\right]$ range. The shaders will produce strange results when input values exceed the intended range, such as the glow effect you're seeing.


Set origin point to the center of circle? I try every Set Origin To and I am literally stuck.
I would like the origin point to the center of it.

If you select the circle and then press shift-s then a pie menu comes up. You can then press cursor to selection. This should put the 3d cursor in the center. If not, then your circle's origin is in the wrong spot. You can fix this bye, in object mode, press object with the circle selected. The object button is towards the top right. After you press this a dropdown will appear and you can hover over set origin, and then press origin to geometry. This will set the origin to the center of the object. Then you can repeat the step to set the 3d cursor to the selection and then the 3d cursor should be in the center of your circle. Hope this helps!


Overlays; how to turn off grid display only? I have tried to turn off the grid in the overlay options, but when I went to check it off, it was already unchecked.  However, the grid is still displayed!

The only way I know of to turn it off is to totally turn off overlays, but that turns off all of them, and I don't want to do that.  Can someone help me out?

Edit:
I noticed that the grid check box is greyed out, so what now?

You can hide grid floor and axis, using viewport overlay options:

The "grid" option is for "orthographic side view' (from the tooltip):


Why is part of mesh deformed by IK Constraints I have been learning to model characters in Blender for the last week or so and am stuck with my 4th attempt and really don't want to start again when I am close to getting it to do everything it should this time.

My problem is that the waist (torso) area of the character has become deformed since adding IK Constraints for the lower legs. I have had to set the chain length to 2 for these constraints so that when I drag the torso bone up and down again the whole body jumps and lands on the ground naturally (arms and legs behave as expected when jumping) as if the character has jumped by itself.

If I set chain length to any other value other than 2 the waist deformation problem goes away but then the feet don't bounce back when landing on the floor. They goes through the floor instead.

I have tried changing different settings regarding the constraints but no matter what I change I can't keep the effect when landing as it is currently is at 2 and also fix the waist problem.

Any ideas what I can try please?

Link to .blend:

Switching the pole angle to -90 alone will result in the leg bending backwards and breaking knee caps when you play back the animation. To fix that, I added a Limit Rotation Constraint above the IK Constraint for each leg. I found Rotation Limit values (differing for each leg) that allows the frames of animation to look correct without the mesh distorting or bones bending in the wrong direction:

Uploaded the edited .blend here:

This seems like a quick fix, and I would love to hear more experienced rigger tell some preventative measures that you could take to avoid IK twisting issues in Blender.


path constraint fails Im new to Blender and i have put my mind into learning all i can about this awesome program. I have done alot of tutorials on sculping and animating, and it all gone real good.
I have now made my own version of Tux and i want it to follow a path. I have put in the Key frames for its walk rotation, but when i try to do a path constraint, Tux gets seperated from the amature and i dancing around looking all weired.

You can see him here.
http://www.mediafire.com/file/f3p4pej5mje96gq/Tux+go+wrong.blend

I have now spend 3 days trying to fix it. reading forums. I have started all over and followed many toturials on the subject.

I will never give up on this, but i hope that after 3 day there is a friendly soul who could be helpfull, so i can learn this lovely program proper.

I downloaded your .blend file and if you remove the follow path constraint on the penguin, it should work fine!

Hope this helps!


Efficient video workflow without multiple renders? I'm trying to use Blender as my primary video editor, I love the concept of imposing 3d onto videos and also being able to add effects and color correction, etc.
My problem is the workflow. I have a video with audio, I need to crop it, color correct and add text. In order to crop, I need VSE, in order to color correct, I need nodes, then I need VSE + 3D viewer for text. I don't understand how to use all of those tools without multiple renders. Right now, I crop the video, render, bring it into nodes, color correct and move from there. But soon as I import into the node editor I lose sound. I know this is probably just an ordering sort of issue or there's an obvious missing piece, but I can't figure out what it is.

To put my question succinctly:

How do I use all of Blender's video editing tools AND maintain audio without multiple renders?

Thanks!

You can do most color correction with Strip modifiers. And if you don't need 3D effects for your text, you can use Text Strips in the VSE.

There are also addons to send strips to the compositor, but it should be better to avoid them if possible.

Finally you can import your video a second time and just delete the image part of it only keeping the audio strips to solve your last problem.

You should watch the YouTube videos from Mikeycal Meyers to get a better understanding of editing videos with the VSE.


Link selection between VSE strip and object? My current workflow for a project I am working on uses empties in the 3D-View to more easily control properties of strips in the VSE via drivers.  However sometimes it gets a little confusing which empties control which strips and I sometimes manipulate the wrong empty.

Is there a way using Python to automatically select the proper empty when I select a strip in the VSE?  For instance when I select the strip in channel 4 of the VSE I would like it to select empty Fader_4.

I tried a little bit myself but I'm not too swift with Blender Python and I couldn't figure out how to tell when a strip is selected in the VSE.

A strip (sequence) is selected in the VSE when its select property is True.  The selected strips are available via the context.selected_sequences list, and the active strip is context.scene.sequence_editor.active_strip

Test code using modal timer operator. Prepended a toggle button to turn autoselect on / off, to the Sequence Editor header.

import bpy
from bpy.props import BoolProperty
from bl_ui.space_sequencer import act_strip

class SeqModalTimerOperator(bpy.types.Operator):
    """Operator which runs its self from a timer"""
    bl_idname = "wm.modal_timer_operator"
    bl_label = "Modal Timer Operator"

    _timer = None

    def modal(self, context, event):
        scene = context.scene
        active_strip = act_strip(context)

        if event.type in {'ESC'} or not scene.auto_select:
            self.cancel(context)
            return {'CANCELLED'}

        if event.type == 'TIMER' and active_strip:

            # deselect everything
            for o in scene.objects:
                o.select = False
            # select empties, make active active.
            for s in context.selected_sequences:
                empty = scene.objects.get("Fader_%d" % s.channel)
                if empty:
                    empty.select = True
                    if s == active_strip:
                        scene.objects.active = empty

        return {'PASS_THROUGH'}

    def execute(self, context):
        wm = context.window_manager
        self._timer = wm.event_timer_add(0.1, context.window)
        wm.modal_handler_add(self)
        return {'RUNNING_MODAL'}

    def cancel(self, context):
        wm = context.window_manager
        wm.event_timer_remove(self._timer)

def toggle_auto_select(self, context):
    scene = context.scene
    layout = self.layout
    #layout.label("Auto Select")
    layout.prop(scene, "auto_select", toggle=True)

def auto_select(self, context):
    if self.auto_select:
        bpy.ops.wm.modal_timer_operator()

def register():
    bpy.utils.register_class(SeqModalTimerOperator)
    bpy.types.Scene.auto_select = BoolProperty(
                               default=False,
                               name="Auto Select",
                               description="Turn on to Auto select Empties",
                               update=auto_select)
    bpy.types.SEQUENCER_HT_header.prepend(toggle_auto_select)

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

if __name__ == "__main__":
    register()


Is there an official "roughness quantity" for each material? Maybe this question is not related at all with Blender but, how i can define the real amount of roughness of a material? i mean, i know that by twitching and guessing with the less/more roughness bar will do the thing, but is there an official amount of roughness for each existing material?
This question came to me because there are web pages that provide official IOR amounts for lots of materials of the real world, so i was wondering if there are web pages that provide the same information but of roughness of each existing material. I went to the internet and found nothing (maybe i'm just bad exploring internet), so... there's something like an official amount of roughness for each material IRL?

IoR can be categorized for transparent substances because it can be measured on the pure a state of the substance, letting the light through in an homogeneous, consistent measurable way.

Roughness - "the quality or state of having an uneven or irregular surface" - is hardly a scientific measure! Though in rendering terms it probably means something like "the probability of an incoming  light ray to get randomly dispersed" (I'll let the experts correct or debate that one).

In reality (as opposed to computer generated virtuality), it is the result of the topology and complexity of the surface of a material at the macro and micro levels, most times also the result of presence of dust or other materials present on the surface. That mean the same substance can be rough or not based on how polished, clean, pure or unpure it is. Basically it is not really measurable or categorizable for  specific type of substances like glass, ice, quartz etc...

If you find any "web page" doing this, I'd highly scrutinize the methodology before trusting it!


How to work with parameters? How can I work with parameters in Blender? I tried searching on Google, but I didn't find results.

When I change the parameter on the X and Y axis, it works well, but when I go into Edit mode, I can't see the parameters. And when I extrude, I can't adjust them on the extrusion. How can I work with dimensions and how to make the parameters in real world scale?

First set the Units in the Scene properties to Metric or Imperial. If you are using Imperial, then checking Separate Units can help make it more natural.

For 2.8x

For 2.7x

When entering in units in Object mode using the Dimensions, watch the scale. You have to apply the scale ( ctrl A > Scale ) before the same measurements will show in edit mode. When the scale of the object is applied (all three field set to 1)  then dimensions will work as excepted in edit mode.


Importing .fbx results in triangulation What causes a Quad mesh to be triangulated when importing it in blender and how can I avoid it?

(note: the .fbx export was done in 3ds Max with correct settings)

In the export dialog, not only uncheck Triangulate but also Preserve edge orientation. This option is here to avoid issue on non-quads i think.


How to get vertex coordinates after modifier in python? simple scenario:
I have a cube with a wave modifier and I would like to get the vertex positions with python.
I'm trying with bpy.types.MeshVertex.co, but it gives me exactly the same as bpy.types.MeshVertex.undeformed_co.
I even tried with the new dependency-graph....all the same.
Any ideas?

As far as I know you can not do it that way. You can make a temporary mesh and find the transformed coordinates, seen as a wave modifier doesn't scramble the Vertex indices. Using obj.to_mesh is a reasonable way to do it and it's fast.

A commented example of Obj.to_mesh

import bpy

def get_verts_edges(obj, use_modifiers=True, settings='PREVIEW'):
    scene = bpy.context.scene
    obj_data = obj.to_mesh(scene, use_modifiers, settings)

    verts = [v.co for v in obj_data.vertices]

    # or..use a copy to avoid dereferencing due to the .remove()
    # verts = [v.co.copy() for v in obj_data.vertices]

    edges = obj_data.edge_keys
    bpy.data.meshes.remove(obj_data)

    return verts, edges

obj = bpy.data.objects['NameOfObject']
verts, edges = get_verts_edges(obj)

print(verts, edges)

If you aren't looking for faces, or edges you could drop the edges return value. The indices of obj.to_mesh will match the indices of the original object (if it's just a wave modifier..).

Here the image draws a blue line between initial position and output of the obj.to_mesh function

responding to some of your questions

i've never used bpy.types.MeshVertex.undeformed_co , and can't for certain say what it's used for or how. But i suspect it's not used for getting the vertex coordinate "post modifier"
Stick a subsurf modifier on a cube, and then do len(obj.data.vertices), it will say 8 (the original 8 and vertex locations). I understand where you're coming from, but that isn't the case
until you apply modifiers, the data returned by obj.data.vertices will reflect the object pre-modifiers. so doing an undeformed_co can't mean what you think it does, then it would be deformed_co surely? -- And i would expect that only to produce useful corresponding coordinates if the total number of coordinates didn't change due to the modifier stack..

Q Why does a Displacement modifier's post-modifier vertex index not correspond with pre-modifier?
A Without peaking at the code I can't say for certain, but the reality of algorithm design is that sometimes algorithms that break this vertex order perform much faster than if extra bookkeeping has to be done to retain expected indices. Because most operations and usecases don't even need this consistent index, only very few people (such as yourself) consider it a problem.


How to make an object accelerate and *then* rotate at a constant speed? Say I am designing a mini-gun. One of the key things it does is spin up, and then continue to spin at a constant rate. I'm having trouble making it look consistent when this transition happens from the 'acceleration' motion to the 'constant speed' motion.

For the sake of round numbers, say I am using a Bezier interpolation from frames 0 - 50, as I want to control the slope of the acceleration. Then, I transition to a linear interpolation from frames 50-100. The problem is that the rotation speed coming out of the bezier curve is awkward, because there is still that easing.

Basically I want it to rev up, then continue at a constant rate (though I'd like control over how long it takes to rev up).

I saw this answer but I don't understand drivers well enough to know if it solves my problem or not.

The tangent to the curve reaching frame 50 must be exactly in line with the linear progression after frame 50. Also the 1-50 curve must also stay to the left of the linear ascension otherwise it will look like it accelerates before getting to the linear part.


How to turn off texture painting mode where your brush cursor lags behind your mouse position? I'm playing around with learning how to paint textures in blender, and must have somehow enabled a strange drawing mode that causes the drawing head of my brush to lag behind the place where I'm actually drawing the stroke.

I was able to paint normally earlier.  Now when I draw a stroke, there's this line from the center of my cursor to a point where my brush was earlier, and the stroke is drawn there.  It makes painting much harder and I can't figure out how to turn it off.

I turned Smooth Stroke on.  Once I unchecked that, I went back to the regular painting mode.
The smooth stroke option is found in the Tool Shelf > Tools tab > Stroke section.


Linking external data back to the blender file after moving I want a friend to render my 6400 frame short film I made on blender... And it has a lot of image textures for materials... I have all the images, music, and pretty much everything that is in the animation in one folder, including the actual blender file... But it seems the destination of the files will change because the folder would be installed on his computer and he would have to go and change all the matierial image texture file destinations to the same folder on his disk... Is there a way where he can just link up to all of the files without the hassle? Thanks

You could pack the Blender file before giving it away.  Packing basically copies all the external files which the .blend file refers into into the .blend itself.  To pack external files go to file > external data > pack all into .blend.


How do I push a crease in to make this mesh more "smooth?" It's simple really but I cannot figure out how to do this. It's a glass ceiling for a mall and I would like for the creases on both sides to be pushed outwards to make this mesh smoother.

I've tried using sculpting mode but that doesn't give me the results I want. I know what to do but not how to do it. Basically, I need a way to somehow pull the vertices along the curve outwards, that will pull the surrounding faces with it while the ends of the mesh stay in place.

Anyone have a clue on how to do this? Thanks.

I suspect your topology might not be the best for this kind of object. Without suggesting mine is the best, or perfectly suits your purposes, here's a way of modelling it.

Starting with a half-cylinder, with loop-cuts as shown
Use the knife tool (K), cut a diagonal from the 2nd-bottom longitude to the 2nd-top longitude just inside the existing loops, and then extend the diagonal to the boundaries,  using the knife tool again, this time constraining it. (KC)
X Delete the inside faces, and ensuring the pivot is set on the center-line (see the last item) SY, scale the center section out appropriately
CtrlE, from the Edge Menu, 'Bridge Edge loops' having selected the loops on the sides of the gap.
CtrlR cut in some more holding loops .. (pressing E makes the new loop parallel to one side or the other, and pressing F flips which side)
Assign a Mirror modifier, and maybe a Subdivision modifier..

By using GG to slide edge-loops (with E and Fin the same way as when you made them,) you can tighten or loosen the creases between the sections by moving the holding loops in or out, or you can even get rid of the central loops. If you want to completely soften the creases, careful use of AltS to scale vertices out along their own normals, and CtrlV Vertex Menu > 'Smooth Vertex' will get you there, but that's destructive, so save snapshots.

This result may not be precisely what you want, but variations on this sort of approach may work for you

Here's a contrasting example, where the central loop in the crease has been removed, and its outside loops slid outwards, to soften the transition:


What is the best workflow for decimating part of mesh on huge aerial models with high poly count? I'm trying to decimate using sculpting on a parts of the mesh, the model is quite big, about 40 million polys. I'm fairly new to blender and i would like to get some pointers to tutorials or tips on how to keep my textures intact but decimate parts that are of no interest, for example trees and some of the terrain.

I have a textured model from Metashape/RC, and i want to preserve the UV-map. When using the decimate modifier i get a good result without having to unwrap and bake, but if i want to keep the high detail on a single building this doesn't seem like the right approach.

I'm sure someone has a great workflow for this and wouldn't mind sharing it. Coming from Metashape and Reality Capture, blender can be a bit overwhelming so any thoughts would be appreciated :)

Cheers

In Sculpt mode, you could try to use the Dyntopo > Collapse Edges mode. It will change the minimum geometry size to the threshold chosen in Detail Size. Make sure the brush is at a Strength of 0.


Problem baking a diffuse texture with a metalic material Hi so I've been constantly scouring reasons why my bake has been unsuccessful. I was trying to bake all the materials into a diffuse map to use. When I did this only some of the materials would bake while the rest would leave just a black texture. I eventually figured out that using metallic for me caused the black textures. The problem is that without the metallic the look of it changes drastically. Is there a certain way to bake the diffuse map to reproduce the colours without getting rid of the metallic in the shader.
https://imgur.com/a/A1H6UKg
This is what the project looks like with uv baking and how the material is set up.
Any help would be greatly appreciated as I have been struggling greatly trying to bake these materials.

You could change metallic to 0, bake the textures and then change it back to what it was. Or add a Diffuse BSDF node, connect it to the output and connect the texture to it, and then bake. When you are done baking go back to using the Principled BSDF node.


How to create icicles hanging off an object? Is there a way to create icicles,
for example like this:

I was thinking if there was some way to use a Snake Hook brush on many random places at once with different strengths etc., but I don't know if this is possible.

How can I achieve this?

Image from Wikipedia

You could use a Particle System of type Hair.

Make a plane and apply a particle system to it.

Also make an icicle as a separate object, or make several and make a group out of them.
Remember to set the origin of each icicle to where it should start growing on the plain, and also CtrlA apply rotation&scale.

In the particle system properties, go to Render. If you made just one icicle, choose the Object tab and your icicle as Dupli Object. If you made several, go to Group tab and choose your group.

Then play with settings in particle system to get correct rotations, placements and scale. Randomness can be applied to all.

Here's a quick result with only one icicle object (open image in new tab to see full size):

Edit:

If you want to fine-tune location of icicles, set Particles/Face = 1 and edit the faces on the plane to exactly where each icicle should originate. Remember to set matching count to amount of faces.


What does the fourth parameter that 'diffuse_color' takes in Blender 2.9 do? It seems that the diffuse_color definition has changed in Blender at some point as older scripts in which it was defined by the struct with 3 parameters now it requires the struct with 4.
Does anyone know what is the meaning of the fourth parameter?

Diffuse_color take 4 parameters as RGBA
red, green, blue, alpha
mat.diffuse_color = (red_v, grn_v, blu_v, alpha_v)  # viewport color