How to get intersection of a specific object and the mouse in the BGE?

After some discussion with gandalf3 we found a solution:
The main problem was that the rayCast function will cast a ray between the centers of two objects: Those passed as objto and objfrom arguments. Thus the ray's hitpoint always was the position of objto, not the position over which the mouse hovered.

But rayCast also accepts 3D points as inputs. The trick is to use a Mouse sensor, set to 'Mouse Over Any', and connect it to the Python Controler which holds the script:

In the script one can use the rayTarget and raySource properties of the mouse over sensor as inputs for the rayCast funtion. The modified code looks as follows:

from bge import logic, render

render.showMouse(False)
#from bge

def main():
    scene = logic.getCurrentScene()
    cont = logic.getCurrentController()
    mouse_over = cont.sensors["mouse_over"]

    if mouse_over.positive:
        tracker = scene.objects["mainTarget"]
        crosshair = scene.objects["Cross_hair"]
        floor = scene.objects["Floor"]
        object, hitpoint, normal = crosshair.rayCast(mouse_over.rayTarget, mouse_over.raySource, 0.0, "isTrackerFloor", 0, 1, 0)
        tracker.worldPosition = hitpoint

One further note: The 'Edit Object' actuator which is set to 'Track To' seems to make the affected object point to the target with its local y-axis. Make sure the object with the actuator is rotated correctly in edit mode.


This is because you are in Wireframe view.

Press Z to toggle Wireframe view. Alternatively, select the small sphere down on the bottom, and then select Solid to go back to the default view.


rotation values not set correctly with script that uses CSV

You are probably using the wrong units, Degrees vs Radians.

You are apparently expecting to enter rotation values in degrees, but Blender expects Radians for Euler Rotations.

See 1.994 Radians = 114 Degrees


Since you dind't upload the .blend it is hard to tell what went wrong. I started with a circle extruded it and scaled the the tip before add some loop cuts.

Check the order of the modifiers

I also reduced the gravity and parented the hat to a sphere to see the deformation:

See the attached .blend for details and vertex groups


In the top right of your screenshot is the outliner, I can see seven armatures there including some that are not visible in the viewport. That would indicate that while in object mode you are duplicating the entire armature, maybe while expecting to duplicate a single bone, which you should do in edit mode.

The first armature is the parent of several mesh objects while the others are duplicate armatures that can be deleted. You may need to select them in the outliner and delete them, enabling the little eye icon will make them visible in the viewport.

I don't know that each rig is the same, you may have made alterations to one of the duplicates that you expect to be in your initial armature. You can hide/show one rig at a time to see which bones are part of each armature.

Once you remove these duplicates you should find it easier to work on your rig.


What is the mathematical basis for F-Curves?

After some digging through the Blender source code, I found the answer.

Short answer: They're just Bézier curves.

Long answer: They're normal Bézier curves with certain restrictions placed on the positions of the handles (the red circles). If the first handle is to the left of the second handle, as in the following image, then the curve is evaluated as a normal Bézier curve:

This guarantees that the curve will not turn back on itself.

However, if the handles cross (the first handle is to the right of the second handle), their positions need to be adjusted to avoid loops. The file fcurve.c (blender-2.77a\source\blender\blenkernel\intern\fcurve.c) gives the answer on line 2199:

/* adjust handles so that they don't overlap (forming a loop) */
correct_bezpart(v1, v2, v3, v4);

On line 1830, the correct_bezpart() function begins. The function finds the width of each handle and the width between the two keyframes. If the combined width of the two handles is greater than the width between the two keyframes, then the two handles are scaled down so that they don't cross each other, but their relative lengths are preserved. The original handles are used for drawing to the graph editor, but the scaled down versions are used for generating the curve, a plain-old cubic Bézier curve.

Here's an example F-Curve before correction. These handles are not used to create the actual curve; they're just drawn to the screen in Blender's graph editor:

Here's the same curve, but with corrected handles. These handles are not seen in the graph editor, but are the ones actually used to create the curve. If you want to pull out your ruler, you'll see that neither the lengths of each handle relative to each other, nor the angle of the handles were changed.

If you're not convinced, I invite you to look at fcurve.c and see for yourself. Overlapping handles are detected on lines 2188-2190. The actual handle correction takes place on lines 1830-1866.

As far as why they're called "F-Curves", your guess is as good as mine. My guess is that the 'F' stands for 'function', meaning that, like a math function, each x-value maps to exactly one y-value (A Bézier curve is indeed a function, except that an (x, y) pair is a function of t).

Whether this method is the brainchild of Blender developers or was the result of some third party is still a mystery to me. The answer to that question, in my opinion, is more valuable than the method itself.


You have to bake the hair dynamics. Sometimes the Blender bakes something automatically, sometimes not. The surething is the Bake button.


I'm assuming you do not have the flame attributes node hooked up to your node set up.

In the material, add an attribute node and type flame into the text field
hook up the fac output to a color ramp
add an emissions node and set its out put to the volume in the material output node
Connect the color ramp to the strength input on the emission node


Script to auto-detect features to track using Python

You have to update the frame with the right command:
⚠ Note that none of these will properly do it for the tracker operators:
bpy.context.scene.frame_current = frameNumber
bpy.context.scene.frame_set(frameNumber)
bpy.ops.clip.change_frame (ctx, frame = frameNumber)

The one you have to use is:
area.spaces[0].clip_user.frame_current = frameNumber

Then you can un-comment and set up your for loop.
The area here is just bpy.context.screen.areas[number] or bpy.context.area but area alone works in the OP's script.
Or use this add-on I just made:
Step Tracker allows you to batch-track multiple "steps" of n frames without degrading performance on very long shots. Please read the Readme for instructions.


What Rich said, also might be worth a shot doing ctrl a - set rotation and scale, as not doing so can cause some bizarre behavior in both editing and object mode.


Script to store name of selected object / curve, so that I can select again

for the selection part of things: Why not simply make the user select both items in a specific order? Blender stores the objects in selection order in this property:

bpy.context.selected_objects

That means, if you first select a cube, then a sphere, then a circle, the property content will be:

[bpy.data.objects['Cube'], bpy.data.objects['Sphere'], bpy.data.objects['Circle']]

To access them, you could use the index:

bpy.context.selected_objects[0]  # = first selected object
bpy.context.selected_objects[1]  # = second selected object
bpy.context.selected_objects[-1]  # = last selected object

Also, the last selected object will be the active one:

bpy.context.active_object


Detect two objects colliding, and write the frame number when collision happened

You can use Animation Nodes for this. We compute the distance between the two target objects, if the distance is smaller than the sum of the radii of their bounding sphere, we create a text from the current frame and if not create an empty text, we read an initially empty text block and append the result to it with a line break as separator (Though a separator of your choice can be used), then we write the output to the text block again. Now as soon as they collide, the frame will be written in a new line.


How do I install Blenrig Addon in blender 2.9

From BlenRig 5 Documention

Download the BlenRig .zip file.
Blender allows to install .zip addons easily. Open User Preferences,
go to the Add-on tab, and press "Install From File". Then browse to
the download directory where the zip is.

After this is done, the add-on should appear in preferences available for use.

A new rig is added via Shift+A>Armature>Blenrig 5 Biped Rig
Also, from the docs:

You will find the rig in the Object Add Panel, under the Armature
Menu. In the View3d Sidebar you will find all the animation controls.
In the Armature Data Panel you will find all the rigging related
tools.


Blender crashes in Manjaro Linux version

Ok, 2020-07-20 Blender update for Manjaro solved the problem.


If you want to check final size after a rotation, you need to apply the rotation: CONTROL+A > APPLY ROTATION

before rotation applied:

after rotation applied:

more info:

  Applying transform values essentially resets the values of object’s
  position, rotation, or scale, but does not actually do anything to the
  object. The object origin point is moved to the global origin and the
  transform values are set to zero. In terms of scale, the scale values
  return to 1.

  To apply a transform select the Apply sub-menu from the Object menu or
  use the shortcut Ctrl-A and select the appropriate transform to apply.
  The Operator panel lets you choose the combination of transformations
  to apply.


Blender throws Error: Exception_Access_Violation when Duet Display installed

It turns out Lenovo's System Update and Windows update doesn't do anything to update the graphics driver. Go to Intel's support site, look for your graphics card (in my case Intel HD Graphics 620), and manually install the graphics driver. This solved the problem for me.


Weird artifacts appeared in eevee because of normal map

You should delete your UV Maps in the Object Data. Since you're not using UV Map based texturing.

Otherwise, you'll get unwanted UV Map data assigned to your mesh.
Best to just delete them when they're not being used.

In your case, (as shown in the picture above) because you are not using UV Map based texturing for any part of your model; you should delete the UV Maps for all the parts of the model.


These lines are visible also in the original texture. So to get rid of this you would have to use some image editor to compensate it. Here I used Photoshop's Box Blur filter with range 1 px that wasn't enough so I used it twice, but you loose some details.
Original

Box Blur 1 px

Box Blur 1 px applied twice

There are probably better algorithms for reconstruction or pattern removal like some FFT Fast - Fourier Transform (they are like a magic in some cases) ... so here are some examples

https://www.youtube.com/watch?v=D9ziTuJ3OCw
https://www.wirebiters.com/salt-pepper-image-denoising-using-matlab/
https://www.cs.unm.edu/~brayer/vision/fourier.html

Ten years ago I used some FFT script for Photoshop, but it is too far to remember anything, sorry :)


Why doesn't Bendy Bones' Easing property work in pose mode?

Well it kind of works, as you can see in this Blend File here:

I say kind of because the limitation is that you have to set up the driver which he's using in the video. Looks like a dependency graph issue to me to be honest. This theory is backed up by two things:

if you transform the controller bone, and cancel that transform using Esc the bendy bone does not jump back into its original state (that's a bad bad thing)
if you run Blender from the command line using the  --enable-new-depsgraph switch, everything works totally fine, even not having drivers on the bone deforms the mesh as it should.

You could try having the controller bone in a separate armature object. That might help overcoming the dependency graph issue. Or simply run Blender with new depsgraph on as indicated before.


As @Markus von Broady pointed out, editing an objects dimensions is available in the N-Panel (hit n key) but not in edit mode, you need to be in object mode.

Changing any of the dimensions will also change the scale, so be sure to apply scale if you're doing any deformations, physics, etc.
There are other ways to get accurate dimensions while modeling in edit mode but that's for another question :)


Looks like your material isn't using the UV map, but generated coordinates. Try changing the following in your Material Nodes:

(I can't test the change as your attached blend file doesn't include your texture)


How do you create a curved sequence of vertices?

Since you are using a mesh object, select the single vertex and use Ctrl + B to start the bevel, and in the Operator Panel (F6 for popup) tick the option 'Vertex Only' and then increase the number of Segments to get a nice curve.
Here I have completed this process on a simple plane with the face deleted so as to imitate your scenario.

After, you can turn on Proportional Edit with 'O' and use the MMB to increase/decrease influence and move the vertices around to shape them.


Render only a certain part of a frame, reuse the rest of the frame from the frame rendered before

You can solve this by separating the foreground and background elements and rendering them separately, then using the compositor to re-combine them.

Result of this approach

First, render only the very background - the object(s) that is behind everything else, and save to file:

Then, make sure you set the background to transparent.

Then render the static foreground elements (the elements above everything else that aren't animated) and save to file:

Now you can render your dynamic, animated element separately from the rest. Make sure you render to an image sequence of PNGs with transparent background:

Now all you need to do is open the compositor and use alpha over nodes to composite the static and dynamic elements, then render it all out together to one video file (or a new image sequence):

Alternative node setup using Z combine:

You can find the blend file that was used for this answer here. Good luck!


How do I make one object hit another and make it move?

They are going to float away because they don't have a floor. Make a plane (size it to however big you want) and apply the rigid body to it, making it passive instead of active. Place the plane just below your objects.

After that, you should animate the blue object to hit the ball. Click "animated" in the rigid body settings for the blue object then animate it to hit the ball. You can animate the blue object to bump into the ball as many times as you want, but make sure that the ball stays on the plane. If you hit the ball too far, it will fall off the edge of the plane.


The raw answer is

import bpy
from mathutils import *
from math import *

v1 = Vector([3,2,0])
v2 = Vector([3,2,1])
C = v2-v1

theta = atan2(C[1], C[0])

print(theta)

If you need to be able to compute this from the currently selected edge of a mesh, let me know and I can upgrade the python.


How to avoid overlaping corners on hard surface modeling?

i say it's the mirror and subdiv-suf modifiers, mess around with their positions in the stack. Mine seems fine though.


Setting up collision for large-scale model in Unreal Engine

I think you should just scale the entire scene down, and then continue from there. This should work, because scaling down doesn't affect any of the objects themselves, but will then be able to do collision simulations in unreal. You could also just scale it down in Unreal.


How to fix a very distorted mesh after having imported a BVH file with the Manuel Bastioni Lab

Other than proportional edit, the following techniques might be handy.

Move vertecies along normal :Alt+S
Smooth Mesh : Tool shelf > Mesh Tools > Deform: Smooth Vertex
To Sphere : Alt+Shift+S
Shrink Wrap Modifier (use vertex group to specify vertecies)

Hope they help.


How can I select multiple vertices and create faces with a single command

There is a command called Grid Fill which sort of does this, might be what you are looking for.

There is also an add-on included with Blender called F2 which (amoung other things) makes filling rows of faces easier. Have a look for some demos of how to use this on Youtube, it is a big time saver.


why is the diameter different on these two Bezier curves using the same Bezier circle as a bevel object?

If you enter edit mode and select the vertices of the curves you can see it in the n panel that the radius of the vetices of the thicker one is set to 2.5 while the other one has vertices with radius of 1.

If the profile needs to be a simple circle you do not need to use another curve as Bevel shape at all. You could also just set the fill type to Full in the curve properties and then set a desired Bevel Depth. You will need to increase the resolution for it to be round as well:

It might be a few clicks less to set it up this way.


How to thicken/enlarge certain areas of a model?

You might use Displace modifier with vertex group to enlarge the delicate part.


Shade Smooth not working in the render tab (even after recalculating/merging normals)

You need more subdivisions on the object to appear curved.
Here's an object only with smooth shading (rendered image on the right), note that the edges and faces are visible.

Here's the same object with smooth shading and a subdivision surface modifier. The curves are smooth.

Just for comparison, here's the same object with flat shading. Compare to smooth shading only.

Click on the images to show enlarged in full screen.


Video codec/video file format confusion in Blender

Number 1 is a selector to guide you in your next step for movie encoding selection. It can make the encoding section disappear or take other options. It's more a selector for whether you want an encoded movie or a selection of images, and blender gives you the right section. It's ignored for your output movie file.

Number 2 is your container, and 3 is your codec.

That said, let's examine your output:

1) Correct. "MPEG-4" and "H.264" must give MP4, being MPEG-4 the container. I think its your best option for your YouTube uploads.

2) Correct. If you choose MPEG or H264 for number 1, you will continue getting the same (AVI). Like I said , number 1 has no impact on your results. Here you will always get an AVI if you choose a container like H264. This is more a Blender behavior. (I expected an MP4, too.) Blender uses H264 like a container and doesn't let you choose a codec, exchanging it for a lossless option. I remember having read that Blender is very oriented towards H264 as a final output file, so I think that explains the special behavior for this option.

3) Correct. Like 1), you will get a .mov container and codec of your choosing.


Smoothing two objects together without boolean

If you really want to avoid actually connecting the two meshes, you can use this custom shader by the community:

Shader: Rounded edge between the two intersecting faces?

Although best practice (and what you see in your reference) would be to just connect them with a boolean or similar operation and clean up the mesh afterwards.


I don't know if this is what you need. But in Object mode select the objects without the materials, select the object with the material and press CTRL+L then click materials. now the objects will have the same materials.


How to use antialiasing with bgl drawn elements?

Turns out any kind of smoothing you want to use with GL_POLYGON_SMOOTH, GL_LINE_SMOOTH etc. (antialiasing simple shapes) requires GL_BLEND also be enabled.

I discovered that if you're using GL_POLYGON with GL_POLYGON_SMOOTH enabled, you get weird breaks in your mesh shapes. For this reason it's best to leave GL_POLYGON_SMOOTH off, then surround the shape created with GL_POLYGON with a line from GL_POLYGON_LOOP and then enable GL_LINE_SMOOTH. This gives the appearance of antialiasing around the shape without the weird breaks (demo in code below).

import bpy,bgl

def draw_callback_px(self, context):

    #Set color to white.
    bgl.glColor4f(1, 1, 1, 1)

    #Using polygon smoothing alone creates
    #lines through shape... better to leave
    #off and just smooth outer line.
    #bgl.glEnable(bgl.GL_POLYGON_SMOOTH)

    #GL_BLEND must be enabled for any
    #smoothing to work.
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glEnable(bgl.GL_LINE_SMOOTH)

    #Can't just stack GL_POLYGON
    #and GL_LINE_LOOP
    bgl.glBegin(bgl.GL_POLYGON)
    for x, y in self.mouse_path:
        bgl.glVertex2f(x, y)
    bgl.glEnd()

    bgl.glBegin(bgl.GL_LINE_LOOP)
    for x, y in self.mouse_path:
        bgl.glVertex2f(x, y)
    bgl.glEnd()

    bgl.glDisable(bgl.GL_BLEND)
    bgl.glDisable(bgl.GL_LINE_SMOOTH)
    #bgl.glDisable(bgl.GL_POLYGON_SMOOTH)

class ModalDrawOperator(bpy.types.Operator):
    bl_idname = "object.modal_operator"
    bl_label = "Simple Modal Operator"

    def modal(self, context, event):
        context.area.tag_redraw()

        if event.type == 'LEFTMOUSE':
            self.mouse_path.append(
            (event.mouse_region_x, event.mouse_region_y))

        if event.type in ['RIGHTMOUSE','ESC']:
            context.space_data.draw_handler_remove(self._handle, 'WINDOW')
            return {'FINISHED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        self.mouse_path = []

        args = (self, context)
        self._handle = context.space_data.draw_handler_add(
        draw_callback_px, args, 'WINDOW', 'POST_PIXEL')

        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}

bpy.utils.register_class(ModalDrawOperator)
bpy.ops.object.modal_operator('INVOKE_DEFAULT')


how to get in python real position of object that follows a NurbsPath?

To get the global position of an object in blender use

obj.matrix_world.to_translation()

To change the frame use

scene.frame_set(frame)

...

import bpy

sce = bpy.context.scene

obj = bpy.data.objects["tracker0"]

for i in range(0, 20):
    sce.frame_set(i)
    print(obj.matrix_world.to_translation())


Why does my softbody have a hole in the bottom?

