Brush to "Spawn" Several meshes on surface? I have a ground and i would like to put lots of grass meshes [ 2 planes , With a grass texture , Image below ] I want to know if its possible to add lots of these meshes on the surface to where i click , instead of having to duplicate then place each one.

Join both of the planes that make the grass into a single object.

On the ground plane create a particle system. On the render section select object and assign the grass as Dupli Object.

Make sure the emitter start and end is 1 and the lifetime is as long as the animation you want to make.
Disable gravity. Make the particle size 1 and give it some randomness.

If your grass comes out flat to the ground just enable the rotation box.

sample file here:


Objects duplicate strangely when joined I am trying to join together a mesh of a cup and many small mesh objects inside the cup using Ctrl+J. For some reason, along with joining the objects together, this is producing a strange combination of duplication, rotation, and translation. Any ideas about the cause or for a solution? Thanks for your help!

Before:

After:

The problem was that I was using unapplied modifiers on the objects. To apply the modifiers to so many objects, I used the command Alt+C while having all the objects selected. Then used Ctrl+J to join like normal.


How to increase number of visible hairs in particle edit mode? I've made some hair using 'Quick Fur' effect. I've also changed how they look (individual hairs are much wider now, because of the look I was trying to achieve) and I've reduced the number of hair, because it didn't look good with too high number anymore.

The problem is, while it looks fine in render or object mode, when I enter particle edit I can only see a couple of them. Like two orders of magnitude less. It makes it very difficult to work in this mode - since I can barely see effects before switching back to object mode or rendering.

