Does Blender have different languages (language as in speech language as english, not computer language as python)? Sometimes it's more convenient for me to use Blender in another language. Does Blender have different languages (language as in speech language as english, not computer language as python)?

Yes you can change the default interface language in blender.

To do so open the User preferences, go to the system tab, on the bottom right of the screen there is a checkbox that says "International Fonts" check it then select one of the translations then choose to apply it to "Interface" or "Tooltips" or both.


Bone Loses Mesh In Pose Mode I've been trying to figure this out for hours, but I can't seem to get it to work. I want the "hands" to remain aligned with the shirt sleeve, but when I rotate the right arm, the hand mesh leaves the bone constraints and is slightly offset. The left side is working properly, but the right side is not (see attached images). I have everything weighted properly and the meshes are in the correct vertex groups as far as I can tell. File link is below. Thanks in advance!

Here is the Blend file: https://drive.google.com/file/d/1i9E91I-sNqQWNsjrVmGcR9IDHfBl2EOj/view?usp=sharing

The right hand is correctly rigged, the problem is that the upper arm bone has influence on the lower arm when it should actually not:

So set your brush correctly in order to subtract and paint through:

Paint and it works:


Characters' Shirt Texture Deforming Strangely I tried posting this on the Unity forums but no one there knows what the problem is and they suggested it could be a UV mapping problem within Blender. When exported my character from Blender into Unity via fbx, I've been trying to figure out why his shirt texture is stretching only in certain areas and I cannot figure it out. Here's a link to a video so you can see the problem:

(https://mega.nz/#!y51X1YJJ!yNT7cQiRN80-u2hBvdOpSyjATwV2_xc4jmvj8XVjw0QI).

I think I'll try to see if weight painting is causing the problem a little later today. I've already tried all the following things:

Tried in Blender:

Applied location rotation and scale before export.
Applied all modifers before export except armature modifer.
Tried UV minimize stretch.
Tried conformal UV unwrap.
Tried changing Auto Texture Space on the shirt and changing it to the same rotation, location, and scale of the object.

Tried in Unity:

Texture Type: Normal Map
Wrap Mode: Repeat

If you any ideas, please let me know, thanks in advance.

I solved my own problem and it was simpler than I thought it would be. The reason for this strange deformation on the texture of the shirt wasn’t due to any of the reasons above. It was because I hadn’t noticed that if I change the angle of the camera view in Unity, I would see that there’s a serious weight paint problem in the shoulder area which I already know how to fix. This problem doesn’t show up in Blender because of the differences in how Unity and Blender process the visuals of weight painting. I thought I share this in case anyone else is having a similar problem and can’t figure it out. Make sure to change the angle of the camera to make sure what you’re seeing is actually what you think you’re seeing.


BGE Python: No module name 'BGE' I can not get Python to work, I have followed YT videos and do exactly what they have done but I only get error message:

  No module name 'bge'

I have searched on Google, but I cannot find similar answers. What is wrong?

At the top of my script I do have import bge

Although, I read somewhere that the inport BGE has changed.

But I'd really like to get this to succeed.
I can get my game to work without python but I'd rather not and it would make it too complicated.

I'm using version 2.77.

Here is my blender file

And this is the Script I trying

import bge

def main():

    cont = bge.logic.getCurrentController()
    own = cont.owner

    message = cont.actuators["message"]
    remove = cont.actuators["remove"]

    own.text = "I don't want to talk."

    if own["time"] > 0:
        own["time"] -= 1

    if own["time"] <= 0:
        cont.activate(message)
        cont.activate(remove)

main()

Also this is the youtube clip I follow. https://www.youtube.com/watch?v=8klSGN1m5no&list=LLi0N8WDVMrYgCK_ni5ajv5g&index=5

BGE is lower case when used in python.

Try;

import bge

Also make sure you are running your script inside the game engine rather than with the 'run script' button. The 'run script' buttons is for addons. To run a script in the game engine you use the python controller logic brick.


How to make visible an object from different layer in bge I want to give a model a selection circle if (and only if) it is clicked once or twice. The circle is in another layer and i want to make it visible when i click on my model, and invisible when i click on the ground, and toggle those states

There's probably a way to do what you want; but there's a better way! I recommend the Visibility sensor.

Assuming one object is called Circle, the other one Character and the other Ground, start by moving the Circle to the main layer; Then, in the Outliner, disable it's render-ability, by pressing the camera icon next to it.

After that, select your Character and add a Message actuator to it; Set the To: field to be Circle, and the Subject field to be Set Visible. Then, select the Ground add another Message actuator, with the To: field set to Circle and the Subject set to  Set Invisible.

Then select the Circle and add two Message sensors to it; set their subjects to be the same as previously, and connect each to a Visibility actuator, set to either set visible or invisible, depending on the message subject.


How can I animate object properties in Blender? I was wondering if there was a method to alter object settings at a set point in an animation in blender.

For example, I want to make the color of an object blue for the first 20 frames, but after 20 frames I want its color to change to green. Is there any known method of doing this? I could not find anything when I searched.

If you right click on a property and click Insert Keyframe, you can animate that property like you would the location, rotation, scale, etc.

This method works with almost all the properties including all values and most checkboxes.

EDIT: Gwenn commented and noted that you can also insert the keyframe by using the I key. Also, you can Remove keyframes with Alt + I


Animation Nodes and Boolean Modifier Using this setup in animation nodes I created a phantom effect for my text with a wave modifier, but when I apply a boolean modifier it gets rid of the transparency of my text. Is there a way to apply the boolean without effecting the text transparency?

You are storing your transparency information in vertex colors layers. Some modifiers—including the boolean modifier—are destructive when it comes to mesh data such as vertex color layers. So upon applying a boolean modifier carrying vertex color data, the data is destroyed.

You have two ways to fix this, you either use another medium to pass the transparency information to cycles, or you dispense the boolean modifier in favour of another approach to achieve the same effect.

Dispense The Boolean Modifier

A more efficient approach would be to write a shader that changes the transparency of the fragments dynamically. Use the object space texture coordinates of an empty as the vector input of a Quadratic Sphere Gradient node and get the fragments that their gradient value is larger than zero. Use the output as a transparency mask and animate the empty location and scale to get the effect you had before:


In Blender 2.80, how to set a custom transform orientation programmatically? Transform orientations in Blender 2.80 are marked as read-only. What is the proper way to provide a custom matrix as a transform orientation in 2.80?

It looks like this call is needed to create a new orientation, which has a .matrix attribute which is NOT read only. Is this the intended usage? The user interface and docs for this don't make it clear.

Here's a working solution/snippet, with a description below:

        orthonormal_basis_matrix = mathutils.Matrix(
            [
                [vcross[0], vnorm[0], vdest[0]],
                [vcross[1], vnorm[1], vdest[1]],
                [vcross[2], vnorm[2], vdest[2]]
            ]
        )
        bpy.ops.transform.create_orientation(
            name='MAPlus',
            use=active_item.apl_use_custom_orientation,
            overwrite=True
        )
        orient_slot = [
            slot for slot in
            bpy.context.scene.transform_orientation_slots
            if slot.custom_orientation
               and slot.custom_orientation.name == 'MAPlus'
        ]
        if orient_slot:
            orient_slot[0].custom_orientation.matrix = orthonormal_basis_matrix
        else:
            print('Error: Could not find MAPlus transform orientation...')

Call create_transformation to add a named transformation
Use a list comprehension to search through the available bpy.context.scene.transform_orientation_slots for a slot having a custom_orientation (TransformOrientation object) with the name you provided
Test whether the list comprehension/search came up with any results, then use the discovered object and set its matrix


The "reset of the scale" flips and destroys my normals I had this mesh with these Normals:

The column had a "wrong" scale

and I wanted to set it to 1 1 1.
Then I pressed Ctrl + a and scale.

The result was that:

The normals are upeset and destroyed (if I flip all with Ctrl + n the final result isn't good . . .  the normals, although flipped in the right direction, don't come back to the origin.

My question is: is there a way to set the scale (1 1 1), avoiding the total distorsion of the normals? Or maybe, am I making any mistakes?

It should work to duplicate your object, before applying scale, and use a Data Transfer Modifier to transfer the custom normals from the duplicate object to the corrected object:

Hopefully that does the trick.


Action won't go away! This is very annoying. I need to delete an action I keep hitting x and clear animation data and all that, won't leave! I have quit and reopened, there is no 0 next to the name.

To unlink datablocks from the blend file hold Shift button and click on the X icon of the datablock. That will set the number of users to zero and it will not be saved in the blend file.

Remember to reload file after saving it.


How create Optical distortion effect I would like to make custom blender transitions similar to the first second of this video https://www.youtube.com/watch?v=mZvQ9ipTK_8

I know that in reality, it's a transition executed outside the rendering engine, added to the editing software. But I'm trying to find out if it's possible to get the same effect (with the nice animation curve that makes the transition visually beautiful) under blender, if so, how to do it?
Here is a test I made with EEVEE :

As you can see, the effect is not as convincing, and there is a zoom that remains persistent.
I would be happy to have a realtime (or cycle calculated) but not copositor effect as the compositor can't give good real time feedback.

You can use Wave modifier for such effect.

Add Subdivision modifier, Solidify modifier and Wave modifier
Increase IOR of Glass shader to increase light bending
Use Life of the Wave for that smooth transition

Adjust IOR to increase light bending

Adjust Life (and perhaps Damping) for smooth transition


How does Blender handle model scale when converting OBJ to blend? I made the following model in MakeHuman: a man wearing a hat and some clothes:

https://github.com/hotmeatballsoup/blender-repo

When I exported him as an OBJ file, and then import that OBJ in Blender, he is huge (way, way bigger than the default grid):

Ultimately I plan on saving him as a blend and then using that .blend file in a game (that uses an engine which natively support Blender assets). But I'm a little confused about how size/scaling works in Blender.

This is a man of reasonable height, so say for the sake of the argument, he's 6 feet tall. In my game I need him to look like he's this height, and to appear neither tiny (Ant Man size), nor huge/giant-sized. However, in the game, perhaps the player does something that makes him either grow to be 50ft tall, or shrink to only be a few inches tall. Clearly, models have to maintain some kind of "display scale" or size metrics, so that the program displaying/rendering them can present them at the correct perceived size, relative to the viewpoint/camera.

Why did Blender import my OBJ file with the model being so big (or is this just me not understanding/interpreting what I'm seeing correctly)? What can I do to "fix" this model - in OBJ format, but from inside Blender - so that he is the "correct" size (again, this could be tiny/several inches, normal/6ft or gigantic/50ft, depending on what's happening in the game)? And how do I make sure that when I convert the OBJ to a .blend file these size corrections are maintained?

It's likely that there's a unit discrepancy between your MakeHuman export and Blender's default units, which are effectively metric (1BU = 1 meter). OBJ is just a container for sets numbers representing properties of the model, and Blender slots those in at face value unless you tell it otherwise.

If your model is exported at a height value of 184.30 cm in MakeHuman, Blender is going to input "184.3" into the model's Y dimension property, effectively making it 184.3 Blender Units (meters) tall.

To correct this on MakeHuman export, you can select "meter" in the Scale Units panel on the righthand side of the frame:

If you can't re-export the model, in the Scene panel, you can change Blender's scene scale units to centimeters (or whatever unit you exported in) before importing model to Blender:

Last, if you do not want to re-export or re-import, you can simply do a uniform scale on the model until it reaches the desired dimensions in the unit that you've picked for your scene.


How to keep objects on the terrain? First of all, I'm actually making a fictional race track mod for a racing simulator, and I already finished the main terrain modelisation and now I'm having some other issues.

One of them is: How to make a separate object respect (snap to) the elevation of the terrain?

Like the screen shot above, I started to make circuit fences using the array modifier, but the pieces of the fence don't automatically match the terrain.
Some constrains may help, but they seem to only be useful in specific situations with simple objects. Is there a easier solution to make the objects match the terrain elevations?

The Shrinkwrap modifier is probably what you're looking for. It has a mode called "Project" that will just translate the objects along one axis until it reaches the target.
You probably won't be able to use the Shrinkwrap modifier on the fences themselves, though. You'll probably have to create a strip of edges that goes on the ground where you want the fence to be (you can make it not renderable, so it doesn't show up). Then you'd use the Shrinkwrap on that to make it stick to the terrain. Then you'd use Dupliverts to make a fence piece on each vertex of that strip.
There may be a simpler solution. I hope this idea will get the creative juices flowing...
From the Manual on Shrinkwrap:

The Shrinkwrap modifier allows an object to “shrink” to the surface of another object. It moves each vertex of the object being modified to the closest position on the surface of the given mesh (using one of the three methods available).

From the Manual on Dupliverts:

Duplication Vertices or DupliVerts is the duplication of a base object at the location of the vertices of a mesh. In other words, when using DupliVerts on a mesh, an instance of the base object is placed on every vertex of the mesh.


how to set context to run operations Here's another little issue I can't solve by myself:

I wrote a little python script called by blender from terminal (or dos cmd) that renders a scene letting you see the tiles composing the image like it does from "inside Blender" hitting the f12 button.

Now, I would like to popup a window with no menus and with the render result fitted in it.

This is what I do from terminal:

blender /path/to/file.blend -p 200 200 640 480 -P /path/to/python/script

This is the content of the python script:

import bpy
bpy.data.screens['screen_name'].scene = bpy.data.scenes['scene_name']
bpy.context.window.screen = bpy.data.screens['screen_name']
bpy.context.screen.scene = bpy.data.scenes['scene_name']

bpy.data.scenes['scene_name'].cycles.samples = 40
bpy.data.scenes['scene_name'].render.resolution_percentage = 50

#this "for" breaks all the code
for area in bpy.context.screen.areas:
   if area.type == 'IMAGE_EDITOR':
       override = bpy.context.copy()
       override['area'] = area
       bpy.ops.screen.screen_full_area(override, use_hide_panels=True)
       bpy.ops.image.view_all(override, fit_view=False)
       break

#what under work as intended without the "for"
bpy.ops.render.view_show('INVOKE_DEFAULT')
#renderizza
bpy.ops.render.render('INVOKE_DEFAULT', animation=False, write_still=True, use_viewport=False, scene='scene_name')

As I wrote in the comment in the py code, everything works just fine without the "for" code.
The error I got on Ubuntu is

RuntimeError: Operator bpy.ops.image.view_all.poll() failed, context is incorrect

On windows it adds a EXCEPTION_ACCESS_VIOLATION (windows always have to make some sort of drama :-)

What did I do wrong?

Thank you for your time and for you help.

Screen Full Area Opens a new Screen

A couple of prints in the following show that the context screen and henceforth area, after calling the bpy.ops.screen.screen_full_area() operator are not the same.  Change the override dictionary accordingly.  (btw running view all without the override core dumps my blender (ubuntu 18))

import bpy

context = bpy.context
for area in bpy.context.screen.areas:
   if area.type == 'IMAGE_EDITOR':
       override = bpy.context.copy()
       override['space_data'] = area.spaces.active
       override['region'] = area.regions[-1]
       override['area'] = area
       bpy.ops.screen.screen_full_area(override, use_hide_panels=True)

       print(context.area, override['area'])
       print(context.screen, override['screen'])
       print(context.window, override['window'])
       override['screen'] = context.screen
       override["area"] = context.area
       bpy.ops.image.view_all(override, fit_view=True)
       break


I have error in my python code(while producing a blender addon) which i couldn't figure it out. Can anyone please help me out? So, recently I was planning on creating a 3D model pack for blender 2.9 in which my 3d models can be easily accessible within blender through addon. My plan was to make a small little tool shelf (at the right panel) in which it shows preview image of the 3D model and when I click add button after selecting the desired 3D model from preview, it should append the object.
As you can see it has categories and there are two categories and the previews are working fine.
My problem is:
When I click on Add button it suddenly pops up  with an error message which is given down below:

and I can't figure it out for a long time why it happens since I am a beginner in the field of coding.
I just reached till to this point by seeking help from others. I will provide the code of the addon so that if anyone could help me I would appreciate that. Thank you!
LINK OF CODE AND FILE STRUCTURE

This looks like a path error, similar to what is described in this question.
Append python script for Blender 2.8


How to focus on the selected object? In Maya if we have an object selected and we press F then the object is brought into focus and if no object is selected then all the objects in the scene are brought into focus.

How can this be done in Blender?

Without knowing the specifics of the Maya feature, try pressing . on the your keyboard's numeric keypad. This adjusts your 3D View to focus on the selected object. You can also press / on the numeric keypad to get a "local view" of the selected object (pressing / again will pop you back to the scene view).
To show all non-hidden objects in the 3D View, press Home.
For purposes of remapping, this keymap is called Frame Selected under 3d View.


How to Take different shot's with one camera in different places I was watching this tutorial  online, and i realized that it was using blender 2.79, and what the person did was switching between shots with one camera while animating the camera. However, in blender 2.8 it doesn’t really happen correctly, because  the camera can only have one view direction throughout. I really only want to use one camera on my animations, so how can i make different shots? (how they did it was to go one single frame forward, and then move the camera to the desired  view, so when you play it, the camera appears to suddenly change view, however when i do it, it seems to override the pervious code).
What i mean is that the view angle does not change, so from the start is looks north, but in the second view angle it looks south. But instead what the animation does is remove the fact that is looks south when i play it.

If you play the animation, the zoom in is suppose to be on the cube, and the jump is suppose  to be a different  angle

One solution: if you want to focus on a single object, use a object constraint (on the camera object).  It will keep the camera rotated to look at the object (your Cube).

result:
Another was @wilks suggestion to not only key in the location of your camera, but also the rotation of your camera (where it points to):

That shows up in the Dope sheet:


How do I get transparency to work with the Principled BSDF shader? How do I get the Cycles Principled BSDF shader to support a base color image such as a 32bit png with alpha or a tga with an alpha channel, and get the transparency to work. I don't see anywhere on the Principled BSDF shader that handles transparency.

Without success, I have tried:

Properties Editor>Render tab>Film rollout>Transparent
Properties Editor>Material tab>Settings rollout>Viewport Alpha (changing to other than Opaque).
Adding a Transparent BSDF and Diffuse BSDF after the base
color image node and using a Mix Shader to combine them.

The principled shader can be combined just like any other shader.
Adding a Transparent shader and using the alpha channel to control the mix will make the black sections of the Alpha become transparent.

Read also:
Add a transparent image on top of a material


Record Animation In BGE I am having trouble getting the Record Animation setting to work in the BGE. Is it possible to record animated characters that are controlled using BGE's logic bricks with some script? In my script I change the positions of the characters bones.

Sadly the Record Animation does not record logic bricks. It only records the actions for physics. Example: a tower falling down and all the pieces scattering across the ground.


Why is this button only getting triggered when 'mouseover' is true? So I made a button with a certain function and I have made more buttons like this and they worked. But this one seems to get triggered when only mouseover is true. Even though it should only get triggered when both mouseover and click are true.
Why is this not working properly?

    import bge

cont = bge.logic.getCurrentController()
close = cont.actuators['Scene']
act = cont.actuators['Action']
act2 = cont.actuators['Action.001']
mouseover = cont.sensors['MouseOver']
click = cont.sensors['Mouse']
resume = cont.actuators['Scene.001']

def actions():
    #animations
    if mouseover:
        act.action = 'Plane.010Action'
        act.frameStart = 1
        act.frameEnd = 2
        act.priority = 0

        cont.activate(act)

    if not mouseover:
        act2.action = 'Plane.010Action'
        act2.frameStart = 2
        act2.frameEnd = 1
        act2.priority = 0

        cont.activate(act2)

actions()

#Turn off guidline and resume game
def clicked():

    if (mouseover and click):
        resume.mode = 8
        resume.scene = 'Main game'

        close.mode = 6
        close.scene = 'Guideline'

        cont.activate(resume)
        cont.activate(close)

        bge.logic.addScene('Main game')

        scenes = bge.logic.getSceneList()
        for scene in scenes:
            if scene.name == 'Main game':
                guide = scene.objects['Guideline']
                guide.setVisible(False)

        bge.render.showMouse(False)

clicked()

Simply use an AND controller:

This is just animating the button. To trigger certain operations there are many options.

Send a message

This way the button does not even care who is processing the command.

The recipient can even reside in a different (but active) scene.

Direct operation

This means the button performs the operation. This creates a tight coupling between button and operation. I suggest to use this only on menu operations (such as switching menus, or closing the overlay scene).

Logic Bricks

Python

There are few ways too. The problem is that you can't connect to the already setup AND controller as there is no Python actuator.

This means you need to recreate the AND controller behavior within your custom brick.

Sample code:

import bge

def allSensorsPositive():
    for sensor in bge.logic.getCurrentController().sensors:
        if not sensor.positive:
            return False
    return True

if allSensorsPositive():
    print("run your code here")

Remarks

I strongly recommend to separate button presentation from button operation. Otherwise your design will quickly become unnecessary complex.

Debug sensor status

If you do not know the sensor status you can run this script. It will print it to console:

import bge

sensors = bge.logic.getCurrentController().sensors
output = ""
for sensor in sensors:
    output +="'{0}' t:{1:d} p:{2:d} |".format(sensor.name, sensor.triggered, sensor.positive)
print(output)

Example:

'Mouse' t:0 p:0 |'Mouse over' t:1 p:1 |
'Mouse' t:0 p:0 |'Mouse over' t:1 p:0 |
'Mouse' t:0 p:0 |'Mouse over' t:1 p:1 |
'Mouse' t:0 p:0 |'Mouse over' t:1 p:0 |

It is

'sensor name'
t: 0=not triggered, 1=triggered
p: 0=evaluated nothing, 1=evaluated positive

Obviously at least one sensor must be triggered to get a new output.


Render resolution lock I wonder why this hasn't been implemented yet. Cinema 4D has a lock ratio so you can change the X size and Y will resize accordingly. I know I can use the percentage but this is not accurate if you want to for instance make the render exactly 1000 pixels but maintaining the exact frame the camera already has.

Any ideas about that?

As far as I know, Blender doesn't have that feature. And settings the percentage doesn't work, because it is limited to whole numbers.

Here is a workaround using math.

Lets say the resolution is 1920 x 1080 and you want to scale the width down to 1000, then the following will keep the aspect ratio.

width  / previousWidth * newWidth = newWidth
height / previousWidth * newWidth = newHeight

The same applies the other way round.

Since the current width is already input in the resolutions X field, we can go into that field and add the number for previousWidth x newWidth. When exiting the field the value will be calculated. Repeat the same in the resolutions Y field with the same data.

This is how it looks in action.

Since pixels are whole numbers, the exact proportions can not always be retained.


Why did part of my mesh suddenly turn purple in sculp mode? (Face sets) I was just sculpting a rock object in object mode, when all of a sudden, parts of it just turned purple.  I don't think I pressed anything I shouldn't have.  I don't know if this is normal of not, but does anyone know how to fix this?

In Sculpt mode, Face Sets allows you to create separate areas, a little bit like the Mask except you can create as many face sets as you want and you won't have to mask and unmask to switch from a face set to another, when you'll sculpt on a face set it will only affect this face set until you release the left click and click on another face set.
To paint your face sets you need to press left click. Release and left click again to create a new face set, Ctrl and left click on a face set to extend it, Shift left click to smooth the boundaries. In the Face Sets menu > Init Face Sets you can choose another way to create face sets (for example By UV Seams):

Once you've painted, choose your sculpt brush and enable the Face Sets options:

It looks like once you've painted your face sets you can't enable Dyntopo without deleting the face sets, Dyntopo creates new geometry so it makes sense.
Now sculpt:


Cycles Render: Light reflections black in render I'm very new to blender and I just managed to get the result I'd like to have, but when I render my image with the Cycles Render the light reflections will rendered black instead of shiny white as I'd expect them too.

Does anyone have an idea why this happens and can point me in the right direction for a solution?

The mistake is in your shader. You are mixing two glass shaders depending on the viewing angle. This causes the physically incorrect resut. Strip out the dark glass, the mix shader and the layer weight node and everything renders fine.

Edit

There are comments mentioning poor rendering optimization, so I took a closer look at your file and reduced the rendertime from estimated 1,5 h to just over 14 minutes at 5760 x 3240 pixel.

The changes:

replaced all mesh lights with area and point lamps, they are much less expensive to compute (less noise)
deactivated the direct and indirect clamping. This reveals, that your lights are way too bright and cause the reflections to blow out. reduced all lamps so the reflection values stay below 1.
deactivated "progressive refine", this slows down your final render significantly
raised tile size to 1024 x 1024 pixel (this might be GPU-dependent and slower on your machine, you might leave it at 512 px².
reduced samples to 512. Without the mesh lights we can get away with less samples
deactivated denoising, it is not necessary here, imho. The image is virtually noise free after 512 samples.

The optimized .blend:


Rendering stack of 2D images as a 3D object? I have a stack of 2D images that I would like to render as a 3D object.  Essentially, each image is a slice of a 3D object such that, if stacked along the z-axis, would make a 3D object.

EDIT

I want to maintain the color of the image while making black transparent, like in the model below.  I have a stack of images that (when stacked) look like that model.

EDIT 2

I would like an actual 3D model.  I couldn't get the voxel texturing to work.  Blender didn't seem to like the fact that there was color.  Below is an example of one of the slices:

Things I've tried/ruled out:

Voxel texturing of an object (I'd like it to be a 3D model, I also couldn't figure out how to color this)
Surface modeling (this doesn't preserve internal structure (duh) but also doesn't preserve color)
Import images as planes (this was suggested to me and I couldn't get it to work, although it seemed like this was not the result I'm looking for either)

The help is appreciated.  I'm open to doing any and all scripting; I'm comfortable with Python and image processing but not so much with Blender.

You can definitely render a 3D voxel dataset using the built-in tools of Blender. As seen in the example below:

The basic workflow using the Blender Internal engine:

Create a Cube that's the same dimension as your voxel data ( image resolution x Voxal size , the important thing is to preserve the dimension ratios )
Create a volume material and texture for the cube.
Load in the density data as image sequence or 8bit raw data ( tested .img and .rawb formats ).
Adjust all resolution parameters ( set it to the resolution of the image you should have this information , incorrect resolution will result in distorted/cropped or even no visible result )
setup the texture to affect Density and Emissions.
Tweak color map and material properties until the data is shown nicely.

The material and texture setup :

the render result :

Using the color ramp, you can even remap the density to different colors.


bevel modifier does not seem to work i am a new user to blender and I was watching a tutorial and then I hit a problem that the bevel modifier did not seem to work, I think it might be but it was not showing the same results in the tutorial if you can help me I will really appreciate it.
here is a link
https://blend-exchange.giantcowfilms.com/b/5wA96GZr/
please tell me if the link does not work

Ok, so there seems to be a few things going on here. Firstly, and I don't know if this is intentional, but your single mesh object is comprised of 2 different pieces sitting on top of one another:

As you can see from the image, both of the pieces seem to have some parts that don't belong. I separated the pieces only for this example image, you don't have to do it yourself, unless you want to delete a piece or something. If you need to separate them, select a face and press L. This will select everything that is part of the same "piece". You can then move it away, or whatever.
You can get rid of the stuff that doesn't belong (pieces separated or not) by pressing M (Merge) and selecting "By Distance". This removes duplicated or overlapping vertices. Doing this to yours removed 24 vertices - you can see the count in the bottom right corner when you perform the operation.

Lastly the bevel is still a bit off as the result of non-uniform scale (result of scaling in object mode). To fix this, in object mode, select your object, Press Ctrl + A and select "Scale".


Moving textured pipe along path i need to animate a cable being moved trough a machine, ive tested ways to do this with the curve/bevel and playing with the start/stop of this, problem comes when i have a texture on it as this ends up deforming when moved around a bend, which it needs to do, not to mention moving the start/stop of the curve doesnt actually give the illusion of moving unless you see the ends of it, so close ups just end up looking like a stationary tube.

This is a (straight) pipe modelled as a curve, using its native Bevel, mapped in its own UV space, deformed along its X by another spiral curve, using a Curve modifier. Translating the pipe along X with respect to the spiral's origin moves it around the spiral.

That's a lot of curves :) the straight pipe could have been a mesh.


Cylinder UV distortion Both cylinders have almost the same topology, and are unwrapped the same way, the distorted one has longer polygons. I tried different approaches but could only make it better by inserting a loop. Is there a better way to solve this?
This was an answer I got in polycount: Select the offending face and Ctrl+T. Once it is broken down into triangles Shift+right-click neighbouring PAIRS then Ctrl+J to join them together into a Quad. You might have a few stray triangles (which is ok), but unwrapping should then work as expected.
What does he mean by ''Ctrl+J to join them together into quads''? in the blender manual to convert tris to quads the keyboard shortcut is Alt-J, and Ctrl+J is to join objects, I'm confused.
Fbx:https://mega.nz/#!l3hy1KIS!6OViRzkx-...ByL8zZ2BKDwsLk

If you're simply trying to resolve the unwrap distortion, I'd verify that you have no doubles causing un-seamed edges that might be causing the warping.   This can be resolved without touching the object itself, which is what the polycount answer was pertaining to.

check seams
U -unwrap mesh
bring up the UV editor in a separate panel

You should then be able to manipulate the UV as you like.


Can I open Blender internal files with python? I want to open a file which is packed into the Blend-file with the open() function while the game is running.

Is it possible? And can I write files into it? Like open("Test.blend/Text.txt", "w") or something?.

If you run the game by pressing P in Blender, you can simply use the bpy module and access Blender's data while the game is running.

If you don't want to depend on Blender, you're limited to the LibLoad function. However, this doesn't support text datablocks. Writing to blend files is also not possible in that case. IMO it'll be much easier to read and write directly to files on the filesystem, rather than packing them inside blend files.


How to modify the graphis curve I made a cycle animation. Is there any way can change the curve like what I drew?

In the Cycles modifier, select After Mode > Repeat with Offset. But make sure that the last keyframe of your cycle is a bit lower on the Y axis otherwise it won't be visible:


Texture bezier curves I'm pretty new to blender, and I followed this tutorial on how to make poly hair using bezier curves. The problem is, I want to make cc for the Sims 4, and I need to place a texture on my mesh. And I have no idea how to do it. I've tried to convert the bezier to mesh, then UV unwrapping, but it has too many polys and it gets messy. Could anyone help me out? (In case it's easier this way: I have Autodesk Maya 2018 aswell)

So you have 2 questions: too many polys in your mesh and how to unwrap it.
Here is how I would do it:


How to fix mirroring issues? Trying to mirror but object rotation is wrong I am trying to mirror across the global YZ plane, so have been using the mirror tool set to the X axis. My pivot point is set at the 3D cursor at the origin. However, when I mirror, the mirrored object is in the right location but its orientation is wrong. It is not mirroring across the right plane. I tried using global axes as the mirror reference or the 3D cursor (Set at the origin). In the attached screenshot is a photo of what is happening (3D objects) versus what I want (drawn in red)

The Mirror modifier uses the object's local orientation, you must have rotated the object in object mode, so its local orientation is not aligned with the global orientation anymore. If you want the Mirror to be aligned with the global orientation, apply the object's rotation with CtrlA > Apply Rotation.


Rotate current selection of Objects .. Each object with a different Random Rotation ... Is this built into Blender? Is such any such simple Object Mode feature/operation built into Blender? If yes what is the mechanism?
It is certainly built in to rotate all the objects by the exact same rotation.
The result might be for example each object has a random rotation about its own origin on the Y axis.  The rotation would be present in the object rotation entries.
Trusted Addons are acceptable if they of age 3 months or greater.
I checked the standard Addons.  I did not recognize anything.  Rotate has a proportional edit property though I did not see an explanation in the Blender documentation.
Please exclude Particles and Pythons Scripts and Modifiers/Constraints/Keyframes and BAN.  I can write Script or use Particles if necessary.

You can do this using proportional edit mode.
If you have some objects in a scene that is already built and you need to do this operation without affecting anything else, first select your objects.

Press / to enter local view.  This will isolate these objects.

Change your tool settings to operate on individual origins, and set proportional edit to random.

You can now select one object and rotate it, with a large enough proportional edit strength, you will begin rotating each object a proportional amount to the rotation of the one you've selected.

Press / again to return to normal view.


What is a missing dna block error? I have recently run into some trouble with my project files. What happened is that the sd card I had them on got corrupt somehow (my computer did not crash and it stayed plugged into my desktop). When I found that the drive was corrupted, I bought a software program that can recover data from corrupted storage drives and was able to get the files "back". However, whenever I tried to open the file in blender (importing and appending included) I receive the following error:

I did a little digging and found that it has something to do with the data structure of .blend files and I'm wondering if there is anything I can do to fix the issue? (Even if it takes some coding).

Thanks in advance for helping out the best you can!

If you have enabled the autosave
File> Recover auto save.


Why is this python script not working? import bmesh
bmesh.from_edit_mesh(bpy.context.edit_object.data).faces[1].select=True

It says python script fail
What should I do ?

Background

This is how to create a new object and add the vertices in the verts list:

import bpy
import bmesh

verts = [(1, 1, 1), (0, 0, 0)]  # 2 verts made with XYZ coords
mesh = bpy.data.meshes.new("mesh")  # add a new mesh
obj = bpy.data.objects.new("MyObject", mesh)  # add a new object using the mesh

scene = bpy.context.scene
scene.objects.link(obj)  # put the object into the scene (link)
scene.objects.active = obj  # set as the active object in the scene
obj.select = True  # select object

mesh = bpy.context.object.data
bm = bmesh.new()

for v in verts:
    bm.verts.new(v)  # add a new vert

# make the bmesh the object's mesh
bm.to_mesh(mesh)
bm.free()  # always do this when finished

This is how to alter an existing mesh:

import bpy
import bmesh

verts = [(1, 1, 1), (0, 0, 0)]  # 2 verts made with XYZ coords
mesh = bpy.context.object.data
bm = bmesh.new()

# convert the current mesh to a bmesh
bm.from_mesh(mesh)

for v in verts:
    bm.verts.new(v)  # add a new vert

# make the bmesh the object's mesh
bm.to_mesh(mesh)
bm.free()  # always do this when finished

Answer

As for selection:

import bpy
import bmesh

mesh = bpy.context.object.data
bm = bmesh.new()

# convert the current mesh to a bmesh
bm.from_mesh(mesh)

# must run this so we can use indexing on the faces
bm.faces.ensure_lookup_table()

# "select" the 0th face by setting its select property to True
bm.faces[0].select = True

# make the bmesh the object's mesh
bm.to_mesh(mesh)
bm.free()  # always do this when finished

# go back to edit mode to see the selection
bpy.ops.object.mode_set(mode='EDIT')

To test this:

Add a cube (go into edit mode and deselect all faces)
Paste the script into Blender's text editor
Hit run script in the text editor with the cube object still selected


How to mirror copy existing vertex weights So far I only find option to mirror the existing weights, but didn't find a way to mirror + copy it, I mean, I want to create symmetrical weights on the other side, but I also want to keep the original, both sides should be in the same group.

For example:

Copy your vertex group
Mirror your vertex group

Now you just have to merge them togerher. Do it with script if you wanna automatize it or by hand:

How to merge vertex groups?


Is it possible to use more than 20 layers? Is it possible to use more than 20 Scene layers or Render layers in Blender?

No. A Scene object only contains exactly  20 layers, no more, no less. But if you mean render layers, the upper limit is 32768.


How to export a transparent clip? In my node editor I have a small movie clip with a green screen. I keyframed it to get rid of the green screen and I am using a transparent background image. I have realized that most of the video formats don't support transparent backgrounds, so I am trying to just render it frame by frame. However, when I use a format that should support transparency, like png, the pictures just come out with a brown or black background. My goal is to overdrop the clip on another video I have. How do I export this clip with a transparent background? Thanks for any help!

Nevermind, figured it out. Turns out I was rendering with the RGB preset instead of RGBA.

EDIT: Expanding upon my explanation: I was getting a brown background whenever I didn't check "use alpha" on my output node. So I checked that and it solved that problem. I was getting a black background on my render images because of my answer stated above. On your render options in the properties tab, right next to the type of file output you have 3 options: BW, RGB, RGBA. I was rendering my images with the RGB preset, which stands for Red Green Blue, instead of RGBA which stands for Red Green Blue Alpha. So it makes sense that it previously wasn't rendering my alpha background.


Split large mesh into small pieces efficiently using Python I have use case where I need split a large mesh into small pieces. When I select and separate each of the desired pieces separately, the consolidation of the indices of the large mesh (i.e. building new packed vertex and face lists) takes alot of time. The consolidation is not really necessary in my use case, as I will be splitting off more pieces right away. If I mark all the different split regions using different materials and separate by material, the runtime suggest to me that this approach is also splitting of the regions piece by piece and consolidating the larger mesh in each iteration.
So what is the most efficient way to tackle this problem?

This can be done by separating the big mesh into small meshes using the below script:

import bpy
ob = bpy.data.objects['MyMesh'] #### replace MyMesh with the name of your Mesh object
bpy.ops.object.select_all(action='DESELECT')
ob.select = True
bpy.context.scene.objects.active = ob
bpy.ops.mesh.separate(type='LOOSE')

UPDATE

If the object has no loose parts and you know the list of faces to separate then you can loop on them then separate using selection using the script below which I tested and it is working:

import bpy
ob = bpy.data.objects['MyMesh'] #### replace MyMesh with the name of your Mesh object
bpy.ops.object.select_all(action='DESELECT')
ob.select = True
bpy.context.scene.objects.active = ob
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='DESELECT')
faces_to_separate = [0,2,4,6,8,10] #### add the list of faces you want to separate
mesh = ob.data
bpy.ops.object.mode_set(mode='OBJECT')
for face in mesh.polygons:
    if face.index in faces_to_separate:
        face.select = True
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.separate(type='SELECTED')
bpy.ops.object.mode_set(mode='OBJECT')


Clear parent relationship, but keep animation By hitting AltP in the 3D View Window, I can clear the parent relationship.

But then I lose the animation endowed to my object by the parent object.  How can I clear an object's parent, but keep the same animation?

Select the child object, and in the 3D View header, go to Object > Animation > Bake Action.

In the pop-up dialogue, enable Clear Parents, then hit OK.


making faces of a sword smooth with Hi im making a sword at the moment in blender and was wondering if anyone knows how to make certain faces smooth in render while maintaining the sharp edge of the sword, in the attached image I've selected the faces i'm trying to smooth out. I did select the edges running the width of the sword and use 'w' to smooth edges which helped a bit but didn't make it much better.
if anyone has any tricks i'd appreciate it.
Cheers

Turn on smooth shading and then use autosmooth so the smooth shading doesn't effect the sharp edges.

To enable smooth shading: in the pannel of the left, which you bring up by pressing T, click on the smooth option under shading.

To enable autosmooth: In the section on the right with render settings and material click on the tab with a icon of 3 vertices connected.

Tick the autosmooth option.


How can I create a material that has different levels of transparency on the front and back face in Cycles? I'd like a simple color material that has for example 80% front face opacity, 20% back face.
If somehow this is not possible, I'd like to at least achieve semi-transparent front face and invisible back face.
Test models sample

Blender 2.91
Test file:

For a face without thickness, you could just use the Backfacing output of a Geometry node to make a switch between values:

(If you don't want unrealistic 1-sided refraction, set the marked IOR field to 1.. you could also use the switch to control, say, Alpha,which may work better for you.. or any other property in the material)
These are simple planes: the faces differ only in their normals-to-camera:


OpenCL error when GPU rendering in Cycles When I try to render using my AMD 5600XT in Cycles, I get a error that says

OpenCL error (-52): CL_INVALID_KERNEL_ARGS in clEnqueueNDRangeKernel

This happens in any scene, even a brand new one after opening Blender. I have updated all of my drivers and restarted my computer multiple times. This happens on Blender 2.9x, I haven't tried any Blender 2.8x versions.

had exactly the same problem when I was trying to view (not even render) a scene with volumetrics in it.
My scene had: a sky environment texture and a default cube with principle volume shader puggled into volume output. Here's what worked for me:-

In anything but render view, switch to render with CPU.
Go into render view
Then in render view swithc to render with GPU.

I have no idea why this worked for me or if it will do you or anyone else any good. All I can say is I think the problem is with OpenCL, kinda wish I'd brought an Nvidia GPU now.


Bones act different comparing camera perspective and Z view I have camera with the following configuration

I expect of camera perspective view and Z view to be the same, but I see different positions of bones

I'm not changing the position of anything during switching between view points

Camera perspective:

Orthographic view point:

EDIT:
Top perspective Z view:

How I can get different results?

The 2nd image is in orthographic view instead of perspective view.

You can change it to perspective view simply via clicking the grid icon like button

If you are not sure what orthographic and perspective views are you can read about it here

What are the differences between Orthographic and Perspective views?


Load DNG/CR2 RAW Images within VSE Is it possible to load RAW DNG and/or CR2 Image sequences within Blender VSE? Might there be an addon available?

Update:
Link


How can I combine two render layers? I would like to know which nodes can I combine this two render layers  width?

I've made this with alpha over node and transparent rendering. I want such an image but I don't want to lose the background (Sky texture).

Thanks for helping! :)

The setup using the alphaover node and transparent rendering is a good idea, try going back to that and make the following changes: First go to your Blur renderlayer (in the renderlayer panel) and turn on the Environment pass,

then go to the compositor and add a second alphaover node. Plug the output of the first alphaover node into the bottom input of the second, then plug the Environment pass from the renderlayer into the other image input and pipe the alphaover output to the composite node.


How to bring the cross to the centre I am a beginner. Please tell me how do I bring where X and Y cross to the centre of screen. I can bring by zooming in but when i do that this is what happens. It is supposed to be a circle but missing in between (I found how to cure that problem, thanks to one of you)

in object mode click shift S and choose 3d cursor to centre


How to map an extra mouse button to ctrl z? Around 50% of my key presses consist ctrl+z.
How can I map ctrl+z to my mx mouse's thumb extra button in Linux?
Pressing the button in preferences > Undo has no effect, while it works out of the box in Firefox (history back).
Env: ArchLinux

What you need is your mouse's software installed. For example, Logitech has its own software for its peripherals like keyboard, mouse.
Once installed, open up the program, and set your extra key as CTRL+Z


Edit Mode Snap Problem My English is nad. I am sorry. Blender dont snap in edit mode selected mesh. But snap other objects. Please help me.

https://streamable.com/q98hp


What's the correct way of cutting holes in Blender? I have a question which I keep researching for a past week or two.
What's the correct or "best" so to speak way to cut holes non-destructively and without messing up the topology and without a need to then clean a mesh?

There is not a single best way and there is really no method that will always give you good topology without a need for some further work.
Since you asked for non-destructive, you've pretty much limited yourself to using boolean operations to cut the holes.  There are add-ons, such as HardOps, that will help you with this process, but none of them will always produce perfect topology every time. Or you can do the same thing manually.
Create your object:

Create a second object to use to cut the hole

Position the cutter where you want the hole

Apply a boolean to the first object, using the 2nd object as the cutter, and set it to difference:

Nothing will appear to happen because the cutter is still visible.  A common technique to resolve this is to change the viewport visibility of the cutter by setting 'display as' to wire:

When you do this, you can still see the cutter's outline, but also the cut it has made:

But you also have to disable rendering the cutter:

As you can see from the matcap display, this works reasonably well:

There are a few other things that can help visibility.  Setting the the cutter to 'shade smooth', and enable auto-smooth for the object often helps, for example.


Filmic Blender not working I have been using Filmic Blender for months now, and it has been working perfectly. But today, when I tried to switched to Filmic, this is what showed up:

I have Blender 2.78
I have not done anything to my settings besides downloading Archimesh and turned off mipmapping
I have not updated the plugin

In the Colormanagement folder in the Blender folder, it shows that it is installed correctly:

Updating your Blender will automatically add a working filmic. I still don't understand why it isn't working on 2.78. If you lose some of your projects by updating, please understand that you can have more than one Blender on your device.


Using spline-IK for bones but keeping control over individual bones My goal is to rig the Ears of my quadruped character, which has huge and soft ears (rabbit-like).

I've set up a Spline-IK constraint for the ear's bones chain, and added soft body physics to the curve that control this constraint. Everything is working fine at this point.

Now, I want to give control to the animator over each individual bones of this chain, so that he can animate it the same way a basic FK chain would do, but keeping the soft body effect while playing back the animation.

Unfortunately, hooking the curve with empties will override the soft-body simulation for the vertices of the curve which are hooked (which seems quite normal). In addition, there is a dependency cycle because :

 Curve depends on Armature through Bone Parent.
 Armature depends on Curve through Spline IK constraint.

I've tried several workaround (adding empties, separate the ear bones in another object...) but it always results in a dependency cycle, just with more steps :

 Armature_body depends on Armature_ears through Copy Rotation.
 Empty depends on Armature_body through Bone Parent.
 Curve depends on Empty through Parent.
 Armature_ears depends on Curve through Spline IK.

So, my question is: Is there a way to add soft body effect to a bones chain, but keeping FK control over it?

Here is a .blend file at the state of my progress: Crastor Rig B.SE blend file

The key is to have the hook modifiers before the soft-body on the curve, so the soft-body will take the hook-deformed curve as an input:

I also subdivided the curve to add it more control points that can be hooked (but subdivision affects the soft-body sim). Without the subdivison you could control only the end-point. The hook-Empties are parented to the head. This works like this:

So you can control the curve shape with hooks now. But you can't control the same bone-chain with IK-spline and FK at the same time without dependency issues. You would have to build 3 sets of bones - IK, FK and a final set to blend between the two. Look up IK/FK blending.

Here is the blend:

Another approach that I would prefer is to rig the character the usual way without any soft-body curves etc. and to put a soft-body after the armature modifier. With the Soft-body Goal vertex group you can control which parts of model will be giggly and which not. For good performance this should be done on a low-poly skinned Mesh-deform mesh controlling the high-poly character.


How can I make the camera taller in the Blender Game engine? I was making a first person game in Blender and I wanted my character to be taller, at the moment the character is just a camera set to character physics. I cannot scale each individual factor [x, y, z] on their own and making it bigger on all factors makes it impossible to control, is there anyway to fix this and make my camera taller?

By making your camera taller do you mean to change the resolution? Your character and your camera should never be the same object. Make a cube (this will be your character), and parent the camera to it. The camera should be set to no collision and the box to dynamic. You can change the shape of the cube if you want the character to be taller. Or if you just want the camera to be higher up you could just move it up in the Z-axis.
If you are meaning resolution then you can simply adjust it in the Output tab under dimensions.


Compositor - File Output - PNG compression ratio issue I use the compositor to save my renders into files with the "File Output" node. I want to have the smallest file size while preserving all information. I use PNG file format with the highest compression ratio, i.e. 100%.

My problem comes from the output file size. It seems that the compression ratio in the "File Output" node is not the same as the one when manually saving the image with the Image Editor (Image Editor > Image > Save As...).

Here are the figures with the default Cube rendering.

File Output node in compositor :

PNG 0% : 8.3 MB
PNG 15% : 1.0 MB
PNG 100% : 610 KB

Manual saving via Image Editor :

PNG 0% : 8.3 MB
PNG 15% : 75 KB
PNG 100% : 38 KB

So for the same level of compression, I have different image size.

Maybe I miss something. Can anyone help ?
Thanks.

Blender version : official 2.82 on Linux.

Screenshot of my compositor node settings :

File browser with file sizes :

All files look the same (resized below) :

The difference comes from the dithering. This post-process is not applied on the viewer node but is applied on the render. You can find more info on dithering : https://docs.blender.org/manual/en/dev/render/output/settings.html#dithering

  Dithering is a technique for blurring pixels to prevent banding that
  is seen in areas of gradients, where stair-stepping appears between
  colors

Dithering adds noise. It explains why file sizes are not the same (noise is harder to compress).
Below, the first image does not have dithering and the second one does have dithering (maybe you need to zoom in to see the difference).

To get back to my initial question, the image saved with the File Output node via the Compositor has dithering and the image saved from the Viewer Node via the Image Editor does not have dithering.

I get the info from developers on ticket I opened :
https://developer.blender.org/T74071


Automatically dissolving edges in quad faces that share same normals Good morning,

I'm trying to getting from this

to this

Is there an automatic way to limited dissolve all only square adjacent surfaces of a mesh into few only squares surfaces (or rectangular surfaces).

Situation:
The fact is I had a text object, then limited dissolved for having n-gon only surfaces, then applied remesh for have square only surfaces. Now I have too many useless square surfaces that I think can be collapsed in few ones.

What I need
The point is, I want a meshed extruded text to have as few as possible quadrangular surfaces, without altering its perimeters (only collapse same angle quadrangular adjacent surfaces int as few as possible bigger quadrangular surfaces).

Already tried
I've already tried the remesh modifier, but it only messes up the border of my text mesh.

Hope I make myself clear in my explanation.

Thank everyone for any answers

A partial solution that lower the mesh vertices but does not keep the quads.

Join the two shapes (to work both on 'Marco' and 'Aries'). For that select them both in object mode, then CtrlJ
Go to edit mode and delete the bottom faces vertices, so that you keep only the top faces

At this step you have the exact same shape, except it is flat :

Go to object mode
Convert to curve AltC, then "curve from mesh/text"

You obtain this (no faces) :

Go to the properties panel and in the curve tab, then click on 2D

This makes the faces reappear :

Now to regive volume. Convert again to mesh (AltC then "Mesh from curve/.../text")

The inner mesh is the following :

You can now extrude it again to regive the original volume.

So no quads. But starting with 41 402 vertices, you now have 8 080. And the shape is the same.


Import external txt with phyton Guys I'm trying to import an external .txt file with some paragraphs, I know I will have a lot of work ahead of me to split that file into the texts I already have animation.

But for the moment how can I import an external .txt that is in the same folder as the .blend and replace the content from the text object that has already an animation?

Try this (I am using Blender 2.81a)

import bpy
import os

# This gets text from file
filename = os.path.join(os.path.dirname(bpy.data.filepath), "info.txt")
f = open(filename, "r")
text_data = f.read()
f.close()

# Get your text object (object name here is 'Text')
obj = bpy.data.objects['Text']
obj.data.body = text_data # set text

```


Animating a series of objects along a path independently I'm trying to animate a long trail of objects along a path, I want each one to follow the path independently without having to offset each single object. I tried follow path but as I said all objects are constrained on a single point of the curve, "clamp to" seems to work but objects do not rotate and I can't control the distance between them.

You can add an array modifier to the object, this will allow you to control the distance from one to another. A Curve modifier will make the meshes follow the curve. You can keyframe the object to make it move along the curve.

Method 1:

Note that this will deform the object along the curve

Make sure the origin of the curve is at the start of the path.

Place the object at the start of the curve as well
Select the object. Add an Array modifier:

Count: how many copies you want
Offset: how far each object will be from one another

Add a Curve Modifier and select the curve in the Object slot.
Animate the object by setting key frames. You only need to animate the Object along one axis depending on the orientation of the curve.

Method 2:

Note: This will not deform the object along the curve. This method is a bit of a workaround and a hack.

Make sure the origin of the curve is at the start of the path.

Create a cube at the origin of the curve.
In edit mode merge all vertices into a single point. Alt M -> Center
Back in object mode add an array modifier. And set the Offset to constant.

Increase the offset to where you can see each individual point

Make sure your object is at the start of the curve
Parent the object to the array of verticies. Ctrl P
Set the Duplication type to Verts under the mesh properties. Enable Rotation.

Use the array of vertices to animate the object along the curve. Animate by setting key frames. You only need to animate the Object along one axis depending on the orientation of the curve.


Bad artifact when bevelling smooth mesh Is there any way to do a bevel similar to that on my screenshot without the artifact (the square appearing) with smooth shading? I see the result is due to all the vertices on the face created by the bevel, but I don't know the best way to solve this. All help appreciated.

If you want to keep your object low-poly, if you smooth it it will try to smooth the 90° angles and it will give what you see. A trick is to use Auto-Smooth, i.e. ask Blender to only smooth the lower angles: Select your object in Object mode, press W > Shading Smooth, then go in the Properties panel > Object Data > Normals, enable Auto-Smooth and keep a low angle like for example 30°.

Note that the general shape will stay angular, if you don't want that you'll need to give your object a Subdivision Surface modifier, and add some edge loops to sharp the angles.


Why is the Compositor not showing any nodes? After rendering a design in blender 2.82 I tried to improve the designs with the nodes but the Composting tab is blank with just the grid showing and no rendering info/nodes

You probably accidentally deleted all the nodes.

Simply add a composite node with Shift + A > Output > Composite.

If you want to feed it the render from your scene, add a Render Layers node:

Shift + A > Input > Render Layers


Why isn't my smoke simulation interacting with other objects properly? I am trying to create a simulation of smoke inside a building with Blender 2.73a. I have successfully modelled the building and created the smoke simulation. However, my smoke is not interacting with the walls of the building like it should. How do I fix this?

You have a normal collision above the Smoke collision, and it seems to be messing things up. I removed both and re-added just the smoke collision, and the simulation appeared to work flawlessly, no smoke came outside of the walls.

Before:

After:

I can replicate this issue by adding a standard collision to the object, then adding the smoke collision. If you reverse the order it works perfectly fine. This appears to be some sort of collision priority conflict or bug. As long as you add the Smoke Collision first it should work as expected.


Generate Rig error: key "ORG-nose" not found' In order to generate a bone rig I have created the metarig and adjusted it to my model/character. As I am trying to create something simple (to use it in Unity), I removed the face and ears.

Then I re-calculated the noremal ("Shift + N" and then "Y").

Once I generated the rig (Object Data Properties > Rigify Buttons > Generate Rig) I got the following error:

  Generation has thrown an exception: 'bpy_prop_collection[key]: key
  "ORG-nose" not found'

And in the Layers it appears a new one named "rig" and it highlights the following:

What am I missing here?

Found the problem.

The face bones were not all removed as I saw one inside the big bone when I moved it.

Removing that small isolated bone solved the problem.


How to achieve a flat colored render pass from material id/index for masking I'm trying to get a render pass that splits all different materials into flat shaded objects (like material id in 3ds max) with anti aliasing.

The output colors aren't important. (random colors are just fine as they will be used as masks)
Render engine: cycles
 NOTE: I do NOT want to use python for this.

What is the simplest way to achieve a result like this?
And...should I use seperate render layers to get the best render time?

You ask a question to which there is no simple answer based on your requirements:

no python - this limits any automation and implies a lot of work
with anti aliasing - this is something cycles cannot do yet on masks

The anti-aliasing issue of ID masks (first render, second without, last with):

The perfect solution would be to render the scene with each material being a different color emission shader of strength 1.0 - without python this is time consuming to set up. Low samples would be enough for this and you would get the exact anti-aliasing like in your final render.

Another solution is to give each material a different ID and render the MaterialID pass in ridiculously high resolution and then down-scale. The good news is you will get the pass with just 1 render sample!

In compositor you will get all the colored ID masks (but aliased) like this easily:

The anti-aliasing after down-scaling will not be pixel-perfect with your final render and will depend on your downscaling algorithm.


Character eyes are black I made a pair of eyes for a character of mine that consists of two meshes. One that acts as the real eye with the iris and the pupil, and then a copy of that one but slightly different to represent a cornea which has only a simple glass shader on. Why are the eyes of my character dark as soon as I place them inside the eye sockets? Seriously, you can barely see them. Can anyone tell me why Blender does this?

Eye out of socket:

Eye inside socket:

From a distance you can't see it's eyes at all, only if you're this close can you make them out.

Blend file: https://www.dropbox.com/s/vj7jwmcu7sn7bej/Dark%20Eyes.blend?dl=0

It is hard to see it all without all the pictures packed (or I just don't have HDR activated), or that the head is lacking materials. However, I myself have had a few troubles in regards to things being not lit the way I like it. One of the things involves having specularity spots on eyes even in a dimly lit room. The two options I came up with was having "virtual lights" (spot and point) surrounding the face, and having a starfield texture added as emission.

I have played around a bit with your node setup, and what I've come up with is that from the Mix node that is connected to the Principled's Base Color, add a connection to a Bright/Contrast node, connect that to an Ambient Occlusion shader, and then an Add shader that adds together the Principled and Ambient outputs to the Material Output.

With the Bright/Contrast node you can control how bright/vibrant you want your eye, seeing as AO (and Add) doesn't have a slider for how much it affects the material. If you want a "strength slider" for the shader, or don't mind the eye emitting some light, you can exchange the AO shader for an Emission shader.

Hope this helps.


Hooks are placed on a wrong origin I'm rigging the wing of the bird Piero training course by CG Cookie but I'm stuck on Episode 23,called : 23_piero_rigging_wing-part1.

I should create 4 new hooks,one for each joints of the wing. In the picture below,You can see that the 4 joints as origin have the point situated inside the black circle. This is the goal that I need to reach as stated by the tutorial. My problem is that though I do the same steps as the author,those 4 joints are placed in a different origin : inside the left eye. Why there ? I created a small video to show you and I added the blender file. Very thanks.

video : what I do

so, I watched the video but couldn't see the moment where he showed the origin of the hooks.

However, I think you should look into the "Set Origin"-options. You can open them by pressing "Space" and typing "Set Origin" into the appearing text box. Or just use the short cut "Shift + Alt + Ctrl + C".

Select all the hooks and choose one of the options. Try out whether one of them results in the wished origin position.

Greets
Jaspa

--- EDIT ------------------

Ohh god, I fixed it xD
You always tried to give the empty elements the origin. But first: empty elements have no origin, just a location (see my link in the comments for more details). And second: That's not what was  done in the tutorial.

To achieve the same origin as in the tutorial, you need to select the armatures (the whole bird) in Object Mode. Therefore you just need to click any bone. Once selected, you need to center the 3D cursor (as described in the comments too). Now you can use "set origin" options for applying the new origin. Et voilà: You've got the same settings as in your tutorial.

Have fun :)


Correct glass shader i am trying to make a glass shader for a photorealistic scene that im making but i have an issue with a glass of water. My glass in real life has some edge loops in the inner part of it. I modelled them and made a glass shader.
But the inner part of it isnt refracting.

This is the best that i could make. But the top part is so bad.

I think the problem could be that you are using the light path node at the end, try this, I hope it helps.


Texture goes away when using the explosion modifier I've been following this tutorial: https://www.youtube.com/watch?v=d59AouNM9lk   Which makes an object slowly dissolve with the explosion modifier. The only difference for me is that I have a texture on the object that is UV unwrapped. When I apply the explosion modifier, the texture goes away. How can I keep the texture on the object as it disintegrates?

Never mind, I figured it out. I didn't connect the textures to a texture coordinate node. Once I connected it to the object coordinate, the texture appeared again.


How to stop Action Constraint giving different results when code is run in text editor vs python console? I am currently developing a script that I hope will streamline the approach of adding keyframes to existing actions used by action constraints.

I am doing this by allowing the user to move an object to a new position, run an operator which will find the action attached to the action constraint for the selected object, load said action onto the object, insert a new keyframe into the action, before removing the action again.

This allows the user to add a new keyframe to the action without having to go through the process of loading and unloading the action manually.

The problem is that the action constraint seems to be adding any movement the user has made to the object and adding the action on top, creating an offset effect.

The annoying thing is that this code does work when entered line by line via the python console, but when run as a whole from the text editor I get the offset problem shown below (after having moved the object and controller 1 unit on the x axis and then running the script):

The Wiki explains that this is expected:

  When the linked action affects some location properties, the owner’s existing location is added to the result of evaluating this constraint....

My existing (and simplified) code is below, hopefully the comments explain the steps, for test purposes it is presumed that the original x location is 0 and that the first keyframe is frame 1):

import bpy;
currentFrame = bpy.context.scene.frame_current;
object = bpy.data.objects['Cube'];
constraint = object.constraints[0];

currentLocation = object.location.copy();             #Store current position
object.location[0] = 0;                               #Undo movement
object.animation_data.action = constraint.action;     #Assign action
object.location = currentLocation;                    #Move object
object.keyframe_insert(data_path="location", frame=currentFrame, index=0) #Insert keyframe
bpy.context.scene.frame_current = 1                   #Return to first keyframe
object.animation_data.action = None;                  #Remove Action
bpy.context.scene.frame_current = currentFrame;       #Return to initial frame

So, how do I avoid the offsetting issue when running the script from the text editor (which will later be an operator)?

I have included a blend file here, it is already set up with one keyframe in the action on frame 1. Setting a second keyframe on frame 10 by running the code line by line in the python console will show the correct result, running the script from the text editor will not.

You change the frame number twice in your script:

bpy.context.scene.frame_current = NUMBER

The frame_current property  should be used for reading the current frame number only, or some special cases in which you don't want to fully update the scene to this frame.

Use the method frame_set(...) instead. It forces an immediate update of all objects in the scene, including animations (transformation matrices etc. will be calculated)

Scripts run from the Text Editor or as addons behave slightly different compared to the Python Console. There are implicit updates when using the PyConsole, which may give the impression of a function causing an update itself. But once you try it in the Text Editor or as addon, you'll experience behavior like you described (basically missing instant updates during an operation, 'cause it's not done automatically).

By the way: although Python supports ; as punctuator, it is no good style.


Make special organic procedural texture I have some problem to make this organic displacement texture
I want make it with procedural generator of blender, but I don't know if is possible.
[]
My example which comes closest to it :

if anyone has an idea, or a different technique, thanks in advance!

I ended up finding something that comes close !
Here is my procedure :
1.Add a cube.
2.Add this modifier :

First displace texture is for animating, add empty for focus coordinates object :

The second and third displace texture are the same :

And Enjoy the result !

For render i advise a lot of subsurface.


Simulation of thin plastic Is it possible to simulate the properties of cellophane in blender? I am trying to understand how a cellophane tube will deform as it passes through a shaped apperture.

It would be possible to simulate the appearance of the material and the form to some degree while working with reference material like photographs. If you need it the other way around - to know how the reality will look from something you would do in Blender, unfortunately Blender is not designed for that. Tools in Blender are more aimed to achieving visuals, not correctly simulating reality according to measured properties of materials. You could experiment and compare simulations to what happens in reality so it might be possible for you to guess some things based on the simulations, but that might not be an easy task in Blender.

I have attempted to predict the behavior of fabrics before but it was with Marvelous Designer that has way more features than Blender when it comes to cloth simulation. From my experience it is always still guessing and you need a lot of experimentation before you can even start guessing the most basic things. I attempted to predict how a beanbag design would look:

You can see my closest prediction of how the design would look on the right and a photogrammetric reconstruction of the actual bean bag made on the left. The overall form seems to match, but if you look at the details it starts to differ quite a lot because of the limited resolution of the simulations. Keep in mind this is done in software that is a lot more advanced in simulations, so I would expect the results in Blender to be a lot more approximate. Either way this would require a lot of work and a lot of experimentation and in the end is mostly just guessing.


Using OpenGL in blender python It seems that blender python exposes very limited functionality of OpenGL. I currently want to draw additional information in every edge of a mesh by using OpenGL. Basically the edge direction is what I am looking for. However, I am not getting very good performance for a mesh consisting of 59,620 edges.

Initially I tried opengl drawing using immediate mode, this was too slow. Next I tried using display list. It is good but not what I expected. I'd have to manually update every the display list when there is a change made(adding, deleting edge/vertex/face). Is there any alternative way to do this? Or is there some way I can just get edges displayed on screen/viewport and display properties for them. That way I don't have to go through checking every edges.

I have a checkbox which when enabled simply generates a display list and adds a draw_handler to the view3d scene which calls this display list.

EDIT:
First I create the opengl display list using this piece of code. This code simply goes through every edge and creates an arrow representing the edge direction and finally generates the opengl display list.

    def createArrowDisplayList(self, context):
        ob = context.object
        if ob is None:
            return

        if bpy.context.active_object.mode != 'EDIT':
            return

        ob = context.edit_object
        me = ob.data

        bm = bmesh.from_edit_mesh(me)
        index = glGenLists(1)

        glNewList(index, GL_COMPILE)
        glColor3f(0.0,1.0,1.0)
        for e in bm.edges:
            vecFrom = e.verts[0].co
            vecTo = e.verts[1].co

            middle = (Vector(vecTo) + Vector(vecFrom)) / 2.0

            v = Vector(vecTo) - Vector(vecFrom)
            v.normalize()

            # if vector is straight pointing up only on z axis ignore it
            if abs(v.x) < 0.0001 and abs(v.y) < 0.0001:
                continue

            vPerp1 = Vector((-v.y, v.x, 0.0))
            vPerp2 = Vector((v.y, -v.x, 0.0))

            v1 = (vPerp1 - v).normalized()
            v2 = (vPerp2 - v).normalized()

            SCALER = 1.0

            glPushMatrix()
            hAngle = degrees(v.xy.angle_signed(Vector((0,1))))
            vAngle = -degrees(v.angle(v.xy.to_3d()))
            glTranslatef(*middle)
            glRotatef(hAngle, 0.0, 0.0, 1.0)
            glRotatef(vAngle, 1.0, 0.0, 0.0)
            glScalef(SCALER, SCALER, SCALER)

            glBegin(GL_TRIANGLES)
            glVertex3f( -0.5, -1.0, 0.0 )
            glVertex3f( 0.0, 1.0, 0.0 )
            glVertex3f( 0.5, -1.0, 0.0 )
            glEnd()
            glPopMatrix()

            """
            glBegin(GL_LINE_STRIP)
            glVertex3f(*(middle + v1))
            glVertex3f(*(middle))
            glVertex3f(*(middle + v2))
            glEnd()
            """

        glEndList()
        return index

And then, I add this method to the draw handler on 3D view. Now the display list needs to be refreshed or generated again manually whenever there is any change made to the underlying mesh

    @staticmethod
    def draw_callback_px(context, displayListIndex):
        wm = context.window_manager
        if wm.mesh_layer.bDisplayEdgeDirection == False:
            return

        ob = context.object
        if ob is None:
            return

        # 50% alpha, 2 pixel width line
        #glEnable(GL_BLEND)
        glColor4f(1.0, 1.0, 1.0, 0.5)
        #glLineWidth(2)

        glPushMatrix()
        glScalef(*ob.scale)
        glTranslatef(*ob.location)
        glCallList(displayListIndex)
        glPopMatrix()

        # restore opengl defaults
        glLineWidth(1)
        glDisable(GL_BLEND)
        glColor4f(0.0, 0.0, 0.0, 1.0)

As you have noticed, drawing bgl is relative easy. For trivial stuff many settle for immediate mode, because the overhead in their drawing routine is never noticed (either a really fast processor, or simply minimal drawing instructions).

As soon as you crank up the amount of geometry and complexity of the drawing call, you will need to think about optimizations and perhaps use a DisplayList. Optimize the code you were using in immediate mode first. Use timers and reproducible geometric inputs to see what kind of effect your code modifications have and figure out which parts take up the most time overal and concentrate on those, profiling helps.

A DisplayList isn't magically going to make your fresh bgl drawing faster.

You already noticed that using the push / pop matrix for 3 vertices can introduce more overhead than calculating them directly.
a .co  is already a Vector, it doesn't need to be recast as a Vector()
I'd try some counter intuitive things like pre-calculating the coordinates for all polygons you intend to draw, then for-loop through them inside GL_TRIANGLES where each 3 new vertices pushed is part of a new Tri.
Consider numpy! initial filling of arrays may be the bottle neck, after that you can get a lot of processing done very fast with the right constructs. (becomes off-topic for BSE)

50k plus edges, in your program translates to 50k polygons with 150k vertices, that's a lot of geometry to update/recalcuate with python and bgl at a high frame-rate.

It may be worth considering splitting it into subsets, if not all data needs to be updated
If it makes sense, show only a sampling of all your points, show more samples in the area you are editing, and less or no samples from beyond it.
If it's not visible, does it need to be calculated.
does it need to be 3d? it's easy to convert view3d 3d coordinates to 2d screen coordinates, and drop edges if they don't meet some criteria like:

the length of the edge on-screen is below a set amount of pixels, don't calculate draw arrow, don't draw it.
are both (or just one) coordinates of the edge visible, decide based on this whether you need to draw it.

only consider selected edges (this will include the active edge).

Alternatives to bgl

Mesh

For Sverchok we found it was worth experimenting with a non bgl way of displaying mesh data, by generating a Mesh object and let Blender take care of the Drawing! Such a Mesh object can either be wiped and refilled between updates or you can use a foreach_set('co', flatlist) when the geometry of the existing mesh has the same amount of coordinates as the geometry you're trying to replace it with. It might be worth reading the code we settled on: nodes/basic_view/viewer_bmesh_mk2.py  -- there's no guarantee this this will be any faster, but it does sidestep home-grown bgl code.

DupliVerts + rotation

It is possible to make a secondary mesh with only the points where these arrows are supposed to appear, and then assign the vertices of the secondary mesh each a custom normal by doing v.normal = orientation. The duplicated Object will then rotate to point in the orientation passed to the normals. Example code: https://gist.github.com/zeffii/d61a4963e6c093dda52b

drawback is that if you go into Edit Mode for the duplivert mesh, the normals will reset. (but you probably don't even need to go directly into edit mode for that mesh..)
it is possible to use foreach_set('normal', flatlist) on the data.vertices collection which is quite fast.


When exporting an H.264 video, why is the resulting file's extension .avi? I have a client that wants the render in .mp4 format. Using the Blender VSE, I rendered the image sequence into a movie using H.264, which I understand is MPEG-4, but Blender outputs the .avi extension instead. Why is this the case and is there any harm in renaming the extension to .mp4? When I rename the extension to .mp4 it seems to work just fine, but maybe there is some harm in doing this that I don't understand.

H.264 is a codec and MP4 is a file format. An H.264 stream can be contained in several different file formats, e.g. AVI, MP4 or MKV, and most file formats can handle several codecs.

Video file formats, such as AVI, MP4 or MKV, can handle multiple streams, and most commonly contain one video stream, one or more audio stream(s) and possibly one or more subtitle stream(s).

Simply renaming an AVI file to MP4 won't make it an MP4 file, though most players will detact the actual format and ignore the filename extension. To convert an AVI to MP4, you'll need to re-multiplex it. Multiplexing is the process of combining the different streams into one file and write the proper metadata. This can be done without re-encoding the streams.

I just had a quick look, and I can't find an option to save as MP4, and unless someone has a solution for that, it looks like you'll need an external program for this. If you need/want a GUI application, Avidemux will do nicely for simple re-multiplexing and even some filtering and re-encoding. If you're OK with commandline programs, I recommend FFmpeg.


Why is the mesh deforming? When rigging this gun for some reason the trigger doesn't seem to response the way I intended? Why does it seem like its rotating the bottom of the trigger, and how can I fix this?
I have separated everything into vertex groups and all vertices seem to be selected I'm not sure why it's doing this.

I figured it out!!!
It was because I had an edge selected in my root vertex group I had to deselect it from that group for it to work properly.


Rotate objects around irregular shape I have these flap things rotating around a very irregular shaped track. While I was able to rotate each flap from a center point perfectly, I was not able to rotate them around this irregular track perfectly. So I had to translate them along Z and simply eye them to their correct spot right along the track. The problem with this is that not all of them are equally protruding from the track.

Is it possible to translate the objects perfectly around the track equidistant from one another?

you can use the path constraint to do exactly this.

Select all the objects you want to follow the curve, and the curve last.
Press ctrl +   P  to bring up the parent menu. (see pic 1 )
Select path constraint. Follow path is the old way of doing this, but the path constraint is easy to change settings.
In the constraint panel, change the XYZ axis to match your objects rotation. (see pic 2)
You may need to clear the location and rotation of the blades ,depending on the location and any other parents the object has.

ALT  + G  (clear location)
ALT  + R  (clear rotation)
and/or ALT + O (clear origin)

You can then use the offset on each item to change the position around the curve.
To change the speed, in the curve options you can change the frames (see pic 3), or the evaluation time in the curve editor.


Offsetting flames and/or smoke from the emitter I've tried a few times to get emitted smoke and fire to appear slightly offset from the emitter, like for example a gas weld or a flamethrower. I've played with vorticity, temperature difference, density, speed, flame rate and practically every other setting whose name even remotely indicates that it may make a difference. All to no avail. I've also tried to add wind with various strengths and directions, and making a larger portion of the fire colour ramp transparent.

As you can see in this image, Suzanne emits fire from her eyes and whatever that heart shape is meant to represent (mouth or nose?).

I want a small gap before the flame actually appears, similar to what can be seen here.

How, if at all, can this be achieved? I'm using BI.

Blend file for the Suzanne image: http://pasteall.org/blend/33192

You could try making a fake emmitter. Basically an object that has faces where you want the smoke emmited.


Why is my file so much bigger after baking textures and adding an HDRI, and can I reduce it? The file I'm working on was 1.7 Mb before baking textures onto most of the objects in it and adding a background HDRI, and now it is 17.2 Mb. That's even though all those images are separate files and none are packed into the blender file. Is there a way to determine what is taking the space, and to trim it down?

The above file contains one object not in the comparison file, but that can't explain much of the size difference. The comparison file otherwise is almost identical, even has a few small bits and pieces that have geometry that was pared away in the above version. There were a couple of subsurf modifiers that were applied, but they were extensively optimized. The total vert count is only about 70,000 higher.

First, you can make sure no textures or external data is accidentally packed into Blender by using the File > External Data > Unpack All Into Files function.

Second, Blender keeps orphaned datablocks around until the next time you save the Blender file. So Save the file, close it. And reopen it, doing it a few times can clear any deleted datablocks from the file.

You can also use the File > Save As > Enable Compression setting to make sure the blend file is compressed to save some space. For files larger than a hundred MB, it will take a bit longer to save and open.


How to access vertex_color layer directly from inside BMVert I want to access vertex colors directly from inside BMVerts, but I don't know how.
I am able to access vertex colors indirect for inside BMFaces:

import bpy
import bmesh
obj = bpy.context.active_object
mesh = obj.data
bm = bmesh.new()
bm.from_mesh(mesh)
layer_color = bm.loops.layers.color.get("col_test")
for bmf in bm.faces:
    #bmf.loops[0][layer_color] = new_color
    for loop in bmf.loops:
        color = loop[layer_color]
        print(color)
        loop[layer_color] = new_color
bm.to_mesh(mesh)
bm.free()

But this way I loop multiple times through the same vertex colors, because a face vertex is owned by multiple faces.
I don't want to loop through all faces only to get access to the vertex colors.

I am looking for something more direct, like:

import bpy
import bmesh
obj = bpy.context.active_object
mesh = obj.data
bm = bmesh.new()
bm.from_mesh(mesh)
layer_color = bm.loops.layers.color.get("col_test")
for bmv in bm.verts:
    color = bmv.????[layer_color]
    print(color)
    bmv.????[layer_color] = new_color
bm.to_mesh(mesh)
bm.free()

It seems there is no "interface" to access the vertex color from insider a BMVert directly, or am I doing something completely wrong?

Vertex colors are stored in face loops, you can't ignore/overlook this.

However its reasonable that you might want to generate vertex colors per vertex and not have to deal with looping on vertex-loops while generating/manipulating the colors.

Your best options would be to have 2 functions for converting colors between loops and verts. This could take & return array of Color objects. Then at least you can keep the conversion isolated and not complicate your color calculation logic. (If your generating new colors you only need one function to go from vertices to loops of course)


Change start and end frame of rigid physics simulation with python I'm having a lot of difficulty trying to change the start and end frame of a rigid body physics simulation with python. Changing the settings in the UI shows the following in info view:
bpy.context.scene.frame_end = 850

However, running this will change the end frame of the timeline, which is not what I want. I saw the following post which solves this for cloth simulation, however this doesn't work, because the rigid body physics are not employed as a "Modifier". (Change the start frame and end frame of a bake in Blender using script)
Perhaps I have to change the context and then running the above code? I would appreciate any help implementing this, or any other way to achieve this effect.

Just figured this out, hopefully this helps someone else. If you access the point cache within the rigid body world, this has a frame start and frame end which you can change with, for example:
scene.rigidbody_world.point_cache.frame_start = 1
scene.rigidbody_world.point_cache.frame_end = 1000


Bake a Displacement map from a cylinder object I have this twisted rope created from a bezier circle with modifiers. To reduce the overal poly count I want use discplacement map for this. So my question is how can I bake a displacement map of this object so I can apply it to a simple cylinder?

Since you're baking scalar displacement from a cylinder, the set-up isn't too bad.. the illustration below shows the rope shaded with its height-map-to-cylinder.

Assuming your rope has its object Z axis straight up its core, with this tree, you put the radial distance from its surface to an (imaginary) cylinder, in this case with radius of 0.65, straight into the strength of a pure-white emission shader.
Put the UV unwrapped low-poly cylinder in the same location as the rope, at the world origin, and bake the emission from selected (the rope), to active (the cylinder) Bake into a floating-point format, 16 bits will probably do.
Then the baked map can drive a Displacement shader for the cylinder:

The cylinder, displaced, is on the left, next to its baked height-map, and the original rope on the right.
It is possible to bake Vector Displacement .. it gets a bit more complicated, with an intermediate map of World-Space positions baked for the Hi-res object, from which positions of the Lo-res object are then subtracted, and baked again, into an exactly corresponding UV map.