text:
How can I make the origin of a smoke emitter follow a Bezier curve?
I am trying to make an icosphere with a quick smoke effect follow a Bezier curve, but I am unable to get the origin to follow the curve. So the smoke just follows the origin along the axis of deformation. How would I ether get the smoke to move with the icosphere, or get the origin to follow the Bezier curve?

Could you please show us a couple pictures of whats going on?

Welcome to blender world, Ahsaan.  Your question is rather brief and has no diagrams or blend file provided, so you may get some inapplicable answers.
The quick-effects // smoke   should have created an Inflow behavior on your animated object.  Verify you don't have this set to a static Geometry behavior (once at startup)

And this object should be following the Bezier curve:

Which should produce the desired effect:

As was produce by

First of all I am extremely sorry for not including any further information, I'm very much new to blender and really all of this. But secondly thank you very much, this has been a roadblock for him for a while now and your assistance was greatly appreciated.


text:
Blender - Rigid body - Mesh - Not rotating/tumble after collision
As you can see in the video I want the slug object to tumble just like the cube does on the left. Both object have the exact same properties regarding ridig body, which is shape:mesh and the rest default.
https://youtu.be/q4fxHrK7WXw

Can anyone tell me what I might be doing wrong? I've seen multiple posts regarding similar issues, but most of those were people not using "mesh" in the rigid body options.
I'm using Blender 2.93.3
This is my blend file:
https://hannemaster.stackstorage.com/s/mminT6VNwSijEDCv
If anyone could have a look I would very much appreciate it!

I needed to apply the scale by pressing Ctrl +  A while having the object selected and then select scale.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Export ANT landscape as heightmap
I found this old question by "omuverde" on blenderartists[1]

It's there a way to export a ANT Landscape generated terrain from Blender to a heightmap?  I saw a tutorial that did it by positioning the camera above the terrain and rendering the heightmap but i'd like a more elegant way of doing this.
So, is there a way or am I going to have to write a script to sort verts from the mesh in the right order?

I repost it here because the question was never answered, and the suggested method (render the heightmap as an image) may have issues with the choice of lightsource. Also It is preferred that the image is exported in linear colorspace.
[1] http://blenderartists.org/forum/showthread.php?115406-ANT-Landscape-to-Heightmap

It can be achieved by baking the height of a mesh.
Before you start, make sure that the origin of the object is beneath or at the lowest point of the mesh, preferably the latter. Negative values do not go well with images.
Go to the UV/Image Editor and create a new image

Go to the 3D view, select your mesh, go to edit mode, select all vertices with A, go to orthographic view by pressing numpad 5 and top view by pressing numpad 7.
Press U and click Project From View (Bounds)

Go back to Object Mode, go to the node editor add a new material for the mesh. Add a Texture Coordinate node, a Separate XYZ node and a Math node. Connect the Object output from the Texture Coordinate node to the Vector input of the Separate XYZ node, the Z output of the Separate XYZ node to the upper input of the Math node and the output of the Math node to the Color input of the Diffuse node. Change the operation mode of the Math node to Power and the bottom value to 2.
Add an Image Texture node, select the just created image in it, but do not connect it to any other node.
The Node Editor should look like this:

Make sure you have the Image Texture node selected, go in the Properties Panel to the Render tab. Go to the Bake options, change Bake Type to Diffuse Color and click Bake.

You can now find the height map in the UV/Image Editor by selecting the image you created at the start. Do not forget to save the height map by pressing F3.

Note that this method is not perfect, a mesh created using this height map will not be completely identical to the original mesh.

Why taking the square?

The square of the height. Has that to do with gamma correction?

It has something to do with the way color data is stored. Minutephysics explains it a bit in this video: https://www.youtube.com/watch?v=LKnqECcg6Gw. I tested multiple methods, and taking the square gets the best result. I am not sure why, but it works. Compare these two pictures: https://snapr.pw/i/0b9059b0e5.png (without taking the square) and https://snapr.pw/i/bbc94fb546.png (with taking the square)

Ok so it has to do with gamma correction. Then squaring is not precisely correct. I need to know if I can save a linear image from blender or not. See also https://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Is there any way to keyframe specific points with AnimAll?
I've recently discovered an included plugin called AnimAll which allows you to animate... Pretty much anything, including UV mappings.
But I've noticed that it keyframes every single possible node/point that's possible (ie. for UV maps), as opposed to just the selected vertexes which armature and pretty much nearly everything in the properties tabs allows keyframing for.
For example, in the picture below, every single UV point has a keyframe on that model, and not just the eyes.

Is it possible to limit keyframing to specific vertexes, just like object keys?
While deleting keys is a practical solution to remove the amount of calculations that need to be calculated (less keys = less changes, even if those changes are literally 'no change at all') there is no feasible way to identify which vertex belongs to which set of keys.

You can always delete the ones you don't need afterward.

Also, any channels that are locked will not accept new keyframe data. So in your case locking may be a solution.

@Mentalist The problem with that is that it's impossible to work out which point is which without lots of experimenting. And boy will that take forever to work out which channels is for which point on the UV Maps

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
How to NOT duplicate data when copy-pasting?
In Blender, there are two ways of duplicating things:

The Duplicate Objects (Shift + D) command, and
The Copy and Paste function that we're all familiar with (Ctrl + C and Ctrl + V).

Both of these create new instances of objects... That can be manipulated without affecting the other...

As many of us know, we can disable data duplication for the first method by simply going to:
File > User Preferences > Editing > Duplicate Data, and unchecking the things they want to be linked to the original instance, rather than copied.

As a result, it does not create new instances of the texture file (in the image viewer) or material data, etc.
Question:
How do you do that with copy-paste?
Of course, things that do not exist that are copied in should have an instance created.
tl;dr Is it possible to merge Duplicate Objects with Copy and Paste?

Use Alt+D, copy paste should only be used to transfer data inbetween files

Note you can also create linked duplicates with Alt+D. Perhaps it would help if we knew why you are trying to accomplish this? For instance, you can link and append objects across files without copy/paste

@gandalf3 Stubbornness and laziness mostly.

The "object" doesn't store the actual data, like the mesh. That's stored in a datablock.
Each object normally has its own datablock, but you can assign any datablock to any object (of the same type), effectively creating linked clones. When you edit one object, you're actually editing the datablock, so any other objects with the same datablock will change in tandem.
Anything on the Object tab (the orange cube in the screenshot below) is part of the object, not the datablock. These settings will not be shared between objects.

The datablock selector


text:
How do I properly split a mesh into chunks?
I have a large mesh that I want to use as a game map, but because of the amount of large faces, it screws up the lightmaps. To remedy this, I want to split my entire map into equal sized chunks.
I know one method is to create a whole bunch of cubes, or long vertical square prisms in a grid and then simply use the Boolean modifier on Intersect. It works, but it is crude as it leaves artifacts everywhere.

I had several of the chunks effectively just joined the cubes onto the original mesh instead of actually Boolean-ing.
Is there a cleaner way to split my mesh?

For those curious - Here's the original mesh (orange) on top of the results of the above (so artifacts and chunk seams are in black, and some are actual faces).

I have some scripts that bisect meshes into grids using bisect. Unlike the boolean modifier they do not fill the cuts.  However, rather than equal area base  chunks, consider  a more logical cut,eg a  block of buildings  that is surrounded by roads, can be split thru the centre of the surrounding road.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Change resolution of a procedural texture without baking
I want to change the resolution of a noise texture node so it is 24x24 pixels for a Minecraft procedural material I'm working on, I have no idea how to do it but basically, I want to "rasterize" the noise texture without baking it. Thank you!

Nevermind I figured it out, I had to use some vector math:

Hi, thanks for the post. This site is not a regular forum, answers should be substantial and thoroughly explain the solution and required workflow. One liners and short tips rarely make for a good answer. If you can [edit] your post and provide some more details about the procedure and describe with words how it works. See How do I write a good answer?

Sorry for not having a clear question @DuarteFarrajotaRamos , but I already found a solution to the problem but thank you!


text:
Make textures low-res
I want to make a ps1 style render of a companion cube I made recently for another project but the problem is that the companion cube I originally made was textured with substance painter and that the textures are high quality, which is not what I want if I want it to look old.

"old" is a very relative term can you edit your question and attach an example image of what you have and an example of what you refer to as "old"

@RickT here, sorry for the bad clarification.
old
new

If your textures are baked to image files, you could just resize them. There is the option for this in Blenders texture painting tab. This is assuming you're after a pixelate effect.


text:
The module called msvcrt causes Blender crashing even if it does existing in Python list
My goal is to simplify and create my own version of screencast key addon and this is my baby-stepping. What I'm doing here is to display a key on the screen that user pressed. However, the module msvcrt causes Blender crashing.
Some people uses bge or keyboard modules for detecting pressed keys but somewhat reason I have no modules in my Python 3. So I decided using msvcrt instead which is already exists on the module list.
I searched my problem on Google but sadly couldn't get an accepted solutions.
Any ideas?
This is the code:
bl_info = {
    "name" : "KeyPad",
    "author" : "anon",
    "description" : "",
    "blender" : (2, 80, 0),
    "version" : (0, 0, 1),
    "location" : "",
    "warning" : "",
    "category" : "Generic"
}

import bpy, blf, msvcrt

class Ksys:
    defaults = {
        "id": 0,
        "handler": None,
        "count": 3,
        "color": [255, 255, 255],
        "size": [50, 72],
        "position": {
            "left": [2, 80, 0],
            "center": [],
            "right": []
        }
    }
    def __init__(self):
        while True:
            if msvcrt.kbhit():
                key = msvcrt.getch()
                print("Key Pressing detected!:", key)

                Ksys.defaults["handler"] = bpy.types.SpaceView3D.draw_handler_add(self.draw(key), (None, None), 'WINDOW', 'POST_PIXEL')
                print("Key Assigning detected!")

                print("Waiting for 3 seconds then remove the handler on the window")
                bpy.app.timers.register(self.remove(Ksys.defaults["handler"]), Ksys.defaults["count"])

    def draw(key):
        blf.size(Ksys.defaults["id"], Ksys.defaults["size"][0], Ksys.defaults["size"][1])
        blf.color(Ksys.defaults["id"], Ksys.defaults["color"][0], Ksys.defaults["color"][1], Ksys.defaults["color"][2])
        blf.draw(Ksys.defaults["id"], key)

    def remove(key):
        bpy.types.SpaceView3D.draw_handler_remove(key, 'WINDOW')