Is hair in particle edit in some low preview (how to change it?) Or am I missing something (since I'm a almost complete newb)?

could it be that you have children visualized (default enabled in quick fur)?

this is with children, as in quick fur, and they are visible only in object/render mode (I think there's no way to visualize children during editmode). You could convert from the modifier panel to a real mesh, perhaps, so that children become "real", but you'll loose particle behaviour...

which in particle edit mode becomes

and this is the same mesh without children, in object and edit mode


How to select only camera's across multiple scenes in bpy? How do I iterate and select only camera's across multiple scenes via python?
This is what I tried but only works for the first active scene.
import bpy

    objects = bpy.context.scene.objects
    scenes = bpy.data.scenes.keys()

    for i in scenes:
        bpy.context.window.scene = bpy.data.scenes[i]

        for obj in objects:
            obj.select_set(False)
            if obj.type == "CAMERA":
                obj.select_set(True)

Always looping over context scene's objects.
Logic error, you were only ever looping over the context scene's ("the first ones") objects.
Test code below, selects all and only camera objects.  Sets the scenes camera as active for each viewlayer.
import bpy
for scene in bpy.data.scenes:
    bpy.context.window.scene = scene
    for ob in scene.objects:
        ob.select_set(ob.type == 'CAMERA')
        # set scene camera to active for each viewlayer
        if scene.camera:
            for vl in scene.view_layers:
                vl.objects.active = scene.camera


Blender game engine seeing through gun I've looked at the other questions similar to mine but they all talk about the normals. After displaying the normals, it seems my normals are fine - yet my object still can be seen through.

Here is the blend file:
http://www.pasteall.org/blend/36891

Normals are pointing inwards

Solution: flip them.

But: They do look right at your picture.

Transparency enabled.

Solution: disable transparency in the material tab. As your model does not need any transparency this should be no issue.

Mirrored the object. That makes the normals point towards the opposite direction (see the first option). This can happen on negative scale on one or three axis (scale by -1). It is possible you have an according modifier mirroring your mesh.

Solution: Mirror again, scale back, flip normals and/or review your modifiers.


Shape key driver posing affects the resting pose? So I'm working on a rig with eyelids that close via shape keys run by a driver. But when I go into pose mode to play with it and then switch back to rest mode or go into edit mode which would usually reset the pose, the eyelids don't go back to their own rest position.
Is this just a quirk of using shape key drivers? I'd assume there to be a setting somewhere to make it... not do that, and instead behave like all of the other bones in the armature. It's otherwise really inconvenient to always have to be resetting the eyelids to work on my model in its neutral state.
I'm using 2.82, I tried to google an answer but I don't really know how to word it simply I guess. Sorry if it's a dumb question, I'm still very new to blender and 3D in general, this is my first rig ever and I'm learning a lot :)

It all depends on how your driver is set up.  There are multiple things your shapekey can be driven by.  Some of those things are "at rest" in rest pose; some of those things aren't.
For example, if you drive from a "transform channel", that's the post-constraint, visual transform of a bone.  Those all go to rest at rest.
But if you drive from a "single property" like pose.bones["Bone"].location[0] (which you get from copying the X position of the bone as a new driver), then what you get is the keyframed X translation channel of that bone, which is pre-constraint, and which doesn't go to "rest" in rest position.  Rest position doesn't change your keyframes-- it just makes it so that they don't do anything.  If that makes it any easier to think about.
So, if you want to change your drivers from single properties to transform channels, I think you'll find that rest pose sets your shapekeys back to their defaults (whatever those are.)  Just be careful about it-- you'll need to specify the space of evaluation for the driver, and you'll be getting post-constraint values, and you'll no longer be getting rotation as your exact keyframed values (for example, you will never see a rotation of >180 degrees in your transform channel.)


Texture problem with Makehuman model in blender I am using a Makehuman model in blender, and rendering with cycles. As shown in the images below, I have used these nodes to put the texture of the tshirt on the person. There is a black spot on arm. What is the problem, how do I get rid of the black part?

result of texturing in blender

textured model in makehuman

UV map is a coordinate system that helps to wrap a 2D image around your 3D object.
You can read a little about UV's here http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics

Here is your situation.

What you see in white is your texture, exported from Make Human. The wires you see are your UV map. To look good they must match. I don't know how you ended up with sweeter when your character in Make Human had T-shirt, but I think this is your problem.

To fix it you need 1 of 2. Either edit your UV's to match the texture or edit your texture to match the UV's. You can read about the first way in the link I gave you, and you can edit the 2nd in any image editing software.


How to rotate mask around cursor? I want to animate mask (half circle) in image editor - rotate mask around cursor placed in a center, but final animation looks strange.

Does it current limitation of masks's keyframe or is there anything that I can do better to create simple rotation?

(I tried to ad last anchor point of previous circle in a hope it will be calculated as circle shape, but same result.)

Thank you

As pointed out by @RayMairlot you can rotate the mask in the compositor by addong a rotate node and animating its values:


Appended layer not rendering any objects I'm something of a noob to blender.  I appended a model of an engine to the 2nd layer of my project, and for some reason, no objects from this model show up when I render.  If I add a cube to the 2nd layer, the cube shows up behind an outline of the engine, but not the engine itself.  The object in layer 1 shows up fine.  For the life of me I cannot find why the objects from this model don't show up.  I have the render visibility turned on for all of them, and I can't find anything else that would change visibility (ie the layer is lit, etc.)

Can anyone point out to me what I'm missing? Its probably something obvious.  Here is the file: https://www.dropbox.com/s/5q1lnq91oxtpkbg/Blend%20for%20SE.blend?dl=0

Your material is set up for cycles rendering but you have it set to blender render at the top. Then the object in layer 1 is set up for blender internal rendering.


Bevel causing weird creases This is a picture in edit mode

and this is the crease plus the bevel settings

Try to make the topology a bit cleaner. Maybe this will help. I retopologized your mesh and gave it the modifier's settings from your screenshot. As you can see the beveled edge of the object on the right looks better.


Easy Ways Of Finding Both Front And Side Profiles for Character Modelling I'm starting to get into photorealistic character modelling and I'm trying to find some reference photos on the internet to practice with. Unfortunately I'm not having any luck finding any photos of the side view of people's faces, as most of the images on Google are of the front view. Does anyone have any tips or know of any websites I can visit to find both front and side views of the same person?

It is probably simply a question of finding a suitable keyword combination. I tried both on Google Images and on Pinterest with "face front side" and found a lot of examples, both male and female. Furthermore, once found a good image, you can use the function to show similar ones, and you will have plenty of examples to practice.


How can I create a 3D repeating pattern on top of a flat surface? Consider:

I try to create a pattern and project with shrinkwrap on an object...But the main problem is after deleting a face from the target object I have too many vertices to connect. I try to create a 3D pattern on that shape.

Another solution is to use tissue add-on

Model your base shape:

Create a component shape (the shape on top of final object)

Select the component object first, and then the base object, and click tessellate.

Note that the order in which you select the objects is important with tissue, if selection is done in the incorrect order you will up with strange results.

Adjust options in redo panel F9

For this object, it was needed to merge by distance and extrude the bottom faces in -Z. This step may vary per object use case.
Also, can select border faces and Alt+E >Extrude Faces Along Normals to create an extended border around the object.

Result:


Render becomes blurry So I downloaded a blend from blendswap and here's the issue. When I load it, it's fine. When I render it, it's initially fine. Then there's something like another layer or something added on top of the render and it becomes very blurry. I am working in 2.8 with Eevee but the same thing is happening in cycles. The original version before the "extra layer" or whatever it is as well as the blurry version can both be found below.

EDIT: I've added a picture of the compositing nodes as well.

Try going to the node tree... See if there's another layer being composited on top.  Also, I'd check out the depth of field under the camera settings, and make sure that it isn't messing stuff up...


How to assign vertex group to single bone I'm trying to animate a simple character in blender. I made a very simple armature, with a bone for every moving part of the mesh. Each moving part is "stored" in a vertex group, and I would like to parent every vertex group to it's corresponding bone. I searched very much on the internet but I didn't find anything useful, even though it seems to be a simple task. Don't tell me to separate the vertex groups into split objects, since I want them to remain connected.

Thanks in advance for your help!

Just name your vertex groups the same as your bones. The bone named "hand.left" will animate the "hand.left" group (by default the weights are set to 1).
Then both select the mesh and the armature (in this order) and parent it (ctrl+p) with empty groups.


Store unique vertex ID in vertex color Script from this answer encodes polygons ID to vertex colors:

import bpy

obj = bpy.context.object
obj_data = obj.data
group_name = 'face_ID'

#check for existing group with the same name
if None == obj_data.vertex_colors.get(group_name):
    obj_data.vertex_colors.new(name=group_name)
color_map =  obj_data.vertex_colors[group_name]

#get faces' number
count = len(obj_data.polygons)

for poly in obj_data.polygons:

    ID = poly.index / count  #for normalized results
    color = (ID, ID, ID)
    for loop_ind in poly.loop_indices:
        color_map.data[loop_ind].color = color

Can this be done with vertex indices as well?

I've tried to change poly to vert and obviously script doesn't work.

Using bmesh.

Similarly to this answer loop thru the face loops and set the associated vertex to a color based on its index.

result on default uv_sphere, cube and torus

import bpy
import bmesh

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

color_layers = bm.loops.layers.color
color_layer = color_layers.get("color") or color_layers.new("color")
L = len(bm.verts) - 1
for face in bm.faces:
    for loop in face.loops:
        x = loop.vert.index / L
        print("Vert:", loop.vert.index)
        loop[color_layer] = (x, x, x, 1)
bm.to_mesh(mesh)

Note: for large meshes could make a a look up table for vert and color to avoid calculating for same vert per face loop.

LUT = {v : v.index / L for v in bm.verts}


How to rearrange the angle of existing polygons I'm trying to think of the easiest way to connect the opposite angles of the quads, as shown in the figure below, are there any existing solutions?
I've found a way with inset modifier + collapse, but after that there's an old grid that's hard to isolate

There's a little trick, which also helps to make diagonal grids for modeling knurls, nettings, trellises, gratings, etc.

WS Subdivide your mesh
CtrlE edge menu, Un-subivide  it.

Done.

It's odd that the operations aren't inverses of one another ... Un-subdivide it again, and you're back to where you started. As Mr. Zak point out in his comment, the iterations should be set to 1. Odd numbers of iterations yield diagonal divisons.


Why do multiple keyboard inputs stop playing an action? I have a simple character, who has simple animations. In the logic editor, I have a Keyboard sensor (W) > And controller > Action actuator set to Loop stop.

I did the same with another keyboard sensor (S). When I play the game and use W it's fine, and when I use S it is also fine. But when I press both of them (W+S) and let go of only one of them, the animation stops.

This only happens when I wait for a second after pressing one (W or S) and then press a second. In other words, the game is fine until I press 2 of the functions at once.

How can I let both W and S work fluently with Loop Stop enabled?

This is because an and controller requires all connected sensors to be true to pass a signal to the actuator. An or controller requires that at least one of the inputs is true.

Think of it this way:

An and controller requires both sensor 1 and sensor 2 to be true.
An or controller requires either sensor 1 or sensor 2 to be true.

This is just boolean logic, see the wiki for more details.


blender cannot see three.js addon i want to use blender models in three.js. To import blender models to 3.js we have to use blender exporter addon   so i follow a tutorial and do every step correctly .i have included folder inside addon directory.but when i restart blender i can't see a three.js addon . i'm using blender 2.72 version .

as you can see there is no addon as 3.js

To use an addon after copying it to Blenders addon folder, you must activate it first in User Preferences. You find it under: File > User preferences or you hit Ctrl+Alt+U.

In the Add-on tab you can search for your addon and activate it by ticking the checkbox.

Also see: Installing an addon


How can i get shape keys from a animation with keyframes? I hope this is not a dumb question. I am a newbie and im not sure if this is proper. How can i make shape keys from a animation with keyframes? how can that be accomplished?

What you can do is to apply an armature modifier as a shape key. Be aware that you will end up with an undeformed starting point and a deformed end point: the mid locations of every single vertex will be in the center of the straight line connecting start point and end point, this often leads to unpleasant results.


How can I convert these Blender video settings to ffmpeg please? Whenever I use the ffmpeg commands, the video is larger and the seeking/keyframe inteval is not the same as the video rendered from Blender. How can I convert the following Blender settings to ffmpeg please?
Blender Settings:

Frame rate: 30
Codec: h.264
Output .mp4
Keyframe interval: 1
Output quality: Medium
Encoding speed: Good

Here's my current command however the seeking and file size is different: ffmpeg -framerate 30 -i %04d.jpg -g 1 -vcodec libx264 video.mp4

My answer was found on stackoverflow for anyone that needs it: https://stackoverflow.com/questions/67011275/how-can-i-convert-these-blender-video-settings-to-ffmpeg-please/67038271#67038271


Random Color in objects using ProRender I am creating several objects and I want each of them to have different colors based on a color spectrum. To do so in the Shading tab I select all the objects and assign them a material. I then connect the Principled BSDF node with ColorRamp. Since I am using ProRender I do not have the Object Info input. Therefore I have using the RPR Lookup with Random Color selected. I then connect RPR Lookup to ColorRamp. In ColorRamp I selected three colors, Red, Cyan, and Blue. However, on the objects instead of showing any of these colors on each of the objects it only shows white.

What did I do wrong?

Thank you.

Blender 2.82a
Lastest version of ProRender

The "Random Color" already produces a color, not a random numeric value like the missing Object Info node, so I think it doesn't play well with the ColorRamp node.
If I connect the "Random Color" output of the RPR Lookup node directly to Base Color on Principled BSDF, I get random colors as expected.

If you'd like to get back the palette control that ColorRamp offers you, you can pass the output of "Random Color" into the "RGB to BW" node (found under Converter) and then pass that output into ColorRamp as shown below.


Restricting surface area for snapping to other objects Sorry, new to Blender, but not to CAD or other 3D programs, but not familiar with terminology used with Blender.
I would like to be able to define "snap points/surfaces" that would allow me to place two different 3D parts together, but only snap/connect together in a predefined area of the objects surface.
A simple example would be a cup with lid and a straw. You would want to be able to restrict the straw to snap to only the hole in the cup lid, and no where else on the cup object surface; likewise the straw would only be able to snap on either of its two ends and no where else. Is it possible to define a point/area on a 3D object to implement this functionality?

This is something that I am working on as well, so I might as well share what I have learned.
A nice way to isolate the target area in the edit mode is to hide the geometry you don't want to be affected by an operation.
You can then safely work only on the area you want, without affecting any of the other vertices.
Other notes:
-make sure to toggle proportional editing off; this is an extremely powerful function
-snapping can be used (the magnet icon) to connect edges or align by increments
-use bridge connect tool


How to paint alpha emissive mask ? I would like to have my material on the object.

Then I want to paint an alpha mask which will be an emission texture material on top of my material.
Basically, only part of the object which will emit light will be my painted texture on it.
How to do that ?

First of all, you are going to want to UV unwrap your cube by going into edit mode and using something like "Smart UV Project." If you then go into the "UV / Image Editor" panel, you should see your faces outlined. Go ahead and hit the new button next to the +, and leave the color as black. Click OK and select paint mode from the drop down bar next to the button with a picture of a pin on it. You can now drag while clicking to paint over your texture. When you are done, select "Image > Save as Image" and name and save your texture. If you don't, the texture will be gone when you reopen the blend file. Your texture should look something like this:

Now, go back into your "Node Editor" panel, and add a new emission shader, mix shader, and Image Texture. Connect the your base, non-glowing material to the top "shader" input of the mix shader, the emission shader to the bottom "shader" input, and your Image Texture "Color" to the "Fac" input. Finally, in the Image Texture node, select the texture you drew on earlier. What this does is, in the white areas of your texture, the emission is able to show through, whereas the black areas let the base shader show through. Here's a picture of how it should all have come together:

In the end, your result should look something like this:

Have fun Blendering! Cheers,
Graves Broderick


SCULPTING - Blender 2.8 "emulate 3 button mouse" disables ALT+LMB Im using a graphics tablet, therefore I have "Emulate 3 button mouse" enabled in the preferences.
However if I want to sculpt on multiple objects at the same time, I cannot use Alt+LMB   to change between objects.
Its pretty lame to go back to object mode and set another object into sculpt mode for each change I need to make.
Maybe there's a workaround that you guys can help me with.

Solved it by remapping the 3D view global Alt+LMB  to Alt + RMB
Go to Blender Preferences -> Keymap -> 3D View -> 3D View (Global) and Scroll down to find a Select keymap box that has Alt+LMB  as keymap (it should be a few lines above the Box Select keymap).
Change the Alt+LMB  to Alt + RMB  instead.
Solved the issue for now. Not sure if this keymap was important for any other workspaces, but skimmed through the global keymap sections and could not spot one in any of the other sections.


IK rigging with a hammer held in hand I'm having trouble getting an IK rig to work how I want it to. My goal is to have a hammer in my characters arm that I can move and rotate have the arm and hand rotate properly like it would for a real person, where the forearm rotates forward and backward mostly with the wrist being pretty much still and maybe a bit of upper-arm action if the forearm goes above a certain angle forward/backward.
The position part of the ik is pretty good, but I'm struggling with the rotation.
I've set up my hammer model with a child bone in it going from the handle near the point where it intersects with the hand to the head of the hammer.
The IK of my hand is set to the 'hammer bone' with location and rotation applied and a chain of 4 (shoulder is the end).
It sort of works, but is un-natural in that the wrist rotates instead of the arm. I'm sure it is just my fault at not being an expert. I've tried different rotation constraints, but can't seem to figure out the one that works/the right way to do it.
I've found some good tutorials on IK, but I couldn't find any sort of forum posts or tutorials that cover how to do it with a hammer or bat or similar tool where the tool drives the rig. I would really appreciate it if someone could direct me on this.

A character using a hammer - (Blend file below - Vers 2.77, will work in 2.8+)
I'm assuming it's the IK 'using' the hammer or sword that you're having trouble with...
Getting the swing appearing natural is probably best achieved using a curve to guide the wrist or hand and the hammer parented to the hand bone so there'd be no slippage.  Other situations might be best served using the tool to drive the rigged arm and hand.

The setup in this example uses a vertical curve (arc) to guide the swing, but to avoid quirky behavior the left arm's handle (an Empty) is not forced to follow the curve directly.
Instead, a dummy plane follows the curve and that's what gets the curve modifier. (Called 'Curve Follower' in the file)
That dummy plane is made a parent for the arm's handle and this takes the arm down the curve but without glueing the arm to it.  The arm can still be moved about whilst it's following the curve
The hammer is made a child of the hand bone so there'll be no slippage.
The curve itself is given it's own handle so it also can be moved during the process. (the circle empty) This is a parent to both the curve and the curve follower.  It keeps the curve and follower together when the curve is moved forward and back during the swing.
The forward movement of the curve is to force the arm to extend a little and change the hand and hammer's angle.  The wrist wouldn't look too hot if it was twisted to do this.
With all that working properly the arm and hand will be seen to take the hammer down in an arc shaped swing.

On impact, because the backbone is in the process of bending forward and the wrist can't go anywhere, the elbow joint is forced to fold some more and change it's angle, automatically adjusting the hand and hammer's angle as well.  The curve is also moving back and that enhances the elbow's folding angle.
The hammer appears to kick up from the impact as though from a recoil.  This only last for a frame so the curve's follower is animated in the reverse direction to take the hammer and arm back up a little further.
Note that impact and rebound behavior is fashioned in the Graph editor.  Those keyframe handles are used to change the Bezier curves into linear style reactions so the hammer, hand, and arm, appear to bounce a little.  The impact approach and bounce is actually accelerated a little.


Make dashed (or dotted) circle appear like powerpoint wheel animation How do you make a dashed or dotted circle appear like a powerpoint wheel animation? I would like to make an animation like the one below.
Thank you!

This can be done procedurally pretty easily.
Just make a ring shaped object that has the desired dotted line width and give it this material:

The driver for the second input of the subtract node is #(frame - 1) / 120. The 120 is the number of frames for one rotation (at 60 fps this is two seconds).


What is the is the difference between object and data link for while creating materials? What is the difference between the two options provided when creating a material while using the blender render engine?

heres an image.

Borrowed from iKIsR from different question:

  Linking a material to Data (to mesh specific data) is ideal when you want a mesh to always have the same material, while linking a material to an object is when you want to have different materials on objects that share the same mesh.

  Short explanation: If connected to the object, you can have several instances of the same Data using different materials. If linked to mesh data, you can't.


How would I merge these 3 pipes with this corner? These are my 3 pipes

I want to merge them together and have this look at its corner

How would I achieve this?
thanks in advance.

Edit: Probably much easier since 2.8 with the new Mirror "Bisect" option
Former answer:
I've found an answer for a basic 3 cylinders shape, but it looks like it's not exactly what you're looking for. That said, I'm not sure your drawing means anything in 3D. Anyway, perhaps my solution will help?

Create a cylinder with Cap Fill Type > Ngon.
In Edit mode, rotate it and move its cap to the origin with the Snap to Grid option (or put the 3D Cursor on the center of the scene, choose the 3D Cursor as Pivot, and S Y 0).
In Object mode duplicate the cylinder once and presse Enter.
Rotate the duplication 120° on the Z axis.
Duplicate and rotate again. Now you have a 3 branches star.
Join the 3 cylinders with 2 Booleans modifiers / Union mode.
Apply the Booleans.
Select all and W > Remove Doubles.
Delete the inner edges.
Delete the useless vertices.
If you want to extend the cylinders length, you can select all the caps and use alt E > Individual Faces, or select each cap and move it on its normal axis.


In game engine with python, add appendage to object I'm doing scripting in the game engine.  I have two basic objects, a "SeaFloor" and "Kelp".  I have python classes for each and the game engine.

My goal is to add the Kelp object to the scene and root it to the SeaFloor, so in the physics of the game it won't be moved by fish or current.  Also, as the kelp grows, I only want it to grow "up".

I can get the kelp to appear using:

kelp = self.scene.addObject("Kelp", "SeaFloor")
kelp.worldPosition = pos

I think I have to do this with constraints, but I don't understand them very well.  I would appreciate some advice on how to lock those two together.

These are two different tasks. Lets deal with them separately.

Grow

I suggest you let the objects grow via an animation (e.g. shape-key, armature). With that you have full control how it grows.

When you use scaling ensure the object origin is at the button of the plant as scaling is always relative to the origin.

Positioning

A simple solution is to check the ground "under" the object. Typically "under" is along -Z.

Perform a ray check along -Z starting from current position. Check for ground (property filter). Then you can place the object at the found hitPosition.

Check the BGE API for rayCast()

Example:

lookAtPosition = kelp.worldPosition.copy()
lookAtPosition .z -= 1 # position below current position
distanceToCheck = 100.0

hitObject, hitPosition, hitNormal = rayCast(
    lookAtPosition,
    kelp.worldPosition,
    distanceToCheck,
    "ground")

kelp.worldPosition = hitPosition

I hope it helps


Blender 2.8 - Get Environment Texture Path from UI to python script i'm unable to get inside a python script the path of th Environment texture that i assign in World->Color from the Blender UI.

I want to set the .hdr there and than get from there the path (C:/.../123.hdr) for other uses, but i need it inside a script.

Thanks for help!

Finding things with the python console.

The scene has a world.  context.scene.world. When nodes are being used the object will have a node tree. world.node_tree The tree has nodes. Consult the manual or the many questions / answers re nodes for more info.

Note: The properties space has a world member of context context.world other spaces may not

Here is a simple example using the python console.  C is a convenience variable C = bpy.context

>>> C.scene.world
bpy.data.worlds['World']

>>> C.scene.world.node_tree
bpy.data.node_groups['Shader Nodetree']

Here I've used autocomplete CtrlSpace to expand available options

>>> C.scene.world.node_tree.nodes['
                                   Background']
                                   Environment Texture']
                                   World Output']
>>> C.scene.world.node_tree.nodes['Environment Texture'].image
bpy.data.images['Untitled']

See that the environment node has an associated image.  Since I've simply added a blank untitled image it has no filepath.  A loaded image will.

>>> env_img = C.scene.world.node_tree.nodes['Environment Texture'].image
>>> env_img.file
                _format
                path
                path_from_user(
                path_raw
>>> env_img.filepath
''

Adding an environment node, given you have a path to the image path

>>> world = C.scene.world
>>> world.use_nodes = True
>>> enode = C.scene.world.node_tree.nodes.new("ShaderNodeTexEnvironment")
>>> enode.image = bpy.data.images.load(path)

Related:

How to set a background using the cycles render engine with the API


Problem when moving bone i've been strugglin with my hair paticule on my character , wich i've been attach to the skin and the skin have been attach to some clothes . I finaly finnish doing a basic rigging on the character but when i'm moving arm or else the hair dont move along with the hair (instead move up and down ) . I've been trying to weight paint the vertex group but nothing is happening , only the skin and clothes have been affect by it . Please could you help me out ! Peace !

When you applied an armature on the particles system based mesh by default armature appeared at the end of modifiers, Please have a look of image below:

Please move up Armature modifier on top of particles modifiers and your hair should be follow the armature

Please take a look of image below:


Why is the cube visible even though there are no lights? If I use the Cycles rendering engine, leave the default Cube, delete the default lamp, set the diffuse color of the cube to some color, why will the cube without any lamps still render visible? Does the default background emit light? Where can I tweak the amount/color of light it emits?

The background is emitting light (by default). You can see the setting of the world background in the world Tab:


How do you reference a scene property by name? Hey I have some string variables in a property group:

line_1 : bpy.props.StringProperty(name = "line_1", default = "1")
line_2 : bpy.props.StringProperty(name = "line_2", default = "2")

I need to reference them by name for a loop, but it is not callable:

for n in range(1, max_number):
    test = bpy.context.scene.test_vars["line_" + str(n)]

What am I doing wrong on this line?

    test = bpy.context.scene.test_vars["line_" + str(n)]

getattr(obj, prop, default)

A custom bpy.props.prop property only has an ID property obj["prop"] once the value is assigned obj.prop = value.  If it hasn't been assigned it returns the default value set when defining the property.

value = getattr(obj, "prop", None) is the equivalent of value = obj.prop if "prop" is an attribute of obj, None otherwise.

import bpy
context = bpy.context
scene = context.scene
for n in range(1, max_number):
    test = getattr(scene.test_vars, "line_%d" % n, None)


Simple python script to stitch images into movie failing with incorrect context I'm trying to write a simple script that adds png images to the video seqeuence editor, and stitches them into a movie. However, between the blender API and all of the old documentation that's floating around online, I can't seem to get it to work. Here's my code:
import bpy
import os, glob

img_dir = 'my/img/dir'

# set movie render settings
resx = 1024
resy = 350

bpy.data.scenes["Scene"].render.resolution_x = resx
bpy.data.scenes["Scene"].render.resolution_y = resy
bpy.data.scenes["Scene"].render.resolution_percentage = 100

scene = bpy.data.scenes[0]
editor = scene.sequence_editor_create()

# get image files
image_files = []
for _file in os.listdir(path=img_dir):
    if _file.endswith('.png'):
        image_files.append(_file)

context = bpy.context

# add to sequencer
img_strip = [{'name':i} for i in image_files]
frames = len(image_files)
frame_end = frames - 1  # offset for python counting

a = bpy.ops.sequencer.image_strip_add(directory=img_dir, files=img_strip,
    channel=1, frame_start=0, frame_end=frame_end)

strip_name = file[0].get("name")
bpy.data.scenes["Scene"].frame_end = frames
bpy.data.scenes["Scene"].render.image_settings.file_format = 'AVI_JPEG'
bpy.data.scenes["Scene"].render.filepath = out_dir
bpy.ops.render.render( animation=True )

with output:
line 32, in <module>
    channel=1, frame_start=0, frame_end=frame_end)
  File "/usr/share/blender/scripts/modules/bpy/ops.py", line 189, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.sequencer.image_strip_add.poll() failed, context is incorrect

What does this error mean? And how might I go about modifying my code?

Ditch the operator.
Have updated the code from
Importing multiple movie clips inside one directory via script

look at all images in a path
glob on "*.png"
to use pathlib.Path

Adding each image as a strip.
import bpy
from pathlib import Path

# glob all movie files from
dir_path = "/home/batfinger/Pictures"
img_dir = Path(dir_path)
glob = "*.png"
frame_duration = 24
files = sorted(list(img_dir.glob(glob)))

# get sequence editor
scene = bpy.context.scene
#scene.sequence_editor_clear()
sed = scene.sequence_editor_create()
seq = sed.sequences

# add movie strips
for i, fp in enumerate(files):
    ms = seq.new_image(
            name=fp.name,
            filepath=str(fp),
            channel=i + 1,
            frame_start= i * frame_duration + 1 ,

            )
    ms.frame_final_duration = frame_duration
    # print some details
    print("%s ch: %d fs: %3.1f len: %d" %
            (fp.name, i + 1, ms.frame_start, ms.frame_final_duration)
            )

Adding images as sequence to one strip.
import bpy
from pathlib import Path

dir_path = "/home/batfinger/Pictures"
img_dir = Path(dir_path)
glob = "*.png"
frame_duration = 24
files = sorted(list(img_dir.glob(glob)))

# get sequence editor
scene = bpy.context.scene
#scene.sequence_editor_clear()
sed = scene.sequence_editor_create()
seq = sed.sequences
duration = len(files)
# add image strip using first
fp = files.pop(0)
imstrip = seq.new_image(
    name=fp.name,
    filepath=str(fp),
    frame_start=1,
    channel=1,
    )
# add the elements
while files:
    imstrip.elements.append(files.pop(0).name)

imstrip.frame_final_duration = duration
imstrip.update()


Arc miter bevel creates miters on straight edges I came across strange artifacts after adding a bevel modifier to a keycap model. When I set the inner miter type to 'Arc,' some vertices have a miter applied despite the adjacent edges meeting in a straight line. This seems counter to the Blender manual:

A miter is formed when two beveled edges meet at an angle.

I found it very easy to reproduce this issue without any manual modeling:

Start with a cube
Add a subdivision surface modifier set to 'Simple' and increase the subdivisions to 3
Add a bevel modifier with limit method set to 'Angle' and inner miter type set to 'Arc'

The model I originally encountered the problem on is a deformed subdivided cube. The same problem occurs regardless of whether I use modifiers or tools to create the subdivisions and bevels. I can understand why Blender might add a miter to a curved edge like the top of the keycap, but it ignored that edge. It seems to add them totally at random.
I have tested from scratch on Blender 2.82 and 2.90. Why is this happening? Is there anything I can do to mitigate it, besides applying the modifier and cleaning up?

The strange behaviour in question was a confirmed bug and has since been resolved. In the latest version of Blender (2.92.0 alpha) the issue is absent.
If you are having the same issue, update Blender.


how to do crochet patterned curtains (grandmother like) I need your help, i have no explanation how to do these curtains
- can someone explain, what is the smartest way to model these?
- how can i use it in the best way for a cloth sim?

Best regards,
Marc

Its not necessary to do the curtain with real geometry, just use a normal cloth simulation and create the visual effect with the material using a texture as mask for an transparent-shader


Where is texture mapping panel in 2.8? I can not find Texture channel panel (image below) in 2.8

The picture was on blender manual.

The Blender Internal (BI) render engine is no longer a part of Blender since the 2.80 release, which means that this specific panel no longer exists. However Cycles and Eevee both have a node-based material system that lets you configure the same properties. Switch to the Shading workspace or open the Shader Editor in one of the areas.

Shading Workspace

Shader Editor

The basic node setup uses a Texture Coordinate,
Mapping and Image Texture node.

The Texture Coordinate node provides access to the active UV map, which can be used as input to the Mapping node. Similar to the texture panel for Blender Internal, you can adjust the location (BI: Offset) and scale (BI: Size) as well as the rotation. The vector output of the mapping node is connected to the Image Texture node. There you can find the Projection property.

The UV Map node is useful if you want to use a specific UV map, not just the currently active one. In this case you can replace the Texture Coordinate node with it.

All nodes offer even more options, that are documented in the linked pages of Blender's manual.


Fakery: High Resolution Fluid Sim I want to make an animation of an arrow (like from a bow and arrow) piercing a raindrop. Pretty quickly, it occurred to me that if I want to make a rain scene straight up, I would have to use a gigantic domain and extraordinary resolution. In addition to being probably not the best idea, I'm working on an 8-year-old computer which can't do that kind of hard core simulating.

What I'm asking is what is the best way to make a rain scene that can be interacted with? I'm fine with any sort of fakery as long as it looks decently realistic.

You definitely don't want to use a fluid simulation for rain. I'd use a particles system for the general rain in the scene. You can use Dynamic paint to make the particles interact with a "water" surface to make ripples (without actually using fluid sim).

For the arrow piercing a raindrop, that's more like a hero shot, up close in the foreground. I'd probably use soft body physics on the raindrop as it will be large in the shot (possibly), and at that size the surface tension of the water drop will be more like a gel object instead of flowing water (until it bursts). The trick is once the arrow pierces through and breaks the surface tension. At that point you do want something more like a fluid sim effect to show the displaced water splashing out around the arrow.

Here's a quick mockup of the fluid sim for the hero rain drop. Note I went for a slow motion look and decreased the gravity to -1m/s2.


Addon or featurs in Blender capable of profiling scene? Im looking for a addon or a feature in blender that can analyse my models. I get them from an engineering department and some of the contain for an example small springs (highly detailed shape), which count up 30k triangles. Therefore the entire thing could easily end up being 250k triagles.

I need something that can profil my scene and tell me maybe a list with each mesh and their respective vert, tris, face counts

Any ideas from the comunity.

There are several ways, with which you can retrieve information about the imported objects in your .blend file.

The Outliner shows all object in a hierarchy in the scene. In Object Mode, the header will show the vertex, face and triangle count of all objects. You can select objects in the outliner and the 3D View.

Expand an objects hierarchy with the + icon. It will reveal a mesh datablock. Click on the mesh datablock to enter Edit Mode. In Edit Mode, you can manipulate the vertices, edges and faces in the 3D View. The header will now show the Verts, Faces, Tris count of only this selected object.

Scripted

You can load a simple script into Blender's Text Editor and execute it from there. The following script will write the name, vertex count, edge count and face count to a file which is specified in line 4. You will have to change the path according to your needs.

import bpy
import os

path = "U:/PWP/Desktop/info.csv"

with open(path, 'w+') as f:
    for ob in bpy.data.objects:
        v = len(ob.data.vertices)
        e = len(ob.data.edges)
        p = len(ob.data.polygons)
        tris = sum(len(p.vertices) - 2 for p in ob.data.polygons)

        f.write(ob.name)

        for data in [v, e, p, tris]:
            f.write(',' + str(data))
        f.write('\n')

Tris count added from batfinger's comment to this answer. Excluded in the table below.

The created csv file can be opened in various applications such as Notepad or any Office Suite.


How do I make the ends of a pole less square? I have a pole-like shape (octagonal prism) with a bevel added on both its ends and branched into two. The faces are triangulated and the triangles are converted to quads. I applied a subdivision surfaces modifier. The edges of the ends are not perfectly circle, though; there's difference between the bevel thickness with subdivision surfaces.

screenshots album

How can I fix this and make the ends look less like squares and more like circles?

To make subdivided edges look as expected make the corner loops follow the curvature of the desired shape (i.e. circle).

In this case, dissolve quad face in the middle (select edges, press X > Dissolve Edges), inset resulting Ngon twice (press I with face selected), select inner edge loop and merge it at center (Alt+M > At Center).

Note that you might want to dissolve also 4 edges in the resulting cap to get rid of tris.


how can I double an image for UV mapping? I am making a moth for use in Unity and it is flying great, but I need to double the png file so it is the same front and back. Is it possible to duplicate within the UV editor or do I have to make a doubled image in gimp and hope it fits?

I don't think you can duplicate the image within the blender UV editor. However, you can as you said create another image using GIMP. In the UV editor go to UVs > Export UV layout to have an image of your UVs. Then you import it in GIMP and you can edit it. That way, you can be sure it will fit !
You can also make your 2 UV islands overlap in the UV map of your moth. It is pretty quick and you just have to reimport your model in Unity, but I don't think it is something to do when you are making a game (something to do with lightmaps or something like this....).
I am not sure I am being clear enough ...

Hope it will help !


Unparent Bone and current bone keep transform How do I unparent bone from its parent bone but keep unparanted bone and its child bones transform and rotation?

If I unparent bone, unparanted bone and its children change their position and rotation. I wish to keep it.

Will appreciate script for that if possible.

Control + A is a keyboard shortcut for applying a changed bone position as it's rest position in 'Pose Mode' (Maybe when you cut the posed position, it reverts back to it's rest position that you created it at?)

Control + A in object mode applies rotation, scale, and location.


bevel doesn't work right Im using last version of blender and when I want to bevel, blender does this:

instead of this: (make it manually)

so maybe this happens because I have my configurations wrong but I don't know how to turn it as default (if thats the reason)
Someone knows how to make the bevel work normal?
WITHOUT MODIFIER! JUST WITH THE BEVEL TOOL IN EDIT MODE!

if you press n and go to:
item -> transform -> scale
can you see if the scale is all 1?
for example scale is all 1

if it is not all 1, for example, if it is something like (4, 1, 0), it is not all 1

if this is the case, this might help: go into object mode, select the object that is causing the error, Press ctrl+A, and then choose Scale

now check to see if the scale is now is all 1. If it is try beveling again.
I hope this helps
if it does not work. Do you happen to have other modifiers or connections to other objects that might be changing the scale of the object?


Quality loss in black&white conversion First of all, I hoped I'm not asking a duplicate of some question (I didn't find any).

I'm currently editing a short-movie, and the main part of it is black and white. We recorded it in colors, so I'm using the video sequence editor to go in black and white for these sequences. My problem comes here (I'm setting the saturation of each strips to 0, but I tried other ways like using a Hue correction Modifier, same result).

Then in a scene, we used a old-look iris effect (darkening borders of the video). I tried different ways but all with the same ugly result : use a transparent png image, use a mask, ...). Here is the actual mask I'm using :

I can't see how to get it more simple than that. Then here is a zoom on a corner when I render a frame to a png image :

It looks normal, isn't it ? Let's see how it looks when I render the video in a .mp4 file :

It's a bit subtle, but I assure you it's reeeeeeally ugly. It looks like now Blender has only 10 choices of gray for that gradient. Shouldn't it have thousands or millions of colors available ? Finally, here is my configuration :

I want to underline the fact that I used the VSE for almost 10 short movies now, and the encoding has always been perfect. I always used H264 in mp4 container, and it looks great (lossless, any encoding speed). But that's the first time we are doing some part of a movie in black and white, and I'm really upset about this result.

Have you any guess why it's sooo ugly when rendered in a video ? What causes the loss of quality ? I have other small quality problems about black and white, but this one is really bothering me ...

Feel free to ask any additionnal informations ! And thanks a lot to have taken the time to read me !

NB : Our camera is a Sony A6000 (hybrid camera) and works perfectly.

Shouldn't it have thousands or millions of colors available?

There is a difference between how the compositor deals with imagery, versus the VSE. The majority of the VSE code paths use unique to the VSE code, and are designed for 8 bit per channel paths, or 256 discrete steps from 0.0 to 1.0. The compositor on the other hand, uses 32 bit float per channel, which is a decimal format and provides much larger granularity in between values.

  Have you any guess why it's sooo ugly when rendered in a video?

The issue is quantisation.

When you apply your mask to an 8 bit image, which all motion pictures encoded in codecs are loaded as in the VSE, you are already constraining your work.

A vignette is a constriction of light, which is a simple multiplication operation. 8 bit imagery is encoded using integers, or whole numbers. This means that if your mask is trying to set a value between 24 and 25, it can't. It is forced to quantise the value to 24 or 25. So the first problem is working in the VSE which is hammering your effort with quantisation artifacts long before you get to encoding it into a video codec.

  What causes the loss of quality?

The second portion of the problem is a codec. Codecs are designed for a number of different needs. Many times, that need is to conserve bandwidth. This means trade offs at the quantisation level as well as compression artifacts. In this case, the motion picture signal is complexly scaled to less than 8 bits per channel, and then further compressed temporally and spatially. While it might not seem like much, that scaling, when placed on top of already sub-optimal 8 bit manipulations, results in a significant degradation in quality. Now stack compression on top of that and you can begin to see where the image begins to fall apart.

Worse still is that at the lower level values your demonstration has, the sRGB OETF is not terribly efficient at encoding. This means that there are very few code values allocated at the lower end, and they must be crafted well or they will exhibit posterization.

In the end, it is a four pronged destruction:

VSE 8 bit quantisation.
Codec signal scaling.
Codec compression.
Inefficiency of the sRGB OETF transfer function.

Solutions may include:

Use the compositor for all work.
Use lower compression levels in output encodes for codecs.
Avoid output / input encoding to file formats, especially codecs, while working on a project. If files must be saved, save individual frames as EXRs. Doing otherwise stacks repeated degradation on the work.


How to get started in designing games How can i design games in a more interactive and in efficient. What steps are required to design a game. What tools are used in designing games?

There are many ways to build games, and you have almost unlimited options, it's just up to you to pick.

Blender has it's own built-in game engine, but there are other free ones, which many people believe to have superior features, such as Unreal Engine and Unity 3D. You may consider trying one of these options, as they are more widely used.

However, the Blender Game Engine is quickly advancing, and it takes less knowledge of importing/exporting models, and complex graphic knowledge in general, than the other two. Because we are on a Blender forum, I will focus on Blender here.

A good way to get started, is by learning from some simple "project tutorials". Here are some good ones by Born CG.
If you don't know much about coding, and still think making games is for you, now is a good time to learn some code. I recommend Python, as it works well with many programs, including Blender.
Now that you know some code, you can learn how to integrate that code into Blender, or other software. Here's another tutorial.
Now that you know a little bit about it, you can join a project. This can help you to learn other skills, and get in the community. (before you do, you may want to consider how long you are willing to spend on it, so you don't get caught up. A good project that uses Unity and is going somewhere, is here.)

So consider it... and see what you come up with. :)


Add confirm upon release event to a custom shortcut I've changed shortcut for pan 3D view to spacebar + mouse movement and it works fine because at the bottom of the shortcut edit window there's a View3D Move Modal section that allowed me to tell Blender to confirm (stop panning) upon releasing spacebar.
I'm trying to do the same for 2D view (node editor). I could set spacebar + mouse movement for panning but there isn't a View3D Move Modal section there.. when I release spacebar panning doesn't stop. When I hit Esc it does stop.
How can I configure the same behavior for 2D view as I could configure for 3D? I only have basic knowledge of changing shortcuts but no python scripting.

I now understand I've been overthinking this while the solution is simply to set spacebar for panning both in 2D view and 3D view.
For some reason I thought in the 3D view/pan view window I needed to set mouse movement, then spacebar as a modifier and then in the view3D Move Modal section in the bottom also set confirm: spacebar: release to make it work the right way (see image with my overcomplicated setup) It did work but was unnecessary complicated and could not be applied for 2D view.


how to use curvature in paint mode? i'm trying to use curvature while painting texture, but it seems to fail in some way.

dirty vertex color seems fail too

i just modeled this object in one minute in freshly opened blender. what am i supposed to do to make right curvature calculations?

more simplier shape just appears to have no cavity at all.

i'm using blender 2.76b btw

EDIT:
just tested it with deformed plane and it worked!!!

but how am i supposed to paint over complex mesh?

come to a solution based on the fact that cavity is calculated in blender based on the verticies. made a tripple subdivisio and was able to paint edges properly.


texture turns purple when image sequence offset changes i have this problem with the image sequence where the only frame that appears is the first on while the others appear purple, i made it so the textures appear overlapping but for some reason when i change the offset its purple. i even tried adding the textures over and over again but it didnt work. help

turns out the textures i used had to be numerically named for blender to get it right


Inverse kinematics acting weird I added a rig with both forward and inverse kinematics but whenever I move the right hand then for some reason the left arm moves in a weird way, same withe the feet.
I have already checked and every bone is labelled correctly and no bone constraint has the wrong bones set.
Thank you.

You have weight painting problems. Here's how I found the first one:
Go back to object mode and select the model.
Go into edit mode.  Select solid view and xray:

deselect all with ALT-a
In the Properties editor, in the Object Data Tab, go to the Vertex Groups area and select one of the relevant vertex groups.
Press the select button.  The vertices that are in that group become selected.  Here, for example is the model with bicep.R selected:

Keep doing this and you will eventually come to forearm.R:

Select it and you get:

Since the left forearm vertices are selected, they will move when the forearm.R deformation bone moves.
In this case, a simple fix is to manually deselect all of the vertices that should stay in the group.  I used circle select with middle mouse but there are a lot of ways.

Next go to the vertex group and click "remove".  This will remove the remaining vertices from the group.
as you can see that partially solves your problem:

What I did isn't the usual way of fixing this sort of problem.  Normally you would use weight paint mode.  It looks like you have a lot of related issues so you might want to find a tutorial on weight painting.


Why is it the body clipping through shinkwrapped shirt? I shrink wrapped my shirt, set the offset to 30, made a thickness from the solidify, weighted the armature move with the shirt, and yet some of the mesh or the normal's clip through the shirt when I rotate a bone. why?


Edge softening with cycles material Is there an edge softening option for rendering? I don't have the time to model a high poly model and I want these soft edges only for renderbut not in the geometry. This possible in rhino 6 render and vray already; is it also possible in blender?

Welcome to Blender Stack Exchange!

Cycles has a Bevel node (found in the add menu under Input>Bevel) that does exactly what you want. Simply plug the output of the Bevel node into the normal input on your shader/material and that's it. The example below shows a basic setup. The radius can be increased to make the corners look even more rounded.

Blender also has a Bevel modifier that will add the geometry very quickly as well. Depending on your model it may be an option too.


Which rx5700xt's driver is stable with blender? Every time I try to use GPU compute in cycle, Blender crash, I don't even have to render, the moment I switch from CPU to GPU in Blender's cycle, the viewport would say "Loading render kernels", and then after a while, it crashes. And when I do try to render without entering render mode in the viewport, it would also say loading render kernels and then crash.
I have seen people benchmarking cycle render with rx5700xt online, so I assume that this is a driver issues. I would like to know which version of Radeon software and drivers should I install for the gpu to work in Blender?
This is my current system:
CPU: Ryzen 7 2700x;
GPU: MSI Rx5700xt Mech OC;
Ram: 2x16gb;
OS: win 10,
Blender version: 2.83.7;
Radeon's Software version: 20.9.1

try blender 2.82a, it may obsolete but run properly for me
i am using rx 5600 xt, 20.9.1, windows 10 20h2
the version above that crashes, or use radeon prorender


Plot single vertices based on xy coordinates from CSV file I'm aware there are numerous posts/questions already been raised on this, but upon reading the previous posts, I'm not quite able to find exactly what I'm looking for. So apologies if there's a duplicate post that already answered this.
Basically, I have a CSV file with 3 columns = x coordinate, y coordinate and pixel value (based on 255 greyscale). All I want to do is import this CSV file in Blender and plot the points as vertices, using python script. That's it. So if there are 3 points in the CSV file, I want those 3 points created/plotted in their respective xy coordinates as vertices in Blender.
I've seen examples of python scripts for adding mesh objects. But I simply want to plot the points given the xy coordinates in the CSV file, as vertices. Not add existing 3D objects/meshes.

This is the code I have so far:

import bpy
import csv

with open(r'file path\img_pixel_coor.csv') as csvfile:
    csvread = csv.reader(csvfile)
    for i, row in enumerate (csvread):
        print("i = "+str(i)+". row = "+str(row))

This prints:

i = 0. row = ['494', '216', '86']
i = 1. row = ['494', '217', '86']
i = 2. row = ['494', '218', '86']
i = 3. row = ['494', '219', '85']
i = 4. row = ['494', '220', '84']
i = 5. row = ['494', '221', '87']
i = 6. row = ['494', '222', '87']
i = 7. row = ['494', '223', '88']
i = 8. row = ['494', '224', '92']

The print is just to show what's in the file (logging purposes).

Also, would it be possible to put this script in a python file, and run it from a python file, without having to manually open Blender, i.e. can you control externally from a python file, to open Blender and run the script, without having to actually open Blender software manually yourself?

Any help would be greatly appreciated.

Update:

Here's a sample of how the CSV file looks like in the first few rows, to demonstrate how the x, y and pixel values are structured:

Finally, how do I smooth the vertices more. As you can see from the image below, the surface of the mesh is very spikey. I used the code below, but it's still very rough/spikey surface.

for p in ob.data.polygons: #Set smooth shading (if needed)
    p.use_smooth = True

Many thanks in advance for any help.

Illustration (my understanding):

of the code:

# Vertices store the color values as Z
vertices = [Vector( (x, y, int(z_max * random.random())) ) for x, y in product( range(x_size), range(y_size) )]

# Get base face indices
face_basis = ((x * y_size) + y for (x, y) in product( range(x_size-1), range(y_size-1) ))

# Each face is a square for the base index turning around counterclockwise
faces = [(v, v + 1, v + y_size + 1, v + y_size) for v in face_basis]

I suppose the input data is a 2D grid with known max values.

Here, we start with a random input but seeing your question you know how to load data from a file.

The script below does the following:

Create random inputs (you'll use file data instead)
Create vertices and store the color value as Z coordinate
Create the face vertex indices
Make a mesh object from that
Scale the object along Z
Create a vertex colors layer
Assign the Z value of the vertices as vertex color
Link a prepared material to the object

That gives the following result:

import bpy
import bmesh
from mathutils import Vector, Matrix
from itertools import product
import random

# Generate a random grid of the given file
x_size = 20
y_size = 30
z_max = 256

# Vertices store the color values as Z
vertices = [Vector( (x, y, int(z_max * random.random())) ) for x, y in product( range(x_size), range(y_size) )]

# Get base face indices
face_basis = ((x * y_size) + y for (x, y) in product( range(x_size-1), range(y_size-1) ))

# Each face is a square for the base index turning around counterclockwise
faces = [(v, v + 1, v + y_size + 1, v + y_size) for v in face_basis]

# Create resulting object
name = "grid"
mesh = bpy.data.meshes.new( name )
obj = bpy.data.objects.new( name, mesh )

obj.data.from_pydata( vertices, [], faces )

# Scale it along Z
scale = 1.0 / z_max # Or set 0.0 here
obj.matrix_world = Matrix.Scale( scale, 4, (0, 0, 1) ) @ obj.matrix_world

# Smooth faces
for face in obj.data.polygons:
    face.use_smooth = True

# Get or create vertex colors data of the given name
vcol_name = "VCol"
vcol = obj.data.vertex_colors.get( vcol_name )
if not vcol:
    vcol = obj.data.vertex_colors.new( name = vcol_name )

# Assigns z values as vertex colors
for face in obj.data.polygons:
    for vertex_index, loop_index in zip( face.vertices, face.loop_indices ):
        intensity = obj.data.vertices[vertex_index].co.z / z_max
        vcol.data[loop_index].color = (intensity, intensity, intensity, 1)

# Get the prepared material
material_name = "Material"
material = bpy.data.materials.get( material_name )

# If found assign it to the object
if material:
    obj.data.materials.append( material )

# Link the object to the scene
bpy.context.scene.collection.objects.link( obj )

The material is the following:

It uses the created vertex color as input for a color ramp and use this color for shading:

As your question was about plotting vertices, you may want to rework the mesh manually or modify the script to have this kind of results:

Note:

An illustration for

# Vertices store the color values as Z
vertices = [Vector( (x, y, int(z_max * random.random())) ) for x, y in product( range(x_size), range(y_size) )]

# Get base face indices
face_basis = ((x * y_size) + y for (x, y) in product( range(x_size-1), range(y_size-1) ))


Bump Node Not Going Through When Connected Into Normals I'm connecting the bump Node into the normals of the principle BSDF shader , but it's not appearing on my texture. A user already helped me set up the nodes. But I'd like to add a bump to it as well.
Thank you.

Connect a texture to the bump. Either a normal map into the normal input or a texture (such as noise) into the height input. Then control the strength with the distance and the strength values.


Any way to automatically mark sharps where edges of UV maps are? I have a photoscanned object that (of course has randomly marked edges of the UVs) and placed them in the correct places on the material (right window). Is there a way to automatically select all the edges where the UV edges are so that I can then mark them as "Sharps"?

Blender can mark the edges for you :).

Select your whole UV map an go UV > Seams From Islands
Select one of the new seams and go Select Similar > Seams
Go Edge > Mark Sharp


why does the subsurface modifier create such a harsh edge here I have tried various fixes like removing doubles, altering the mesh, the problem persists.
Here's the .blend:
https://drive.google.com/open?id=1OwhsqAuXHCTySSfbciQxV9f1igz4xLQ1

It looks like it's a problem of normals, select all and ShiftN to recalculate and it will fix it.


cycles glass acting odd the glass is acting odd

the faces are oriented the right way

so i thought it was because of the odd geometry

and i dissolved those

so im stuck can someone help me

I would try clean up that topology around the bottom of the glass - rather than those stretched areas, delete those faces and try clean loops, it will help even out the subdivision surface. Use edge loops or Inset (I) as required.


Why is this bone not keyfaming or animating when keyframed? I've been animating a character and everything's been fine until I tried to move the "Belly" bone's location. At first, I wouldn't get any errors, and when keyframed, the belly wouldn't move. It would just stay in the last position I moved it in. Rotation's fine, and every other bone is fine, but this one's not.

Even in the properties, the rotation and scale values were yellow, showing a keyframe, but I couldn't keyframe the location values - they just stayed green.

Then I tried fixing it and I think I made it worse, not sure what I did. Now it won't let me keyframe it at all - location OR rotation.

I need to be able to animate at least the belly's rotation and location.

Here is my .blend file -

As the error message hints, your animation channels are locked:

You need to click the padlock icon next to the bone name in the Dopesheet Editor to unlock them all. You probably just clicked it by accident. This solves being able to insert new keyframes, but the bone still doesn't move when animated. This is because the location channels are also muted:

Locking protects the animation channels from being edited (inserting/deleting keyframes) and muting temporarily disables them (hides their effects).


Flock behavior using Blender python scripting I am very new to the blender python scripting. I am planning to do a
flock (boids) behaviour using python script in blender. With a little research, I find some animation script examples for bge but not for blender python. Can anyone please help me
to start with this. Any links to the tutorials will be appreciated.

Thanks

Blender actually has a built-in boids implementation. If you don't need to use Python for some reason, you can do this with Particle Systems.

Go to the default cube (or whatever object you want the flock to start from), go to the Particles tab (second from the right in the Properties panel), and click the New button.
Scroll down to the Physics section, and click Boids. There are a lot of options to tweak here.
Now you have a basic flock, but they'll just drift around aimlessly at this point. (You can watch them by pressing Alt+A.) To make them attracted to an object, select the object, click on the Physics tab (all the way to the right), and then click Force Field.
Set it to Force to make them attracted or repelled to the the object.

A negative strength will attract them, while a positive strength will repel them.

In the particle Physics section on the emitter, you can make them interact with other boid flocks in your scene.


After applied as rest position mesh doesn't move I'm really new to blender and english isn't my native language so i'll try to be as clear as possible. I'm making an animation for an university exam, i made a simple videogame character that i'm going to animate.
The character is an archer so he got a rigged bow and arrows as props; he wears a shirt, a vest, trousers, gloves and boots. All of them are different elements, i didn't joined the wearing stuff because i thought it could have been more simple to manage and edit the single elements.
After i used the Rigify Modifier i tried to put him in an idle position and when i had done it  i had accidentally applied the pose as rest pose. Since then, the only thing that moved was the rig but the mesh seems to stand still and even if i try to move the rig in pose mode it doesn't move.
There are many question that i would like to do, but essentially: Why the meshes doesn't move along with the rig anymore? And where i can find that bloody rest pose!? (I just selected "Apply as rest pose" because i was thinking maybe that was the only way to make that position the default pose in viewport and a good starting pose for my animation)

If you have nothing to loose, delete and regenerate your rig.
When i reset my rig i select all the bones and then
Select all the bones, in pose mode with A. Then, hit:
ALT R to reset all rotations,
ALT G to reset all translations,
ALT S to reset all scales.
Or select all bones (A) and hit space. Then search for "clear pose"


Reseting blender gui in a loaded model I have tried to model my first object in blender after watching online tutorials. But when I came to adding modifiers, it turn out, that I can#t find them at any sidepanel in blender. Is there are way to reset these panels to the point when you create a new object?

While loading a scene unclick Load UI option:

If your file has already opened, you need to reload startup file first (File -> New)


How to make concave disk? (Solved) I am relatively new to blender and I am trying to make a concave disk (or really short cylinder) and I can't find any tutorials on how to do this. Could somebody please point me in the direction of a tutorial or tell me how? The shape I am trying to get is below. Thanks.

(source: ingersolltillage.com)

Create a UV Sphere and delete the bottom half of it in Edit Mode. Go back into Object Mode, select the entire half-sphere and scale it only on the Z axis. (press "Z" while scaling is activated) That should give you a concave disk.


How do you restore previously tracked footage? I've recently reformatted my PC, and once I reinstalled and loaded my Blender file back up, the trackers were still there, but the footage wasn't. I tried to reload the sequence back up, but now that the footage is there, the trackers aren't. Though they do appear in the camera's view in Object Mode. How do I go about reasigning those trackers to the footage?

Thanks

In the Movie Clip Editor use the footage settings.
Click on the folder icon and navigate to the place where the video clip is stored.

Alternatively you can use the outliner. Set it to  Data-block and manually edit the path to the Movie CLip file.


Why can´t i select the image frame? So I am trying to select the frame in order to zoom out a little as
I normaly do, but somehow i can´t select it. I tried it in other files and it worked there. I recognized that there is normaly a clear black outline at the frame but in this case it´s somehow missing. What am I doing wrong?

I have the answer. I noticed that there was no camera in the layers I wanted to render. I simply had to additionaly select the original layer where the camera was placed in order to manipulate the camera view.


Map multiple textures to a face individually I have two textures mapped to a uv unwrapped face but one of them is the wrong scale. If I change the uv map to make it right it throws off the other texture. Is there any way I can have multiple uv maps for the same face so I can scale one texture without changing the other?

Yep, you can manage them in Object Data > UV maps:

To use a particular map, you can select it via the UV map node (cycles):

Or in the texture settings (BI):


Why my texture painting is repeating? I was following the doughnut tutorial made by Blender Guru,and I bumped into some problem:
1.I can't get the purple doughnut in UV editing mode. (So I UV unwrapped,did get a purple doughnut in Texture paint mode(not in UV editing mode),but don't know what would that help or effect anything)

