How to draw a circle on a plane with OSL (Open Shading Language)? This is my very first day of learning Open Shading Language. I have watched few videos in Youtube and learned a little.

Right now, for learning purpose only, I want to know what OSL codes can draw one black circle against the white ground of plane, but I can't find any tutorial to teach me that.

Next, I want to know how to do a circle grid like this below.

And this too.

These scripts will create two nodes. The first one is for the grid and the second one for the circle. By changing the size of the grid, you will have more or less circles. By changing the radius, you will have bigger or smaller circles.

shader Tiles2D(
    point Vector = P,
    float Size = 1,
    float Offset = 0,
    output vector Tiles = vector(0,0,0)
)
{
   Tiles = Vector * Size;
   Tiles[2] = 0;
   Tiles[0] += step(1,mod(Tiles[1],2)) * Offset;
   Tiles -= floor(Tiles);

}

shader Circle(
            point Vector = P,
            float Radius = 0.5,
            output float Fac = 0)
{
    vector st = Vector;
    vector dist = st - vector(0.5,0.5,0);
    Fac = smoothstep(Radius*0.99, Radius * 1.01,dot(dist,dist)*4);
}


Is it possible to determine the UI panel class that is parent/host to an operator when its button is clicked? I'm dynamically registering a variable number of panel classes, all sub-classed from a custom panel class that includes an operator. Thus all the new panel sub-classes contain a button that executes this common, ancestral operator code. When the button on one of these new sub-class panels is clicked I would like the operator code to be able to determine which of the panel/button instances invoked it. Is such a thing possible? My apologies if I've not described this very clearly. Basically I'm trying to recreate the same functionality as the 'X' button that sits in the header of modifiers sub-panels. In my example, the code behind the X button needs to know which panel class the clicked button belongs to in order to unregister the correct panel. Any advice is greatly welcomed and appreciated. Thank you!

You can define a property for the operator in order to identify something.
For instance:
class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    # >>>> Declare a property
    some_value = IntProperty(default=0)

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

    def execute(self, context):
        print(self.some_value)
        return {'FINISHED'}

Then, in the panel you can assign the property value as you want:
class HelloWorldPanel(bpy.types.Panel):
    """Creates a Panel in the Object properties window"""
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    def draw(self, context):
        layout = self.layout

        row = layout.row()
        op = row.operator("object.simple_operator")
        # >>>> Assign its value
        op.some_value = 1
        op = row.operator("object.simple_operator")
        # >>>> Assign its value
        op.some_value = 2

Alternatively, you can assign the value in a subclass if your want to work with subclasses.


Using the UE4 mannequin for scale in Blender So I am rather new to Blender, UE4 and modelling in general and am currently about to create a modular pack to import into UE4 and create a scene. I have done reading on units and scaling in both programs and have made sure I am going to be 1:1 for the process though I am scratching my head with one thing... the mannequin for reference.
I will be creating hallways, walls, doors, windows etc etc and want to make sure they all look and feel right in context. So as far as I can tell in my research, the UE4 mannequin is 183cm tall in UE4, so I am rather confused after exporting it and importing it into Blender that it comes out around 210cm tall in Blender. I thought I was 1:1 where does this 27cm difference come from and what is the way out of this? Oh, and I want precise not approximated size.
I can't find an answer anywhere.
I'm at a loss because I am a noob. Any help would be appreciated thank you.

In Blender you can input math operations instead of values. In your case select the mannequin followed by S 183/210 This will reduce the size to that you had in UE4.
Putting Scale X,Y and Z transform fields to 183/210 and hitting Enter works as well. Also, this is the way to use with i.a. modifiers and every field.


Animation Nodes using 100% CPU on Linux I am trying to create a node tree that builds a 3D matrix of 10x10x25 spheres. With the node tree shown below my cpu is at 100% at all times. Am I asking too much of it or is there a way to reduce the drain on the processor. I am using the latest 2.79 version of Blender on Ubuntu 17.10 Thanks!

node tree image

In default settings, AN rebild scene "always", that means that AN invoke your set up as many times as it possible.

Instead of this, try the setting, whan AN will be invoke nodes only if something changed:

It's more friendly for CPU, and faster for workflow..


Control-Click on a Mac? How can I Control Click on a Mac? I mean holding the Control key and clicking to get the RMB  functionality. I know that I can use a right-click mouse, but I like using Ctrl-click.

simple answer is to go to system prefs on MacOS and go to mouse or on macbook trackpad and select point and click settings and then secondary click and adjust any necessary settings


Extrude normals not working properly When I extrude these faces along normals with Alt+E and select Extrude along normals my faces get extruded wrong, even If I select Offset Even the thickness of the model is wrong.

I reset all my settings and reopened Blender before trying to replicate this behaviour. It still happened.

So here's what I expect

Heres what I´m getting

You must have changed the scale of your object in Object mode, you need to apply the scale with ctrlA, otherwise you will have some stretch effects when beveling, shrink/fattening, etc.


In v2.7 cannot repeat change to solid view-port shading default gray to shiny metalic option. In v2.7 I, as complete newbie, I first attempted to use the materials menu (without reading a tutorial) and was offered, to my pleasurable surprise, a window with an array of selectable shiny materials, perfect for my model. These were applied in solid view-port shading for both edit and object modes, replacing the gray default material. I disabled this material becuse its brightness was occasionally obscuring the meshes during editing, and presumably having not saved this, it has been lost. I have been unable to repeat my actions despite having loaded all .blend files on my system to retry and having done endless web searches for information.
I would dearly like this option back, can anyone help please?

I think you are talking about the Matcap option for solid view mode :

In 3D view, hit N key to display the properties toolbar, then thick the Matcap option and choose a material.

Note that it only affects the 3D view in "solid view" mode, and won't be used for rendering.


Shrinkwrapping moiré-like artefacts (blender-osm) I'm having issues with getting a water polygon imported through blender-osm add-on to properly shrink-wrap on the corresponding terrain.

Here is what the artifact looks like (the black moiré-like effect):

Here is what the polygon looks like when it isn't shrinkwraped:

Any idea on how to deal with these problems when shrink-wrapping in general (or with the Blender-osm add-on in particular)?