# test run before register
o = Ksys()

def register():
    pass

def unregister():
    pass

are u using windows?

@Chris Yes. I'm using Windows. Windows 10.

@Christ I have Mac also but msvcrt is the module that only avaliable on Windows (at least not one of default modules of Python I guess). So I'm currently using Windows.

that's why i asked...i am using mac too and there is no such module ;)

It's not crashing, you're just stuck in an infinite loop because of while True:

From my experience it's next to impossible to run a logic separately from Blender's main logic loops. You'll have to use a modal operator I think. Keep in mind autosave is disabled when a modal operator is running though. learnt it the hard way :)

msvcrt is part of the Microsoft C++ runtime library and it's very much not recommended to use it raw, mostly because the code is not portable. bge is a Blender module for the game engine, which was removed when the game engine was. This answer talks about doing kbd input with a modal operator. There are threads on how to do it with a separate blender thread but that's pretty hard to get right as Gorgious pointed out.

see the gotchas section on threads for comments on threading in the API

There are two ways to go about this in Blender.  The recommended portable way is to create a modal operator.  Modal Operators is a good free tutorial and this answer gives a minimal implementation that I quote here.
class VIEW3D_OT_process_input(bpy.types.Operator):
    """Process input while Control key is pressed."""
    bl_idname = 'view3d.process_input'
    bl_label = 'Process Input'
    bl_options = {'REGISTER'}

def modal(self, context, event):
    if event.type == 'ESC':
        return {'FINISHED'}
    elif event.ctrl:
        pass # Input processing code.

    return {'PASS_THROUGH'}

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

There are two obvious limitations of using the keypress event

Being modal means that everything else has to wait while the modal operator is running.  Sometimes this is a good thing, often it is not.
You only get to receive the key press events that the blender interface is willing to expose and the list is far from complete.

The second approach has the disadvantage of being much harder to implement properly and much harder to debug.  It also requires writing a version to interface with each OS that the script will run on. See Threading Gotchas for some examples of problems using separate threads.  It also doesn't resolve the second problem.
Unless you have a compelling need to dive into one of the harder parts of OS interface, I would strongly advise using the modal approach.

Sorry for late response and thank you for details.

No problem on the late response.  I'm just glad the answer helped you.


text:
Does Blender text editor not support custom module importing?
In VSC, this code works
import bpy
from subp.panel import Panel

Panel.test()

However, in the Blender text editor, Suddenly it doesn't work

ModuleNotFoundError: No module named 'subp'

If I change the second line to from .subp.panel import Panel then

ImportError: attempted relative import with no known parent package

Why can't I run the code in the blender text editor like this?
When I move the panel.py to the outside of the subp folder and change to from .panel import Panel, it throws the same error

ImportError: attempted relative import with no known parent package

Try removing the first "." from the from .subp.panel import Panel and see if that works.

@Jakemoyo It doesn't work neither. Terminal throws the errorModuleNotFoundError: No module named 'subp'.

Do you have an __init__.py file in the root of your custom module?

https://blender.stackexchange.com/a/181036/86891 ?

@Jakemoyo I think it is, yes. My directory looks like this Overlay - __init__.py, panel.py right now.

@Gorgious I'm using version 2.93.1 but the way you linked, it throws this error; KeyError: 'bpy_prop_collection[key]: key "panel" not found'.

@Gorgious I changed from ... import line to this; Panel = bpy.data.texts["panel"].as_module()

EDIT: Hopefully clearer answer in response to comments.
The short answer is 'No, you can't do that'.
The long answer
The reason this works in VSC is that Python has a system variable called PYTHONPATH.  Python searches all of the directories in PYTHONPATH to find the file. VSC knows this and adds the directory containing your module to PYTHONPATH.
For various reasons, Blender ignores PYTHONPATH by default. So it can't find modules that VSC can.
The workaround
You can work around this by

running Blender with the command line argument --python-use-system-env and
Adding the parent directory of your module to the search path using code along the lines of

import sys
sys.path.append("PATH_TO_YOUR_MODULE")

before you try to import it.  That's only the path to the directory containing the module. Don't include the module name.
Background
You may want to read the Python manual section on the import system; especially the paragraph about searching.  The key bit has to do with import path

A list of locations (or path entries) that are searched by the path based finder for modules to import. During import, this list of locations usually comes from sys.path, but for subpackages it may also come from the parent package’s path attribute.

For a discussion of Blender and PYTHONPATH, see this answer

Then what are the other custom addons? They still use normal import syntax for fetching their own sub-modules especially like this one; https://github.com/curtisjamesholt/BY-GEN-public

Custom addons are Python files.  That's why ordinary syntax works in them.  The console is not a Python file.

So you say I can't use the import syntax on built-in text editor of the Blender because it doesn't support? Sorry if I bother you I can't fully understand because I'm not a Native English speaker.

Don't worry, you're not bothering me.   I have not written a clear enough answer, so I will try to clarify it.

Thanks for understanding me. Speaking of which, I found a related answer from a question which has the same problem with me. https://blender.stackexchange.com/questions/183773/trying-to-make-a-menu-using-multiple-modules/183817#183817 I followed exactly same way such as changing files’ and folders' names, inserting register-unregister functions to every each .py files etc.. But sadly, it still throws the attempted relative error.

@sniffingdoggo You're welcome.  It will take me a little while to write a better answer, so please be patient.

Appreciated for detailed answer. Maybe I'll just write down an one .py file.


text:
Where window.screen belongs in this code?
import bpy
for window in bpy.context.window_manager.windows:
    screen = window.screen

    for area in screen.areas:
        if area.type == 'VIEW_3D':
            override = {'window': window, 'screen': screen, 'area': area}
            bpy.ops.screen.screen_full_area(override)
            break