(After UV unwrap)

(Got a purple doughnut in Texture paint mode)
2.And then I pressed the + New on top of the left panel to add a new image(2048*1042),and used Shading node to add the image to the texture of the doughnut,then I started painting,found out that my texture is repeating.

(Add the texture to the doughnut)

(The texture repeating)
Sorry for the bad English.
Have a nice day.

It is repeating either because you've unwrapped every quad to the whole UV coordinate space (each quad becomes a square going from x:0,y:0 to x:1, y:1), or because of this setting on your Image Texture node:

What this "Repeat" means is that if a particular point of a mesh is mapped (in the UV map) to a point (texel) outside the texture (e.g. x: -5), then it should be "wrapped" from the other side, so for an image 2048 pixels long, the x: -5 becomes x: 2048-5 = x: 2043. This repeats, so x: -6000 becomes x: 2048-5000 = x: -2952, which becomes x: 2048-2952, which becomes x: 2048-904 = x: 1144. The effect is that a mesh with UV map spanning from x: -6144 to x: 2048 will repeat (horizontally) 4 times.
Go to the UV Editing tab, edit your mesh, select all faces (3, then A) and on the left side see if some of the quads go outside the texture - if so, select everything there (again 3, then A) and scale it down (S) until it fits. If you only see a single quad, then you need to properly unwrap the mesh.
How can I mark the seams to UV unwrap a torus?