If by 'hole' you mean the cavity that has formed under the sphere where the bottom surface has become concave, then that is a limitation of using Soft Body simulation to simulate what you consider to be a solid.
The Soft Body simulation in your example is simulating the object's surface only. This means that there is no internal structure to push the deformed surface back out. The surface is made up of vertices and edges and the simulation tries to move the vertices so as to get the edges back to their preferred lengths and relative angles.
In your case, the deformation has pushed the bottom of the sphere beyond flat and it has effectively folded back on itself. Since there is no internal structure to resist that deformation it has 'flipped' inside out and found a new 'at rest' position - where the inverted geometry can reach the edge's preferred lengths.
One solution is to add internal geometry to allow the simulation to 'push' those surfaces back out again. One way of achieving this is to criss-cross the inside of the mesh with "struts" of edges which can oppose the deformation and act as internal material pushing back out.
To achieve this, go into Edit mode,select a vertex and Shift-select the opposite vertex, then hit F. This will create an edge spanning the middle of the sphere. Repeat this for vertices in many opposing directions (keep the spread even so that the internal "pressure" is evenly distributed.
Now running your simulation should have the soft body reacting as if it has internal structure.


Snap a selection to cursor when scaling or moving

I believe this is what you're looking for...

With cursor positioned as desired and vertices / edges selected scale it while choosing axis which you'd like to affect on scaling (in this case Global X):

Select vertices, set Pivot Point to 3D Cursor.

Press S to scale, then X to scale to 3D Cursor by X axis axis.
Enter amount of effect of scaling. In this case it will be 0.

Taken from this answer here


Code edit

To the questioner,  Please ignore this answer.: it is for others who may come across this question / answer after code to get bmesh elements from their indices, or for those like me who cannot see "not nice" code with out suggesting alteration.  Rather than long-commenting added here as an alternate answer.

If we have the indices of vertices  can look them up via bm.verts[index], after calling bm.verts.ensure_lookup_table()  to ensure the indexing.  Similarly for edges and faces.  Need only loop over indices.

[bm.edges[i] for i in edge_indices]

Looping over every vertex and checking if v.index == index or worse if v.index in indices, then appending with verts = verts + [v] (suggest verts.append(v)) is both grossly inefficient and s shown, not required.

Use a set for verts in edges to have only one occurrence of each vert.  There will be same vert added to list for each connected edge in the list comprehension. Cast it back to a list if need be.  list(set(verts))

import bpy
import bmesh

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

edge_indices = [0, 2, 4]
bm.edges.ensure_lookup_table()

edges = [bm.edges[i] for i in edge_indices]

all_verts_in_edges = set(v for e in edges for v in e.verts)

print(edges)
print(all_verts_in_edges)


Rounded color values
When you need exact colors, you wouldn't want to use rounded values. To be exact, open your reference in the Image Editor and use the Eyedropper in your RGB node to pick the color.
Make sure, your scene doesn't use Filmic log encoding or any viewer LUTs, stay in sRGB the whole time, to maintain color fidelity.

Emission and diffuse combination
As @lucas-leme suggested, the emission shader gives you the exact values from your reference. But your image will look very flat. Create a second renderlayer, don't change any settings, just add a diffuse white material to the material override slot of the second render layer. In the compositor, set up the nodes as shown below, and clamp the diffuse pass down, so it is almost completely white and only contains the core shadows. Multiply this layer over the Emission pass.

please let me know if this helped, or if something is unclear. Here is my blend:

you need to render first, to see the compositing nodes at work.


Let's say you want to interpolate the movement of empties between frame 0 and 50

create one empty for each tracking point of set A.
add a constraint to the empty associating with tracking point 1 of set A
add a constraint to the empty associating with tracking point 1 of set B
set the influence of the first constraint to 1 and add a keyframe
go to frame 50, set the influence to 0 and add a keyframe
do the inverse of steps 4 & 5 for the second constraint (0 --> 1)
Repeat steps 2-6 for the other tracking points

This strictly answers your question of how to interpolate between tracking points (you might need to adjust the curves to be linear).

However since you need to morph the next logical step was to use the empties as hooks to deform a mesh. However the hooks need to modify the position of the vertices directly and not relatively as they do (see this queston ). Still, the half-solution here is worth sharing.


Copying exact position and pointing angles of a tracked camera with non-tracked camera

Switching from a constrained cam (track to) to a duplicate and maintaining the exact same view as the original cam when the constraint is removed from the duplicate -

Take the timeline cursor to the switch over frame.

Duplicate the camera.

The duplicated cam will inherit the same constraint as the first.  To prevent it swinging back when the constraint is removed, select the duplicate cam and press "CTL-A --> Visual Transform".

Then delete the constraint from the duplicate.

When switched to the duplicate, the cam view should remain exactly as the original cam was.


Object displacement - ocean of hexagon tiles

Just scale all of the individual parts down to a size of 0 in the UVmap (using individual origins as scaling center). That way, each part will stay intact, but will be displaced as a whole according to the value of your noise where that UV island resides.

UV Map:

Result:

Edit: if you use a displacement modifier instead of shader displacement, it's easier to control the axis of displacement:


How to overlay Alpha masked image over finished Video without re-rendering the whole track?

The only way I know is to split the video in two parts (200 frames and the rest), do the changes to the first part, render it, and than join the parts.
BUT! To join parts without decoding the second one, you must render the first one with exactly the same parameters (codecs and so on). There are different programs for splitting and joining footage without decoding. It's not a problem to find one. But the main problem will be to adjust rendering parameters for the part that will be changed. Otherwise it will be decoded and than it all doesn't make any sense.


Auto Smooth can it be applied permanently to a mesh?

Auto Smooth option and Edge Split modifier give essentially the same result starting from Blender 2.71 when the support for the sharp edges and split normals preview in the viewport was added for the Auto Smooth.

There is one difference though - Auto Smooth doesn't actually split vertices, it only shows them as split ones. Hence the result of the Auto Smooth is visible in Edit mode but is not editable (e.g. to move out the faces which fell under the angle threshold).

To preview the split normals in Edit mode uncheck the Auto Smooth and add Edge Split modifier, then apply it (depending on the case it has to be in the bottom of the stack so it doesn't interfere with other modifiers and has to be applied last).

It is still possible to undo the results made with the modifier by removing doubles in Edit mode.


animate between pose/reset position in object data

Rest (not reset) position is the original position that your character is set to, prior to any poses being made. It shouldn't be changed once you've finished creating and rigging your character.

Pose position allows you to set different poses and save then in a Pose Library or record them as keyframes. You normally start with a starting pose and then save/record as you move it through a series of poses to create the movements you want the character to take over a number of frames.

Rest position doesn't play any part in your animation. The animation uses only the poses you save/record.

A simnple experiment is to create an initial pose, keyframe it to frame 1, then set your character to another pose and keyframe it to frame 20. Now press Alt-A to animate the character and watch what happens. Add more poses and keyframe them at various points along the timeline. This will familiarize you to the basic procedure and give you a better idea of how to use poses.

For info on using the Pose Library to save/use poses, consult the documents.


Metaball Active Element Panel is missing

I think it's working, but admittedly in a weird and unintuitive way (and there's no visual indication of what is happening), which might be considered a bug. I've submitted a fix here.
Steps to reproduce:

Add a metaball
Deselect all (the transform panel remains present)
Switch out and back into edit mode (the transform panel is gone)
Select the metaball again (the transform panel returns)

If you are aware of how the "active" selection works with other selectable things in Blender, this behavior makes sense:

Only one object/element may be active at a time. In rare cases (e.g. there are no objects), there may not be an active object.
The active object is the "last individually select object"; that is the last one clicked on.
Deselection doesn't affect the active object.

If you try this same exercise with a mesh object, you get roughly the same behavior, but a rather less confusing "Nothing selected" message in the transform panel when nothing is selected.


Mesh Bisect Algorithm: How does it actually work?

As you might have heard, blender is open source software, which means the full source code is public. You can download the source code for example from blender's official download page. (Link on the same page above source download leads to info about setting up dev environment and such, if you have more interest on project)

For particular file inside the project, bisect tool is found under source / blender / bmesh / tools / bmesh_bisect_plane.c/h.


There is no "simple" way to do anything in numerical analysis. However, the tasks can be laid out straightforwardly.

EDIT: This idea is a brain-fart because it doesn't distinguish parallel planes. The Internet must never forget though. Pile on, people.

How about this: generate an array of normalized normal vectors (not vectors in the dynamic array sense; in the math sense. A 1x3 array representation of a floating-point ordered triple is fine. I guess you can make an object but why bother) for every 3-point combination (not permutation) of the n points you have in your set. This list will contain nC3 normal "vectors".

If no plane that can be made contains more than 3 points in the set, then your list of normal vectors will entirely contain nC3 unique normals.

If any plane exists with 4 vertices, you will have 4C3 = 4 identical normal vectors in that list.

If any plane exists with 5 vertices, you will have 5C3 = 10 identical normals.

If any plane exists with k vertices, where 3 < k < n, you will have kC3 identical normals.

You would just need to quantify the normals that are the same, identify the largest value, and deduce what k was.
EDIT: Thanks to Rich Sedman for pointing out comparison should be done with dot-product. Weeding out parallel planes is another task that would need to be done optimally in the worst case scenario (a stack of parallel planes).

Doing all this would require knowing how to do a 3D cross product, how to normalize a vector, how to find a dot-product, and how to solve this equation:

k!/(3!(k-3)!) = count, Or:

k(k-1)(k-2)(k-3)!/(3!(k-3)!) = count, Or:

k(k-1)(k-2)/6 = count,

where count is the number of duplicated normal vectors,  which you will have already counted before solving this. This is just a 3rd degree polynomial.

Note also that if the set is randomly chosen, and even if the range and precision of floating point values are small, it is very unlikely that you will have more than 3 points in any plane. The list would need to be curated to have more than 3 coplanar points in order to make good use of this work.


BGE is lower case when used in python.

Try;

import bge

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


How to render displacement of cycles material output into normal map?

It is a bug in a version 2.79 (build 2017-09-11, 5bd8ac9). Same scene rendered fine in both 2.78a and latest build of 2.79 (build 2017-11-05, 8a72be7).


How can I seperate parts of a human body to add materials for texturing?

Why do you need to separate your mesh? You can have multiple materials on a single mesh. In the material window you can add as many as you want. Then just go into edit mode and select the faces you want to give a different material, and then assign the matching material from the material window.


You have to offset the Y coordinate of the texture for every square along the X axis :

Playing with the offset:


Is it possible to armature a multiple objects?

Yes. Each object can be parented and weighted to the one armature in the same way you would a single model.


Starting with a text object and a cylinder, give the text some extrusion.

Add a lattice that has only one subdivision on the axis you want to use to align the text.

Place the lattice so that it barely overlaps with the back part of the text.

On the text object add a lattice modifier and select the lattice as the control object. The idea is that any deformation on the lattice will affect the text object.

Next, select the lattice and add a Shrinkwrap modifier to it, using the cylinder as Target. The lattice will then wrap around the cylinder and the text will deform following the lattice:

The text remains fully editable this way and doesn't need to be converted to mesh.


Blender 2.8 (Python) - resetting camera rotation to (0,0,0)


Weirdly shaded faces after triangulating

This also might be caused by duplicate vertices on each other. Try to go to edit mode, select everything (clicking A), on the tools tab, click 'Remove Doubles', that might fix it. Although it is indeed hard to tell without seeing your mesh.


Cycles Render is showing black silhouette

I found out the issue. I had some masks turned on...


What you can do is that you can edit a copy of the texture in an image making program like Paint.net.

First, make the area where the non-blue strands are black and the blue areas grey or white. If you want the blue area to be translucent (between opaque and transparent), choose grey. If you want it to be fully transparent, choose white. After you do that, save the image as a separate image file (I'll call it alpha.png).

Now go to Blender. Go to Cycles Render.

Then, go to the material's nodes in the Node Editor. Add an Image Texture node and load alpha.png in it. Connect its Color to a Transparent BSDF's Color. Then, add a Mix Shader node. In one Shader socket on the left side, put the Transparent BSDF. In the other, put the BSDF your actual texture (NOT alpha.png) is connected to. Finally, take the shader socket on the right side and connect to the Material Output.

Here's the explanation; connecting alpha.png to the Transparent BSDF creates something called an alpha. White means fully transparent, grey means between transparent and opaque (translucent) and black means opaque.


Inconsistant edges and lights rendering for orthogonal pixel art with freestyle

What you can see is the effect of sub-pixel movement. If an area that produces a pixel, has different contents than another area producing a pixel, those pixels can differ. Therefore what you need is to snap your objects to pixels.
I've set up my camera at 60° angle, and scaled down the unit scale to get a satisfying grid - something that could be my resolution. I decided that I want a lower resolution than yours, so that I can count the pixels easier and the screenshots are more readable here on SE site. I made sure that the grid aligns with camera borders.

Keep in mind, this is only a pixel grid in the Top Orthographic View, while in the camera view, every grid cell has only half (perceived) height, so each pixel is two grid cells tall.
Now when I duplicate the sphere in camera mode, and move them with CTRL held, my sphere is aligned to the pixel grid:

And if I render the image, all spheres look the same:

However, if you look in a Free view, you might notice the positions of spheres don't exactly illustrate how you would position them in a real scenario:

So let's repeat, this time disabling Z axis (SHIFT + Z) when moving our balls:

The render:

Some balls are different. To be exact, there are two types of balls. This is because, as I said earlier, the grid on XY plane isn't the same as pixel grid - 1 pixel takes two cells. So we need to make sure to align all our objects to even vertical cells (or all objects to odd vertical cells, but we have to be consistent):

And the render:


Objects From Group, list order issues - Animation Nodes

If you have a list of object [Object B, Object A, Object E, Object C, Object D] and you wish to order them as [Object A, Object B, Object C, Object D, Object E], simply construct a list such that its elements are that of the list at the indices [1, 0, 3, 4, 2].


"no object or images found to bake to" error

You have to create an image first. To do so click new in the UV Image Editor. Create your image and with it selected click bake. This only works in Blender Render like that. If you want to bake in Cycles you'll have to create an Image Texture Node in your material, don't connect it to anything, select your image and bake with the node selected.


Snappping the 3D cursor to the surface and find the surface's face it was snapped to

Using Scene.ray_cast

Can shoot a ray into the scene using Scene.ray_cast from the cursor location, in the direction of the converted view matrix's z axis.  Test code, prints the ray hit (if hit) of each 3d view in the context screen.

import bpy
from mathutils import Vector
context = bpy.context
screen = context.screen
scene = context.scene
areas3d = [a for a in screen.areas if a.type == 'VIEW_3D']
for a in areas3d:
    r3d = a.spaces.active.region_3d
    vm = r3d.view_matrix.transposed().to_3x3().to_4x4()
    norm = vm * Vector((0, 0, 1))
    norm.normalize()
    ray = scene.ray_cast(scene.cursor_location, norm)
    hit, loc, norm, face, obj, matrix = ray
    if hit:
        print("hit object", obj, "on face:", face)


How can I make a glowing or shiny gold material similar to these pictures?

Here is setup that works for both Eevee and Cycles and seems not too far from what you show: Put a Point light into your object, and for your material use a mix between Diffuse, Emission and Translucent node, with an Attibute node as factor that uses the Color Vertex Paint > Dirty Vertex Group in order to keep some parts more opaque:


Why is this little program of logicbricks not working?

You need to enable "True-Level-Triggering" on the message sensor. Also, make sure the massage is sent every tic on the object that is sending: also can be done by enabling TLT on one or all of the sensors.

True-level-Triggering makes the sensor send new positive pulse every logic tic that the sensor is active, rather than just once, and the a  negative when inactive.
It can be enabled with the little three dos icon on the left of the sensor.


Python: proportional editing vertex move

look at the doc: http://www.blender.org/api/blender_python_api_2_76_release/bpy.ops.transform.html?highlight=proportional#bpy.ops.transform.transform

By the way you can look in the 'action log' of the info editor (window header). enlarge it, sroll down, select entry it with your select mouse button and use CtrlC to copy the command for your action


Strange data while importing DEM and Contour files into blender via Blender GIS - addon

I just have the same problem yesterday, if you want to fix it, you need to change the right coordinate (CRS) in QGIS or ArcGIS first. For reference coordinate you can find it in google as free, because each area or zone has different coordinate.
Then, after do that, when you try to import .shp in BlenderGIS you can see in the bottom right corner in Blender after import it, change elevation so from geometry to Field and select elev field same as contour table in your open atribute table in you GIS software. OK.
Or if you want the easier way, you can try to create contour from your DEM data to ArcGIS first:

Import DEM.TIF to ArcGIS
Create Contour from DEM.TIF
Create TIN from Contour, coordinate use Web Mecrator
Create TIN_LINE from TIN
Import TIN_LINE.shp to Blender

In Blender -> Click ur Contour -> GIS -> Mesh -> Delaunay


Is it possible to hide the wire in the edit mode?

There is the option which was formerly dubbed, Only Render.
The icon to the left of the red-arrow is the toggle button, the icon to the right has a bunch of other viewport toggle draw options.


I tried your file, and just after removing the parent in "object > relations" and selecting again "cube.004" in that listbox, the parent is better:

something didn't update correctly during some previous operation, maybe.

edit: ok, it is nearly the same even with the new file.

this time, after re-applying the parent as above, you need to clear its origin.


you can use a Game actuator, load global dict and save global dict, i dont know how this actuator works. i think you'll need little bit of python to do this.
google for "bge global-dict". there are a few tutorials on youtube.
or you can just create a file.
with open("file", "w") as f: f.write() f.close(),
save the file a openit up from other scene.
with open("file", "r") as f: f.readLine() f.read()... and so.
It's basically the same thing. A dict that blender handles or a "dict" you handle.


Selecting a smaller object hidden inside another big object

In this case, and in the case where you have a large scene with many objects, selection is done more easily using the  Outliner.


Scale object with edge loop as if there were no loops

You can use the proportional editing. So you edit the base loop and it influences also other loops:


How to ease the edges of a volumetric texture?

Using another Shape is indeed not a bad idea. (@Jachym Michal)
But here is a node setup to give you pretty good controll of the density border.
For better visibility I haven't multiplied it with your current density setup yet, but the math node already is sitting in place as you can see.


Imported object being lit from wrong direction

Fixed: Face and vertex normals were okay.
However, Blender tries to auto generate vertex-per-face normals and get all mixed up.
Once you turn this off, all works just fine.
Thanks to this post for the solution: How to unify face and vertex normals


Did you try applying transforms? Your scale is not 1. Select your mesh and press Ctrl - A, apply rotation and scale


I believe Blender hasn't support material with texture import from .obj file even though we have the .mtl file.
So you still need to assign your texture manually.


How to plug specular map into Principled Shader?

There isn't an exact answer to this. In older-style shaders it was typical to independently control specular intensity and specular size(also called hardness or glossiness and other names). This isn't how real-world surfaces actually work though. The reflectivity of a real surface is determined by the refractive index of the surface, and the roughness of microscopic imperfections in the surface.

The principled BSDF mimics this with a "specular" control that adjusts index of refraction (IOR) within a narrow range (specular=0 is IOR=1, specular=1 is IOR=1.8). Then there is a roughness control which controls the imperfections of the surface. The result of this is that "specular" controls intensity of reflections and how quickly they fade when viewed straight-on, and "roughness" controls the intensity of reflections and the blurryness of reflections. (worth mentioning here that "specular highlights" are nothing more than reflections of light sources).

So, what do we do with specular, gloss, and reflection maps?

Gloss/specular-size is easy. Plug it into roughness. You may need to invert it. But otherwise, it should pretty much work.

Reflection and Specular: You may not even need them. Both of these map types were just used to deal with reflections not being dependent on roughness, or handling lamp speculars being calculated separately from reflections.* Since this stuff is all handled in the "physically correct" way based on roughness, these maps are essentially unnecessary. They were to compensate for a missing feature which is no longer missing (fading reflections based on roughness).

With that said, you might find putting one of them (try each one!) on the "specular" input gives better results. It's all trial and error. There isn't really any convention for traditional specular materials the way PBR materials have, so those textures really only have a "correct" setup in the software+shader they were originally authored for. So just poke and prod with different inputs to see what looks good. Hopefully the info in this answer is enough to get you started.

*Fun fact: in realtime PBR shaders reflections and spec are still calculated as separate elements. They're just controlled together by roughness and merged under the hood!


Face dots are not displayed if Textured Solid is enabled in 3D View > N-panel > Shading.

Odd theme colors could make it hard to see the face dots, but that's not the reason in your case. Unselected faces use the wire color for both, the edges and the face dot, which is light purple in your screenshot (so clearly distinguishable from the surroundings).

As last resort, submit a bug report to the tracker.


Bone constraints not working on first bone in chain

The issue was with the bone at the start of the chain being set as Connected. This is because the bone chain was made using the Skin modifier on a vertex chain. Normally if you add a bone and then extrude it to make a chain, the first bone is not Connected. Apparently the armatures made by Skin are. The Connected checkbox is greyed out, but still can be unchecked. Since the bone has no Parent, the Connected status was locking it in place.


In theory, if you close and restart Blender all operator presets should be reset to default values, but if you don't want to do that you can reset them one by one by hand.

Just add a new UV Sphere or invoke any other operator, and from the 3D View Tool Shelf (T key) you can reset any property to default value by right-clicking it and choosing Reset to Default Value


render bloom in eevee without cutting by silhouette

That node tree in composer solve the problem


Sapling tree to a mesh and follow the treeArm Animation like the leaves?

I had this exact problem, and I just found out the solution. In the Operator panel for the Sapling, simply check the "Make Mesh" box in the Armature menu and there you go! If you want to edit the mesh, you have to look for the Skin modifier that is created in the Outline under's the tree's mesh and apply it.

Hope this solves your problem!


I'm not sure you need a curve at all. Here's how I would go about a model like this.
First I would make a "sphere" by adding a subdivision surface to a cube with three subdivision levels (CTRL+3). I would then add a cast modifier and cast it as a sphere, to make the mesh a true sphere shape.

Then I would apply the modifiers, and make the egg shape using proportional editing set to smooth.

Then I would inset THESE faces, and scale them inwards slightly.

I would also scale the "seam" edges closer together on their respective axes:

Then I would turn proportional editing back on, but set to random this time, making sure to check "connected only". I would then select some random vertices along the edges of the "petal seams" and scale them towards each other on whatever axis they lie. (I know the "gaps" are wider in the first image - I took this screenshot early, before I scaled the edges).

Do this for all the "seams", then select the centre areas again, and inset by a small amount.

Do the same for the outer areas - this helps define the edges of the "petals"

You should then be able to select the whole surround edge as one loop - you can then extrude this (extrude faces along normals) to form the lip.

Lastly,  add another subdivision surface modifier, and shade smooth to smooth it out.

Hope this helps.


How to batch convert between file formats?

Set the path variable and change the import line to whatever importer you are using :

import bpy
import os

path = 'C:/path/to/files/'  # set this path

for root, dirs, files in os.walk(path):
    for f in files:
        if f.endswith('.meshdata') :
            mesh_file = os.path.join(path, f)
            obj_file = os.path.splitext(mesh_file)[0] + ".obj"

            bpy.ops.object.select_all(action='SELECT')
            bpy.ops.object.delete()

            bpy.ops.import_scene.obj(filepath=mesh_file) # change this line

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

            bpy.ops.export_scene.obj(filepath=obj_file)


How to access an Alembic velocity attribute?

This is not yet supported, see https://developer.blender.org/D2388


This is what I have done ...

1 Create a cube.
2 Copy a face of the cube you want to have your transparent graphics on.
3 Move the face a little outward so that it does not share the same 3d space with the original face.
4 Create 2 material, a red one and a transparent one.
5 Remember to turn off cast shadow for the Transparent material.
6 Apply the red material to the cube.
7 Apply the transparent material to the copied face.

Attached is the file I have created for your reference.


Limiting the roll on a rigid body cylinder joint chain

All you really need to do is get rid of the Child Of constraints on all of your bones.

The other thing I did which will improve the accuracy of the simulation, is change the shape of the ridge body collision shapes, so that they are thinner and wider (they can also be much shorter).

In this picture I have the ridge body collision set to "Box", and as you can see it works fine.

For reference here is before and after.


How to create vertices/edges/faces at the intersection of an object and a plane?

Probably you are not using the Intersect command properly.

The intersecting plane should be inside the object to cut, so you must join the objects. You should also remember to pick only one part, and not the whole mesh in order to feed the operator with a correct source selection.

Here's two wrong sample of usage, followed by a good take.


How to get cursor snap status in python?

Closest Point on Mesh

Object.closest_point_on_mesh(...)

Takes a point in object space and returns the hit result, the location of hit, the normal of face hit and the face's index.

Alternatively could utilize mathutils.geometry.distance_point_to_plane(...), where each plane is defined by face center and face normal. Edit, this is somewhat flawed since the cursor can be on a faces plane but outside its edges, which would need to be tested for

Both these methods require the point to be in object space.  The 3d cursor location is in global space, convert using

pt = o.matrix_world.inverted() @ scene.cursor.location

Here is a verbose script using both methods.  The on_face boolean is true if cursor is on face of an object.

Note testing shows the tolerance TOL (distance from point to face) needs to be in the vicinity of 5e-5

import bpy
from mathutils.geometry import distance_point_to_plane as dp2p
context = bpy.context
scene = context.scene

dg = context.evaluated_depsgraph_get()
TOL = 5e-5 # Tolerance

mesh_obs = [o for o in context.scene.objects if o.type == 'MESH']

for o in mesh_obs:
    me = o.data
    print(o.name, me.name)
    #cursor location in o's object space
    pt = o.matrix_world.inverted() @ scene.cursor.location

    # using closest point on mesh
    hit, loc, n, i = o.closest_point_on_mesh(pt, depsgraph=dg)

    print(i, (pt - loc).length)

    on_face = hit and (pt - loc).length < TOL
    print("closest point on mesh", on_face)

    # using distance point to plane for each face

    for p in me.polygons:
        print(p.index, dp2p(pt, p.center, p.normal))

    on_face = any(abs(dp2p(pt, p.center, p.normal)) < TOL
            for p in me.polygons)
    print("plane distance", on_face)

Result of running on default cube after clicking to snap cursor to face from view.

Cube Cube
3 2.1159816795005355e-05
closest point on mesh True
0 -0.9940524101257324
1 -1.0059475898742676
2 -1.1975289583206177
3 2.104043960571289e-05
4 -0.8024709224700928
5 -2.000020980834961
plane distance True

Related Snappping the 3D cursor to the surface and find the surface's face it was snapped to


How can you change the "inherit rotation, scale location" for a vertex or empty or an object, not just a bone?

There is no such option. Objects always inherit their parent's transformation. You can use constraints to selectively copy transformations from other objects to work around this, though.


It's probably because when you assigned it an IK, you also gave it a rotation limit, you'll find it in the Properties panel > Bone > Inverse Kinematics. As you can see if the Limit X rotation box is still activated, it is just greyed because the bone doesn't have any IK constraint anymore, and the red line still appears on the 3D view.


Rigify N menu options missing, reloading the rig_ui.py doesn't help. Solution?

This particular problem was caused by deleting the rig_ui.py file and replacing it with the rig_ui.py file generated in a different file. The rigify plugin creates and executes the script which is partly specific to the rigify rig that it's generated with. It's found in the scripting tab.

The problem is solved by going to the scripting tab, and checking a specific line in the 'rig_ui.py' script.
On line 6, where it says 'rig_id =' there should be within quotes, a specific code that should match the code found on your rig.

To find your rig's ID, select your rig and check the rig properties. Underneath 'Custom properties' copy the 'rig_id' code. Check to see whether it matches the code mentioned in the rig_ui.py script. If it doesn't match, that's the problem, so delete the code inside of the quotes. Paste in your rig's ACTUAL id in the code, inside of the quotes next to 'rig_id ='.

Now hit 'Run script' on the toolbar below and the buttons on the N menu should return.


How to draw mesh Schwartz Primitive Topology

I can't help with mesh creation but you may like to use volume shader for visualisation.
Notice that the cube has a size of 10 units, and a scale of 1.
Cycles will give more precise results but you can use EEVEE too.
In cycles (orthographic view):

In EEVEE  (perspective view):

I used an emission shader but you can use simple volume shader with some external light.


Array modifier with curve is deforming mesh?

If you scale and apply the scale of a cuve, its vertices radius will change to the value before the scaling, here it looks like you've scaled up to 9.677. To bring the value back to 1, select all the vertices and type 1 in the N panel:


Blender 3D object editor skipping frames

Most probably this happens because you have the snapping option on as shown below. Try to disable it.


Is it possible to bind mesh to armature using its current pose?

You can apply the armature modifier, go into pose mode on the armature and set its current pose as the default (idk what menu, use the search system if need be but pretty sure it’s Pose), then re-create the armature modifier.


After separating the geometry it is it's own object thus, I presume that either the tutor deleted X or hid H the  rear geometry once returned to object mode.


bpy.ops.view3d.snap_selected_to_cursor(use_offset=False) works manually (by using mouse and keyboard) but not using bpy

as @lemon says the answer is override the context
import bpy
for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        override = bpy.context.copy()
        override['area'] = area
        override['region'] = area.regions[4]
        bpy.ops.view3d.snap_selected_to_cursor( override, use_offset=False)


How do you create a fluffy cloud in blender 2.82?

I'm not sure that this is a complete answer, but maybe what I found will help you. I also wanted to make such clouds
https://www.youtube.com/watch?v=lPAYX8z9i8M Creating Procedural Volumetric Clouds with Blender Eevee (48:35)
https://www.youtube.com/watch?v=GhMQN4vVMIU Create Procedural Clouds Fast (Blender Tutorial) (3:12)
https://www.youtube.com/watch?v=WJMol3CLHEE How To Make Clouds in Blender - Procedural Volumetrics (19:47)
https://www.youtube.com/watch?v=Nb1jQ9UsTAw How to Make Volumetric Clouds In Blender (2.83) (8:15)
https://www.youtube.com/watch?v=Br_ldLJPtxU Volumetric clouds in EEVEE - Blender 2.8 [ Beginners ] (12:07)
For water you can use Ocean Modifier and shader with "Glass BSDF" to Surface output with "Volume Absorbtion" to Volume output
Edited:
I found this in reccomendations. He creating clouds from metaballs and then adding displacement with voronoi texture and other textures, using "Principlied Volume" for volume absorbtion material.
https://www.youtube.com/watch?v=5QxCa-bsbK0 Creating Fluffy Clouds in Blender (10:48)


Freestyle lines as an independent render pass

The option isn't available in Eevee but is still available in Cycles. You need to use the Filter panel in the Render Layers properties and disable the elements (eg, Surfaces) that you don't want to appear in the render :


Particles and Random Numbers and Cycles Render

You can use the particle info node to achieve this:

Where 1000 is the total number of particles.

If your particles do not have a random distribution, then this doesn't work so well.
In that case, you could try mapping the index to a procedural texture, e.g. like this:


The first thing to understand is that Texture Paint mode only paints on one mesh at a time.  Even if you select multiple objects, only the active (i.e., normally the last selected) object will be set up for painting.

The second thing to understand is that Texture Paint mode will only render the active object (the one you're painting on) with the texture that you currently have selected for painting, and other objects in the scene will be rendered according to the current Viewport Shading mode (set by Z).  If the Viewport Shading mode is "Solid", then the object being painted will show the texture, but other objects will have the usual boring gray shading.  For example, here I'm painting on the cube on the right, and the cube on the left is rendered using the "Solid" setting:

However, if you switch Viewport Shading to "Material Preview" or "Rendered" AND if the materials for the objects are properly set up to render the texture (e.g., you have a Principled BSDF whose Base Color is set to the texture), then non-active objects will show the texture, too.  Here, because the cube on the left has a proper material set up, it shows the texture, too, as soon as I switch the Viewport Shading to "Material Preview" even though I still only have the cube on the right set up for texture painting.

If you want to be able to paint on both cubes at once, you need to combine them into a single mesh.  You can do that by selecting both cubes and then hitting CtrlJ to join them together.  They'll now be one object/mesh, and you can select the combined object and paint on it in "Texture Paint" mode.  Later, you can separate them again by selecting the combined object, switching to edit mode, and using Mesh -> Separate -> By Loose Parts to break them into separate meshes.


Setting objects into edit mode often seems to fail in python script

As mentioned by dimus, your problem is solved by adding keyword to the mesh.remove_doubles operator's first argument, meant as threshold property value. With that little bug fixed, your script works properly.

What causes the error is that, keyword arguments are used to set operator properties, and positional arguments to set how the operator is called (further explained in the API docs). By not using a keyword for the first argument, you're turning it into a positional argument, thus interpreted as operator execution context which is an error.

EDIT: Another possible error is iterating over bpy.data.objects, which comprises of all objects in every scene in a file. The script is bound to fail if there's more than one scene in a file containing a MESH object, because it'll try to make object from a different scene the active object of current scene which is contextually incorrect. You should iterate over bpy.context.scene.objects instead.

Here's the amended code, can't see any other bug:

import bpy

scene = bpy.context.scene
scene.layers = [True] * 20 # Show all layers

for obj in scene.objects:
    if obj.type == 'MESH':
        scene.objects.active = obj

        bpy.ops.object.mode_set(mode='EDIT')
        bpy.ops.mesh.remove_doubles(threshold=0.0001)
        bpy.ops.object.mode_set(mode='OBJECT')


In User Preferences search for the "Pipe Joints" addon and enable it.

Press ShiftA and go to Mesh > Pipe Joints > Pipe Y-Joint.

UPDATE:

Pipe Joints is now part of the Extra Objects Addon in the Add Mesh category

And can be accessed through Add>Mesh>Mechanical>Pipe Joints

You can control the shape and angle of the joint by using the tab on the left side of the 3D view.

To add some thickness use a solidify modifier.


How do i make the camera rotate about the object using the mouse or keyboard in the game engine?

Press Shift + F on keyboard
Once you press shift+F on keyboard u can move the camera where you want with the arrow up down front back and A S W D key like games


How can I check the returned boolean of a function?

The way you are doing it in the second block is not what you think you are doing.  The line

if target is True:

will ask if a function reference is the same as a literal True...which it is not.  You want to invoke the function, so use the parenthesis and pass in the string you want.
If the parameter "context" is the one you are interested in comparing (if you are using BPY, it isn't, heads up), it will instead be:

if target(context):

Notice I drop the is True", if is doing that for you already, you don't need to do it again.


This is possible, but requires the sphere to be in a separate collection. Assuming it is, you can use the following steps to hide it in one area, while still displaying the object in the other.

Open the sidebar by pressing N and select the View tab in it.
Expand the panel named Collections
Enable Local Collections, this allows you to have different (local) visibility settings per 3D view area.
Hide the collection with the sphere by clicking on the eye icon behind its collection in the panel


How does the Inset Boundary option work?

The boundary option on an inset faces operation will only inset new faces where the mesh doesn't have a boundary (where the edges connect 2 or more faces).  Where face edges have only a single edge, no new edges will be created:

Any difference in behavior from toggling "boundary" on the operation depends on whether the edges of the inset face are manifold-- which is not apparent in either of your flat shaded example images.


Why is my object offset from the Bezier curve?

That can happen when the curve and the "tentacle" object do not share the same location.

Make sure the location (either under the Object tab of the properties window, or the properties region in the 3D view, accessed by N) are the same for both objects, curve and "tentacle."

If both are the same, in edit mode check that the mesh is at the object's origin. As the gif below shows, when the mesh is away from the origin, even both the curve and object show the same location it will still be off the curve.


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

Use Mirror Modifier

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

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

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

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

Animate with ShapeKey

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

You can do an animation with shapekey.

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

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

Hide the Electrons under the plane

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

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

Result:

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


Any way to attach another mesh to another ( Not CTRL + J)

You could try using the Boolean modifier.  Select your jacket, add the modifier, change the mode to Union, and set the Object to the pocket cube.  Hit apply and it should make it one manifold mesh.


You need to enable Backface Culling in the material settings. It is the extra geometry for creating an outline blocking the view.

You can build a custom toon shader. Here is one:

This is for EEVEE only.

If you want you can watch some tutorials on Non-PBR shading. For example https://www.youtube.com/watch?v=E3zHGD8V2IY or https://www.youtube.com/watch?v=dCF29s2FRsQ


Go to "Mesh" and press "Bake Mesh". This will create a mesh based on the information generated by the fluid data bake. What you are seeing now is only a particle system helping you visualize the fluid and is not meant to actually be used in a finished product.

After baking the mesh is finished, the domain will take on the shape of the liquid, and you will no longer need to use wireframe mode.


In edit mode select the faces you want to modify and then, in weight paint mode, enable the faces or vertices selection masking button. Remember that weight is a property of a vertex relatively to a vertex group, so face normal is not taken into account.


How do we move subdivided things "correctly"?

To do this computationally would be a headache. Every surface point is influenced by multiple control points, there is infinite number of solutions and without some constraints (a 2d plane, some symmetry constraints, etc) it's non-trivial.

The trivial solution is:

The objective is to place the marked surface vertex at (0,0,0):

Copy the object and apply the subd modifier. Measure how far the point is from (0,0,0):

Delete the duplicate and move the original object inverse of what you measured. If you don't want to move the whole object, you have to move the control geometry surrounding the point in question (all vertices that influence the location of that point)


How do I reduce tesselation effect with textures?

It's in the creation and size of the texture that determines the quality of "tiling" over large objects. There are many ways to create a texture. You seem to be interested in photographic textures. The key to success here is to have flat even lighting and a camera that is perpendicular to the subject. If you want to optimize the result the camera should be stationary (IE a tripod). High resolution is also important in the original capture.

In the texture itself, for 3D rendering, the “Power of Two” is important. One potential reference http://www.katsbits.com/tutorials/textures/make-better-textures-correct-size-and-power-of-two.php there are many others. The Blender default is 1024 x 1024. I use 2048 x 2048. I believe larger file sizes (in the current environment) offer little advantage and can even slow the system down. There can always be exceptions.

*Depending on the pattern of the original image capture/texture some modification most likely will be necessary to facilitate tiling. Every image/ texture is different but here are some bullet points to follow in creating tillable textures (assuming the above).

Remove from the original image capture any “stand out” features (Like a large blemish on a slab of concrete or maybe a knot in tree bark).
Duplicate the image and scale the height -100% and the erase/delete part of the top or bottom. Flatten.
Repeat the previous for the width.
Use the new texture and make adjustments if necessary.

*The use/knowledge of image editors like Photoshop/Gimp is key here.  But this is not the forum for me go into that level of detail. Hope this was of some help. Maybe I should do a tutorial?


I downloaded the file.  When I went into Edit Mode, I couldn't select anything for some reason, so I wasn't able to test your exact problem, but I noticed that in Object Mode the whole cup does exactly what you're describing, and I figured out why it's doing that, and it would affect Edit Mode transformations as well.
You have snapping turned on; that's the magnet button up at the top of the viewport.  That is constraining the selection to your floor plane.  So you're trying to move it in the Z axis, but that is exactly what it cannot do while it's set to be snapped to the floor plane, and so it just moves in whatever axes it can.  Turn off snapping, and it behaves normally.


bones on the right side affect the left side

I guess what you want is to create symmetric vertex groups so you don't have to repaint for the left what you've already painted for the right? Once you have finished the weight paint on a side, stay in Weight Paint mode, go to the Properties > Data menu, then click on the button on the right of the Vertex Groups list, choose Copy Vertex Group, a new vertex group is created, then click Mirror Vertex Group, the group has been mirrored. But this method only works on a real symmetric object.


Rigid body tower falling over by itself?

The issue is that rigid body physics are taking over your tower, and making it collapse before the ball hits it, which is what would happen in real life, if the tower was already broken. The way to fix this is to go under Properties > Physics > Rigid Body Dynamics and check Enable Deactivation and Start Deactivated.


Convert imported SVG shape to Bézier/NURBS surface

Just make the shape 2D and it will be filled.

The shape will still be editable as NURBS.

If you need to convert it to a mesh press ALT+C


how to setup the opacity in the stencil brush mode in blender 2.8

You can look in the properties panel under the tool and see the panel 'Display' and open that, and there you can set the stencil brush opacity and toggle it to disappear on stroke.


Is there a way to use the normal of a face to model something else?

You can also select the face, then "view->align view to selected->front" (shift Numpad 1) and then change the 3d manipulator to "view" (instead of "global" or "local"). Then you can extrude a vertex along the normal by pressing "E YY" or "E XX" or use the manipulator to move along the aligned view axis.


How not to render objects when they are out of the frame?

to switch visibility during rendering/animation just hit I when your cursor hovers over the little camera icon to add a keyframe. Then move the timeline cursor to another frame and tap on the little camera icon to toggle it and hove over it again and tap I again -> ready.
The other "place" where you can set the keyframe is here: (it has the same effect): (Renders)


Change Default Render Output to JPEG with 98% Quality

Open a new project and change the output format to JPEG 98% quality in the render settings panel:

Then, from the File menu, choose "Save Startup File" (or press CtrlU).  That will make your compression setting the default for all new projects, and for images saved from the UV/Image editor window.


A camera being ‘multi view’ or not isn't a specific camera setting but relates to the configuration of multiple cameras, with one camera object for each 'view'.

If you look at the bottom of the Views panel of your first screenshot you'll see the 'Camera Suffix' property. This can be defined for each 'view' of the camera.

To link the cameras into a 'multi view camera' you simply need to name them to have the camera 'name' (eg, 'Camera') followed by the suffix.

So, for a multi-view camera named 'MyCamera' with views of 'Left' (suffix '_L') and 'Right (suffix '_R') you would name your two cameras 'MyCamera_L' and 'MyCamera_R'. Selecting either camera as the 'active' one will effectively select both for rendering.

All of the defined Views must exist as cameras in the scene for it to be considered "multi-view".

See Is there a way to batch render images from several cameras? and continuous sequence of frames with multiple cameras with each camera starting at start of animation?


Material preview background color - Blender Cycles

The Material Preview window uses the view transforms set in the color management section.


Setting the Context Window Screen Layout Explicitly in BPY

The current workspace can be changed to the UV Editing workspace through:

bpy.context.window.workspace = bpy.data.workspaces['UV Editing']

This assumes that a workspace named UV Editing exists. In order to check for the case where it doesn't exist, use bpy.data.workspaces.get('UV Editing') instead and verify that the returned value is not None.

The current area type can be changed through bpy.context.area.type. In order to change to the UV editor you can use:

area = bpy.context.area
area.type = 'IMAGE_EDITOR'
area.ui_type = 'UV'

Although it's not documented in the manual you can also just assign the ui_type and it will automatically change the type as well.

bpy.context.area.ui_type = 'UV'

If you want to change a different area than the current one, you can iterate through bpy.context.screen.areas.


How to model a light source using a spectral distribution curve for the color

To accomplish this you would require a wavelength to XYZ conversion, and then from XYZ to sRGB / REC.709 primaries conversion.

Make sure that you obtain linearized RGB values from your wavelengths. If you are using normalized wavelengths, display linear (0.0 to 1.0) would suffice.


Help for creating a radar sensor with python - bge

Please have a look at the BGE API -> KX_GameObject.rayCast

Basically you measure the faces an imaginary line is crossing through.

The mesh of the game object you measure with will be ignored (you want to find another object, rather than itself).

Here is a short demo measuring between [0,-10,0] and [0,10,0]. The coordinates are given in scene space (world coordinates). The direction of the measurement matters as the nearest face to the start point gets returned. The endPosition is a reference where to point to. The measurement will stop after reaching the distance of 15 (regardless the distance to the endPoint).

Code:

import bge

controller = bge.logic.getCurrentController()
owner = controller.owner

startPosition = [0,-10,0]
endPosition = [0,10,0]
distance = 15

hitObject, hitPosition, hitNormal = owner.rayCast(endPosition, startPosition, distance)

if hitObject:
    print("Object hit:", hitObject, "at", hitPosition, "the normal at that point is", hitNormal)
else:
    print("hit nothing")

Be aware this is a one-shot. This means you need to call it each time you need to measure. The python solution fits when you need to measure:

only at specific time (rather than all the time)
with dynamic parameters (rather than fixed distance straight forward)
you need to measure multiple times with changing parameters within a single frame
you need settings the ray sensor does not offer (e.g. measure along a reflected imaginary line)

When you just want to "reinvent" the ray sensor, notice it is way easier to use the ray sensor.


Mirror Modifier is visible in object mode but disappears in edit mode

You need to enable "Display modifier in edit mode". This icon is of a box with four orange corners, and can be found on the modifier node with the other visibility settings.

Box
Displays the modified geometry in edit mode, as well as the original geometry which you can edit.

Without:

And with:

If you enable the Triangle option next to the box one you can then also edit the transformation caused by the modifier on edit mode

Triangle
When enabled, the final modified geometry will be shown in edit mode and can be edited directly.

For a detailed description on the use of these options read this page of the Blender manual.


Please help me understand the various ways that textures need to be linked to images

In order to paint on a texture, the texture must be of type "Image or Movie":


Traceback error when attempting to add a reference or background image in 2.8

Just had this same problem.
I was trying to add the image to a hidden collection.
Adding to an unhidden collection gave me the reference.


BGE How to make text appear when winning or losing a game?

The Message Actuator works with the Message Sensor to send messages between objects in the game, not to send messages to the player. To show text to the player you need to show a text object or an object that has text as part of it's material, you can also use a scene as an overlay to present the text as part of a HUD.

You could use the messaging system to have an exit sign object become visible by having it change it's visibility when it recieves a message.


Go to Object tab (with Sphere selected) and switch Maximum Draw Type to Textured.


How to render a mesh transparent with a color on its edges only, with nodes?

EDIT:

Here's an example using layer weight/fresnel to control the transparency:

So how does it work?

The Fresnel value on the Layer Weight controls the mix of emission and transparency.

But you can see right through the mesh at the back side of the object. So you need to limit the rendering to only the part of the geometry first seen by the camera, and make the back faces transparent. That's what the Light path node and Transparent depth is for.


Problems applying Boolean modifier to mesh using arrayed object to make Colander

The result you have is correct but the subdivision surface modifier doesn't have the geometry to make it look nice.  You could try marking the edges of the holes as creases with SHIFT E.  Then the subdivision surface will know where the edges are.


How can I access, edit, add and remove Metaballs in Edit Mode with Animation Nodes?

You can use a simple script as follows, you access the required metaball data block by name, clear its balls, and add new metaballs and edit their attributes like location and radius:

mball = bpy.data.metaballs[name]
mball.elements.clear()
for v, r in zip(locations, radii):
    ele = mball.elements.new()
    ele.co = v
    ele.radius = r

The API describe the possible attributes per ball.


Make sure your image texture and your material are single users, if anything is repercuted on the other objects it means they are still using the same data-block.


Is it possible to stack two or more materials with transparency for textures?

In the material tab, go to Settings and change the Blend Mode from Opaque to Alpha Blend or other related Aplha options


Why doesn't the shutter speed have any effect on image brightness?

Unlike a real camera, in blender the brightness on the scene will not be affected by the shutter speed (or angle), or the f stop used by the camera.

If you want to change the overall brightness of a scene change the

Film->Exposure control.

There is no ISO, or photosensitive anything in blender as on a real camera. You can of course change the exposure of your scene to simulate the effect it would have with changes in exposure time.

If you think of a shutter shutter angle of 0.5 as the normal exposure, changing the value to 0.25 would result in an image that would be darker since it only captures half of the light than the normal exposure. To simulate the exposure change you would need to make your image darker by changing the Exposure in the film section to 0.5

Conversely, if you changed the shutter speed to a setting of 1.0, it would result in twice the brightness, so to simulate the change you would need to have an exposure value of 2.0.

There might be a way to create a script or a driver to do the computations for f stop, and shutter... but there is no built-in functionality for it by default.

Just to be clear, the term "exposure' in blender is quite different than it is in film or digital sensors. In cycles, the value of a given pixel is calculated by the amount of light being reflected by objects based both on the intensity of lights, the albedo (reflectance) and other characteristics of the material and other atmospheric factors (if you use volume scattering). The resulting values are then processed through the color transforms on the color management section, which will determine what the pixel's brightness and color will be. There is no notion of "exposure time" or "ISO" (in terms of sensitivity that would affect brightness).

The shutter speed option in blender is there to simulate motion blur (as pointed by @michaelh).

The F stop is there also to simulate the effects of depth of field.

Changing the values of either one of them will not affect the brightness of the rendered image.

If you want blender to behave like real camera in terms of exposure there is no automatic option for it, you will have to do it by hand (or through a script)


How to choose between entering a Radius or a Diameter when creating a Circle

It's not posible to toggle the Radius field to Diameter. However, as the diameter is twice the radius there is a direct relationship between the two - so the Radius is the Diameter divided by 2. Also, Blender is capable of automatically interpreting mathematical formula when entering values.

Therefore, to create a circle of, say, 30 units in diameter, simply type 30/2 into the Radius field and Blender will automatically calculate 15 as the radius.


Can I cut out the texture part of an object?

If you are using armature for both objects you can just hide one of them in the Outliner. If you joined objects together and didn't connect any of their vertices then you can easily assign different materials to them from edit mode. Go to edit mode, mouse over one of the objects, press L (it should select only connected vertices, 1 object in your case), assign other material to faces from material tab (Assign button under list of object materials).


Align vertex with edge or rather the imagine line between two verticies

Your goal is not fully specified by the imaginary line.. the sharp edges could be flattened to any plane that contains it.. (they could be twisted at any angle around the line)

If there is a plane you want to flatten to:

In the Pivot Center menu in the header, select 'Active Element'
Select three vertices which define the plane (possibly including the ones at the ends of your imaginary line)
Hit Ctrl Alt Space to create a Custom Orientation from them, checking 'Use after Creation'
Select the edges you want to flatten, and then, in vertex mode, one of the vertices that defined the plane
Hit  S Z Z 0 to scale the edges onto the plane.


So here is a quick try: First, deactivate the world in the Shader Editor, increase a bit the strength of the 2 suns to 2, as the shadows are a bit too dark and as you need to compensate a bit the removal of the world, create a point light in the middle of your room, disable its shadow option and give it a strength of 300 W. It may need a bit of tweakings but I think I'm not far from what you want?
Edit: also, maybe a Light Probe > Irradiance Volume will improve the lighting, to be tested


You are on the right track with using the Boolean Modifier, you just have to use it on the "Lumpy Tunnel" as well.
Add a boolean to your tunnel, and select your staircase as the cut object. As you can see from the photos, the original placement of the staircase causes the bool to make some ugly cuts (Image 1), but if you move it .001 along the Y axis, it makes a cleaner bool operation (Image 2).

After applying the boolean, it's just a matter of cleanup. For me, the bool left a ring of duplicate faces on the inside of the "merged junction (Image 3). I deleted them, and then there was another ring of faces underneath. Select and delete them as well (Image 4).

The result should look like this:


Subdivide is a bad option in your situation because you get more verticals than you need.

The fastest way, in my opinion, is to manage this with a loop cut.

Loop Cut CTRL+R and slide to the position where you want to connect your vertex
Select your vertices and merge ALT+M them

You could the same with the knife tool (K). However you can't guarantee  for a good mesh flow if you do so.
With Loop Cuts you are most of the time on the good side.


Drawing text through bge module - Drawing several words

Managing multiple text fragments

I suggest to place the text attributes into a container such such as a class:

class Text():
    def __init__(self, text, x, y, color, font_id):
        self.text = text
        self.x = x
        self.y = y
        self.color = color
        self.font_id = font_id

You can use a list or dict too, but I think this is easier to understand as you see the structure of the data.

Then place modify your code that it can work with the above text container:

blf.position(text.font_id, (width * text.x), (height * text.y), 0)
blf.size(text.font_id, 50, 72)
bgl.glColor4f(*text.color)
blf.draw(text.font_id, text.text)

This still allows just one text to be drawn (as there is just one text container). But now it is pretty easy for us to create a container that can contain any number of texts:

texts = []

You create that once in your drawtext.py replacing font_id, chain, positionx, positiony.

Make sure your write() can deal with more than one text container:

for text in texts:
    blf.position(text.font_id, (width * text.x), (height * text.y), 0)
    blf.size(text.font_id, 50, 72)
    bgl.glColor4f(*text.color)
    blf.draw(text.font_id, text.text)

Now you can add some comfort to your module, by providing a function that let you easily add new texts:

def add(text, x, y, color, font_id=0):
    texts.append(Text(text, x, y, color, font_id))

Your using script can look like that:

import drawtext
import bge

COLOR_GREEN = 0.0, 1.0, 0.0, 1.0

if all(sensor.positive for sensor in bge.logic.getCurrentController().sensors):
    drawtext.add("Hello Green World!", 0, 0.15, COLOR_GREEN)

The complete drawwtext.py can look like that:

import bge
import bgl, blf

texts = []

class Text():
    def __init__(self, text, x, y, color, font_id):
        self.text = text
        self.x = x
        self.y = y
        self.color = color
        self.font_id = font_id

def add(text, x, y, color, font_id=0):
    return texts.append(Text(text, x, y, color, font_id))

def write():
    """write on screen"""
    width = bge.render.getWindowWidth()
    height = bge.render.getWindowHeight()
    # OpenGL setup
    bgl.glMatrixMode(bgl.GL_PROJECTION)
    bgl.glLoadIdentity()
    bgl.gluOrtho2D(0, width, 0, height)
    bgl.glMatrixMode(bgl.GL_MODELVIEW)
    bgl.glLoadIdentity()

    # BLF drawing routine
    for text in texts:
        blf.position(text.font_id, (width * text.x), (height * text.y), 0)
        blf.size(text.font_id, 50, 72)
        bgl.glColor4f(*text.color)
        blf.draw(text.font_id, text.text)

bge.logic.getCurrentScene().post_draw = [write]

Font Management

You might have noticed that I skipped fonts in the above code by making them optional. I recommend to manage them separately. The blf-module is the font container already. But you need a way to provide easy access to the loaded fonts without dealing with cryptic numbers. I suggest to create a new module fonts.py encapsulating the load operation:

import blf

def load(file):
    return blf.load(bge.logic.expandPath(file))

this enables you to declare font "constants" right at the beginning of drawtext.py:

FONT_ID_ARIAL = fonts.load("//arial.ttf")
FONT_ID_AGENCYR = fonts.load("//AGENCYR.TTF")

Which on the other hand enables you to use them when defining your text fragments:

import drawtext
import bge

COLOR_GREEN = 0.0, 1.0, 0.0, 1.0

if all(sensor.positive for sensor in bge.logic.getCurrentController().sensors):
    drawtext.add("Hello Green World!", 0, 0.15, COLOR_GREEN, drawtext.FONT_ID_AGENCYR)

The reason why load() is placed in a new module is simply to avoid defining this function before you define the constants, which let the constants be a the pretty top of drawtext.py

Color Management

You can do a similar method with colors. Right now each user script adds his own color. You can provide a few color constants right at the beginning of the module:

COLOR_GREEN = 0.0, 1.0, 0.0, 1.0
COLOR_RED = 1.0, 0.0, 0.0, 1.0
COLOR_BLUE = 0.0, 0.0, 1.0, 1.0
COLOR_BLACK = 0.0, 0.0, 0.0, 1.0
COLOR_WHITE = 1.0, 1.0, 1.0, 1.0

this allows to use them wherever this module is used:

import drawtext
import bge

if all(sensor.positive for sensor in bge.logic.getCurrentController().sensors):
    drawtext.add("Hello Green World!", 0, 0.15, drawtext.COLOR_GREEN, drawtext.FONT_ID_AGENCYR)

Complete Code

fonts.py

import bge
import blf

def load(file):
    return blf.load(bge.logic.expandPath(file))

drawtext.py

import bge
import bgl, blf
import fonts

FONT_ID_ARIAL = fonts.load("//arial.ttf")
FONT_ID_AGENCYR = fonts.load("//AGENCYR.TTF")

COLOR_GREEN = 0.0, 1.0, 0.0, 1.0
COLOR_RED = 1.0, 0.0, 0.0, 1.0
COLOR_BLUE = 0.0, 0.0, 1.0, 1.0
COLOR_BLACK = 0.0, 0.0, 0.0, 1.0
COLOR_WHITE = 1.0, 1.0, 1.0, 1.0

texts = []

class Text():
    def __init__(self, text, x, y, color, font_id):
        self.text = text
        self.x = x
        self.y = y
        self.color = color
        self.font_id = font_id

def add(text, x, y, color, font_id=0):
    return texts.append(Text(text, x, y, color, font_id))

def write():
    """write on screen"""
    width = bge.render.getWindowWidth()
    height = bge.render.getWindowHeight()
    # OpenGL setup
    bgl.glMatrixMode(bgl.GL_PROJECTION)
    bgl.glLoadIdentity()
    bgl.gluOrtho2D(0, width, 0, height)
    bgl.glMatrixMode(bgl.GL_MODELVIEW)
    bgl.glLoadIdentity()

    # BLF drawing routine
    for text in texts:
        blf.position(text.font_id, (width * text.x), (height * text.y), 0)
        blf.size(text.font_id, 50, 72)
        bgl.glColor4f(*text.color)
        blf.draw(text.font_id, text.text)

bge.logic.getCurrentScene().post_draw = [write]

Show Green Text

import drawtext
import bge

if all(sensor.positive for sensor in bge.logic.getCurrentController().sensors):
    drawtext.add("Hello Green World!", 0, 0.15, drawtext.COLOR_GREEN, drawtext.FONT_ID_AGENCYR)

Show Red Text

import drawtext

    if all(sensor.positive for sensor in bge.logic.getCurrentController().sensors):
    drawtext.add("Hello Red World!",0,0, drawtext.COLOR_RED)

Excercise

I suggest to allow customizing the size of the text fragment. How would you do that?


Blender scripting: Circle Selectiong in the "3D View"

You have to override the context to be able to call this operator outside of the 3d view :

import bpy

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':

        override = bpy.context.copy()
        override['area'] = area
        override['region'] = area.regions[4]

        bpy.ops.view3d.select_circle(override, x=300, y=150, radius=300, gesture_mode = 3)
        break

Update : Finding the camera corners coordinates

import bpy
from bpy_extras import view3d_utils, object_utils

scene = bpy.context.scene
cam = scene.camera

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        viewport = area.regions[4]
        rv3d = area.spaces[0].region_3d
        P1 = (0,0)
        P2 = (viewport.width, viewport.height)

        depth_location =  view3d_utils.region_2d_to_vector_3d(viewport, rv3d, P1)
        p = view3d_utils.region_2d_to_location_3d(viewport, rv3d, P1, depth_location)
        P1cam  = object_utils.world_to_camera_view(scene, cam, p)

        depth_location =  view3d_utils.region_2d_to_vector_3d(viewport, rv3d, P2)
        p = view3d_utils.region_2d_to_location_3d(viewport, rv3d, P2, depth_location)
        P2cam  = object_utils.world_to_camera_view(scene, cam, p)

        cam_width = int(P2[0]/(P2cam[0]-P1cam[0]))
        cam_x = int(-1*P1cam[0]*cam_width)

        cam_height = int(P2[1]/(P2cam[1]-P1cam[1]))
        cam_y = int(-1*P1cam[1]*cam_height)

        print(cam_width, cam_height, cam_x, cam_y)
        print("\nP(0,0) at (%d, %d) and P(1920, 1080) at ( %d, %d)"%(cam_x, cam_y, cam_x+cam_width, cam_y+cam_height) )


Whats the cheapest particles to use? Both in Blender Render and Cycles

I think the best thing to do is to benchmark. My five cents are that (personal best guess based on seven years of Blender usage, but not backed by actual tests):

If you are only rendering the particles (black or photographic background), you can get away by using only one (or 2 for antialias) sample in Cycles. It should be fast.
If you have something else Cycles-powered in the scene, you would have to crank up the samples, thus rendering bounces from  the particles. That could be a real pain. You may want to do a mixed composite.
If you are doing it in the internal in the first place, stick with it.

Using the "Halo" setting (in the internal) could give more pleasant results than "Billboard" if you are doing sparks or somesuch.

Cycleswise you could give a shot at the new point density input for a volume. It has the good side of not requiring you to make physical planes orient themselves to the camera. I am pretty sure it is far slower than anything else though.


So just rigging a model and after parenting my arms and legs the spine will move the mesh but the limbs wont!

Might need to use weight paint mode to put som weight on the mesh from the bones related to arms and legs. If you select the mesh and then go into weight paint mode the parts of the mesh that are affected by your bones will be colored other than blue. You will find each bone that deforms the mesh in vertex groups for the mesh


Why is this happening and how may I make it look like wood?

There aren't many reasons for this other than you didn't follow the tutorial correctly, because the wood in the tutorial looks completely different.
Tutorials are meant to be watched and re-watched until you get how the stuff works, so this is normal. It is completely normal not to understand everything straight away, I believe this happens to everyone who tries to learn CG and it's OK. You just need to redo it. ...and then possibly re-do it once more, and once more after that, and maybe even after that and so on. This is how learning 3d goes - there is lots of re-doing at first. Watch the tutorial again as many times as you need to and follow it more thoroughly until you understand everything that is done in it and get good results. If you want a more in-depth answer about it than this, you need to share your file so people can see what exactly you did.


The problem is in your Mesh. Go to edit mode, select all Polygones an then click ALT+N and chose recaculate outside.
That is because the Polygon have 2 sides. Front and Backside. You cant paint on the backside of the Polygon


How to setup custom data-structures in blender python?

Make your custom class a subclass of bpy.types.PropertyGroup, then you use that as the type for a bpy.props.CollectionProperty. See the collection example here.

I expect your collection should be part of the armature data, if you wanted a more global collection add it to bpy.types.Scene.

class BoneCluster(bpy.types.PropertyGroup):
    name = bpy.props.StringProperty()
    # ...

def register():
    bpy.types.Armature.clusters = bpy.props.CollectionProperty(type=BoneCluster)

def unregister():
    del bpy.types.Armature.clusters