I'm learning blender python with its documentation. The code is one of the example code from the tutorial. What I don't understand is, the variable screen doesn't belong to iterable module called bpy.context.window_manager.windows. If everything comes together, shouldn't this be bpy.context.window_manager.windows.window.screen because variable window is a part of the module?
>>> bpy.context.window_manager.windows.
                                       as_bytes(
                                       data
                                       find(
                                       foreach_get(
                                       foreach_set(
                                       get(
                                       id_data
                                       items(
                                       keys(
                                       path_from_id(
                                       rna_type(
                                       update(
                                       values(

See, there's no module called window. All I can see in the console panel is bunch of built-in functions.
    for area in screen.areas:
        if area.type == 'VIEW_3D':
            override = {'window': window, 'screen': screen, 'area': area}
            bpy.ops.screen.screen_full_area(override)
            break

This one is same. I can't find screen.areas in area module. screen.areas is iterable and loop is ongoing so it should say ...screen.areas.area.type yet there's nothing in it. (even bpy.ops.screen has no area.type.)
What is going on in this code? How can I see visually where the modules are located in my console tab?

A blender collection is a mapping that behaves like a dictionary and a list. In this case, a particular window is window = windows[0] not windows.window  This is the case for all collections.  Also a member of a collection is not necessarily a module. eg  a list called ints = [1, 2, 3]  can be iterated for i in ints: there is no expectation that can use ints.i.

@batFINGER Can I understand this is same concept looping nested array in Javascript? o.o

What you are missing is that bpy.context.window_manager.windows is an iterable:
>>> type(bpy.context.window_manager.windows)
<class 'bpy_prop_collection'>

In order to see a window, you must choose a member:
>>> type(bpy.context.window_manager.windows[0])
<class 'bpy.types.Window'>

Or you can chain together something like this since screen.areas is also an iterable:
bpy.context.window_manager.windows[0].screen.areas[0].type

Thanks for details. I was literally chocking myself lol


text:
How to re-access properties panel after misclicked by accident?

I usually change the segments & rings at the properties panel after generated an object. The problem is when I misclick, it disappears and couldn't find re-opening option. I have to delete the existing object and recreate another one.
Are there any ways to access this panel w/o creating same object?

The shortcut for this function is F9 key on your keyboard, it should appear again

Thank you. now I can escape from this redundant limbo re-creating hell.


text:
Any tips or documentations for improving blender python skills?
Recently, I set my goal to create my own screencast key for my python projects, but there's not much related instructions nor infos out there, like creating an empty box on the bottom right corner, button pressed events etc.. Nada. I thought this was easy such as a HTML/CSS thingys at the beginning and now I'm getting kicked my ass so hard.
I have been reading API documentation but they don't describe what the built-in functions do in the end of results unlikely MOZILA documentation does. Feels like I'm getting lost my way.
As a person who have Javascript/C# experiences, where should I go to get the ball rolling?
Any recommendations?

What about learning from existing screencast keys? Search on GitHub, code is available

@chris I tried, but it's hard to figure out w/o basics. What I need is detailed documentations for getting used to the built-in functions step by step because at the end, I would know that which module is done here, and others done there. However, with that much have been pushed by google, I can't find the module instructions especially blf and bgl

If you have a blender cloud subscription this tutorial is available.  Much of it is available even if you don't; but afaict there aren't any written documents for blender python coding.  Certainly very little specific to those particular bits, which the Blender Cloud tutorial doesn't cover.


text:
3ds max: Copy, Instance, Reference - a similar function in the blender. An example of the 3ds max, is in the description
I have a question that I can't find an answer to anywhere. More precisely, I do not know how to ask such a question correctly in order to find an answer to it.
I am interested in whether there is something similar in the Blender as in 3ds max? https://3dtuts.by/chem-otlichayutsya-variantyi-klonirovaniya-copy-instance-i-reference/ In a nutshell, I need to: create an object-1, create a copy of it-object 2. I want that, in the editing mode, moving the vertices of object 1, the same vertices automatically move, but in object 2.
Аlso, it is very desirable that such a function extends to splines (curve) as well.

Select the object, and press Alt+D, creates a so called linked duplicate -> https://docs.blender.org/manual/en/latest/scene_layout/object/editing/duplicate_linked.html

Thank you very much, friend! This is exactly what I was looking for! Thank you!

@brockmann I have duplicated your comment as an answer. At your request, I would take it down. I say this because it got an upvote and a downvote, and IDK if it was you, so there you are.

Not mine @TheLabCat. I'd suggest, search for a dupe though, had no time yesterday... Such basics already have an answer, IMHO we should respect that effort from years ago instead of repeating the same stuff over and over again by duplicating a comment.

Like Brockmann said, you can create a linked duplicate of an object that shares the same mesh data block. However, if you’ve created a duplicate object with a duplicate mesh data block and wish to change it, you can also go to the mesh properties tab in the Properties  editor while the duplicate object is selected, and change the mesh data block to the original one, and the two objects will be “linked.” You can even do this for objects that at first have mesh data blocks that did not come from each other.

Manual link: https://docs.blender.org/manual/en/latest/scene_layout/object/editing/duplicate_linked.html


text:
what are the hotkeys for changing the direction of extrusion in sculpting

I have version 2.93.2 what are the hotkeys for these buttons? and how to quickly search for hotkeys in blender?

Commonly, the "opposite" in sculpting can be achieved by holding Ctrl. (Example: click and drag extrudes outwards - Ctrl + click and drag extrudes inwards)

Thank you))))))


text:
Why can't I import a specific class from the module?
I'm trying to retrieve a class from the module called draw_op. The problem is in the module, some of classes can be imported normally while some don't.
Error:

<class 'draw_op.BlenderObject'>
<class 'draw_op.Drawer'>
Traceback (most recent call last):
File "/__init__.py", line 21, in
AttributeError: module 'draw_op' has no attribute 'DrawOperators'

__init__.py:
bl_info = {
    "name": "Draw a line",
    "author": "t",
    "blender": (3, 1, 0),
    "description": "test ",
    "location": "",
    "warning": "",

} # addon information, displayed on the preference panel. type = dictionary

import bpy, sys

#from operators.draw_op import BlenderObject
sys.path.append("/Users/jobpc/Desktop/Draw/operators")
import draw_op

BlenderObject = draw_op.BlenderObject
print(BlenderObject)
Drawer = draw_op.Drawer
print(Drawer)
DrawOperaotors = draw_op.DrawOperators # << This throws the error

draw_op.py:
import bpy, bgl, gpu

from gpu_extras.batch import batch_for_shader
from bpy.types import Operator

# ============ Following these classes are imported well ===============
class BlenderObject():
    prop1 = 10
    dict = {prop1: 5}
    @staticmethod
    def getNew():
        print("Hello")

class Drawer():
    def __init__(self):
        print('hello')

# ============ From now, those classes cannot be imported ===============

class DrawOperators():
    def __init__(self):
        pass

class draw_operators():
    def __init__(self):
        pass

class OT_draw_operators(Operator):
    bl_idname = "object.draw_op"
    bl_label = "Draw Operator"
    bl_description = "Draw Line"
    bl_options = {'REGISTER'}

    def __init__(self):
        self.draw_handle = None
        self.draw_event = None
        self.widget = []

    def invoke(self, context):
        self.create_batch()

Seriously, why this keep happening? Is this an error of Python itself? or just Blender?
Have been wasting almost 2 weeks, now I'm out of my patience. This makes me sick. I want to get out of this unending limbo hell asap.
Can somebody help?

It should work. Make sure the script that's located in "/Users/jobpc/Desktop/Draw/operators" is the same file that you made your edits to. And that you saved it. Saving it inside the Blender text editor doesn't save it on your disk. You need to use ALT + S or Text > Save to save to disk

@Gorgious I checked the location. The file is in /Users/jobpc/Desktop/Draw/operators and I saved the file manually but still nothing changed.

You may need to restart blender to reload the script ?

@Gorgious Thank GOD I restarted the blender then it finally works. Thank you for answering. This one nearly killed me.

Alternatively you can go to the blender logo (yes, it's a button) > System > Reload scripts https://i.sstatic.net/UQRG6.png

FWIW just clicking Reload Scripts won't necessarily work unless you have an __init__.py with this configuration in it. Clicking Reload Scripts only reruns every __init__ file for every addon in the blender addon folder, it doesn't reload every python file. This is only important if you want to reload custom modules in the same session.


text:
How to get smooth edges on text object?
I'm working with some text objects for some motion graphics. However, the edges come are really rough:

Initially I figured it was just caused by lower-res rendering in the 3D view, however, it also shows up when I render it out at 100%:

I'm using the Cycles render engine, rendering using CUDA on a GTX 750 Ti, and here's the node layout for that text:

Is there any way I can improve the quality of the letters?
EDIT As requested by Todd McIntosh
Wireframe:

I think you are talking about AntiAliasing here?

@zeffii Yes, that's what I'm going for. I tried changing the Anti-aliasing samples to 16, but I doesn't help any :/

Ah I misunderstood the problem. There's completely different approach then of course. You can use alpha channel of the text and blur it in the render (one way). However you should include information about render engine used

@MrZak I've updated my question with what I thought was best. Let me know if that helps and/or if you need/meant more.

Please post the blend file for an accurate answer. I would question why you are using the Object TextCoords to drive ColorContrast to drive the MixFac between an Emission and Transparent shader. Is that necessary for pure white text?

Also, perhaps post a wireframe of the text. Are they still curve objects? What is the curve subdivision set to?

@ToddMcIntosh Sorry for the delay, I've updated my Q. As for the node layout, that's for an effect I'm attempting to achieve where the text appears letter by letter. See here for an example: https://youtu.be/8gIcPO4FFKU. As for it being a curve object & curve subdivision, I believe it's a curve object and I have no idea what the curve subdivision is set to. Where would I find that?

@OP I very recently ran into a similar issue... (Although it was an After Effects to Final Cut Pro issue). My AE renders were crisp and clean. Similar renders in Blender were crisp and clean. But in the clients final render there were jagged edges. So, while I don't have an answer for you: What file type are you rendering out to? And in what application are the artifacts showing up?

One last thought... Maybe it is the font you are using?

It looks to me like you are suffering from a lack of anti-aliasing.
If you are using cycles, you'll need more than one sample (Properties > Render > Sampling) in order to get good anti-aliasing. Try maybe 15 or so, and increase until the result is smooth enough for your liking.
Keep an eye on the rendertime though.

If your animation consists entirely of flat colors, I would recommend using BI or
OpenGL render instead.
OpenGL
The OpenGL render operates using the same techniques for the viewport and realtime games. In other words, it renders nearly instantaneously (especially for flat colors).
To enable anti-aliasing when using OpenGL render, enable Anti-Aliasing in Info > Render > OpenGL options and choose a suitable number of AA samples (more == slower but smoother):

Blender Internal
If you need a little more than just flat colors (motion blur, for instance), then you might consider BI. While perhaps slower than OpenGL (depending on your hardware), it's still much faster than Cycles when it comes to flat shading:

I actually ended up taking a break from Blender/video work in general for a bit and have just now come back to it and while initially everything was rendering out greyscale, I switched the viewport to Material mode and then using OpenGL worked perfectly! Thank you!

Try increasing the interpolation for the text.
After that you can convert the text to a curve or mesh by pressing Alt + C

You'd probably have to manually smooth the edges by converting the Text Objects into a Mesh or Curve Object. This is easily done by selecting your Text Object, and hitting [Alt + C].

I tried this and it helped a very small amount, but the edges are still very rough. :(


text:
Why doesn't a wire mesh render?
I'm working on a simple 2D motion graphics project and I'm trying to use a circle mesh for part of it. However, the circle isn't being rendered:

The circle should be appearing right where the cursor is, but it's not. Obviously some objects are being rendered, as evidenced by those two planes.
I've set up the circle in regards to material exactly the same as I did the two planes, Emission, RGBA 1.0/1.0/1.0/1.0, Strength 2.0, but it's not being rendered. I also noticed that it only shows up as an outline when in the Material Viewport Shading mode.
I've tried googling this, but I haven't found anything yet.
What's causing this and how can I get the circle to render, or do I need to go with something else?

the circle has no thickness (surface to reflect the light so it can be seen) it can't be rendered like that you have to make it thicker ( like the lines )

@Chebhou How would I do this?

The circle has no faces ( surface to reflect the light so it can be seen ) it can't be rendered like that. You have to make it 'thicker'. For that :

In Object Mode select the circle and switch to Edit Mode (Tab)
Hold  Alt and right-click on the circle ( to select it all vertices )
Press E then S ( extrude and resize )
Move the mouse till you get the desired result

@RPiAwesomeness you're welcome


text:
Weird static-y appearance of object
I'm working on some motion graphics that involves making text appear from behind objects and other text.
I was able to get the first word appear correctly using empties, texture mapping, and mix shaders. (I've been following this tutorial.)
However, when I attempted to use the same method, the second word ends up looking like this:

Does anyone know why this is/how I could fix it? I want the second word (Tech) to disappear/appear behind the first word (VES in the screenshot).
Materials:

Background surface is a plane set to Emission, Strength 2.0
First word (VES in the screenshot): Text object, node setup:

Second word (Tech in the screenshot, static-y): Text object, node setup:

It seems like Z-fighting (related question), which occurs when both words are semi-/visible. Are the letters located on top of each other?

@MrZak Yeah, that's kinda what I was thinking. And yes, they are on top of each-other

@stacker Yeah, that's my issue. Is there no way to fix it?

@stacker But the thing is that I need the text to slide out from behind the first text object. I've updated my question.

@stacker No, I just typed it. I did scale up the other one manually, but AFAIK I just typed it.

@RPiAwesomeness Just move one of the text objects slightly along the y-axis. so that they don't overlap exactly.

@stacker That worked great. If you could post that as an answer I will glad upvote and accept :)

Both text objects are located at exactly the same y-coordinate (0). To fix this move one of the text objects slightly along the y-axis after that the z-fighting artifacts will disappear.


text:
Exporting a GLB file to share it on Facebook
I have tried "glTF Blender Exporter", "blendergltf" and "glTF 2" to try and export a Cycles model I made to .GLB format for Facebook upload, however nothing I tried worked.
Only "glTF Blender Exporter" seemed to add options in the "Export" menu, but even though I packed my textures, applied modifiers and followed the slim instructions given with it, I couldn't get it to export a model with the textures.
If anyone has made this work, I'd love to hear how they did it!

UPDATE: For Blender 2.80, see the Blender Manual 2.80 glTF/GLB documentation.
These instructions are for Blender 2.79x with the Khronos Blender Exporter:
https://github.com/KhronosGroup/glTF-Blender-Exporter
In addition to installing this plugin, you will also need a copy of the glTF2_Principled.blend file that ships with the plugin, for a custom node group it contains.  Future versions of this plugin (glTF-Blender-IO for Blender 2.8) will not depend on these custom nodes, and use the Principled BSDF node instead, but it will target the same channels in the glTF output file.
First, select Cycles as the rendering engine.  Then click File -> Append -> glTF2_Principled.blend -> NodeTree -> glTF Metallic Roughness.  This imports a custom node group into your blend project, that the exporter will look for when exporting materials.
Create a new Cycles material, and turn on "Use Nodes".  Then, select the newly appended node group, the "glTF Metallic Roughness" node, like this:

The inputs on this node correspond almost exactly to the various channels available inside the glTF 2.0 format, and the glTF exporter will specifically look to see what's attached to this node when creating the glTF file.
Note that some are named "Factor" or "Strength".  For example there is a "BaseColor" and also a "BaseColorFactor".  In Blender, these are just node inputs and you can attach anything.  But in glTF, the "BaseColor" is specifically a texturemap, that can be present or absent, and "BaseColorFactor" is a solid color (including alpha) that can either multiply against the BaseColor Texture, or be used in lieu of a BaseColor texture for cases where the base color is solid.
So keep that in mind when hooking up node inputs:  Connect only texture images to the primary inputs, and set solid colors on the "factor" inputs.
glTF can also pack Occlusion (Red), Roughness (Green), and Metallic (Blue) values into a single image.  Thus, a single image node can be connected to both the "MetallicRoughness" and "Occlusion" inputs, to allow that image to drive all three channels.
A tangent-space normal map can also be connected, and optionally an emissive map.  If you connect an emissive map, be sure to change the EmissiveFactor to white, as that gets multiplied by the map.  The default EmissiveFactor is black so that models don't emit light when the emissive map is missing.
A typical PBR wireup may look like this:

With these textures wired up, you're ready to export a full PBR model to glTF format.  If your target is Facebook, they currently have a size limit of 3 MB including textures, so keep it small!  Using JPG images may help get under that limit.  glTF supports both PNG and JPG image formats, but not arbitrary formats.
Use File -> Export -> GLTF.  There are two choices, one will save a text-based glTF file with binary mesh and separate texture image files, the other will save a combined ".glb" with mesh and textures all rolled into a single binary file.  Facebook wants the latter, the .glb file.  You can save a tiny bit more space by un-checking "Export Tangents" from the export options.  Facebook uses ThreeJS as its renderer, and the tangent vectors are easily recomputed on the client, so no need to clutter the export with them.
I hope this helps!

Way too complicated for such an old format. Facebook should use the more common WebGL format.

Granted it's more complicated than what's ideal.  But consider that this format (glTF 2.0, dated from June 2017) is one of very few that will take a full set of PBR (Physically Based Rendering) texturemaps, and deliver them to a wide array of viewers, platforms, and engines.  Few other formats from any age can share whole PBR materials across a wide ecosystem in this fashion.


text:
giving hollow objects a thickness
I'm working on a uh60 Blackhawk. The problem is I need to give the main body a thickness. Extruding gives the object different thicknesses at different points.  I want it to have the same thickness across all of the body. So for example, I might want to have a thickness of 5cm that is maintained for the entire body.
Here is a picture of what I want to make, that needs a thickness that is maintained throughout the main body:

The easiest way would be to use Solidify modifier.

authors: ΠΕΤΡΟΣ ΚΑΡΑΠΕΤΡΟΣ


text:
Trying to get FBX import add on
I think the link is missing to this addon
https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/Autodesk_FBX
Anyone know how I can get this? Thanks!

You shouldn't have to get it...it should be in your blender by default. What version of Blender are you using?

This is built into Blender.  Go to File -> User Preferences... -> Add-ons and type "FBX" into the search box at the top.  Put a checkmark on the FBX plugin to activate it.


text:
How to keep same texture coordinates on model exported from Blender to glTF?
How can I keep the texture looking same as in Blender? In the GLTF viewer it always looks like there is no "texture coordinate" node connected. When I connect this node, the texture changes in Blender, but it does not change in the GLTF exported file. It still looks the same no matter what kind of connection of texture coordinate node I use (Generated, Normal, Object...). It all looks the same in GLTF, as if the texture coordinate node were not connected at all.
How can I fix this?
Here is how it looks in Blender:

And this is how it looks in GLTF viewer:

The glTF format needs an actual UV map, not Blender-generated coordinates.  Blender offers many ways to bake or project different kinds of coordinates into a UV map, many of which are available with the u shortcut when in "Edit Mode."
Blender's glTF exporter also supports UV transformations to a limited extent.  You should avoid complex things like nonuniform-scale rotations of UV coordinates, but a simple transform will work.
Ultimately you'll need to get your coordinates into a UV Map and assign that to the material, before exporting to glTF.

To mimic generated coordinates select top view and press U in edit mode and click Project From View and then you might want to move the uv island around a bit if you want it to be exactly the same

I have this issue as well, the thing is uv mapping will take too much time and i have to do this to nearly thousand of different objects.
Worse thing is i dont know how to create same effect of the node below without that.

Stack Exchange prefers that you don't add new questions in the answer section.  You should edit your answer so it answers the question the OP asked, or you should delete it and add a comment or even a new question of your own.


text:
Text Not being exported to GLTF

I am trying to export an object (above right), and I put 3D text (not a texture) on it.  But every time I export the glTF, the text does not come with it. Is there a way to get text, or is text not possible with the glTF format? In the image above, you can see the imported building on the left does not have the text, but I need the text to export.

glTF is a GPU-ready format that only supports meshes, not other types of geometry directly.  To make the text compatible with glTF, look for the convert option in the Object menu of the 3D view:
Object -> Convert To... -> Mesh from Curve/Meta/Surf/Text
If needed, make a copy of the text beforehand.  Once converted to a mesh, you won't be able to change the font or letters used, but you can apply normal mesh modifications to it.


text:
How to create a new blank empty area?

I would like to remove the area, yet leave the screen itself(red box) and create a whole new empty black area(light blue area) in that screen for making my own editor type. I've looking for awhile in the console but there's no options for turning off nor deleting the space itself.
Are there any ways to resolve this problem?
A sample code block;
import bpy
from bpy.types import Screen, Area, NodeTree

area = bpy.context.screen.areas[2] # 'NODE_EDITOR'

if area.type == 'NODE_EDITOR':
    node = area.spaces[0]
    view = area.spaces[1]
    outliner = area.spaces[2]

    node.show_region_ui = False
    view.show_region_ui = False
    outliner.display_mode = 'SCENES'

Another code block here. This one is VIEW_3D area but there's no options there neither;
area = bpy.context.screen.areas[4] # VIEW_3D

if area.type == 'VIEW_3D':
    space = area.spaces[0]

    space.show_region_header = False
    space.show_region_hud = False
    space.show_object_viewport_mesh = False
    space.show_region_toolbar = False
    space.show_region_ui = False
    space.overlay.show_overlays = False # Hiding Grid on the floor

# ============== Initialize ==============
# ========================================

It's not possible to define custom editor types using the python API. You can only define new node editor types.

This is unrelated but FYI you can unpack variables in python like node, area, outliner = area.spaces rather than assigning them via indexing.


text:
Add a cylinder on a flat surface
I'm trying to make a model of a speaker and I have modeled it until this stage where I need to make a volume knob for it. And I'm not sure how to go about for it.

By sheer luck, the knob size is about the circle in picture 2, which is touching two edges.
My idea is to just make loop cuts and then extrude it out but that just turns into a big rectangle block, which is not good.

Create this topology, select this edge loop and press AltShiftS and drag (or tweak the Operator box parameters) to make it a circle; or enable the LoopTools addon and right click > LoopTools > Circle:

Here is what you get:

You can continue to model (extrude down, etc):


text:
How to delete a part of a mesh of a multires object?
So I have imported a mesh with multires already on the mesh and I have deleted a part of the mesh in edit mode but the mesh still appears unchanged in object mode.

This is the mesh in object mode.

This is the mesh in edit mode and the multires modifier as well. There are no additional modifiers applied to this mesh. The mesh also looks like the second pic in sculpt mode as well.
I have tried to apply the modifier and then try to remove the head but that does not work as well.
So is there anyway to "force" the mesh in object mode to be the same as the one in edit mode.
Thanks for your time.

Perhaps a stupid idea, but did you try and deactivate the Multires modifier (unticking the "screen" icon) in Object Mode, then reactivate it ? Just in case some data are cached and should be updated after modifications on Edit Mode...

I have tried that and it is still the same, head in object mode, no head in edit mode

I ended up doing retopology for this model.

Doing retopology may not be a good answer here, it is basically redoing the whole model. The part you want to delete can be hidden in the edit mode.


text:
How to make triangles into quads Boolean operation
I'm new to blender and I'm trying to make a sphere with a 40 degree cut from the top to the front. I'm using boolean operation to do the cut but I'm having difficulties turning the triangles on the side into quads. (I heard that this will cause issues to the subsurf modifier)

The small triangles can be dealt with by simply merging them but the bigger ones are the ones I'm having trouble with.

did you try merge by distance?

I have tried but I could not reduce the triangles into quads. There will always be triangles no matter how I merge.

If the cut is made along a latitude and then sphere rotated would remove issue of tris and 5-gons.

The thing is this shape should also have a flat bottom as well.

From a cylinder.

The thing is this shape should also have a flat bottom as well.

If add a sphere for reference, then a default cylinder and shrinkwrap the cylinder to the sphere.
Grab the top face, or top edge ring and transform. In GIF example have simply scaled arbitrarily  in Z and rotated top face about its median point 40 degrees. Adjust this to suit.
Then CtrlR Loop cut and slide
Exited edit mode, applied the modifier.
Could also be done similarly with one of the to sphere options..

Thanks you so much for this lovely guide, I tried to replicate it and this is the result. Are the lines supposed to be this jagged?
https://i.sstatic.net/GNHFZ.png

Quickly slapped together another, this is result https://pasteall.org/pic/de442b27e08a40759be876a41760d0ba  Did you use Target Normal Project as modifier method?

I did. I see from your picture the top is slightly twisted. I think thats where I messed up cause I tried to straighten that top which might have mess up the loop cut.

I'll try again to do the loop cut first then adjust the top and report back the issue.

Do the loop cut last.

I managed to do it but I need to set the wrap method to project to not have the slight twist on the top. Thank you so much for your help.
https://i.sstatic.net/HyWqQ.png

The usual workflow is to edge slide (shortcut: select the vertex and type GG.  Type Enter when done.) one of the vertices along the circle until it reaches another one nearby and then to merge by distance to create just one node.
For example, your leftmost circled problem can be fixed by doing this twice.  First edge slide the upper vertex in the circle to the one below it.  Then slide the vertex that's in both circles to the one that's only in the middle circle.  select all and merge by distance, and that's solved.
Unfortunately, this won't work in some case.  Having done that, your middle circled area is still a triangle.  Some people suggest subdividing the edge that is the circle part of the triangle.  Other's suggest not bothering.  It depends on how bad the triangle affects shading.
Sometimes you just can't fix the triangles without adding more geometry than necessary.


text:
Correcting bone orientation in Python
I'm working on an importer from a game format, using an existing MaxScript for reference.
So far things have been working out pretty well, but I was wondering what the best way to solve this issue is:

These bones should really be pointing down the line, and I'm not sure if it is the way I'm orienting them when they're created.
for bone in self.bones:
    bone.blend_editbone = self.blend_armatureobj.data.edit_bones.new(bone.name)
    bone.blend_editbone.tail = (1,0,0)
    bone.blend_name = bone.blend_editbone.name # actual name
    transform_loc = Matrix.Translation(bone.pos)
    transform_rot = bone.rot.to_matrix()
    transform_rot.resize_4x4()
    if bone.parent_id is None: # no parent
        bone.blend_editbone.matrix = transform_loc * transform_rot
    else: #parent
        parent_bone = self.bones[bone.parent_id]
        bone.blend_editbone.parent = parent_bone.blend_editbone
        bone.blend_editbone.matrix = parent_bone.blend_editbone.matrix * transform_loc * transform_rot

(all happening within EDIT mode of an armature, for each bone, in descending hierarchy -- parents first)
As I'm not a whizz at quaternions or matrices, let alone the two combined, I may have the order of operations wrong. Alternatively, the stored bone formats are of a different orientation.
I've got the bones importing as seen and parenting with the mesh correctly. It poses correctly, but I'm having trouble incorporating animation, and as the animation data's format is practically the same as that for setting the bone's original orientation, I figured getting this right would help getting the animations functioning.
I've attempted to use_connected, but as I expected it forces the rotation upon the bones, great for manual posing a model you made yourself I suppose, but results in a jumbled mess when I'm trying to set these orientations to precise values.
The orientation quaternions I'm reading in appear to be local for the bone, using the parent bone's orientation as a rotational origin. I'm wondering how to rotate these without causing the later bones to inherit an incorrect parent orientation.
Here's a different model with the same issue:

Any help with the correct way to orient these bones when importing would be greatly appreciated!

The 90 degree out tends to suggest a different bone orientation.  Blender uses y-up on bones, ie if the bone is facing up, it's the y axis of the bone.  I came across this with bvh import.  Look for axis_conversion in .../scripts/modules/bpy_extras/io_utils.py.

@batFINGER Yeah after seeing how the FBX importer corrects object orientation I've given this a shot, but I can't get it working correctly -- I've tried multiplying the rotation matrix (transform_rot) with the correction matrix that axis_conversion spits out, but that appears to break all the child bone's orientations.

@Frohman did u solved the problem?


text:
Constraint on fixed distance between 2 objects not respected
[Blender 2.76b]
Hello, I'm trying to physically simulate a robot structure in BGE. Right now, I'm only trying to connect two servos together. The problem is, the rigid body constraint(generic 6dof) that is supposed to fix the upper servo to the frame does not seem to be working correctly, as proved by this video
Scalings are applied, the masses are 720 for the servo and 10 for the frame. I noticed setting more similar masses alleviates the problem but 1) it does not disappear completely, 2) I want the simulation to be realistic NOT feel realistic, so playing with the masses is out of question.
The physics sub steps are set to 5, the maximum allowed by blender's interface. What I don't understand is that in blender render, the same configuration behaves normally (I don't want to switch to it because blender game engine gives me some useful methods I want to use)
The file is available here


text:
other objects push on bone controlled surface?
I have made a basic cardboard box model, and I'm trying to use bones for control/as a hinge.
is there a way to make other objects push on the flaps controlled by a bone or must I animate this effect manually?(i.e. dropping a bowling ball onto a close box and having it move th flaps out of the way on the way down)

Do you need to use bones? this could be more easily accomplished other ways.

you could use rigidbodys , or make a center IK rig that moves all pieces

@Knuckles209cp I don't think that would work as well as you would expect.

not necessarily need bones if there's another way to bend the flaps without going into edit mode and manually changing the shape.

Here, I've set up a simple box that is weight painted so the main bone only influences the flap.  The tip bone is there for the IK setup.(not sure I did this entirely right since I'm still just learning this as well)
Anyways, here are a few pics.  First you can add a loopcut to the edge of the flap to limit the weight paint so the bone does not affect the rest of the box.

Now the weight paint setup.

There is an Empty added near the tip of the IK controller bone which is referenced in the IK constriant which I added to that bone as shown next.

I also added rotation locks to both bones so they can only move in one axis.  The image shows 2 places where this can be done.

Next is an animation showing the result of moving the Empty.


text:
Get path of my script file
How to find out the file path I dropped my Python script from?
I want to call an external application for image post-processing from a Python script and I want the application to be in the same folder as the script. And I want Blender to automatically find that application.
I know about this question:
"How do I get the path my script is running in?"
but it's not the same

As for the link you provide, is the variable __file__ is not answering your question ?

No, it shows some temp path which is NOT the real path I dropped my script file from

I'm sorry I'm not sure to understand what you are doing. Can you detail more the workflow ? What about "dropping" the python script ?
is it like there folderA with your script AND the executable of that other application, and you run (how?) a python script from that folderA in blender and you want to know where is the python script running from ?
os.getcwd() ?

I drag&drop myscript.py to Blender's Text Editor and then press the Run Script button. I want my script to find out which folder it has been dropped from so that it can run my custom external exe from that same folder (using subprocess.call())

Interestingly, the status bar under the Text Editor shows my script's filename with full and correct path.

Yes, and bpy.data.texts['scriptName'].filepath will give you that same path. But I don't know yet how to get the active text when you click on the run script

bpy.context.space_data will give you the current text editor when you click run script, where you can access the text block.
print(bpy.context.space_data.text.filepath)

For an unsaved text block this is empty. For a file dropped onto the text editor or opened by using the Text->Open Text Block menu item you will still get an empty filepath.
Blender doesn't appear to fill in the filepath property of a text block unless you save the text block to disk, meaning you need to open the text block and then save as to get a filepath. Once it has a filepath you can save, close and re-open the blend file and it will keep the filepath.
__file__ will give you the path to the text block inside the blend file. That is the path of the blend file with the text block name added as if the blend file was a directory. This applies even if the file is saved to disk.
For your own use you can setup the blend file with the script. If you want to share this then you probably want to make it an addon with AddonPreferences to save the path to the utility. On registration you might search a few possible paths to get the initial setting and have the user set it as needed, or you can tarball the script and utility so that it is next to the addon script when the user installs it.

NOTE I'm on *nix and drag n dropping doesn't give the full path, osx/windows may fill the filepath for a dropped file.

Tried print(bpy.context.space_data.text.filepath). Got error: AttributeError: 'SpaceProperties' object has no attribute 'text'.

It will only work when you click the run script button. Or more precisely while the text editor is active. It may only be as the script starts, during execution it can loose focus and fail.

My script first creates a button in the Object Toolbar and then that button executes the main algorithm. So, I guess, the Text Editor does lose the focus

Get the filepath first before you do anything else.

Dirty option
Assuming there is only ONE text editor open from which you have run your dropped script you can have this (in your script) :
import bpy, os
for area in bpy.context.screen.areas:
    if area.type == 'TEXT_EDITOR':
        for space in area.spaces:
            if space.type == 'TEXT_EDITOR':
                scriptFolder = os.path.dirname(space.text.filepath)
                print(scriptFolder)

This will print the directory of loaded and displayed scripts from any active text editors. This is why it's working if there is only one text editor and you had just pressed the run script button. In that case you should have the right path. Note that this is dirty and unsafe :)


text:
Array with Size Increment / Decrement
I am trying to make a step-pyramid with hundreds of steps and it is far too tedious to size one step at a time.
My first instinct is to make an array with reference to a scaled object but this yields results with a curved slope.  For example, scaling by .9 produces:
100 x .9 = 90
90  x .9 = 81
81  x .9 = 72.9 ...

Where as what I am trying to simply subtract a value at each step:
100 - 10 = 90
90  - 10 = 80
80  - 10 = 70 ...

The above calculations apply only to the X and Y dimensions while the Z remains constant.
Here is a screenshot.  The pyramid on the left was generated with an array and has a curved slope.  The one on the right is the desired result with a straight slope and was made by hand.

Is there an easy way to generate the pyramid on the right?

This is in case you wanted pyramid of separate objects  *linked "share the same data" or not:

run the script
select an object
hit space type "pyramid" select "create a pyramid"
setup the options through the tool shelf

the script :
import bpy

from bpy.props import IntProperty,FloatProperty,BoolProperty

class Pyramid(bpy.types.Operator):
    """Add a simple box mesh"""
    bl_idname = "object.pyramid"
    bl_label = "Create a Pyramid"
    bl_options = {'REGISTER', 'UNDO'}

    steps = IntProperty(name="Steps",description="Number of items to create",min=1, max=100, default=1  )
    Z_offset = FloatProperty(name="Z Offset",description="Z offset",min=-100.0, max=100.0, default=2.0 )
    dX = FloatProperty(name="X increment",description="X increment",min=-100.0, max=100.0, default=2.0 )
    dY = FloatProperty(name="Y increment",description="Y increment",min=-100.0, max=100.0, default=2.0 )
    linked = BoolProperty(name="Linked",description="created objects are linked to the original",default =False)
    apply_t = BoolProperty(name="Apply Transform",description="apply object transform",default =False)

    def execute(self, context):
        steps = self.steps
        Z_offset = self.Z_offset
        dX = self.dX
        dY = self.dY
        linked = self.linked
        apply_t=self.apply_t

        for x in range(0, steps):

            if linked :
                bpy.ops.object.duplicate_move_linked()
            else :
                bpy.ops.object.duplicate()

            bpy.context.object.dimensions[0] += dX
            bpy.ops.transform.translate( value =(0,0,Z_offset))
            bpy.context.object.dimensions[1] += dY
            if apply_t and not linked:
                bpy.ops.object.transform_apply(scale =True)

        return {'FINISHED'}

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

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

if __name__ == "__main__":
    register()

You might want to try out the Remesh modifier. Create a regular pyramid without any steps and then add a Remesh modifier with the mode set to Blocks. Play around with the modifier's settings and the size of your object in Edit mode until you get a nice result.

This is a really quick and easy way to get the results but the mesh ends up being unnecessarily dense; the vertical faces are split up into a bunch of skinny rectangles.


text:
Can UV Layers be applied over procedural textures?
I am planning out a future project and I am planning to create a procedural wood texture for the front of a wooden sign. I also have created some PNGs in Illustrator that I want to use as UV layers and apply over this texture for the sign's content. Is this possible? Are there any best practices for this type of desired goal?

Depends on how many texture maps you want to use for this wood material. If it's only color, you can simply overlay the image texture on the procedural texture with a MixRGB node.

https://blender.stackexchange.com/questions/32997/how-to-place-a-png-texture-with-transparency-over-a-material

There are several ways to do this, and as far as I know, none of them are considered always better than the others.  Each has advantages and disadvantages, so it tends to depend on what your eventual goal is.  Here are my three favorites.

Separate models.  For example, import your PNG using the Images as Planes add-on.  Place the image plane against the part of the wooden model where you want your image.  This is the most flexible, but does require you to parent the plane to the wooden model so you can move them together.  If displacement is an issue, shrinkwrap the plane to the model.

Separate BSDF nodes, using a mix shader.  This works well if you have an alpha channel in your image.  Here's an example:

In your case, of course, my red shader would be replaced by your wood shader.  This is the fastest, but it does tend to fail if the non-image shader has any sort of displacement, since the displacement isn't present in the image node.

Mixing the image with the wood material using a mixRGB.

In your case, of course, my red color would be replaced by the color part of your wood shader.  This overcomes the problem with displacement, since the color is fed into only one shader.
Obviously you can plug a UV Map input into the Vector input node of the image texture.
If you don't have an Alpha channel, the third approach works, except you would use overlay mode in the mixRGB node and set the factor to taste.

Thank you so much for the detailed reply!


text:
Clear mesh relationships/ Unparent

My problem is the glasses seem to be parented to the cube from the blue dotted line. I must have done it accidentally. I tried to clear parent the normal way (Object-Clear-Parent) but nothing. How do I fix this?

Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.

can you add a screenshot of the outliner with all of the folder open?  Also of the selected object's Object data properties with the relationship folder open?

Are you sure it's parented? It might be an object constraint.

Thanks. It's actually a constraint I must have put there


text:
I am trying to copy an object with particle system animation but not working
I am trying to copy an object with particle system animation into another blend file. Every time I copy it, it moves without the particle system.
Note: If I apply the particle mesh, it doesn't keep the animation.
Here is blend file https://blend-exchange.com/b/5PYZ6z02

Have you tried to use File>Append instead? Appending the object and then the particle system should make it work.

@mqbakamqbaka I have never tried to append. I am trying it now for the first time. It's not working. so either I'm doing the wrong thing or it's just not working.

The append doesn't work too? Ok. I'll check your blend file and come back when I am done.

@mqbakamqbaka Okay. Thank you.

@mqbakamqbaka. Thank you so much. that's actually got the case. I got the blend file from a site and was trying to insert it but nothing was happening. Thank yu. It now works.

I took a look into your file and I think you may just have copied the wrong object. The thing is you have 3 meshes objects in your file : the Sphere, the Wave (which serves as a rendered mesh for the particles) and a Cube.

That Cube is actually the one that has the particle system attached to :

And I don't know if it was on purpose but, the cube doesn't have any vertices (you may have gone into edit mode and deleted them), but it's origin point is still visible when we select it from the outliner :

In the screenshot above, I moved it back slightly so you can see that it's actually the one that emits the particles (not the sphere). And with the cube selected, I pressed CTRL+C and opened a new Blender scene, pressed CTRL+V and it pasted the object successfully :

Notice in the bottom of the viewport that the Wave object has been copied along with the emitter.
I think the first time you copied the Sphere alone and since no particle system is assigned to it, you only has the sphere pasted in the new Blend file.


text:
I can't find a way to fill this specific gap
so i'm trying to do this kind of triangular thingy but, I can't fill this little gap in the middle of the model, I already tried hitting F but it just say's that there are no faces to fill, even though I selected the two faces that are the most closer to the gap I want to fill, is there another hotkey I don't know about or a modifier for this?

Select the two Edges you want to span with a new face, and then 'f'.  Sort of like https://blender.stackexchange.com/a/217895/111042

BTW, select the edges you want to fill, not the faces.  Otherwise the Fill Vertices already sees existing faces that connect your vertices (from the too many vertices you are selecting) and assumes there's nothing to Fill.   You can first clean up (remove) any unwanted faces.

maybe share your file? https://pasteall.org/blend/


text:
Distort a texture around a mask to create a 'blackhole' effect using shader nodes
I am trying to create a shader in Blender that uses a mask of a specific shape to displace and warp another texture around it, effectively creating a distortion effect where the masked shape pushes the surrounding texture aside. The goal is to make the texture appear as if it’s being distorted or stretched around the masked area, sort of like how a blackhole distorts space around it. What would be the best approach to achieve this using Blender shader nodes?
Here is my attempt at the problem:

This is close to what I want. However, the streamlines currently go through the shape. I want the streamlines to distort around the shape such that each line remains continuous/uncut. The shape should create a perfect void for itself while minimally distorting the surrounding texture.

Starting with a simple wave texture and preparing ground for maths with separate/combine:

Imgur mirror (SE image hosting has problems)
Now you want to stretch the texture. The simplest way to stretch a normalized value (0..1 range) is to raise it to a power, as the output stays normalized. Just remember it won't work for negative values so you need to remove and restore the sign:

Imgur mirror
And now base this effect on the x coordinate:

Imgur mirror
You can move the hole by moving the origin, but notice how there was an assumption that y coordinate is normalized and so bigger values than 1 fail:

Imgur mirror
You can use simple math shenanigans to e.g. clamp the effect to normalized range, and restore the cut off offset:

Imgur mirror
And you can further work on that, for example you might not want the falloff to depend only on x, then you can use "Vector Math: Length" instead:

Imgur mirror
And maybe you don't want to modify only y component of the coordinate:

Imgur mirror

This is not perfect math, but you could add a power to the sphere warping factor:


text:
Copying FBX animation to armature
Here is the Unreal Engine mannequin and several animations: https://wiki.unrealengine.com/File:ThirdPerson_FBX.zip
I am trying to have the mannequin use those animations. I tried copying the animation using Make Links > Animation Data (selecting both armatures and hitting Ctrl-L) however the mannequin mesh then disappears.
Clearly I'm doing something wrong and would appreciate some expert input :)
I'm using the following import settings for the FBX (which I found via their documentation or forum somewhere, as suggested by a staff member I recall):

Update: it turns out if I import the mannequin with the above settings, but then import the animation FBX with -Z Forward and -Y Up then I can make it animate by changing the Object in the mannequin's Armature modifier settings to be root.001 (the armature of the animation) -- the only problem is the character is then running lying down on his back (in line with the animation armature), but I can rotate that to correct I guess.
Trying the same orientation for the import of the animation as for the mannequin import blew up the character. I'm still not sure I'm going about things the right way re applying imported animations.


text:
Bevel modifier artefact on a single vertex
I made a simple object and applied a single bevel modifier on a vertex group. The modifier works fine except for a single vertex (see picture below) where it created a strange  artefact.
To avoid that I tried:

removing doubles
recalculating normals
checking for double faces
recreating the group
reopening blend file

Here is my blend file:

Has anyone an idea what is wrong with the object?

Please use blend-exchange to upload .blend files

Done. Thanks for the tip.

Another method would involve getting rid of the unnecessary vertices in the mesh to simplify it by sliding the loops towards the edges.

The result of this is a much cleaner mesh while still retaining quad-only topology.

The final result can then still be tweaked by vertex groups or bevel weights.

Cool, I already solved it by bevel weights, but this is even better. So I am accepting this as an answer. Thanks.

I think there’s nothing bad with your topology, EXCEPT that it can’t fill your needs, meaning it can’t properly bevel with the Bevel modifier:

You've created a vertex group to designate all the edges that are supposed to be bevelled by your Bevel modifier. At the top of your mesh you've selected all the border vertices because you want all the border edges to be bevelled.

The problem is that vertex groups don't include only the vertices, it also include all the edges between vertices. Therefore your modifier will also affect all these edges:

You can verify it, if you select all the vertex group, you'll see these edges included:

So, as you're using a Bevel modifier with Vertex Group method it will also bevel all these edges and it will give a mess of intertwining edges. Yes by chance it kind of works better on the right side but I don't think it's satisfying either:

If you create additional topology to make sure that the inner edges are not affected by the bevel, in my opinion it still won't work properly and it will make you loose the roundness you want:

So I may be wrong (edit: actually it looks like the topology proposed by Metaphor_set works with modifier) for the result you wanted) but the solution is probably to do it manually and to bring some manual corrections at the end with some join vertices and dissolve edges. The Bevel modifier can't always do everything properly:

Thanks for this answer. This looks like a bevel modifier bug to me. I also managed to move the artefact to another vertex by recreating the group in a different order but I wasn't able to get rid of it. Both solutions you suggested are fine but not ideal. Because when adding topology (As you mentioned) i am missing roundness and when beveling manualy I am adding permanent geometry which I tried to avoid by the modifier because it is harder to modify the mesh later on.

yes I understood that you're trying to make non-destructive bevels but I don't think it's possible here, it's not always possible unfortunately, when you have a lot of edge loops intertwining, it doesn't always know what's the best solution

I think I found an acceptable solution for me. I wasn't able to make beveling be vertex groups working so I tried to bevel by weight. The result is not perfect (there is also a small artefact) but good enough.

The final blend file:


text:
How to join single parts of an armature to another rig's bones
I'm fairly new to blender, so far I've managed to generate a full body rig thanks to some addons. Recently I've been wondering to add a detailed facial rig in order to achieve decent face expressions, therefore I thought of addin a face rig to an already generated body rig, but I can't figure out how. Is it possible to take two individual generated rigs and join them together into a single system? How can I attach a face rig to a body rig otherwise? The addon I've been using is AutoRig Pro, but the facial rig I would like to use is Universal Human Face Rig (https://cjones.gumroad.com/l/dOumo).
Thanks!

Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.

I have two separate rig systems, one for my character's face and one for the body, they are generated with two different addons, which means I can't generate them together. How can I create a single rig system by joining them together?


text:
Manage water flow with Arduino
I have made an animation with a water flow. I want it to start and stop  with Arduino, I have thought about making it with a sensor that triggers the animation of "start and stop". Is it possible to do that? I have seen that the animation of the "start and stop" flow only works if you refresh the cash. And I was thinking that maybe a sensor is not enough, cause I need it to start and stop the flow (so trigger the keyframes I suppose) and I believe that I need to refresh the cash. Is blender appropriate to make this project or I should stick to another software? If it's appropriate, what should I do? I'm new to Arduino.

I'm not sure if this question is appropriate for this site since it seems to be more related to Arduino instead of Blender...

I think the question is OK here, because it's about stuff that happens in Blender. I'll attempt an answer.

Blender could interact with Arduino, because Blender has Python API. You could use Pyserial to communicate with your Arduino via serial connection through USB. You would need to install this external Python module to Blender's Python - see Using 3rd party Python modules.
If it's a playing animation you need to somehow interact with, you could check serial on every frame change using an Application Handler:
import bpy

def my_handler(scene):
    #Serial communication could happen here
    print("Frame change")

bpy.app.handlers.frame_change_pre.append(my_handler)
#bpy.app.handlers.frame_change_pre.clear()

I haven't tested any of this, so this is only a possible solution, that you would need to look into and you might face some unforeseen problems, but I think this should be possible.
This question about serial communication might be of interest to you as well.


text:
Update/overwrite an existing mesh within a collection Python Blender
I have made the following python script which contains one function, this function creates one simple mesh.
import bpy
import mathutils
from itertools import repeat

def add_single_brick(brick_width, brick_length, brick_height):

    mesh_name = "brick"
    collection_name = bpy.data.collections.new("BrickCollection")
    bpy.context.scene.collection.children.link(collection_name)

    vertices_brick = [  (0,0,0),
                    (0,brick_width,0),
                    (brick_length,brick_width,0),
                    (brick_length,0,0),

                    (0,0,brick_height),
                    (0,brick_width,brick_height),
                    (brick_length,brick_width,brick_height),
                    (brick_length,0,brick_height)
                    ]

    edges = []

    faces = [(0,1,2,3),
         (4,5,6,7),
         (0,4,5,1),
         (1,5,6,2),
         (2,6,7,3),
         (3,7,4,0)
         ]

    new_mesh = bpy.data.meshes.new('brick_mesh')
    new_mesh.from_pydata(vertices_brick, edges, faces)
    new_mesh.update()

    # make object from mesh
    new_object = bpy.data.objects.new(mesh_name, new_mesh)
    collection_name.objects.link(new_object)

brick_length = 0.21
brick_width = 0.1
brick_height = 0.05

add_single_brick(brick_width=brick_width, brick_length=brick_length, brick_height=brick_height)

I call the function at the end of the script to create the mesh within a collection I called 'BrickCollection'

The mesh is in this collection:

When I run the script again with other variables in the parameters, I want the script to update the existing mesh and not make a new mesh.
I found this post
3: When to use bmesh.update_edit_mesh and when Mesh.update? as in which I understand I should start using the bmesh module
I also found this post
I am getting quite confused, now I have two simple questions:

Is there any simple python example of mesh being overwritten within a collection when running the python script again with different parameters?
Does the bmesh module also work with modifiers?

You don't want to create a new object if you want to update the mesh in place. You would have to edit the original object's mesh in place to do that.  On the other hand, you could create the new object, then delete the original, and then rename the new object to the old object's name.

I solved it by making a function which checks if the collection already exists, if it exists it removes the content of the collection before calling the function which makes creates the mesh.
def remove_brick_collection():

    bpy.ops.object.select_all(action='DESELECT')

    if (bool(bpy.data.collections.get(name_collection))) == True:

        collection = bpy.data.collections.get(name_collection)
        bpy.data.collections.remove(collection)

    else:
        print ("no collection found")

at the end of the script:
remove_brick_collection()
add_single_brick(brick_width=1, brick_length=2, brick_height=3)

You have to remove the mesh as well, not just the collection. Otherwise it keeps creating new meshes and adding them to the file. You can't see them in the GUI but they are there if you look in `bpy.data.meshes'.


text:
Weird shadow in rendered image
Here's the rendered image. The problem is with the shadows on the green object's right side. It's like a weird wave shaped shadow. And I get this result in all my renders where I use subsurf and smooth shading. I don't know if it has anything to do with them. Help if you can, please.
Many thanks
I've tried a few changes based on the two links, but it's still the same. So gandalf3, it's not the same question, the problem is different, as it seems.

Related answer: http://blender.stackexchange.com/a/26577/2217

@atlas, you can upload the .blend to http://blend-exchange.giantcowfilms.com/  . When using images to convey an issue it's  worth hiding extra geometry and place the camera so that the unwanted feature becomes more prominent.


text:
How to make a custom sculpting brush using the bake function
Made two objects a plane and a pyramid then bake using the displacement mode with select to active.

The output from the bake is grey for the plane and flat white for the pyramid. When the image texture is used as a sculpt brush it doesn't create the same pyramid shape that was used for the bake. Don't know what I have done wrong could I have some help please.

Can you elaborate what you're trying to do? Are you trying to bake the pyramid shape into a texture?

I'm trying to make a custom sculpt brush that puts a pyramid shape onto a mesh when in sculpt mode. But the sculpt brush that i made and loaded into blender using texture that you can see in the lower window just sculpts a square shape with a bit of a bump.

Can you post how your texture looks?

added image to the original question

Try enabling normalized in the bake settings. You could place a camera above the cone and use the z-depth from the render for the brush.

I really don't think you can have such a deep point on a displacement texture. That's why it just bakes a white square. Your brush is essentially just a square brush.
I quickly made an example of how the texture should actually look like. It's not precise but it's to give you an idea.

Basically did the same as your screen shot but added a invert node [link]http://imgur.com/a/kaB8C which gave a better result but still isn't exactly what I was trying to achieve [link]http://imgur.com/a/VPVog Do you think I'm attaching the texture to the wrong sculpt brush should I apply it to another sculpt brush that blender has like the clay brush?

Ok just needed to change the curve to this. http://imgur.com/a/uZ1vg fixed :) thanks for your help

No problem. Give it a check if you believe it answered you correctly so others can know. ;)


text:
Seeing black lines in my render using Cycles with GPU compute
So I'm doing the blender donut tutorial by blender guru and im at this video https://www.youtube.com/watch?v=ZTxBrjN1ugA&feature=emb_rel_end
whenever I render with Cycles and GPU compute I get these strange black lines:

For some reason when I do it with CPU it doesnt show them and CPU rendering is for some reason way faster than GPU compute and I get this clean image:

My GPU is an AMD RX460 and yes I have updated drivers and no the GPU compute option isnt grayed out.

I’m voting to close this question because this is a bug, which is currently being dealt with here

Try to update your graphics driver. It appears that this issue doesn't occur with the most recent ones. See bug report: https://developer.blender.org/T77095


text:
Having trouble making a keymap work when mouse button is released
I'm trying to bind view3d.navigate to middle mouse button so that it's only activated while the buttons is pressed.
I'm having trouble getting it to deactivate. I've tried every option "click", "press", "click drag" for example:

I presumed that didn't work because it needed a command to run on release which would deactivate view3d.navigate. I tried view3d.select as seen below but still no luck:

Any hints on what i should try?
Why am I doing this? I'm trying to replicate other 3D design programs. view3d.navigate allows navigating the viewport with wasd keys and moving the mouse.

Sorry, I missed that it said 'Walk/Fly' in the screenshot - didn't realise Fly mode's generic name was 'navigate'. Will delete my comments.

Go Preferences and see Keymap.
3D View > 3D View (Global) > View Navigation (Walk/Fly)
set to Mouse , Middle Mouse , Press (or Click Drag)
then
3D View > View3D Walk Modal > Confirm
set to Mouse , Middle Mouse , Release


text:
All inactive with circle selection

I tried to use free camera with Shift+F but I it didn't work. After that circle appeared around my cursor (and I can scale it with mouse wheel) and I could change objects. But all tabs became inactive (I cant even choose file to save my project) and I can't do anything except closing blender. I can easily remake project but for the future please help is it a bug or feature?I tried deselecting all with A+A and deselecting Circle Selection with C but it didn't do anything

Press esc to get out of selection mode.

Thanks, it helped. Also can you how to get rid of this circle around cursor?

I solved it: I accidently pressed W and chose another type of seletion.


text:
How creating function to aplying image to object python
In other answer script not working:
(in Add a Texture to an Object using Python and Blender 2.8 answer not working, generate only black image and delete everything)
import bpy nazwa_tek="cyfry" plik_tek_gr="//grafiki/gr.png" tek =
bpy.data.materials.new(name=nazwa_tek) tek.use_nodes = True bsdf =
tek.node_tree.nodes["Principled BSDF"] texImage =
tek.node_tree.nodes.new('ShaderNodeTexImage') texImage.image =
bpy.data.images.load(plik_tek_gr)
#tek.diffuse_color = (1.0, 0.0, 1.0, 0.8) tek.node_tree.links.new(bsdf.inputs['Base Color'],
texImage.outputs['Color']) print("tekstura:=", tek)

def DodajTeksture(ob, nazwa="cyfry", plik_gr="//grafiki/gr.png"):
    global tek
    # Assign it to object
    if ob.data.materials:
      ob.data.materials[0] = tek
    else:
      ob.data.materials.append(tek)
    return

bpy.data.scenes["Scene"].render.image_settings.file_format = 'JPEG'
bpy.data.scenes["Scene"].render.filepath = './'
bpy.ops.render.render(animation = False) img = bpy.data.images[0]
img.save_render('wynik.jpg')
bpy.ops.wm.save_mainfile(filepath='bb.blend')

but how create a image texture? My texture are now procedural and do not have .image value. (I need image texture not procedural)
obrazek = bpy.ops.image.open(filepath="//file.png")
bpy.data.images["//file.png"].pack(as_png=True)

load image, but how aplying image for object named "Cube"?

How creating procedure in python
def appimage(obj, name_image, dx, dy)
   #applying image to object name obj staring from (dx,dy) in image
   return

create texture, add image to texture (one texture will be assign to some object) specifi region in image for this object. I have big texture for many objects. Only small region is for object. My image have transparent region (it schow diffuse color from bottom?).
appimage("Cube", "//file.png", 170, 200)

your answer not working, it generates only black screen and texture, it not assign to texture but remove all informations

this is not duplicate


text:
bvh display multiple frames at the same time

How to display multiple frames of a BVH file at the same time？Then can I get a picture like this?

Onion Skinning.
My very first attempt at an addon for blender was a thing called "Mocap Madness". I thought for a while blender had the possibility to display onion skinned armatures, or maybe I coded similar to this, and recall that.

Only had CMU 01_01 floating around, result of running script below

Push the bvh action down into the NLA editor

_Example, rig generated from CMU 01_01, action pushed down

Copy the rig. A linked copy will save a lot of space (same armature data)

Shift the strip start of the action in the NLA editor.

Here is a test script, the following
frame_range = (200, 1000, 100)

make a copy starting at frame 200, every 100 frames until frame 1000. Edit to suit.
If the action is the only one pushed down in the NLA can assume it is track zero strip zero.
import bpy
context = bpy.context
ob = context.object
scene = context.scene
collection = context.collection

# clean up last run.
obs = [o for o in scene.objects if o.get("Frame", False)]
bpy.data.batch_remove(obs)

tracks = ob.animation_data.nla_tracks[0]
strip = tracks.strips[0]
print(strip.action)
action = strip.action
#frame_range = map(int, action.frame_range)
frame_range = (200, 1000, 100)
for f in range(*frame_range):
    print(f)
    x = ob.copy()
    x.name = f"Frame {f}"
    x["Frame"] = True
    x.animation_data.nla_tracks[0].strips[0].frame_start = -1 * f
    collection.objects.link(x)

Thank you very much, this is exactly what I need!


text:
How can i assign a random material from a list in Python
Ive been trying to write a script to assign random materials based on probabilities without success.
the working code is this:
item = bpy.context.object
            if random.random() < 0.2:
                item.data.materials.append(bpy.data.materials["crustylava"])
            else:
                item.data.materials.append(bpy.data.materials["magma"])

I tried using a variation of this:
import secrets
import random

foo = ['a', 'b', 'c', 'd', 'e']

print(random.choices(foo, weights=[1, 0, 0, 10, 1]))

which i wrote:
foo = [bpy.data.materials["crustylava"], bpy.data.materials["magma"]]
mat1 = random.choices((foo, weights=[1, 0]))
mat2 = random.choices((foo, weights=[0, 1]))

item = bpy.context.object
    if random.random() < 0.2:
        item.data.materials.append(mat1)
    else:
        item.data.materials.append(mat2)

It says that materials.append expects a material 'type' not a list. Sorry for the noob question but I'm losing my sanity over this =D

random.choices((foo, weights=[1, 0])) is just a complicated way to write [foo[0]]. The equivalent of your working code is item.data.materials.append( random.choices(foo, weights=[2,8])[0] ).

thanks man!!!! this is spot on!!

random.choices returns a list.
>>> random.choices(
choices(self, population, weights=None, *, cum_weights=None, k=1)
Return a k sized list of population elements chosen with replacement.
If the relative weights or cumulative weights are not specified,
the selections are made with equal probability.

Error message is pretty self-explanatory here, in that choices is returning a list, as explained in doc string above A test print from the letters example
['d']

which for the second example you are trying to append a list to the materials collection, not a material. Just like ['d'] is a list containing the character d, not a character.
If we are sure the list contains an element can  mat = somelist[0] and  mat = somelist.pop() to get the first and last.  (or the other way somelist.pop(0) , somelist[-1] respectively.
Test script, (simply used material list as test case rather than key by name)
import bpy
from random import choices, random
# require at least 2 materials
assert len(bpy.data.materials) >= 2
foo = bpy.data.materials[-2:] # last 2 of all materials

mat1 = choices(foo, weights=[1, 0]).pop()
mat2 = choices(foo, weights=[0, 1]).pop()

ob = bpy.context.object
me = ob.data
me.materials.append(
        mat1 if random() < 0.2 else mat2
        )


text:
how to make loop animation on bazier curve with multiple object and it disappear at the end of path?

i try  to make arrow follow along path like this and the arrow will disappear at the end of the path right now the arrow keep on going infinity i try this only on 1 arrow. planning to make something like in the picture, how to achieve something like in the picture?

Well, animate the arrows to disappear ? I don't understand what is your issue.

you can make its material transparent at the end?


text:
Hair not rendering properly
So I was rendering out a character in the eevee render engine when I realised something was wrong with the render. While the character looked like this in the rendered view in the viewport:
When I render it out it looks like this:
I am not quite sure why this happens so if anyone could tell me why it looks like this and how to fix this issue, that would be appreciated.

Looks like insufficient particle hair render subdivisions

Are the render and viewport hair segment settings not the same number? There are both, and they are not cross-limited.


text:
3D camera tracking and object tracking are not on right position
I'm sorry if this question as already been asked, but I couldn't find it anywhere so asking again. If someone knows please write in comments.
The story is, I've a video clip form (hollywoodcameraworks). Very common clip, where a women is holding a gun kind of object and walking on a street.
Please see the images.
I've tracked camera very nicely with 0.01px error. Very smooth camera tracking, this worked great.

and for object I tracking 0.25px error I don't think that is bad at all,

And in 3D space ... both things are tracked, 3D box-object has also applied constraints to the tracked OBJECT respected to the camera. that seems fine on the 3D space.

But the ISSUE is.. the 3D box-box object is too low to the surface... I won't be able to cast shadows since I want to change the road into cracks on concrete or anything in 3D as well... so don't want to do it separately ...   Can somebody give me some tip where I'm doing wrong.

Thank you.
one more small question: how to add file as attachment.?

And after some testing.. I've found the solution..
My camera solution's scale was little.. I had to increase that..
See my first results with solved scale.

I selected two points with good results 0.01 and 0.01px,
Hit Apply Scale
Scale up and keep look on the result preview in right top corner in my image.

. this is what I got..

Perfect. Thank you to ALLAH for giving me solution..  :)


text:
Cuda error, Out of memory while I have 4GB of GPU
Many of the people have asked almost the same question.
I'm trying to render a big mesh + fur/grass file with a few characters on the screen.
when I hit render, after a number of processing, copying data to gpu etc... i get following error.
Mem: 2960.07M, Peak:2960.07M | CUDA error: Out of memory in cuMemAlloc(&device_pointer, size).
I'm using Geforce GTX 690 which contains 4GB memory.
Can somebody tell me how can i get GPU rendering, while 2960M is far less then 4196M of memory.
I know somebody would suggest me to use CPU.. but i'm curios why not GPU?
I've already compressed texture, etc
Edited
I don't think any other application is using any of my 1GB remaining memory. everything is closed but blender is there, also the GPU utilities are showing 2000/2000 MB are free on one card and 1900/2000MB is free on 2nd card.
i'm using GTX 690. with two GPUs of 2GB each. If somebody thinks that one GPU should have memory matching to the cuda memory/or Peak memory then I'm doubtful. Because in preferences Blender does know that I have 2GPUs where I can select either first GPU or second GPU or even both.
When I render some of smaller objects/scenes both of my GPU renders simultaneously with two blocks.
I'm running following specs
Xeon E5-1660 0
24GB - 1600mhz
GTX690

Several Blender (or other applications) at the same time?

You could be overflowing a specific portion of the vRAM (too many or too large textures etc)

Maybe other applications are using that GB, or Blender itself?
If so, you could try to render from the command line so displaying Blender doesn't cost any resources:
https://docs.blender.org/manual/en/dev/advanced/command_line/arguments.html
(Reducing subdivisions of text sometimes saves a lot of memory, according to your description there is no text.)

i edited question.. please recheck