Cant see Object with "ocean" modifier through glass I have a small issue with transmission. I cant see objects with "ocean" modifier through and object with transmission.

In the example you will see that the transmission is working on the blue object, but not on the one with the Ocean Modifier.

I am using EEVEE in Blender 2.82.

After getting very constructive and utterly important changes in my question structure, I have found out, that the "transmission" DOES in fact work on the Ocean Modifier. After creating the scene in a new file, I haven't changed any setting, only the material of the objects. I think there was a mistake in the light setting or a change in the World Properties, that made the transmission not working probably.


How do I rotate bones along bone axis? How do I rotate a bone along the bone axis? Nether the local or global help.

The bone in edit mode has no rotation. And that probably why you cannot obtain a local axis coordinates.

But you can set the axis to "normal" and (for instance) use 'individual origins' as pivot point to rotate it around X or Z.

To rotate it around Y, use the roll value on the panel on the right.

You can do it with 'local' (or normal) axis in pose mode. It will work for X, Y and Z (no roll here).
Once done, apply the pose as 'rest pose':


Lighting doesn't make objects cast shadows I wanted to make a Solar system in Blender. Everything on the scene is made pitch black (including World), except planets and Sun. I want that planets cast shadows so I added an Emission node to the Sun, but planets are still fully visible.  All planets just have Image Texture nodes like this. And this is Node Tree of the Sun. My render engine is Cycles.