Shrinkwrap will move the faces of an object on top of the faces of the target object, making them overlap or occupy the same space. When that happens you get Z-fighting errors. The program cannot decide which surface to render.
 (For a detailed explanation read https://en.wikipedia.org/wiki/Z-fighting).

To avoid it make the shrinkrwapped surface be above or below the target surface. Use the Offset option within the modifier.

Additional info in this related link:  How do I avoid rendering glitches from overlapping faces?


Rigid body simulation always has a visible collision space Every time I use the rigid body tools I have a visible space between the passive object and the active object, even when I set the collision margin to very small or zero.  Any suggestions?

This seems to be caused by the Subsurf modifier on the Suzanne.

Frame 124 with the Subsurf modifier:

Frame 124 with the Subsurf applied:

In addition the Backdrop had a collision margin of 4cm, in the images above it is set to 0.

Comparison of frame 124 with the collision margin of the BackDrop set to 4cm and 0m:

I also set the Collision shape of the Suzanne to Convex Hull and disabled Collision margin.


How to identify unsupported properties (such as vertex-groups) without relying on names? I created a plugin that procedurally creates vertex-groups.
The only problem is that I cannot identify the vertex group I created because bpy.types.VertexGroup doesn't support any custom id properties.
 C.object.vertex_groups['MASK: PAINT.00']["unique identifier"] = "5sdf4e6hg4hjs6" #trying to create a prop to identify my created vg
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
TypeError: bpy_struct[key] = val: id properties not supported for this type

#adding bpy.props won't work either

Right now I'm working with their names, the only problem is that once the user remove or rename the vertex group my whole vertex group management fall appart.
how can we accurately identify vertex groups without relying on their names?
Does anyone have a solution to such kinds of problems?
PS: note that this kind of problem is not specific to vertex groups, many other properties don't support custom props.

Potential Solution?
I did some tinkering.
Visibily there's no way to add properties to this bpy.types.VertexGroup
it's also not possible to create inherited subclass in blender.
Maybe playing with memory address can help here
>>> print(C.object.vertex_groups['Group'])
<bpy_struct, VertexGroup("Group") at 0x000001BA8B6041C8>

>>> print(C.object.vertex_groups['Gro'])
<bpy_struct, VertexGroup("Gro") at 0x000001BA8B6041C8>

we can see that when changing the vg name, the memory address stays the same, so here we have an opportunity to identify our object. for example with the as_pointer() function
It's sure that the memory address will be lost when quitting the blender.exe, but we could counter that by saving the names of our VertexGroups in bpy.app.handlers.save_post the when the user open blender again we could reset all our addresses.
So the technique could work per blender session?
the only problem is that I'm not sure if blender can dynamically re-allocate memory if needed, or if the memory address will stay static per session.

Edit1*
Bad Idea, objects are dynamically allocated in memory and might change
So maybe we could identify our objects using __hash__?
I'll do some tests
Edit2*
no hash() method won't work, same for id() These function are based on memory too


Nothing will unwrap, even after applying seams Absolutely nothing will unwrap, on any layer, at all. I have no idea why. The E hotkey doesn't seem to do anything, and neither does pressing the unwrap function its self. I'm at a loss.

Choose the UV Editor, not the Image Editor, or choose Paint mode instead of View. Also, use U to unwrap, not E.


Shading faces depending on orientation Newbie here with possible strange request.

I am learning anatomy, currently by studying a 3d skull.
I would like to lit it in some ways, so that the faces facing front would be in a certain color, the faces facing left in another, the faces facing right in another.. you get the idea.
This would come with some threshold i guess: lit faces that are x degrees facing front for example.

I guess that i would have to dig into creating a shader to do so? Maybe with the normals?
Maybe what i want is not possible?

Thanks in advance!
Y

If you want it to look like lighting, you could just use colored lights?

But to shade the surface, you could use an arrangement something like this ..

.. which is quite tweakable .. It would depend.. how do you want the colors to be combined.. as @moonboots asked, do you want the colors to be stuck to the surface?


Simulating a screw turning a gear My goal is to model the parts for a guitar in FreeCAD and Blender, and then use Blender to make sure they will work before I have them made. I've started with the tuners, which consist of a screw turning a gear (and a post attached to the gear, and a little handle and enclosure).

I've figured I need to constrain the position of both main parts, and limit their rotation. But I can't figure out the best way to rotate my parts. The game engine doesn't seem to use precise enough collision detection, and I have trouble making my screw spin with regular Blender physics. I've tried adding wind to spin the screw, adding a vortex force to the screw, tweaking the weights of the objects, and nothing really works.

Here's the blend file.

Animating gears is usually done using the Copy Rotation  constraint, in your case you want to copy the rotation from another axis therefore you might want to use the Transformation constraint to copy and scale the rotation from one axis to another:

Video Tutorial:
Gear rigging tutorial constraints

Note: This is only to do an animation, I'm not sure whether Blender is suitable for simulation of mechanical parts from an engineering point of view.


Animation Nodes Error When Checking off Add-on I have installed Animation Nodes from animation_nodes_v2_1_windows_py37.zip in Blender 2.80. Installation seemed fine. When I check off 'Node: Animaton Nodes' in the list off Add-ons, I get an error message

I saw on the Animation Node Github page the answer is to download VC_redist.x64.exe from Microsoft. Sorry, I should have read that before posting - hopefully this will help other people searching for the same issue.


Blender crashes when enabling "true" displacement I created an OSL shader (a 4D noise texture) and connected it to the "Displacement" output of my shader. I wanted this to be a animated micropolygon / adaptive subdivision displacement, so I enabled "Experimental" of course.

When I go to make the Displacement type "true" though, Blender consistently crashes, probably due to memory overload. I don't have an especially high vertex count, though.

How can I work around / fix this?

This video shows the problem, it's through Google Drive.

Here is the Stackexchange question that help peed me create the OSL shader

And, finally, here is the video that was guiding me through the Micropolygon Displacement process.

EDIT: Here is my OSL code.

#include "stdosl.h"

shader simple_noise_texture4d(
float Scale = 1.0,
float Time = 0.0,
output color Color = 0.0
)
{
    Color = noise( "uperlin", P * Scale, Time );
}

This doesn't explain the crash but does offer a way to work around the issue.

I noticed that your OSL script is generating a Color to pass into the Displacement. The Displacement is a Scalar value (at the moment - I believe the future incarnation of True Displacement will offer a Vector - much more versatile) and so there is no benefit in generating your displacement as a Color - it will be converted to and interpreted as a scalar value anyway.

By amending the OSL code to generate a float rather than Color, Blender no longer seems to crash :

Further to this, it appears to be specific to the type of noise used. For example, changing using 'usimplex' instead of 'uperlin' does not trigger the issue - also fine for 'cell', 'simplex', 'perlin' (without the 'u'), 'gabor', etc. all seem to work fine but for some reason 'uperlin' causes the crash - but only if you actually try to 'use' one of the elements of the color (eg, color c = noise('uperlin’, P*Scale, Time); Displacement = c[0]; causes it to crash).


Any tips on modeling this mushroom? I'm not quite sure the approach for this and would be grateful for any tips. Using cycles in 2.81

Create hair particle system. Add wind pointing down. Add material.


Get value from a bpy.types.Scene property I have a few properties created like:

bpy.types.Scene.myprop = bpy.props.IntProperty(name="Myprop",default=1)

I want to save their values to a text file but don't know how to extract the actual value (saving just myprop saves all object data instead of just the int value).
How to get the actual value?

You can access using bpy.context.scene likes this: print(bpy.context.scene.myprop) or set it equal to a variable: value = bpy.context.scene.myprop, also in your post, make sure you have IntProperty not InProperty like you currently have.


How to get if the image texture node material lost image path with python? I was wondering if there was a way to get the simple information.
For example on the broadcast node in this case it has lost the image link, how can I get this information in python?
This is the classic situation:

I would like to understand how this information can be obtained through blender bees if possible.
And if there is also information about the path of the folder to the currently lost file

This could be useful, I should have found the method that checks the state of the images.

To check if the image in the node are "Purple":

import bpy

    ob = bpy.context.object
    mat=ob.active_material

        for n in mat.node_tree.nodes:
            if n.type=='TEX_IMAGE':
                img=n.image
        for i in bpy.data.images:
            if i == img:
                print(i.has_data)

    ###if your material are lost/purple return true

This will go directly to material the node, but you can check it directly in bpy.data.images

for i in bpy.data.images:
    if not i.has_data:
        print('Purple/lost image find: ' + i.name)
##print a list with lost image file

So I suppose this is my answer


Is there a tool for scientific visualization using Blender? Is there an interface or API that allows using Blender as a tool for mathematical and scientific visualization?  It should allow Blender to read in data (a la gnuplot or matlab, perhaps using scipy) and interface with Blender's primitives and rendering engine to create the output.

Detailed Example:

I was imagining (hoping for) an API that would take matplotlib-like calls (e.g., plt.{x,y,z}label, plt.gca, plt.plot(cos(x in range(0,2*pi,0.01*pi)) ), etc.) but instead of drawing to a canvas, it would generate a scene. It would be fantastic to be able to map data or functions to texture coordinates, to add more sophisticated visualization techniques than color maps allow. Also nice would be to input functions as parameters to textures or meshes, so I could "plot" a catenary path, and then make a polygon follow that path to make a mathematically precise arch.

Blender is the tool and bpy is the API.
If you want to render geometry you can use bpy to deal with any meaningful input. Blender has been used effectively to display data for scientific publications for many years. I'll add a non-exhaustive list below. But if you are expecting ready made functions to plot a 3D scatter plot with scales and cube grid, with evenly spaced intelligent sub-ticks, I'm not aware of any. However, once written you can pump similar data through that routine in the future. This might be a lot of work the first time, but then you learn how to do it and can customize your visualizations meticulously.
The more you can prime your data in those packages like matlab, octave, numpy, and scipy prior to bringing it into Blender the better. (ie. find the min / max / scale / appropriate dimensioning values, tag your data set ..etc). If you are using matplotlib, it is possible to retrieve generated plot data (like autoscaling margins..etc) and use that to build your custom scene.
In recent official builds (and from builder.blender.org/download/) the numeric Python library numpy is included by default. Allowing you to speed up a lot of heavy computations which don't rely directly on bpy.
Useful plotting addons:
Add Mesh / Add 3d Function Surface: Takes formulae for x, y and z axis and generates the surface mesh.
Sverchok: This node based geometry generation add-on is developed primarily with Architecture and Design in mind, but it can generate meshes from any kind of data, or a combination of its 150+ nodes. If the data type isn't supported by default you can easily write an importer or ask on our Github issue tracker for advice.
Examples of scientific usage of Blender
Mathieu Gibert
This researcher at the Max Planck Institute for Dynamics and Self-Organization used it here: http://www.gibert.biz/downloads/3dscatterplotswithblender
(with an example script, and data)
There's a thread over at BlenderArtists about his forays into visualizing that data.
BioBlender
http://bioblender.eu/ with some fantastic renderings of molecular structures. From version 1.0 onwards this has become an addon, and has its own Github repository
excerpt from the site:

BioBlender is the result of a collaboration, driven by the SciVis
group at the CNR in Pisa (Italy), between scientists of different
disciplines (biology, chemistry, physics,  computer sciences) and
artists, using Blender in a rigorous but at the same time  creative
way.

Visualize Color Spaces
Interesting visualization from Mark Meyer to show color spaces.
http://www.photo-mark.com/notes/2013/mar/13/color-theory-blender/
CellBlender
http://mcell.org/ (combines matplotlib and Blender 2.6x)

MCell and CellBlender development is an ongoing collaboration between
researchers at the Pittsburgh Supercomputing Center, the Department of
Computational and Systems Biology of the University of Pittsburgh, and
the Computational Neurobiology Laboratory at the Salk Institute, with
support from the National Institutes of Health, the Howard Hughes
Medical Institute, and the National Science Foundation.

AstroBlend:
An Astrophysical Visualization Package for Blender. http://www.astroblend.com/
From the abstract to this paper, which is  introductory to AstroBlend

an open-source Python library for use within (...) Blender. (...) AstroBlend combines the three dimensional capabilities of Blender with the analysis tools of the widely used astrophysical toolset, yt, to afford both computational and observational astrophysicists the ability to simultaneously analyze their data and create informative and appealing visualizations

Elsewhere
A swift google search for blender for scientific visualization returns many examples of people using Blender with their data.
I started a github repo with scripts that may be of use for understanding how to create 3d meshes from functions, called BlenderSciViz. It is still rather minimal but I welcome any reasonable feature requests if you can provide me with representative data sets so I can test and fine tune the resulting geometry algorithms.


How to exact copy paint weights from one object to another 2 object occupying the same space with the exact same geometry.
They both need to be influence by one bone identically. I edited one's paint weight so I want to have the same changes applied to the other.

I was suggested to:
Select the object with the correct weight(source)
Shift select the object that you want to copy weights.
In weight paint hit [ Transfer Weights ]
Opens the Transfer Mesh Data tab.
hit [ Transfer Weights ] again.

I tested it in pose mode but it didn't work they are still different.

(UPDATE)
Upon additional information
Hit [ Transfer Weights]
For Source Layer destination select: By Name
For Destination Layers Matching select: All layers
For Mix Mode select: Replace

I know this is 4 years old post but I've found a simpler solution with blender 2.82. So what I do is I copy the mesh that has three original vertex groups and arrange in the space where the 2nd mesh is meant to be at. Then rename the 2nd mesh's all vertex groups to different so it can retain its weight paint from original mesh. I used armature human rig default.


How do I set scale pivot point to cursor in Blender 2.90.0? Here's my problem, I'm trying to pivot around where my 3D cursor is located in the picture. I've tried to set "orientation" to cursor in multiple places, none of them seem to do anything. When I scale it's still around where the scale pivot point you see in the picture is.

Second part of the question, the move operation has the ability to snap to vertices after locking to an axis, so if you want something at the same height you can just lock to your Z axis and hold your mouse over the vertex you want to match the height to and you're done. I haven't been able to use this feature with the scale operation. I have the exact same problem, I want to scale the selected area to match the heigh of the notch above it, so using the same logic as the move tool I would scale it, lock to Z and snap to the height I want to scale to. This does not seem to work (Snapping doesn't seem to work at all using the scale tool). Is this just a bug or a feature to be implemented in the future? Cause it's really really really really really really annoying to have tools work in completely different ways when they basically do similar things.

You need to use Pivot Point > 3D Cursor (right next to it).
Snapping while scaling also works just fine.

Change pivot point to 3D cursor
Select vertices you want to scale, last selected will be active
Enable Vertex Snapping > Active and scale


Modeling typology for sharp/diamond like objects I've been trying to modeling this simple diamond shape for a couple hours and I can't seem to figure out a way to model it with good edgeflow and for it to be sub-dividable. Its such a frustratingly simple model as well!!

I always tend to always have trouble keeping everything as quads when it comes to objects that end in sharp corners like these. My most intuitive attempt was starting from a basic pyramid primitive but, that wont subdivide properly.

Any tips about topology and edgeflow guys?

Final:

You can do this in couple different ways. I'll present you two of them, and both non destructive.

Base mesh:

As a base mesh you'll need to create diamond shape with triangle-like quads (yes, they are ok, and they are still quads).

Mean Crease method:

Select outer/sharp edges and add to them Mean Crease - I've used 0.96 for base of the mesh (square) and 0.8 for the side ones.

After that add Subdivision Surface modifier.

Bevel modifier method:

This one is simpler and recommended.

Add Bevel modifier, choose Limit Method > Angle. Set number of Segments and Width.

Add Subdivision Surface modifier.


How to model multiple lines along random paths I don't quite know how to phrase the question correctly, so I'll just show a picture of what I am trying to achieve, specifically the part I have highlighted. I'm beginner with Blender.

I've tried using a particle system to generate hairs but I haven't been able to quite get this effect, it's the randomness in each lines path that I can't quite replicate so far. You can see some lines change direction completely and some even have loops in them.
Any assistance pointing me in the right direction is greatly appreciated.
Thanks!
Edit:
I got enough of a result using the particle system but instead of using a hair system, I used an emitter system, created an animation with some force fields, I used turbulence and wind and then just baked the animation. That resulted in some lines like below, which is more or less what I needed for this.

I have seen your question and I would recommend 2 things.
You could use the particle system, go to particle edit and add also sorts of funky hairstyles to your bacterium over there, but I will tell you this if you try this method, you're gonna have a bad time. Sorry for adding the little undertale pun but seriously though, you will find it troublesome. It always causes some problem that makes the Bacteria look like some sort of a hybrid of a monster, a virus, and a bug instead of giving him a funky hairstyle as you want. I will recommend the next method, Use the grease pencil. Yeah, the grease pencil is perfect for this stuff as it gives you way more customizability compared to blender's particle system, and animating this sort of hair is also easy in case your bacterium is part of an animation. You just animate the grease pencil. Now if you want it as a mesh, you can turn the grease pencil drawings into a mesh like this. Make sure you are in Object mode. Now select your drawing/whatever you've drawn with the grease pencil, right-click, and select Convert to mesh. For some reason, it turns it into a curve but no worries, you can just right-click and select Convert to mesh, problem solved. But you would be just fine if you grease pencil most of the time. Converting it to a mesh can also cause errors so mostly going with Grease pencil won't cause problems and no one would really know. Hope it helps, if you have any problems, please comment.


Particle simulation as fluid inflow I have a scene with a fluid domain and a particle simulation. How would I use the particle simulation as an inflow for the fluid domain? (I'm using Blender 2.90)

Add and configure the particle simulation to a mesh
set this mesh as "flow", under "flow source" choose "particle system" instead of the default choice that is "mesh"
cache the simulation in the domain
you did it!


Why is the boolean modifier creating a glitchy mesh instead of cutting into the object? I'm modeling a city and wanted to create a river with help of boolean modifier. I've checked doubles and normals, so I don't know what the problem is when I'm adding a boolean modifier. You can see what's happening and nothing is happening to plane, just glitchy bugs.

If you want to cut something into an object using boolean, the modifier has to be set on the mesh that you want to edit. Not on the stencil object. You also may change the visibility of the scencil object from textured to bounds.

It then should just look like this

Also i recommend using the BoolTool Addon. It is far more user friendly.


Nothing to export, 0/7 objects selected? When I try to export this item as a collada, nothing exports. It will sometimes go through with the export (when I export as collada - default) but nothing is actually in the file. When I try to export as collada - avastar I get : 'Nothing to export' and the option to export 'Selection only' is grayed out.

I noticed that when the item is selected, in the top bar it says Objects : 0/7 which I assume means its not registering the object even though its physically there.

Any suggestions?

I identified that there is an issue when I import a collada, and then save the file as .blend. When I reopen the .blend file, the collada object is not editable like shown above. How to fix it, I'm still not sure. I had to delete the object and re-import the collada, losing my rigging and uvs.


Fluid is not simulated at the target location I've tried to set the S mesh to be a fluid or inflow object and have created a large size domain around it. However, the fluid is generated in the top left corner instead of around the S mesh.

How do I make the S become a fluid?

Origin point of the fluid object was set putside/on edge of the domain.


How do I create the left to right CRT refresh effect with material nodes? I want to create the CRT refreshing effect as shown in the GIF:
Now how do I do that?

This can be done by quantizing the x and y generated coordinates and combining them to get a unique value in $[0, 1)$ for each pixel. Then it's just a matter of creating a falloff for the scan lines.
Create Pixel Indices
The y coordinates have been inverted by the subtract node so that the scan lines will start at the top.
Here I have created a plane with a $4:3$ aspect ratio like a CRT would have, and for the material, I have assigned a material that takes the floor of the $x$ multiplied by horizontal resolution (640). This gives an index from 0 to 639 for each column of pixels.
The same can be done to the $y$ except multiplying by the vertical resolution (480) giving an index between 0 and 479.
By multiplying the row indices by the horizontal resolution, you can get an offset of 640 for each row that can be added to the column indices to get a unique index for every pixel.

I like to work in the zero to one range, so I will divide the pixel indices by the total number of pixels $640 \times 480 = 307,200$. This will result in what looks like a smooth top to bottom gradient, but it is actually a quantized left-to-right, top-to-bottom ordering of pixels each with a specific value in $[0, 1)$.

These values are essentially the domain of the yet-to-be-created falloff function.
Make it Repeat
But before we make the falloff function, let's create an offset that can be used to move the falloff along the scan lines.
To do this I have created a subtract node with the subtrahend being driven by the expression #frame/480/9. This means that in nine frames, the domain will shift by one scan line (480 total scan lines).

So that the scan lines will repeat once the end is reached, I added a Fraction math node.
Recap:

Falloff
To create the falloff function, I will use three exponential functions: one for the short, initial flash of the electron beam, one for the slightly longer colorful trail, and one for the faint ghosting.
This is the first function.

The important values are the divisor of the second node and the factor of the last node. They are the length of the trail and the brightness respectively.
To create the other two functions, just select everything after the subtract node, press ⇧ Shift⎈ CtrlD and move 'em down twice.

Adding these all together with the values I used gives this.

Making a Picture
To make it actually draw something, you can simply multiply the above output by an image texture. (I've added a dark gray to the image so that this CRT isn't an OLED.)

Final Nodes


Making 3 points stick on a plane / flag with wind I have a flag I want to waft in the wind. I imported the shape as an SVG from Adobe Illustrator.

I converted the mesh to a curve.  It wouldn't let me make some subdivisons but it still seems to work with the cloth property.

When I press play, you can see the structure of the flag stops.  How can I make those last 3 points intact? Also the fill colour seems to have disappeared, do you know why and how I can bring it back?

Thanks

Steve

File here: https://www.dropbox.com/s/mb8jsdnjm9f1enc/flag.blend?dl=0

Such simple shape should be modeled directly in Blender, I see no need to import an SVG. Resulting bezier curve objects have poor topology with uneven density, unsuited for most tasks like simulations.

I'd model it manually with an even quad based topology, create a Vertex Group for the side closest to the post, then use a Subdivision surface Modifier before the Cloth simulation.

Use the Pinning option for the above Vertex Group and add the force field.


Add a simple vertex via python How can I add a Vertex from a script?
I'd like to create a line from the extrusion of a vertex.
This is my script now:

import bpy

location = bpy.context.scene.cursor_location    # Get Cursor location
bpy.ops.object.editmode_toggle()                # Enter Edit Mode

# Here goes the script I'm looking for!

bpy.ops.mesh.extrude_region_move()              # Extrude vertex

You can pass a list of vertex coordinates to Mesh.from_pydata(vertices, edges, faces) However, you also have to create a new mesh as well as a new object datablock and link them together properly:

Blender 2.8x

import bpy

def point_cloud(ob_name, coords, edges=[], faces=[]):
    """Create point cloud object based on given coordinates and name.

    Keyword arguments:
    ob_name -- new object name
    coords -- float triplets eg: [(-1.0, 1.0, 0.0), (-1.0, -1.0, 0.0)]
    """

    # Create new mesh and a new object
    me = bpy.data.meshes.new(ob_name + "Mesh")
    ob = bpy.data.objects.new(ob_name, me)

    # Make a mesh from a list of vertices/edges/faces
    me.from_pydata(coords, edges, faces)

    # Display name and update the mesh
    ob.show_name = True
    me.update()
    return ob

# Create the object
pc = point_cloud("point-cloud", [(0.0, 0.0, 0.0)])

# Link object to the active collection
bpy.context.collection.objects.link(pc)

# Alternatively Link object to scene collection
#bpy.context.scene.collection.objects.link(pc)

Blender 2.7x

import bpy

def point_cloud(ob_name, coords, edges=[], faces=[]):
    """Create point cloud object based on given coordinates and name.

    Keyword arguments:
    ob_name -- new object name
    coords -- float triplets eg: [(-1.0, 1.0, 0.0), (-1.0, -1.0, 0.0)]
    """

    # Create new mesh and a new object
    me = bpy.data.meshes.new(ob_name + "Mesh")
    ob = bpy.data.objects.new(ob_name, me)

    # Make a mesh from a list of vertices/edges/faces
    me.from_pydata(coords, edges, faces)

    # Display name and update the mesh
    ob.show_name = True
    me.update()
    return ob

# Create the object
pc = point_cloud("point-cloud", [(0.0, 0.0, 0.0)])

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


How can I map an image correctly over my texture? My image preview is correct in how the image is supposed to look and doesn't look anything like I need it to.

This is how it should look

This is what I got so far, as you can see I need the label to be up higher on the bottle and lower on the bottle

Since you are using a subsurf modifier you are experiencing interpolation issues over the large polygons on the label.

Add a few cuts on the edges of the label:

Then select the area for the label, unwrap it again and scale and rotate the UVs to get something like this:

Where the UV mapping uses the top and bottom of the image and is twice as wide as the image (since it will use the image for the front and back of the bottle).


Atmospheric fog in Blender 2.8 I am a long time Blender user and I built some nice scenes with it. I also love the new 2.8 but ever since I was working with volumetrics in Blender I was never really happy with it.

So what I want to achieve is something like this:
A Fog, which brighten up things in the back + dont nessessarily make it muddy grey (as it always happens in Blender)

So I know three ways of creating dusk in Blender, but none of these is really what I want.

create an Object and give it the volume-scatter material. There you can lower the densety until it gets a nice foggy feel. Unfortunately, the only result I get is stuff like this:

a muddy looking grey + dark fog. Yes I can higher the strenght of the light - but this doesent really solve it. First the rest of the scene gets way too bright and secondly there are still greyish parts in my fog. Not as in the reference picture I posted at the beginning.

2.Create A volume scatter node in the world node editor and plug it into volume. There I get pretty much the same thing, but over my whole scene. Still not right ..

3.Add Volumetric Fog in the composer AFTER the rendering. But this is kind a complicated to be honest. You need to figure out the exact numbers for the volume density and render over and over again. I gave up on using this technique because it was too complicated to be practical in my eyes

In game engines like Unity or Unreal I can achieve this with one or two buttons, and it looks exactly like I want it to look.
Therefor I even found a cool gif/vid on twitter: https://twitter.com/i/status/1148767976096747526
check it out. Something like this or at least a world volume adjuster HAVE to be possible in Blender. How?!

Kind regards
Frece

I'm sure you figured it out by now, but it took me a while to find the right answer...so for anyone else: I used the Principled volume node
At first it is also dark, but take a look at the Emission Strength and Color Parameters...the dark fogs shall lighten up for you!
Have fun!


No specularity when rendered? I am learning Blender by play around with the default startup scene, where there is a cube, a camera, and a point light source.

I then only did one thing: I increased Material -> Specular -> Intensity from 0.5 to 1.0.

Then I render the scene. Although the material preview shows some specularity, the rendered image doesn't show any specularity.

Why is this, and how may I fix it?

The preview is a sphere, and the scene is a cube. They don't have the same reflections, and that's pretty normal, when you think about it... Did you ever see a box with absolutely so bevel on the edges (that's pretty hard to find) with absolutely the same reflections as a ball? This reflection dot is essentially created by the curve of the sphere. If you want to see the material test on a cube, there are a bunch of buttons at the right of the material test window. They define the shape on which the preview will be made.


Retopology of Cloth from Marvelous Designer Is it necessary to retopologize triangulated cloth coming from marvelous designer?

I noticed that cloth coming from MD is triangulated.

you can actually create it quadrangulated inside of Marvelous. Otherwise, you will need to retopo it yes (depending on your needs)


How can I achieve an "blinded by light" effect? First of all, the term I use is definetely not a good one, so as soon as someone know how to describe it please tell me so I can correct it (or correct it directly)

I have a box in the middle of my scene who emit light more and more I as move forward in time. What I'd like to achieve is that at some point, the light begin to be so intense it surexpose the scene and at the ind all the scene is white (well…what the camera get).

I tried pushing the emit value and also change exposure value in the world parameters but its not related.

I assume I'll need to play with the node editor with compositing but is there others ways to do that?

This will most likely be hard to achieve through the 3D scene alone, and will probably require some post processing and compositing work.

It could probably be achieved with a mix of lens flares and god rays and volumetric lighting.

Volumetric lighting can be made with a volume material in cycles, see this: Project light through shape, text or symbol to appear in cloud or mist

It can also be faked or enhanced in the compositor with the Filter > Sun Beams node.

In compositing you can also add a lens flare effect with Filter > Sun Beams or Filter > Glare

Blender God Rays Tutorials
Blender Lens Flare Tutorials


Why does the exported obj look wrong? I have created a model in blender in which I wish to use in my openGL application.  Before exporting I expected the obj file to look something similar to this.

However when I exported the file I got something like this

I started to ponder on whether I had exported it wrong or not, as this is the first time I have used blender.  I am currently using blender version 2.70.

Thanks

The problem is (as guessed by ideasman42) that Blender exports .obj-files always (at least I tested it on windows and Linux) with Linux line endings (that means there are only LF and no CR characters).

If you use a better editor than the standard Notepad you can often see the file correct even on Windows (for example with Notepad++). There should be no problems using this file as it is, because I think most Programs can work with both line ending types. If it doesn't work it's easy to convert the line endings (as well with something like Notepad++).


Changing default camera settings? Every time I add in a new camera to my scene I have to change a number of settings to fit my default (passerport opacity, composition guides, etc.). This is something of an annoyance.

Is there any way I can change the default settings so that I can just add in a camera (or any sort of object, I suppose) and have the settings be how I want them?

TLDR; create a camera with the settings you need and duplicate it when you need a new camera, so you'll have the right setting already there.

LONGER ANSWER AND PROCESS:

You can create a template .blend file where you have a set of cameras with the configuration you want to use (the same for objects).

Set this blend file as the default one (FILE > DEFAULT > SAVE STARTUP FILE). When you need to have a new camera, don't create it by scratch, but copy the one you have already in the blend file (main one, or another one hidden one in some collection you use as repository of different settings).

does it make sense to you?


rigid bodies violently jumping away I'm having some issues with simulating certain rigid bodies. The above gif illustrates what happens and is a simplified version of a large assembly that i need to simulate which is shown here:

As you can see, the spindles around the vertical beams of the lower assembly are simulated correctly, but the central pin that sits in the hole of the upper assembly comes loose although it should not due to the flange on top of the pin.

I've gone through every fix/workaround I can think of, including:

check objects for holes, degenerate triangles, etc. everything seems fine.
perturbed physics parameters, including 0 friction, 100% bounciness, and vice versa, different mass settings, various damping parameters, etc.
increased solver iterations, reduced gravity, reduced timestep, etc.
fix one object in place using a constraint to a passive cube and remove the floor to eliminate possible problems with floor object
toggled use of collision margin
used trimesh to accurately calculate the center of gravity and mass

This assembly is a reduced version that I need to evaluate for clients, and it's quite important we get it right. I have no idea why this object keeps failing, and other objects seem to have the same problem.

I have prepared a git with all the relevant code and models here:

https://github.com/jochemborges/blender_pathology

The repo does not contain the larger assembly because of copyrights, and the only requirement is the blender module.

If anyone could have a look and possibly shed some light on this, I'd much appreciate it!

thanks!

Jochem

The problem is that this simulation is to perform in an automated process where human-designed but random assemblies are put through a physics simulation, so it's impossible to fit the correct collision shapes by hand. Fortunately, I have made some progress. The (at least partial) solution was to do a convex decomposition of the mesh, after chopping the entire thing up into manageable blocks.The whole process is this:

split the mesh into its components (mechanical separate parts)
subdivide those components into 3x3x3 blocks
split those blocks up into isolated parts
perform an approximate convex decomposition on those parts.
finally, assemble all the convex hulls into groups that approximate the original components

Although it requires a lot of processing, the results are quite stunning. You can now interactively manipulate one of the more complex assemblies in the set. I haven't tested this on other production models yet, but at least there is some real improvement in the quality of the simulation.


Why do automatic bone weights paint distant meshes I have created a simple block-person from a few cube meshes, as well as an armature. When I parent the armature to the meshes with automatic weighting, it seems like blender is assigning distant vertices to a bone while ignoring nearby vertices.

The docs on automatic weights say:

  It calculates how much influence a particular bone would have on vertices based on the distance from those vertices to a particular bone (“bone heat” algorithm)

This doesn't seem to be what I observe. The calf.r and thigh.r bones are closer to the vertices in the right leg than the vertices in the left leg, yet they entirely influence the latter (visa-versa for the left side).

I realize that I can manually assign vertex groups if needed, but I'm wondering if this unintuitive behavior means I set up my mesh or armature poorly.

Yes, there are some issues with your work. Several objects have their origins misplaced, rotations and scale unapplied, non-uniform scales, ... You must always fix this before even creating the armature. And never scale your armature unless the rigging and skinning are completed and you really have to.

Also, automatic weight never does a perfect job, and it surely works better when you have your bones and meshes correctly placed, not set in a pause which may lead to confusions (like the arms stuck along the body) and with enough bones and vertices to make the assignations obvious.

In your case, you have a very simple mesh and with not mathematically logic needs for the weights, so you will be way faster by assigning your weights in edit mode or weight paint.


Do high end cards have better rendering performance? A lot of times I try to render meshes with millions of polygons in a scene, and the performance is exremely slow. I tried using CUDA but without luck. I'm using a GeForce gtx 960, 10GB Vram, and have an eightcore CPU. Should I get a different card or use SLI? Or maybe look into a workstation card?

Rendering on GPUs has a few limitations, the most crucial one is the amount of VRam on the card. Basically, the whole scene that you're trying to render needs to fit into it. If you 'only' have one GPU available, the situation gets worse, because the 3D scene needs to be displayed on the same card, reducing the amount of free RAM as well.

Besides geometry eating a lot of RAM, textures can be a surprisingly effective GPU rendering killer. Check if you have many high resolution textures in your scene, and if so try to reduce their pixel size. I've had scenes where the geometry would take less than 1GB VRam, but the textures would blow the rest of the 11GB available (we have a few Titan X cards here). I reduced the texture sizes, and in the end the scene rendered on a card which only had 3GB VRam - without a visual difference.

SLI is pointless when rendering, it only makes viewport display faster, and only if the application fully supports it. GPUs cannot share memory with each other, each GPU is like a dedicated mini-computer.

Regarding workstation cards: I have access to Quadro cards here in the company. My own experience is, that they actually render a bit slower than consumer cards. If that's a CUDA implementation thing or Blenders code being more optimized towards consumer card I am not aware.

The only recommendation for your system - besides optimizing the scene itself - would be to get an additional GPU (if your motherboard can fit it) and use that one dedicated for rendering, and your primary GPU for viewport display only. What you get is:

more available VRam on the GPU
rendering does barely slow down your machine, you can continue to work while a render is running in the background
much faster viewport rendering updates
technically, a second rendering machine, because you can fire off a CPU render at the same time while the GPU is rendering on a different Blender instance

All of this we tested here in our company.


Lattice deformation (bending) - not having any luck I've looked at a few tutorials and done everything according to them but can't get the object in the lattice to deform.
- Created lattice, scaled, added additional area in lattice, and put object in center.
- Selected object, added lattice modifier and attached it to lattice.
- Subdivided object several different ways numerous times.

Each time I alter the lattice, it does nothing to the object. What am I doing wrong? Trying to get the mouthpiece to curve around the mask better.

Add lattice modifier and subdivide if needed. Select the mesh on which lattice modifier you need to apply. Go to modifier tab in the lattice modifier in the object mode select lattice or with dropper select the lattice. Now select the lattice in the 3d view. Go to edit mode and with the verts selected move it where your satisfied.


How to place automatically a bone/vertex/object or a group of them in the center of the screen and zoom in them I would like to know if you know how to place automatically a bone/vertex/object or a group of them in the center of the screen as soon as I click over it / them with the right mouse button or if there is some addon that already does it. I'm realizing that it would be very useful because the movements that I do to with the mouse wheel are always the same and if a script does them for me,I will save a lot of time. Plus,I would like to zoom in the object,so that I can see it better.

So,What the script should do ? Every time I click with the right mouse button on a bone or a group of bones,automatically it should press the dot and it should zoom in the selected object.

Each time I click on a bone I need to place it on the center of the screen and I need to zoom in. So,why I need to press the dot and the mouse wheel manually each time ? They are extra steps that I don't need.

I imagine that adding the zoom feature is a little more complicated than pressing automatically the dot because it depends about how the objects are big...thanks.

In the User Preferences under the tab Input there are all the categories for the key bindings.

If you expand the 3DView category and then the 3DView(Global) category by clicking on the little arrows/triangles you can scroll down to the end of 3DView(Global)'s entries until you see the button Add New.

If you click on this button a new entry "none" is added. If you expand it, again by clicking on its arrow, there will be a field that also says "none".
In this field you can put the following:

view3d.view_selected

Press return to accept it. On the right the current shortcut is displayed with its default value "A". LeftClick on that so that it says "Press a key" and click the right mouse button. Now you have assigned RightClick to the operator. You can also chose one or several modifier keys with the checkboxes below.

Now if you select something by right clicking on it it should be put in the center of the screen and zoomed in on.
If you like how it works you can go back to your User Preferences and click Save User Settings.


Massive import with CSV file I have exported game archive with all objects. I also have CSV file with all their details, such as model name, location, rotation (XYZW). How do I import CSV file, and make blender read it and put all objects on the places?
Ps. Z rotation axis must be multiplied to '-1'.

so after @batFINGER `s examples, I wrote my example. The code is 'Ugly' but in the other hand, it's working

import bpy
import csv

csvfile = "yourfiledirectory\file.csv"
suffix = '.fbx'
with open(csvfile) as csvfile:
    csvread = csv.reader(csvfile)
    for i, row in enumerate (csvread):
        if i==0: continue
        filename = row[0]
        loc_x = row[1]
        loc_y = row[2]
        loc_z = row[3]
        scale_x  = row[4]
        scale_y  = row[5]
        scale_z  = row[6]
        rot_x = row[7]
        rot_y = row[8]
        rot_z = row[9]
        rot_z = float(rot_z)*-1
        rot_w = row[10]
        dir = "directory where your files are"
        bpy.ops.import_scene.fbx( filepath = dir )
        bpy.ops.transform.translate(value=(float(loc_x), float(loc_y), float(loc_z)))
        bpy.ops.transform.resize(value=(float(scale_x), float(scale_y), float(scale_z)))
        for obj in bpy.context.selected_objects:
            a = obj.name
            print(a)
            bpy.context.scene.objects.active = bpy.data.objects[a]
            bpy.context.object.rotation_mode = 'QUATERNION'
            bpy.context.object.rotation_mode = 'QUATERNION'
            bpy.context.object.rotation_quaternion[0] = float(rot_w)
            bpy.context.object.rotation_quaternion[1] = float(rot_x)
            bpy.context.object.rotation_quaternion[2] = float(rot_y)
            bpy.context.object.rotation_quaternion[3] = float(rot_z)


Safe Blender Download Mirrors blender.org seems to be down as of now. And I could not find a list of trustworthy download mirrors. Does anyone have such links in handy?

Windows:
https://mirror.clarkson.edu/blender/release/Blender2.81/blender-2.81a-windows64.msi

Windows - Portable (.zip): https://mirror.clarkson.edu/blender/release/Blender2.81/blender-2.81a-windows64.zip

macOS:
https://mirror.clarkson.edu/blender/release/Blender2.81/blender-2.81a-macOS.dmg

Linux:
https://mirror.clarkson.edu/blender/release/Blender2.81/blender-2.81a-linux-glibc217-x86_64.tar.bz2

I got these links using the tool Wayback Machine (https://web.archive.org/). It has a saved Blender download page from few days ago (https://web.archive.org/web/20200125185852/https://www.blender.org/download/). When you click on download it appears to you a "thank you" page, then there is a link on a text on the bottom of that page ("Your download should begin automatically. If it doesn't, click here to retry."), which leads to an official mirror download. You click on it and the download will start.


How to turn off symmetry in texture paint mode My question is very simple, I want to turn off mirroring in the texture paint mode (I'm using Blender 2.74 and I have tried a few older versions).
In tutorials I saw that there was a "Symmetry" tab, but I only have Brush, Texture, Texture Mask, Stroke, Curve, External and History.

This option is only available in the upcoming version, 2.75. It's not present in Blender 2.74 so there is no way to enable or disable it in this version.

You can either wait for the 2.75 release or if you want this option right now, download a release candidate version of Blender:

http://download.blender.org/release/Blender2.75/


my reference photo has a weird rotation I am completely new to blender. I am following Blender Guru's instruction too create a 3d coffee mag. However, when I add a reference photo, it has been rotated automatically. I am pretty sure that I have never changed the coordinate. Why would this happen? What can I do to fix the problem?

You probably weren't in a front view when you imported your image, so select it and press AltR to reset its rotation. S to scale it, G to move it.


Can a Script node using OSL have a checkbox? I made a Cycles script node using OSL. Works great.  To modify what it does, is it possible to add a checkbox, like for example the "Clamp" checkbox in math nodes?

There is a thing called 'string widget' (metadata syntax), which may be of some interest. The OSL specs suggest it in page 18 chapter 4, but that syntax may not be implemented in cycles. I haven't seen any examples of its usage. (Except for vray - 3dsmax docs)

if Implemented from the specs, it would look something like this:

int clamp = 0
    [[ string widget = "checkBox"]],

The implementor, Dingto, confirmed on IRC that metadata is not supported - yet.


Can Blender render animated gifs? I need to save an animation as an animated GIF.

Can this be done from Blender? cheers.

I created an addon that allows you to render or import animated GIFs with Blender. The addon is called Bligify.

Render GIFs

Import GIFs


Is there a way to make a given value relative to another piece of value? I'm trying to animate several objects along a curve with the Follow Path constraint. If I adjust the Offset of one object, I must adjust all the ones behind it. This is tedious. Is there a way for me make the Offsets relative to one another?
For example,  is equal to (  + 10). If Suzanne has an offset of 24, then cube's offset is 34, ect.
Thanks.

You can do that easily with drivers. Drivers can be hard to understand, but are very powerful.

RMB  click on the Offset field in the Follow Path constraint that you want to be linked to the other constraint's value (I will call this object 1).
Chose Add driver
Open up the Graph Editor and switch it to Drivers, click on the Offset Factor (Follow Path) in the list of drivers on the left.
Press N to open up the Properties panel to edit the driver.
Change the var type to Single Property, point the Prop: to the object that has the other Follow Path constraint.
Select the object that has the other Follow Path constraint (in my example it is Suzanne).
RMB  click on the Offset field in the Follow Path constraint chose Copy Data Path
Select object 1, go back to the Graph Editor, and paste in the value for the Path:, should be this constraints["Follow Path"].offset_factor.
Change the Expr: to be var + 10.


Export textures as a flat image with multiple materials I am trying to get a flat texture image, something like this ...

instead of using multiple textures with a mtl. Is there anyway to do this?

Yes there is.

You will need to uv unwrap your model first.
Apply mulitiple material as you would previously.
Set your materials to shadeless or set the bake to only diffuse bake.
Bake the information out using your UV unwrap data into a single texture image.


Texture Painting: How to not have jagged edges when drawing? I'm doing texture painting. I get these horrible jagged lines when painting, I want straight lines, what am I doing wrong? How can I do it better, if I can?

Here's some info to help you out:
1. I let the blender handle UV the mesh, so you can consider it auto-uv'ed.
2. I paint straight from a side view but the line goes jagged anyway.
3. Smearing or softening doesn't help.
4. Playing around with "Project Paint" settings didn't help. IE. Occlude, Cull and such.

Can this be a UV issue where the islands are distorted so the paint doesn't go straight?

Paint on an image that is twice the size you think you need, and you will get the better detail since this is about pixels, and downscale the image with an image editor to get the lower memory version. Make sure your UV mapping has allotted enough pixels for each island - unwrapping technique is critical for small details. In setting up your base image to paint to, perhaps consider checking the option '32 Bit Float' so that you have enough color depth to avoid jagged details, especially when painting bump maps.


Is this a hardware problem I've just started studying Blender. I have been using Blender Gurus' videos on YouTube. So far, they seem pretty useful. But, I seem to have a basic ( I would assume ) hardware problem. I have an Alienware PC with twin 1080Ti video cards, 32 GB ramm and an i7-7820 @ 3.60 GHz processor. On his very first video, which is mostly about key basics, he ends with a burning monkee ( bring up the monkee object, set him smoking and then on fire ). All of this works except when I play the animation it only plays from 0 to 50 and then freezes, the progress indicator goes to 250, and then repeats but again freezing its progress at 50. I can't seem to get past this, I hate to continue without solving this horribly basic problem. Is there some sort of limiter I'm not seeing or what? Everything else I've done with his videos seems to be going along fine. Anybody have any thoughts?

The number of frames the simulation plays for is dictated by the domain cache:


Spawn object after animation finishes in Python I have an animation that loops and has two phases: "cube_object" goes to point x, spins - repeat).
Now everytime the "spin" animation is finished (or the "cube_object" reaches a certain location...?), I'd like to spawn an object on a random position with Python.
If there are 10 objects spawned stop the animation and change camera angle to another scene.

Imagine a worker in a game that chops wood and every time he finishes chopping a new log spawns. After 10 logs - something new happens.

Try this example that will spawn a random cube everytime the frame == 10, it will stop after 5 cubes:

import bpy

# this is for the random position, imports the random() function from random library
from random import random

# this holds how many cubes were created and what the cap is
spawned_cubes = 0
max_cubes = 5

def spawn_object(scene):
    """This function will be run everytime before frame changes because it is added in the callback list"""

    global spawned_cubes
    global max_cubes

    # read the current frame number
    # if it is 10 and number of spawned cubes is less than max_cubes place a cube
    # if the frame number is not 10 just end and do nothing
    if scene.frame_current == 10 and spawned_cubes < max_cubes:
        loc = (5-10*random(), 5-10*random(), 5-10*random())
        bpy.ops.mesh.primitive_cube_add(enter_editmode=False, location=loc)
        spawned_cubes += 1
    return

# add spawn_object function if there isnt one in bpy.app.handlers.frame_change_pre callback list
# the function needs to be added there only once
# everything thats in that list will be executed before any frame change
if spawn_object not in bpy.app.handlers.frame_change_pre:
    bpy.app.handlers.frame_change_pre.append(spawn_object)

This uses the app handlers callback list. In your spawn_object function you can test any property - for example the location of your cube_object, or some frame value etc.


Depth data works, but not in Background mode As the titel says, I found a workaround for obtaining a depth image of the camera's FOV by using this workaround. It works just perfectly by accessing the pixel data of the image with python:

 pixels = bpy.data.images['Viewer Node'].pixels

BUT: This method works only when the GUI is used as well. In Background mode (using the attribute -b in cmd line) this does not work. The farest I got was to check if the image "has" some data with:

 pixels = bpy.data.images['Viewer Node'].has_data

which gave me a clear false.  Therefore my question is, if there is a way how to enable this data also in Background mode?

I googled a lot and the only other option I found to access depth data, is to use the Camera Data Node's depth output. However, I do not know how to access this data via python script.

Rendering of viewer nodes and previews in background mode was disabled in 2013 for speed optimization (see here). However, you can easily enable it again by modifying 2 files of the blender sources and compiling blender yourself (as described here).

In the file source/blender/compositor/operations/COM_ViewerOperation.h, line ~58:

bool isOutputOperation(bool /*rendering*/) const { if (G.background) return false; return isActiveViewerOutput();

should be changed to

bool isOutputOperation(bool /*rendering*/) const {return isActiveViewerOutput(); }

and in file source/blender/compositor/operations/COM_PreviewOperation.h, line ~48:

bool isOutputOperation(bool /*rendering*/) const { return !G.background; }

should be changed to

bool isOutputOperation(bool /*rendering*/) const { return true; }

After these changes, the pixels array gets properly updated in background mode.


Radeon RX 480 or CPU for rendering animation? I'm currently 4 and a half hours into rendering a quite simple animation (was supposed to be just a test), realized I left it on GPU Compute after tinkering with those options. Really hoping that that has slowed down the render.

I'm new to making this kind of thing with Blender so I've quickly gotten in over my head and need a few pointers.

I have a Radeon RX480 4GB GPU, and an AMD FX-8350 2.3GHz CPU, 8GB System RAM.

I was reading in the manual about NVIDIA's advantage with CUDA, so my main question is if it's even worth messing with seeing as I have an AMD card which doesn't seem to have an advantage.

I was also wondering if the tile size affects animation speed. The things I was reading were only about complex still images. But larger tile size is better for GPUs.
It would make sense that it might work for animations too, but there's a lot I don't know about this.

Finally I'm curious about the render samples. I have mine set to 256, which I was reading needs to be higher for scenes with depth of field (of course mine has that). So I may need to re-render. But I don't want to wait another 5+ hours for a 3 second intro video.

Any pointers for settings would be really awesome. Even if the final render will take this long, I'd like to have less of a wait for test renders.

If you are using an RX480 you should get a fairly significant speed boost over your aging FX-8350.  The AMD videa cards cards have a few less supported features than Cycles than Nvidia cards on CUDA but nothing that can't be worked around.

I'd suggest lowering the number of samples in your sampling settings and turn on the seed value being different per frame.  Video doesn't need as much refinement per frame as people think.  For the tile sizes, through experimentation I have found that larger sizes work better with GPU rendering but it is a fairly minor speed gain.

Good luck rendering your project!


Grease Pencil Keyframes not visible in timeline I am very new to blender, working on my first project. I am trying to combine a 3D model, animated using an armature, with some hand-drawn animation, using grease pencil. I started with the model, and everything worked as expected, but when I started animating with the grease pencil, the keyframes were not visible in the timeline. As a result, I cannot grab them, arrange them, or view their onion-skinning.
I saw a similar question asked about the Dope sheet, which allowed me to see the keyframes there, but the timeline is still blank. I have a picture of the view, with the grease pencil selected, but with no keyframes visible. For reference: There are keyframes on frame 0, 1, and 20. I cannot see them in object, edit, or draw mode.

I think my problem has something to do with using the wrong "Keying set" since I am using one with LocRotScale for the armature bones, But I am not sure how to change it to a keying set that allows for grease pencil frames. Keying sets are still a little confusing to me in general. I know the keyframes are being created because scrubbing the timeline still shows the different frames in the viewport, but I just can't view them in the timeline. I am most interested in getting the onion skinning working, which I believe is linked to this visibility issue.

Any help is much appreciated. I've been at a bit of a stuck in the project because I cannot figure this out.

I have the exact problem, I have keyframes and there is animation, but the keyframes aren't visible anywhere, not even in graph editor even though the object is selected.
To fix the bug go to Object Mode and create a new grease pencil stroke. When going back to the original drawing keyframes show again.


Trying to export a cloth simulation to a Collada file I'm using an avatar and a skirt as .blend files and trying to create an animation as a cloth simulation (I followed this tutorial - http://blenderartists.org/forum/archive/index.php/t-325838.html) with them on Blender, in which the avatar puts her skirt on. Now I'm trying to export the animation as a Collada (.dae) file and use WebGL (three.js) to render the animation. But the Collada file seems to not be working, since the browser (Safari) does not display the animation. How can I export this cloth simulation to a Collada file properly?

I faced similar problem. I have conducted extensive research. It seems that a mesh animation (created on base of cloth simulation) just doesn't get exported to .dae. You have to try other formats or re-design the project unfortunately... Check out here: Exporting cloth simulation to Collada results in static cloth instead of a waving one


Use Blender's bpy in projects outside Blender? How can I use Blender's bpy outside Blender? I need to use it in a project to check for some Blender settings in a .blend-file and to automatically start rendering. Since it should completely stand-alone I don't want to set up any paths.

Thanks!

The easy way is to use blender. You can start it with cli options to run in the background (without gui) and to run a python script.

blender --background --python myscript.py

You can also start rendering from the cli without a script.

blender -b mymodel.blend --render-frame 1

or render an animation

blender -b mymodel.blend --frame-start 1 --frame-end 100 --render-anim

For something more interactive you can use blenders built-in python console

blender -b --python-console

The other option to get access to bpy without a normal blender install means you will need to compile your own copy of blender as a pymodule.


Video Editing, Is there a way to make the speed value animated? I added a Speed Control filter onto a clip inside the Video Sequence Editor. When I tried to make the Multiply Speed value of this filter animated, both by making it a key frame and by making it dependent from a driver, I got the error message: Multiply Speed cannot be animated.

Am I doing something wrong?
Why is this value not able to be animated?
Is there a way, for instance an add-on to make it work?

My goal is to  make a movie play at first very fast but then drop the speed continously until it is played in slow motion.

From my experience it is much easier to use speed control disabling Use as speed.

You can then just re-map frames using graph editor (after you've pressed I over the Frame number).
Allows for smooth speed transitions or sharp ones, whatever you like.

This makes it also much easier to pick the exact frame from which the speed will be changing.


How to compare values properly with expression in Animation Nodes? Such simple task goes wrong somehow (result of comparing inside Expression is far from expected):

What did I overlook here?

Floats in general have a limited precision and most real numbers can not be fully represented using a float. So when you set the input float node to 0.1, it is actually represented internally as 0.100000001490116119384765625. See this answer for more information. Python's representation of 0.1 is different from blender's representation, python's is more accurate 0.1000000000000000055511151231257827021181583404541015625. Hence the result you see in your setup.

In general, don't try to compare floats as this may yield some unexpected results. You can use something like isclose() function to compare floats, this function is the standard math module.


Cycles: Ambient Light? I have disabled all lights, why can I see the textures? There is some ambient light going on, how can I disable all of it?

You have Ambient Occlusion enabled in the World tab. Uncheck it and your scene will be dark.


A more portable blender game engine? I was curious about blender game engine and it's portability. It seems that for the most part blender is pretty portable, the main difficulty is moving around the python parts of blender to other platforms.

I am coming at this from a game developer standpoint. If I write a game in blender with Logic Bricks and assets, and if I want to pack that up and deliver it to the marketplace, it doesn't seem feasible. All the stuff I've read seem to have shown a stall in mobile games built in Blender. If blender didn't require the python parts, at least in the run time it could easily be packaged up as a C/C++ project which can be built for almost any platform out there.

If it is possible to build a version of Blender to work without python with no noticeable differences, wouldn't it significantly improve the portability of the Game Engine? Does anything like this currently exist, and if not, has it been attempted before or could it be attempted now?

Python is an integral part of blender's design, python is used to define the user interface of blender and some operators that perform tasks are also in python. Removing python would really disable blender from functioning.

Using only the game engine it may be possible to run it without python as you won't be using any of the pre-defined UI, only object rendering through opengl, provided you don't use any python scripts in your game logic.

Blender's use of python isn't likely to be a factor in mobile distribution. While desktop usage of the game engine is as broad as blender's availability, the main thing that you will find preventing blender's game engine being used for mobile games would be the limited support of openGL ES, which is used on mobile devices. There has been a couple of attempts at starting this but I'm not certain of the current state of progress.

I believe you will most likely find that blender's GPL licensing forcing developers to also release their games as GPL and possibly still being in conflict with the Apple Store TOS, that it would be the main factor in it's non-use for commercial and/or mobile games.


BGE - remember position after action In the BGE I need - remember location after action. I have button - when I press - character do a step forward. I want make when the another press character begin step from a new position, after old step.

http://joxi.ru/KAxeW4jcW7qgr8

just remember this new position after step.

Your question is a bit confusing, but maybe you should rebuild your animation so that the step is taken in place, and you should move the armature instead.

If you dont't want to do this, then you need to add a python script to move your object to the exact position where you animated step ends... You must get the object's world position and increment it by whatever distance it travels in your animation. The script is only activated at the end of your animation... you can use the frame property on the action actuator to control this.

hope this helps
Nuno Estanqueiro


Reset object origin without moving object I have been working on this sculpt and noticed when trying to mirror that the point of origin for the model has been moved. How do I reset the location of X and all rotations to zero without moving the object?

Here's one way which assumes your object is centered over 0,0,0:

Snap the 3D cursor to the object's origin (⇧ ShiftS)
Depending on the orientation of your object, set the 3D cursor's location to 0 along one axis (based on your screenshot you'll want to set it to 0 on the Y axis)
Snap the origin to the cursor (⎈ Ctrl⇧ Shift⎇ AltC)

Apply rotation (⎈ CtrlA) to vertices (this will reset object rotation).


How do I get mode editor Im a complete noob at blender and im trying to find node editor but I cant? Could someone just explain the steps to find it please haha.

Welcome to blender! :)
Its called "shader editor" since > Version 2.8
For a better start you can check out the Blender Manual (https://docs.blender.org/manual/en/latest/editors/shader_editor.html) and also the official Youtube Series Blender Fundamentals (https://www.youtube.com/watch?v=0zrd37k2tJM)


2d falloff button gone in 2.82.7 The 2d falloff button for weightpainting pass through seems to be gone in the new update, now there's a button which i found worked the first time i used it but now doesn't called frontface falloff, I am currently trying to weightpaint a mesh that has several layers of mesh beneath it, and manually weightpainting each layer or vertex grouping every layer seems a bit overboard, I've tried using x-ray as well and it still wont pass through, front faces only was also unchecked and checked and did nothing.

https://i.gyazo.com/54cc1f75c99fa6fc907b69ec16304a04.gif

I just had the same problem after downloading this new Blender version.

If you open this Falloff menu, then there is that Falloff Shape.
Changing it from Sphere to Project work for me.


how are the math node operations in cycles calculated? How does the math node do calculations with a specific operation:

the usual operations of add,subtract, multiply and divide are quite understandable and are(empirically) very similar to some of the operations in MixRGB node. But, how do the operations such as Sine, Power, Logarithm, Minimum, Maximum, Modulo, Round, etc,.. interpret with the values. How can we visualize this in realtime?

Here is a list of the mathematical equivalents of each operation.

Add: Out = Value1 + Value2.
Subtract: Out = Value1 - Value2.
Multiply: Out = Value1 * Value2.
Divide: Out = Value1 / Value2.
Sine: Out = Sin(Value1).†
Cosine: Out = Cos(Value1).†
Tangent: Out = Tan(Value1).†
Arcsin: Out = Sin⁻¹(Value1).†
Arccosine: Out = Cos⁻¹(Value1).†
Arctangent: Out = Tan⁻¹(Value1).†
Power: Out = Value1 ^ Value2.
Logarithm: Out = log(Value2, Value1).††
Minimum: Out = Smaller Value of (Value1, Value2).
Maximum: Out = larger value of (Value1, Value2).
Round: Out = Value1 rounded to nearest integer.
Less Than: Out = 1 if Value1 < Value2, else 0'
Greater Than: Out = 1 if Value1 > Value2, else 0'
Modulo: Out = Value1 (mod Value2).‡

Note that some operations use only the first input, in such cases the second input is ignored completely.

†. All trigonometric functions use radians.
††. log(x, y) = the logarithm of x to the base y.
‡. x mod y = the remainder when x is divided by y.


Selecting faces not covered by other objects I have a mesh of a terrain with seperate models of a large building and various roads and parking lots on top of it. I wanted to add a tree particle system to the faces of the terrain not covered by the building and roads and I wanted to know if there was a way to select only the faces that are not covered. All of the faces that I want to select are visible when looking from above.

As @lemon has commented, an alternative method for generating the raw texture might be to temporarily disable all your lighting, replace with a Sun lamp pointing vertically down in Z, and (using Cycles) bake a shadow map, as shown on the left.

If you set the angle of the lamp wide, to get a soft shadow map, you can have some control over the margin between the buildings and the trees, by putting the texture through a color ramp, and out into an Emission shader. You can then re-bake the resulting Emission.

Optionally, retouching can all be done inside Blender, using Texture Paint.


Dopesheet - What is the difference between Select methods Border Axis Range and Border select? In Dopesheet you have two border select methods. Border Axis Range and Border select. They share the same tooltip, which is made for Border Select. The manual has no info about Border Axis Range neither. And there is also no visible difference by using the tool from what i can see.

So what is the difference between Select Border Axis Range and Border select?

Old question, but the answer might be useful to someone:

Border Select: Selects the elements inside of a given rectangle.
Border Axis Range: Selects the elements between the left and right sides of the rectangle, regardless of their vertical position.

Example:

In other wordes, Border Axis Range is a range selection tool, while Border Select is a box selection tool.

Border Axis Range is useful for armatures with a large number of bones: If you cannot fit all the rows in one window, you can still select over a range without having to scroll up or down.


Rough vertex curve transform into even curve? I made this curve in SketchUp and imported it into Blender. I am trying to figure out how I might transform the rough top section into a smoother curve that Blender can handle better... or how I might do it from scratch following the path of the one now.

I am not sure how I would make this from scratch in Blender but can do it in SketchUp so that's why I imported it.

What username:cegaton shows is part 2 of how this issue can be dealt with.(this may be helpful for adjusting the curve before extrusion)

The folowwing image shows a Curve before Alt+c was used to convert the curve to a mesh object.

To adjust a mesh's curvature, you can use proportional editing.  There are several math function options available for doing this and they are shown using the popup dialogue.  The default setting often works well.  Proportional Editing can either be activated using the o key or by clicking the icon shown in the following image.

The Proportional Editing tool has a fallof radius that is shown on the screen as a white circle that can be re-sized either useing the Page_UP, Page_Down or the mouse wheel as shown in the following animating .gif that was made with a program named LICEcap

Now I would do what cegaton has shown in the answer posted previous to this one.


Adjust properties of 3D object and camera faster I need to adjust position parameters for a specific object and x shift value parameter for the camera frequently.
What are my options to make this process more comfortable? - I want to avoid that I have to switch selection between camera and object to show the respective parameter input boxes.

You can pin any properties tab to the editor.
Click the pin icon, and the tab will stay active even if you select other objects.


Colorizing part of a texture I'm creating a crowd of people in Blender. For now, they all have the same model, and I want to create some variation by changing the colour of their clothing. What I have is a texture, a mask for each piece of clothing, and a randomly chosen colour. What I would like is to be able to use these to create a new texture like so:

Of course I can create each texture by hand, but I'd rather write some script that performs these tasks automatically in Blender. I also want to avoid a directory full of textures, as I can easily create those myself. What would be a good approach for this?

I'm using Blender Internal, and GLSL shading in the viewport. It's important that the viewport also reflects the colour, as I'll be using this in a live demo.

UPDATE: By using material nodes (as suggested by @chebhou) I almost got it working. This is the material node setup now. The material referred to in the "Material" node is actually simply a white textureless material.

The one thing that's left is to ensure that each object has a unique value for the HSV converter inputs. Does anyone have any ideas about this?

UPDATE 2:
Chebhou writes: I have tried to use the driver on the value node but it's not evaluated ( it's just stuck at a certain value) , and i need to make this value specific to each object (there are many objects that use this material but needs to look different )

I'm looking for a way to get an object related value like in cycles :

it would be good also if there is another approach(I can go through the objects and assign this material with different settings but it would be better if it is only one shared )

UPDATE 3:
Sybren writes: What I have so far is working nicely, check the video at  https://www.youtube.com/watch?v=BBlS4PKJhOc

However, it still uses the same values for all objects that use the material :(

this is not a total script but it does the job :

in the default scene (or empty one) create this compositor node setup

you need to run this script just to have random numbers available in the driver :

import bpy
import random

def rand():
    return random.uniform(0,1)

bpy.app.driver_namespace['rand'] = rand

now add a driver for the value nodes with the scripted expression rand()
set the number of frames to render to the number of textures
render the animation and you'll have the output directory full with textures


How to add an image onto an object I want to put a 2D image onto a 3D object. I have downloaded the image, and just can't find out how to add it onto the object. Thanks! (v2.80.75)

Let's say, you want to add an image to Cube. Select Texture Tab -> Base Color -> Image Texture

Now select Open an Image required. Image will apply to Object.


No solution to "Bone Heat Weighting: failed to find solution for one or more bones" blender 2.8 I have this issue but not found any solution working for me. I am new to blender and modelling, and I am aware that my model is far from perfect. But my armature is quite simple. I have tried to clean the mesh, remove some wrong faces...but I still have the issue when parenting...Thank you for any idea !

To be more specific, I have already tried a "remove double/merge by distance" on the mesh, and a scale
Found the solution: I fixed the nose vertices which was dirty and the parenting worked. Thank you for reading :)


Make the dots the color of your logo The grid shown below is what i have right now but it just overlays. I want the white dots to be using the image texture color.
I have this method i have seen with simon tommes.
Where he uses a image texture and 'projects' it over the material set up by some math nodes. The image texture does clip to the knittr (in simon tommes shader) i put a picture here.
I have this setup, also with math nodes. made a grid of dots

This is my set up of nodes

You need to pixelate your UV coordinates which you can do as so:

x - (x modulo pixelSize)

You can then use the same modulo nodes by normalizing their outputs to get the coordinates for your discs:

(x modulo pixelSize) / pixelSize

Create your discs the same way you have already done and use them to mix between your image texture output and a background color.

I hope this helps.


how to use external values as input for color ramp shader node? All,

I've recently started dabbling in Blender to do some scientific visualization, like ParaView but 1000x prettier :)

At the moment I'm trying to tackle adding a color ramp to a 3D surface. As of now, I've been able to figure out how to use the surface's vertex geometry as the input for coloring. My current node setup looks something like this:

This separates the z-values from the geometry and uses them as input for the color map (after normalizing them in the map range node).

I want to do this exact same process, but instead of using the z-values, I want to use arbitrary values.

If I have a surface with n points, I will have an array with n values. These may represent temperature, salinity, velocity etc.

How could I go about doing this? Both GUI and python based solutions welcome! Would like to learn it first by GUI but will eventually be coded.

You can loop over every vertex after initializing different arrays for each of your vertex color layers. You can parse the init data from a file (eg .csv) with python but this is not covered in this answer.

import bpy
import bmesh

obj = bpy.context.selected_objects[0]  # Get the currently selected object

vertex_colors = obj.data.vertex_colors
while vertex_colors:
    vertex_colors.remove(vertex_colors[0])  # Remove all vertex color layers form the mesh data

bm = bmesh.new()  # Create new bmesh object
bm.from_mesh(obj.data)  # Init the bmesh with the current mesh

verts_count = len(bm.verts)  # Get the number of vertices in the mesh
# Not obligatory, I just use this to populate the vertex color layers)

# This dictionary will map each vertex color layer name to the data for each vertex
data_layers = {
    'Temperature':  # vertex color layer name 1
        [
        (1, 0, 0, 1),  # Color of vertex index 0
        (0, 1, 0, 1),  # Color of vertex index 1
        (0, 0, 1, 1),  # Color of vertex index 2
        (1, 1, 1, 1),  # Color of vertex index 3...
        ],
    'Velocity':  # vertex color layer name 2
        [(i / verts_count, i / verts_count, i / verts_count, 1) for i in range(verts_count)],
    'Salinity':  # vertex color layer name 3
        [(i / verts_count, 1 - (i / verts_count), 0.5, 1) for i in range(verts_count)],
    }

color_layers = {}
for layer_name in data_layers:
    # Create the vertex color layers and store them in a dictionary for easy access by name
    color_layers[layer_name] = bm.loops.layers.color.new(layer_name)

for layer_name, layer in color_layers.items():
    # Loop over each vertex color layer
    for v in bm.verts:
        # Loop over every vertex
        for loop in v.link_loops:
            # Loop over every loop of this vertex (the corners of the faces in which this vertex exists)
            try:
                loop[layer] = data_layers[layer_name][v.index]
                # Get the value from the init dictionary
            except IndexError:
                loop[layer] = (1, 0, 1, 1)
                # Set a placeholder (magenta) value if the mapping array is not long enough

bm.to_mesh(obj.data)  # Give the data back to the actual mesh

Then to acces the vertex colors in your material, use the vertex color node :

Note that the "Temperature" layer was initialized with only 4 values, so only a few vertices in the right eye got colored and the rest of the vertices got mapped to a magenta color.

Also note that you can store 4 values in each of the 4 channels of your color. Example with the 'Velocity' vertex color layer used before :


Recreate to_track_quat with two vectors using python i've been asked to recreate the to_track_quat function of mathutils to create a quaternion that looks from point a to point b, but so far i've been un successful.

I'm using in blender two objects, being their positions:

object.location = mathutils.Vector((0,0,3))

target.location = mathutils.Vector((2,4,4))

angle = look_at(object, target)

Here is my first function:

def look_at(u, v):
    u.normalize()
    v.normalize()
    dot = u.dot(v)
    cross = u.cross(v)
    q = mathutils.Quaternion()
    q.x = cross.x
    q.y = cross.y
    q.z = cross.z
    q.w = math.sqrt(u.length_squared*v.length_squared) + dot
    q.normalize()
    print(q)
    return q

Returns (w=0.9129, x=-0.3651, y=0.1826, z=0.0000)

The result is something like this:

I believe i'm missing an operation, but i'm not certainly sure what.
Can someone guide me a bit on how to do it properly?

Another attempt that has been suggested:

def look_at(u, v):
    w = (v - u)/math.sqrt((v.x - u.x)**2 + (v.y - u.y)**2 + (v.z - u.z)**2)
    up = mathutils.Vector((0,-1,0))

    q = mathutils.Quaternion()
    cross1 = w.cross(up)
    dot1 = w.dot(up)
    q.x = cross1.x
    q.y = cross1.y
    q.z = cross1.z
    q.w = math.sqrt(w.length_squared*up.length_squared) + dot1
    q.normalize()
    return q

Based on this tutorial I wrote this function

def look_at(camera_position, target_position):
    """Returns model-view matrix from camera position to target.

    # Arguments
        camera_position: Numpy-array of length 3. Camera position.
        target_position: Numpy-array of length 3. Target position.
    """
    camera_direction = camera_position - target_position
    camera_direction = camera_direction / np.linalg.norm(camera_direction)
    camera_right = np.cross(np.array([0.0, 0.0, 1.0]), camera_direction)
    camera_right = camera_right / np.linalg.norm(camera_right)
    camera_up = np.cross(camera_direction, camera_right)
    camera_up = camera_up / np.linalg.norm(camera_up)
    rotation_transform = np.zeros((4, 4))
    rotation_transform[0, :3] = camera_right
    rotation_transform[1, :3] = camera_up
    rotation_transform[2, :3] = camera_direction
    rotation_transform[-1, -1] = 1
    translation_transform = np.eye(4)
    translation_transform[:3, -1] = - camera_position
    look_at_transform = np.matmul(rotation_transform, translation_transform)
    return look_at_transform


Blender 2.8 - Multiple View Layers is it possible to add new ViewLayers to current beta version, or it is work in progress? I am looking for a way to render two objects on two separate viewlayers with different compositing nodes on each and then merge them together.
I have been looking around but cannot find a definite answer how to do it, or if it is even possible.

I am using Cycles and Eevee.

View layers, that previously are been here:

Now moved in top right corner:

This animatable checks

Now presented it view layer settings:

Per layer settings for exclude, holdout and indirect only, that previously are been here:

now can be setup in context menu:

You need to know that EEVEE doesn't supports holdout and indirect only at current time.


Camera rotates around object at awkward angle I am using Blender's game engine to make a racing game. To have the camera follow the car, I parented the camera to the car. The camera tracks it fine on straightaways, but not so much on turns. Around the turns, the camera rotates at such an angle that the car goes to the side of the view.

As you can see, the camera does sort of an ovular rotation. How do I stop the camera from doing this?

To fix this, I applied a camera actuator to the camera instead of parenting the camera to the car. The camera actuator allows the camera to track an object and choose how precisely it tracks it using damping (e.g. if the car goes over a pothole it won't shake the camera, but if it goes over a big hill, the camera will follow it). Here is a picture of the actuator settings:

You can learn more about camera actuators here.


How to make each frame represent one second? I really want frames to represent seconds but how?

By watching a video I learned that doing CTRLT should do what I want but that didn't work. Because seconds are like 25 frames but if every frame was a second that would be cool.

Go to the Properties window, then in the Render tab scroll down to the Dimensions section. The Frame Rate is the setting you want to change. From the dropdown choose "Custom" then in the new frame rate field that pops up enter 1.


Find the edges of checker texture for adding bumps or ridges? I created a floor for a butcher shop scene and added some dirt, but I realize that it still isn't very real. There are no grooves or edges between the tiles where I can bump them a bit. Is there a way to find the edges?

I tried using a couple of color ramps but can't figure out a math node to find only the edges between the two colors.

I am doing this all procedurally, with only a grunge map for the dirt under the unit. I don't want to add another image texture.

How can I find that edge so I can create some dirt and scratches in the edges?

A material such as this should be useful.

This combines a couple of Wave textures (at the same scale as the checker texture) to identify the edges - in this way you have a graduation as you get closer to the edge rather than a sharp edge. You can vary the Power node to bring the 'edge' closer to the edge of the Checker tiles (eg, 2000 would get it really close, 1 gives you a graduation over the whole tile).

I've not quite got it clear in my head yet why those values in the Location and Scale of the Mapping nodes - the scaling on the Wave textures is 1/4.5 and that seems to work fine (I'll try and figure out a more scientific reason for that at some point!). Obviously the Scale of both the Wave textures and Checker texture must match. Also, if it's different to 5.0 then you'll need to adjust the Location offset of the Checker texture to suit. I'll try and figure out a better way of getting these to line up but, for now, hopefully this will be useful.

I've combined it with the Checker texture with a Mix Shader just to show that they combine correctly - vary the Mix Factor to blend between the two.

Here's an example using this as a Bump map.

And here's the Blend

EDIT : Here's a "simplified" material using Cosine maths nodes in place of the Wave textures. This simplifies the scaling so that a single Value node can be used to set the scale for both the Checker texture and the Edges (the output of the Power node). Note that the second column of Multiply nodes are set to multiply by 'pi' (which blender kindly expands to the value of pi).

Blend file attached