You need to disable Ambient Occlusion in the world properties.

If you use the shader of the sun itself to light the scene, your texture will be overwhelmed by the emission part and any detail will be lost.

You can emulate the light from the sun by using a point light centered on the sun itself. Remember to set its size to a high enough number so that it is bigger than the sun object or else light won't get through to your planets.
You can then set the emission strength of the sun to a low enough value that it still appears to be glowing but you still see all the details of your texture.

Details on the point light (Adjust these settings depending on your scene) :


Reducing the number of faces on a basic text mesh I want to create a text animation in blender. I'm trying to reduce the number of faces in my mesh. I'm having a lot of trouble adding faces to certain letters after I have gotten rid of some of the edges. For example, when I try to fill the letter "A" the entire letter including the negative space is filled.  I've tried ripping and separating the match but I haven't had much success.  I'm trying to mimic a YouTube tutorial but I'll never get to the end if I can't get the mesh straight.

I've included a screenshot of my project and a link to the video. My knowledge of edges vertices and faces or lack thereof is probably was giving me trouble.

I appreciate any assistance that you can give me

SAMPLE TUTORIAL

The problem is that if you try to delete too many edges on this kind of shape with a hole, Blender won't be able to understand what he's supposed to fill and what is supposed to be a hole. So keep the necessary edges. For example here are a try with an O with two different topologies:


Straighten the series of vertices in UV editor I've got a bottle modeled and I want to put a Nuka-Cola label on it. I took where I want to put it, marked the seam, and unwrapped it. It looks like this:

I want to straighten the UV so that it matches the angle of the Label, is there any way I can do this? I understand it will be a bit distorted, but i'll deal with that afterwards.

Here's my project files (Not using Blend-Exchange because you need the images aswell)

If you don't want to straighten your UV islands (How do I straighten UV maps?), cause in your case it might be very time consuming you might repeat the steps I've shown in the .gif below.
In Edit Mode select all faces (A), press U-->Lightmap Pack-->OK. Now select one of the face to make it active, then again press U-->Follow Active Quads-->OK. Your UV island is straight now. Adjust it using G, R and S to fit the image. If your mapped image is upside down just scale it negative 1 (S,Y,-1).


How can output of "copy rotation constraint" be accessed? Object C has copy rotation constraint and is copying rotation from A and B

When i rotate objects  A and B  target object C rotates but the Transform does not show the resultant rotation values.

Q1: Where dose the resultant rotation values are show?

Q2: Can they be accessed through python?

Use the world matrix.

On Q2 target_object.matrix_world.to_euler() will give you the resulting Euler rot, which could be used in a panel to ans Q1 part.

Example script using the panel template.

import bpy
from math import degrees

class LayoutDemoPanel(bpy.types.Panel):
    """Creates a Panel in the object context of the properties editor"""
    bl_label = "Layout Demo"
    bl_idname = "OBJECT_PT_layout"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

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

    def draw(self, context):
        layout = self.layout
        obj = context.active_object
        col = layout.column()
        mw = obj.matrix_world
        euler_rot = mw.to_euler()
        for axis in "xyz":
            col.label(text="%c : %7.4f" % (axis, degrees(getattr(euler_rot, axis, 0))))

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

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

if __name__ == "__main__":
    register()


Alternative update callback for PointerProperty? I have created a custom property

class CSGOriginProperty(bpy.types.PropertyGroup):
    origin = FloatVectorProperty(subtype="XYZ", default = (0.0,0.0,0.0))
    size = FloatVectorProperty(subtype="XYZ", default = (1.0,1.0,1.0))

    def template_layout(self, layout):
        row = layout.row(align=True)
        row.label("Origin")
        row.prop(self, "origin", text="")
        row = layout.row(align=True)
        row.label("Size")
        row.prop(self, "size", text="")

And it is then used in a node

class CSGOriginNode(Node, CSGNodeTree):
    """CSG Origin Node"""
    bl_idname = "CSGOriginNode"
    bl_label = "Origin"
    bl_icon = "OBJECT_DATA"

    def init(self, context):
        self.outputs.new("CSGOriginSocket", "Output")

    def uda(self, context):
        print(uDa)
        if self.outputs['Output']:
            self.outputs['Output'].default_value = self.OriginProperty
        self.update()

    OriginProperty = bpy.props.PointerProperty(type=CSGOriginProperty, name="OriginProperty", update=uda)

    def draw_buttons(self, context, layout):
        self.OriginProperty.template_layout(layout)

Normally updating the property would trigger the uda function, but in the case of custom properties using the PointerProperty it would seem this is not the case. Is there a workaround for this?

Major edit:

After re-reading batFINGER's answer, I have figured out another way to do this for Bender 2.79+. One of the key points batFINGER highlights is that you can work out which node is the parent by checking all nodes and seeing if the property is a member of one of them.

Instead of creating a factory though, I created this function that iterates through a node tree and tries to find the node with an attribute that is prop:

def find_prop_node(tree, prop):
    if tree is not None and prop is not None:
        for node in tree.nodes:
            for attr in dir(node):
                if getattr(node, attr) == self:
                    return node
    return None

Now all the property has to do to find its parent node is call find_prop_node from its update function:

class COProperty(PropertyGroup):
    tree = PointerProperty(name="tree", type=NodeTree)
    call = StringProperty(name="call", default="update")

    def callback(self, tree, func):
        self.tree = tree # node.id_name
        self.call = func

    def update(self, context):
        node = find_prop_node(self.tree, self)
        if hasattr(node, self.call):
            getattr(node, self.call)(context)

    origin = FloatProperty(default=1.0, update=update)
    size = FloatProperty(default=1.0, update=update)

    def template_layout(self, layout):
        row = layout.row(align=True)
        row.prop(self, "origin", text="Origin")
        row = layout.row(align=True)
        row.prop(self, "size", text="Size")

The custom Node code now looks like this (note self.id_data instead of self.name):

class CONode(Node, CONodeTree):
    """CO Node"""
    bl_idname = "CONode"
    bl_label = "Origin"
    bl_icon = "OBJECT_DATA"

    def uda(self, context):
        self.update()

    coProp = PointerProperty(type=COProperty, name="coProp")

    def init(self, context):
        self.coProp.callback(self.id_data, "uda")

Because this method isn't reliant on the node's name it isn't susceptible to breaking after a node is renamed. Iterating though the entire node tree might be slower, however.

By adding 2 StringPropertys (parent and call) to the PropertyGroup which store the name of the node that owns it and the function it should call, it can do getattr(self.id_data.nodes[self.parent], self.call)(context):

class COProperty(PropertyGroup):

    parent = StringProperty()
    call = StringProperty(default = "uda")

    def uda(self, context):
        if self.parent in self.id_data.nodes:
            if hasattr(self.id_data.nodes[self.parent], self.call):
                getattr(self.id_data.nodes[self.parent], self.call)(context)

    def callback(self, name, call):
        self.parent = name
        self.call = call

    origin = FloatProperty(default = 1.0, update=uda)
    size = FloatProperty(default = 1.0, update=uda)

To set it up in the node simply call self.coProp.callback(self.name, "uda") in the init (and in update if the name of the node can change):

class CONode(Node, CONodeTree):
    """CO Node"""
    bl_idname = "CONode"
    bl_label = "Origin"
    bl_icon = "OBJECT_DATA"

    def uda(self, context):
        self.update()

    coProp = PointerProperty(type=COProperty, name="coProp")

    def init(self, context):
        self.coProp.callback(self.name, "uda")


camera movement for game? Ok ive setup some keyboard movements for forward, backwards, turning left, turning right. But what I want is when I move my mouse I would like my camera to pan to the right, left, up, or down some. Think about the movement controls in minecraft if that helps any.

Use the mouse actuator on your camera.

delay>and>Mouse, mouse look.

Set the delay to 0.01 and enable true-level-triggering this will behave as an always sensor, but delay works better with mouse look. The delay will read 0 but it really will work for 0.01 frames.
Create a mouse actuator and set the type to mouse look.
You can specify how you want the mouse to look in the properties of the actuator. Basically, if it's turning too far when you move your mouse, increase the min. value and decrease the max. value.


Understanding (and fixing) non-manifold geometry I'm trying to understand Blender constructs and manifold vs non-manifold geometry.
I do a lot of modeling for 3D printing, so really need to get this right.
I've looked at a number of tutorials on YouTube, and Googled the subject extensively, but still cannot find anyone/anywhere that explains the basics.  I have tried all sorts of things, but I'm still confused.
Let me start with an example:
I've created a cube manually.
1)Set Snap-to to "edge"
2)Turn on Snap
3)Add --> Mesh --> Plane
4)Copy plane --> rotate 90 degrees on the x-axis
5)Move new plane and snap to edge of 1st plane.
6)Repeat (similar) steps 4-5 for remaining 4 sides of the cube
7)Join all into one object
8)In edit mode, select all
9)Merge vertices (by distance) and confirm only 8 vertices now exist
10)Using 3D Print addon, do "Check All"
This shows 20 non-manifold edges.  If I use the addon's "Clean Up" --> "Make Manifold" option, it removes three of the six faces and still shows eight non-manifold edges.
I simply don't get it.  Can ANYONE help me with my understanding or point me to a place where I can get it?
Many, many thanks in advance!

When you turn on edge-snapping, then try to snap a point to a vertex, the point will end up on the edge, not on the vertex.
Try the same procedure you gave with vertex-snapping enabled instead of edge-snapping. Everything should work as you expect.
Alternatively, when you merge points that are not in the same place, you can increase the merge distance. Or you could select a group of points you want to merge and merge to center, but your resulting cube is liable to be out of square.


How to remove an object in bge? I have the following piece of code to add an object to a scene in bge. When I use endObject(), the object disappears from the scene, but I can still see it in scn.objects. How can I remove it from scn.objects?

import bge
import bpy

cont = bge.logic.getCurrentController( )

own = cont.owner
scn = bge.logic.getCurrentScene( )
ob = scn.addObject("Cube.001", "Empty", 0)
ob.endObject()

print(scn.objects)

# the output is [Empty, Cube, Lamp, Camera, __default__cam__, Cube.001]

How can I remove Cube.001 from that list?

With KX_GameObject.endObject() you request the game object to be deleted.

This call does not remove the object from the scene at that time.

The object will be removed by the BGE after the actuators where executed. It takes effect within the next frame.

Imagine you put a label on the object ... "please remove" (or you put it in the trashcan). The janitor will remove it when cleaning the room.

Remark: It does not matter if you use endObject() or the EndObjectActuator. The behavior is the same.

Care the timing


Menu not showing up when python script is run I have a python script that I run but the menu doesn't show up, I'm not sure why it doesn't show up in View3D > Add > Mesh.

From:
https://github.com/WannesMalfait/Blender-Add-ons/blob/master/times_table.py

Code below:

import bpy
import bpy_extras
import math
bl_info = {
    "name": "Times Table",
    "location": "View3D > Add > Mesh",
    "category": "Add Mesh",
    "description": "Add a cool mathematical design",
    "author": "Wannes Malfait",
    "version": (1, 0),
    "blender": (2, 82, 0),
}

class Params(bpy.types.PropertyGroup):
    base: bpy.props.IntProperty(
        name="Base",
        description="Number of points around the circle",
        default=10,
        min=2,
        soft_max=256,
    )
    multiplier: bpy.props.IntProperty(
        name="Multiplier",
        description="Step by which points get connected",
        default=2,
        min=2,
        soft_max=128,
    )
    radius: bpy.props.FloatProperty(
        name="Radius",
        default=1,
        min=0.0001,
        soft_max=10,
    )
    skin_modifier: bpy.props.BoolProperty(
        name="Add Skin Modifier",
        default=False,
    )
    mean_radius: bpy.props.FloatVectorProperty(
        name="Mean Radius",
        default=(0.1, 0.1, 0.0),
    )

class MESH_OT_times_table(bpy.types.Operator, bpy_extras.object_utils.AddObjectHelper):
    """ Adds a mathematical times table as a mesh """
    bl_idname = "mesh.add_times_table"
    bl_label = "Times Table"
    bl_options = {'REGISTER', 'UNDO'}

    p: bpy.props.PointerProperty(type=Params)

    def execute(self, context):
        # Intialize the verts lists
        verts = [(0, 0, 0) for i in range(self.p.base)]
        edges = []
        for t in range(self.p.base):
            angle = t/self.p.base*math.pi*2
            verts[t] = (self.p.radius*math.cos(angle),
                        self.p.radius*math.sin(angle), 0)
            result = t*self.p.multiplier % self.p.base
            if(result != t):
                edges.append((t, result))

        mymesh = bpy.data.meshes.new("Times Table")

        # create mesh from python data
        mymesh.from_pydata(verts, edges, [])
        bpy_extras.object_utils.object_data_add(context, mymesh, operator=self)

        if self.p.skin_modifier:
            bpy.ops.object.modifier_add(type='SKIN')
            bpy.ops.object.editmode_toggle()
            bpy.ops.mesh.select_all(action="SELECT")
            bpy.ops.object.skin_root_mark()
            bpy.ops.transform.skin_resize(value=self.p.mean_radius)
            bpy.ops.object.editmode_toggle()
        return {"FINISHED"}

    def draw(self, context):
        layout = self.layout
        col = layout.column(align=True)
        # Control over the parameters
        col.label(text="Times Table")
        col.prop(self.p, "radius")
        col.prop(self.p, "base")
        col.prop(self.p, "multiplier")
        col.prop(self.p, "skin_modifier")
        if self.p.skin_modifier:
            col.prop(self.p, "mean_radius")

def draw_add_menu(self, context):
    self.layout.operator(MESH_OT_times_table.bl_idname,
                         text=MESH_OT_times_table.bl_label)

classes = [
    # Order is important here
    Params,
    MESH_OT_times_table,
]

def register():
    bpy.types.VIEW3D_MT_mesh_add.append(draw_add_menu)
    for c in classes:
        bpy.utils.register_class(c)

def unregister():
    bpy.types.VIEW3D_MT_mesh_add.remove(draw_add_menu)
    for c in classes:
        bpy.utils.unregister_class(c)

I just needed to add the following line to the end of the python script
Thanks goes to @brockmann for this.

if __name__ == "__main__":
    register()


Suspended particles inside a material (procedural) Inspired by reading this very intense thread about procedural materials, I decided to try and build upon saunam's material of "suspended particles in a recipient" to create a material for a watermelon ice pop such as this (the red, top bit):

The idea is to create a translucent material inside of which are present black seeds. I have created a mesh for the seed with a shiny black material, but also tried creating the seeds procedurally.

However, my node-wrangling mastery fails to achieve what I have set myself to do. When I tweak the node setup from saunam, for example to replace the emission node by a translucent node, or the volume scatter node by a glass node, everything breaks. I'm not sure I understand how the node setup works.

I don't even know if this is possible, but I would really like to procedurally scatter the shape inside the material.

I have tried with a Particle Setting, but it just doesn't stay inside the mesh and the particles aren't dispersed evenly. Since I will be making the object move, I'd prefer to use a material than a Particle System.

Current blend:

For your purposes, a particle system based setup will work best as any material will cause the grains inside to appear very flat.

Starting with your blend file, on the object Cylinder.001, under Particles > Emission, I set these values:

End: 1

Emit From: Volume

Distribution: Grid

Distribution Resolution: 5

Distribution Random: 1

Now we have an object filled by volume with the grain object. Don't worry that some of the grains are outside the object, we will fix that.

Under Particles > Rotation, I ticked the Rotation checkbox and set the Velocity/Hair Random to 1. This will make the grains appear to have frozen in random floating orientations.

Next, we're gonna need some room to work with our particles. So, with your object selected, press M and click the next open layer to move your object there. Then press 2 on your keyboard to go to that layer.

With the object still selected, go to the Modifiers tab and under the particle system modifier, click Convert.

Now all your seeds are individual objects. In solid 3D view mode (Z), check the outside of your object and just manually delete any remaining grains that accidentally protruded the mesh.

Next, select your cylinder and hide it with H. Using B, select all your grains and press Ctrl + J to merge them into one object.

This will make them much easier to manage. Unhide your cylinder (Alt + H), and with both the cylinder and grains selected, press M and select the original layer to move them back. If you are planning on making your objects move, you can parent the grains to the cylinder with Ctrl + P.

You will discover on your first layer that Blender also expanded your original grain object with the particles. You can either choose to move this object to another layer, or hide it with H.

Here is the result:

Not bad, with the existing node setup. Please note that I disabled depth of field for this render. For a clearer icepop, you can fiddle with the balance between the translucent material and the glass material. I might also experiment with mixing in some subtle volume density or subsurface scattering for a more photorealistic render, but I do not have the time to test right now. Maybe someone else can comment on better ice-pop materials?


Does an Obj important contain UV mapped textures? I am almost a total beginner with blender. I purchased a model off of https://www.turbosquid.com/3d-models/maya-human-eye/818788. which came with a .obj file, a .mb files and some .jpg textures. On the website it says its already been fully textured and UVmapped. But when I import the .obj into blender, it does not appear to have any textures applied (and when I switch to rendered view it's just black).

I also tried loading the .mb file into maya and I see this green blob, though it does appear to contain textures and material properties.

Given what you see, does the .obj file not have textures and is there no way to work with in blender?

No, a .obj file does not contain textures. This is not a problem with Blender, but just an inherent thing to .objs. It stores the mesh information and actually includes UVs, but not the textures. You will have to import textures separately just like with any other application that uses .objs.


Parenting armature to mesh with automatic weights I'm just beginning in the animation world and I've been studying Blender – so far it's been good but now I've got a snag. Whenever I parent my mesh to a certain armature or bone on the right side of my mesh and flip it to the left I get a weird movement on the left hand side. It deforms in a very twisted way.

I'd really appreciate some help. I've attached a picture.

Thank you.

It looks like your images didn't show up correctly. Generally when this happens to me I make sure modifiers are applied, the origin is centered to the mesh, and check my work using weight-painting.


Environment behind window for interior renderings I’m mainly interested in architectural visualizations and have also completed a few projects, but there are things that I despair of every time and that is the environment that can be seen through the windows. Should i only use photos or should i model the surroundings for each interior render as well? I am going for a photorealisitc look and would be happy about a tip because i have no idea whats the best way is to do that. I tried HDRs but i only looks ok when the environment is far away. I attach some examples. Thank you!

If i understood you right (correct me if i am wrong) you do not want to see the HDRI through the windows, but just use the lights of it, right?
you can do that so: just tap on transparent


Can't add keyframes properly I am very inexperienced so if the solution is simple no hate please. I am trying to add more keyframes but it says: F-Curve with path= 'location'(2) cannot be keyframed. Ensure it is not locked or sampled. Also, try removing F-Modifiers.

I have no idea what this means. Can someone please explain it to me? I'd greatly appreciate it thank you for your time.

In the Animation layout there is a "Dope Sheet" and summary. I resolved this problem by unchecking the lock icon.

This was my error:

  RuntimeError: Error: F-Curve with path 'scale[2]' cannot be keyframed, ensure that it is not locked or sampled, and try removing F-Modifiers

After turning the lock icon off it works!