Material Doesn't catch light shining on it from using a Geometry and Mix Shader node I created the following node setup to place an image on 1 side of a plane and have the other side white.

The issue is now the material will not catch any light from a lightsource.

The following node setup works but then the image is on both sides of the plane.

Question

How can I use Geometry and a mix shader in my material and have it catch light?

The first node setup is almost right, except that you're missing a shader between the Image Texture node and the Mix Shader. The green sockets indicate that the input to the Mix Shader should usually be the output of another shader, for instance the Principled BSDF.

Start from the node setup from your first screenshot and add a Principled BSDF. Disconnect the Image Texture node from the Mix Shader.

Connect the:

Color output socket of Image Texture node to the Base Color input socket of the Principled BSDF node
BSDF output socket of the Principled BSDF to the upper Shader input socket of the Mix Shader

Adjust the properties of the Principled BSDF to get the desired look. Specular controls the amount of specular reflections.


Custom heatmap 3D texture I have a 3D model constructed from photogrammetry. I would like to colorize this based on custom values on some vertices, and interpolate a heatmap for the rest of the mesh based on these values. I would like to either assign a max/min value to the vertices from which a color ramp is generated or do this outside of Blender and give the vertices RGB values from which the rest of the texture is interpolated.
Does anyone have a workflow or ideas on how this may be achieved?
Edit: I managed to acomplish this using the pyvista interpolate tool https://docs.pyvista.org/examples/01-filter/interpolate.html

I quite didn't understand the meaning of your Heat map so I created a not-so-complex procedural material, which would consist of 3-4 nodes based on your heat map.

1] Depth Map : This map is based on height, if u want this kind of material then use the top three nodes
nodes

2] Fake Heat Map : This is a fake heat map based on distance from the
camera, a very common filter.

Ahh! I nearly forgot, you can also use the layer weight node to get
the faces facing the camera. Like This :


Convert cycles closure (shader) output to colors? Is it possible to convert the output of a cycles Shader node to colors?

For example to use an ambient occlusion shader output to multiply or darken act as a mix factor between other shaders?

No.

Long answer: Closures (the green sockets) are symbolic descriptions of lighting behavior on a surface. They only result in a color value after evaluation of all the possible incoming light directions by the renderer.

Now, when you talk about using the result of an Ambient Occlusion shader for mixing other shaders, this describes a physical or chemical effect which is not part of the basic pathtracer model with inert materials, i.e. the light influences the physical properties of the material (which in turn could change lighting and so on ...).

A good illustrating example is phosphorescence - if you wanted to implement this with cycles you have to bake a map of the "charge" and use that for an emission shader, while also reducing the charge over time as well as increasing it with incoming light. The important point is that this whole physical simulation is outside of the actual pathtracer and only communicates with cycles via image textures (much like dynamic paint).

The key missing feature is baking of course. It will eventually be added to cycles, but for the time being you'll have to resort to using Blender Internal or some external renderer (or just make an image map by hand).


Using bpy in a standalone python script dies when rendering EDIT (Solution):
I was able to fix this by adding the following line:
bpy.context.scene.render.engine = 'CYCLES'

This works fine for me as I need to use the cycles engine anyways
Original Post:
I'm writing a standalone python script to render .OBJ files automatically, without a .blend file or anything.  I installed bpy 2.82 on my windows machine using the instructions found here.  And I have python 3.7.9 installed.
Currently, as just a test to get my bearings, I tried the following code to try to setup a simple scene, load in a .OBJ, and render it out:
    import bpy
    import os
    from math import radians

    maplet_path = 'obj_files\\bunny.obj'
    image_out_path = 'render.png'

    # Create a Scene:
    scene       = bpy.data.scenes.new("Scene")
    camera_data = bpy.data.cameras.new("Camera")
    light_data  = bpy.data.lights.new(name="Light", type='SUN')

    # Import the maplet data:
    local_path = os.getcwd()
    bpy.ops.import_scene.obj(filepath=os.path.join(local_path,maplet_path))
    scene.render.filepath = os.path.join(local_path,image_out_path)
    scene.render.image_settings.file_format='PNG'

    # Get handles for all objects:
    maplet = bpy.context.selected_objects[0]
    scene = bpy.data.scenes.new("Scene")
    camera = bpy.data.objects.new("Camera", camera_data)
    sun    = bpy.data.objects.new(name="Light", object_data=light_data)

    # Setup camera parameters:
    scene.render.resolution_x = 1920
    scene.render.resolution_y = 1080
    camera.location = (-2.0, 3.0, 3.0)
    camera.rotation_euler = ([radians(a) for a in (422.0, 0.0, 149)])

    # Setup scene:
    sun.location = (2.0,2.0,2.0)
    sun.rotation_euler = (radians(10), radians(15), radians(20))
    maplet.location = (0,0,0)
    maplet.rotation_euler = (0,0,0)

    # Add camera to the scene:
    scene.camera = camera

    # Update the scene:
    bpy.context.view_layer.update()

    # Render:
    bpy.ops.render.render("EXEC_DEFAULT",write_still=True)
    bpy.data.images['Render Result'].save_render(os.path.join(local_path,image_out_path))
    print('hi')

Unfortunately, the program runs perfectly fine, but once it gets to the line:
bpy.ops.render.render("EXEC_DEFAULT",write_still=True)

it hangs for a moment, and then just exits.  It never prints 'hi', and it never writes any image.  It also doesn't print out any errors or anything else, it just stops running.
I tried stepping through with pdb and it appears to hang/fail at:
c:\......\python\python37\2.82\scripts\modules\bpy\ops.py(182)idname_py()-'render.render'
-> return self._module + "." + self._func

Is there something wrong with how I went about installing bpy?  Or something wrong with the script I've written?

Adding
bpy.context.scene.render.engine = 'CYCLES'

Fixed this issue


What's happening RE Blender Player? Has it been discontinued? I'm a bit out of the loop, but my Mac Software update client says Blender Player has been discontinued. The current (last?) version of Blender Player is 2.79, file build date 9/14/2017.

I'm wondering what the story is behind this? I looked through the release notes going back to V 2.73 on the official Blender website and did a search via DuckDuckGo (my preferred search engine) and did not find any mention about what's going on with the Blender Player, and I looked deep clicking on "read more" on closely related topics on version 2.79 and 2.78.

Blender Player was a part of the Blender Game engine, which relies on Blender Internal Render engine.

Blender Internal Render engine was dropped due to the fact that its render aproach was quite outdated and with the release of Eevee as the new physically based real-time render engine, the developers would have had to take care of three render engines (Blender Internal, Cycles and Eevee).

Depending on what you want to do with Blender Player, there might be alternative solutions with UPBGE and Armory3D (no MacOS support, afaik)


Controlling Anisotropy with Textures My Aim in Short

I would like to controll my Anistropic material with an image input.

What I Have Tried

I made a mockup to show what I would like to achieve.

This is a single plane with an anistropic material as simple as the following.

The trick here is to distort the UV map (and add multiple lamps).

By the method explained above, I managed to make an wood like anisotropic material. However, ...

My Problem

Here I have 2 problems.

I do not have an intuitive controll over the pattern. (I prefer an image input)
I use an excessive number of vertecies.

Please help me with the problems above.

This is math heavy.

So in this case, the only thing that varies, texel by texel, is the tangent.  The tangent is a vector that points in the direction of delta UV (well, either U or V, I can't remember.)  In order to represent this on a texture, you code how much the tangent has been rotated from a "base" UV map.

So start by making an additional, "straight" UV map.  Now you need to know the difference in the tangents between the two UV maps.  To do this you can use the arc cosine (math node) of the dot product (vector math node) of the tangent vector of each UV map (tangent node).  This will give you a value ranging from 0 to pi that represents the amount of rotation, but not the direction (clockwise or counter).

In order to determine the direction of rotation of the tangents, you need to create another vector.  Start by taking the cross product (vector math) of your two tangents, then take the cross product of the cross product vector and one of your tangents (probably the undistorted tangent).  The first cross product is a vector orthogonal to both tangents, while the second forms an orthogonal 3D basis with the undistorted tangent and the first cross product.  Now you can use the dot product (vector math) of this second cross product with your other tangent (from the distorted UV map) and evaluate whether it's positive or negative to determine the direction of rotation.  Putting this together, you can generate a value ranging from -pi to pi:

(dot(cross(tangent1, cross(tangent1,tangent2)), tangent2) > 0) * arccos(dot(tangent1, tangent2) - (dot(cross(tangent1, cross(tangent1,tangent2)), tangent2) < 0) * arccos(dot(tangent1, tangent2)

(What if any dot products are 0?  Or what if any cross products are 0 vectors?  Then that means that tangent1 = tangent2, and there is no rotation; it is equal to zero.)

If you remap this to the 0,1 range (add pi, then divide by 2*pi, math nodes), you can bake it to a texture on your undistorted UV map and you have an image map of the rotation of your tangents.

How do you use this texture to regenerate your anisotropy?  Load as non-color data from your undistorted UV.  Now rather than feeding this into tangent, you can use it directly as a rotation input for your anisotropic shader, which accepts input in the 0-1 range anyways.  Don't forget to use your undistorted UV map to generate the tangent vector.

Order of operations on cross product matters, and rather than getting into details regarding that, just be aware that you may have to invert your rotation depending on how you do it (rotation = 1 - rotation, subtract math node).

Once you do this, you can safely delete the distorted UV map.  Your rotation is coded on a texture, and you can access it with only 4 vertices.


Making an animation with a transparent background blender cycles render I am currently trying to export a animation with a transparent background to lay over the beginning of my YouTube videos. I got this idea from the famous YouTuber captainSparklez. I have tried changing the output to RGBA but that does not work and I have also tried selecting transparent in the film section but that doesn't work either. keep in mind I am using Cycles to do this and I don't know if u can render a QuickTime animation in cycles. I will be using this in my editor Adobe Primer Pro if you need to know that. My version of blender I am using is Blender 2.78a If you could help that would be amazing thank you for your time.

Just render it out as a PNG sequence (with alpha) then take those files into Premiere as a sequence.

In your render settings tab, make sure your dimensions/frame rate are correct.
in the output dropdown make sure you set a destination place, and make sure PNG is selected with alpha
Make sure you hit animation and NOT render when you are ready to render out all your frames.

In Premiere make sure you click "image sequence" when bringing in your files.


Add-On Dev: Access Property Details This question has likely been asked before. I tried to search, but I honestly don't know how to phrase the question specifically enough to find anything.

If I define a property inside of a class like this:

class Type(bpy.types.PropertyGroup):

    stuff : bpy.props.BoolProperty(
        name="Property Name",
        description="Property Info",
        default=False,
        )

Is it possible to access the name, description, default, and other fields, later at execution time? Say, for example, during a panel draw function?

Edit:

After posting, I starting playing around and found that class_instance.__annotations__.values() seems to include all of this data. But I'm not sure how to sort it out or access the data. I'm still pretty unskilled with Python concepts like tuples and dictionaries, but it looks like the wanted data may be in a dictionary? I'm thinking it may be possible to access it with something like var.__annotations__.values()[1]['description'].

But even if something like this is possible, would it be the correct way to do it? Is there a better way?

You can access them through RNA without using annotations. Assuming you have registered your PropertyGroup you can access them like in the following example.

For instance the code below gives you access to the description of Eevee's render samples property.

bpy.context.scene.eevee.bl_rna.properties["taa_render_samples"].description


Planetarium sky animation I want to make the inside sphere effect, like planetarium, where I will show not stars, but planets.

The obvious way is to use sphere and place camera inside. But I wish to make animation from the spherical surface to the flat surface.

Also I wish to shift sky (planets) by X and Y to emulate user scrolling action.

The closest way that I found is use the particle emitter and changing the "Jittering Amo".

But it can't be animated.

How can I achieve this effects: the planetarium effects (like Google Sky Map) and animate the surface from the sphere to the flatness (like Google Maps)?

Thanks!

Not sure if i understood your question, but have you tried panorama camera mode in cycles? There is Fisheye Equidistant projection, it will spherize you render

Just spread your planets with particles in a volume, and then move your camera towards it, it will correctly distort your image for FullDome projection


Sculpting Low Poly Brush Too Strong I have decided to expand my knowledge and start learning Blender. I am following this tutorial since i want to start with low poly art style. I think am following all the steps but the thing is that when i start sculpting my brush make a mess and I can't find a way to properly set it in order for it to work like in the video. Here is an overview of my settings:

Sculpting an Icosphere with size 10 with subdivisions set to 3
Using the Draw brush
Dyntopo is ON, detail size: 7, detailing is set to constant detail
Using Blender beta 2.80

Here are some screenshots of my results:

I am new to Blender and the community, sorry if I use any term improperly.

You can see the video to find the expected results.

Thanks in advance.

You can lower the strength from here:

and you can reduce size by clicking F and dragging mouse.
And according to the video you have selected the wrong brush.

It should be the top Red Brush.

Hope this helps.


How to create a shortkey for "Replace image" in "UV/Image editor"? In the UV/Image editor, in the Image Menu, every option such as Reload image has a shortcut, except for Replace image.
So I've tried to add a shortcut in the preferences, right under where I found "Reload Image" shortcut, then saved the user settings. All was done just as the manual said, but it is not working.
How can I add this shortcut?

To add the new shortcut in User preferences > Input scroll down to :

click Add New , set up your shortcut as follows :

NOTE: the shortcut name 'Replace Image' will come up automatically

Save your preferences and now you can use your new shortcut

To know what to type for the shortcuts use the tooltips :


Is there any way to run blender 2.80 add-ons on Blender 2.79 I tried to run a Blender 2.80 addon script on blender 2.79. But it is not working. Is there any way to run it?

No there isn't. The Python API has changed between the two versions and therefore add-ons for Blender 2.79 won't run in Blender 2.80 and the other way around.

You would have to modify the code of the add-on to let it run in Blender 2.79.


Glass reflection distortion Which factors should I look at to make the reflection as neat as that of the reference image?
Some of the thigs I've tried:

Increasing roughness, but still have too many distorted reflections and also I can't see the yellow sphere in the cube clearly like the reference image.

Changing variables on Ray visibility, but nothing seemed to work. Material of the cube is set to default material with : Specular 0.5 / Roughness 0 / Transmission 1 level

Reference

My Cube  – Bottom and left sides has way too many distortions.

Those things at the bottom are reflections (as you mentioned) so care about environment you use.
For distortion you can try to play with IOR value.
Another thing to care is curvature of your Cube - more rounded more distortions.
Here White environment with a bit of Beveled edges and IOR 1.15


Panoramic render cuts at top hello im trying build a scene of a street at i have a huge object on the top, im rendering this in panoramic, equirectangular. The thing that happens is that in the viewport its ok but when i render it or i look thru the camera in rendering mode the top part gets cut.

images

Check you Active Camera (Render Camera) Clipping Plane Near and Far. Viewport is not the same as final render Near and Far clipping plane.


Distorted plane as image After importing as plane image. This happens.

Original png on left. How can i avoid this?

Alpha values range from 0-255.  Your image editing program is hiding pixels with very low values such as 1-3 into that background checkerboard pattern.  Blender is expecting 0 for complete transparency.

Open image in GIMP, use the magic wand tool to select transparent area, then click Delete key.

File >> Export As... and give it a new name, or Overwrite PNG if you are satisfied with results.


why the object not following the curve? I want to animate this sphere. so I added a bezier curve and object constrain to sphere follow the path but soon after selecting the bezier curve. How can I make my sphere placed at the bezier curve to animate the path

g

The curve has start and end with no direct indices. Set current frame to zero, then select followed object and a curve as active, then Set Parent To > Follow Path, you will see a dotted line pointing to start of curve and move object to it. If Curve direction is wrong use Edit Mode > Segments > Switch Direction. Curve origin doesn't matter.

By default animation adjusted to 100 frames starting from zero. You can tune Curve Path Animation in Object Data tab.

Result in 60 frames.


Mesh lagging behind another mesh in the same target bone I am currently making a hinge armature and there are a few meshes that is attached to the target bone (via object constraints). It looks like this:

However, when I rotate the selected bone on the X-Axis to move the hinge up and down, the tracks lag behind the rest of the other objects:

I have tried to weight paint all of them equally but it still prevails the same issue. The track has is parented to the curve and no object is parented to the armature (except the circular and box empties). Does anyone have a solution?

Okay, found out while accidentally messing around with the object constraint. I noticed the main gear piece was going in front of the armature itself. I set the bone influence to 0 on the object and now its moving with the bone properly.


Implementing Multiplayer I am making a multiplayer game with blender, well intending on doing so.
Can anyone set me out the tutorials I'm going to need for this project intended on. I want it done by direct IP for you to join friends (so you host your own server).

I don't need tutorials on how to build functions or whatever, just need help to understand how to make the game multiplayer and the rest I should be able to do on my own.
I'd prefer no python coding, but that is imply impossible :P
Thank you for whoever can help! :D

There is an addon for BGE made by agoose that has a multiplayer setup. I suggest you have a look at that and see if it provides an easy solution for you.

This is similar to the question "how do I carve a statue in wood - without using my hands". Multiplayer is not something you can implement in a few hours, or even a few days. A good multiplayer setup requires an understanding of a range of topics from advanced programming concepts through to the network stack and even some physics (and AI for more advanced lag compensation techniques).

So that this answer isn't completely useless as an answer, I will continue.

Networking in python is done typically through the socket module, though other frameworks such as twisted are available. Because blender python scripts have to run inside a frame, typically ports have to be used in non-blocking mode, or a multithreaded system set up.

You also have to design the architecture of the system. Do you have a game instance that is the "true" state of the game and all the clients are just interfaces to it? Do you have purely client-side calculations and only send updates to what a player does? There are many more architectures around, have a read and take a pick.


Cannot modify or delete mesh without it collapsing I've been working on a model for a game, and found out about Shape Keys for clothes/armor that can be changed out. When I tried to squish the torso, I found out I can't scale it at all. Then I found a rip in the mesh - which is strange since its from an applied mirror, and the cut isn't on the other side.

It turns out this cut has to be from Cthulhu or something, cause it completely wrecks everything.

https://youtu.be/XbFRfi2QcJM

I made a video showing what happens if I duplicate the other side, or delete the vertices around it. It just goes berserk and collapses on itself.

The only modifiers on the effected mesh are smoothing and armature.

Does this mean it got corrupted? Is there a way to stop it from becoming a black hole and devouring the entire upper torso? Or is the only option starting from scratch?

Edit//

The Upper Torso shape key likely needs to be removed, or at least you need to disable the Shape Key Edit Mode option


Refraction bending with planar surfaces in Cycles (2.78b) I was always under the impression that straight lines should refract and reflect via planar surfaces into straight lines.  Cycles seems not to do this in certain instances.  In the video below you can see it best on the left face at the start and the right face at the end of the sequence. At first I thought it was a problem with my HDRi but it seems surrounding geometry creates the same effect.  Am I wrong in my assumptions, do I have some settings or parameters incorrect in my materials or environment or is this a "feature" of Cycles?

Refraction example on YouTube

Here's the Blend file (slightly edited since this video was made):

Here's a single face of the cube and no HDRi showing the effect.

On first look it might seem that refraction on planar surfaces will not distort the image, but just linearly bent it or zoom it:

In real world there are very few examples where the distortion is clearly visible, one of them being refraction on water level:

(Thanks to @RichSedman for pointing this out and patiently making me dig deeper to find the truth and how it works.)

Refraction follows the Snell's law. This means that for every IOR value there exist a critical angle after which the ray won't be refracted but reflected:

We can see this in the above pictures, where the refraction is surrounded by the reflection of pool or sea bed. We will return to this (in Cycles) later. What we also see is the distortion of those refracted rays, so lets tackle the distortion first:

It's best to start with reflection analogy. Reflection is much simpler - the angle of incidence is the same as angle of reflection - their relationship is linear (unlike with refraction). By tracing the reflected rays, we can construct a single(!) virtual viewing point B, from which we see the reflected image:

Doing this with refracted rays (and drawing them in CAD with Snell's formula) reveals, that the rays do not intersect into a single virtual viewing point, but into infinitely many of them (because the relationship between incidence angle and refracted angle is not linear). This means that every piece of the refraction we see from different perspective and that is the reason for the distortion (every 2 rays create a virtual viewing point in different location):

Now let's see how this behaves in Cycles - left how it changes with distance to camera (single refractive quad with IOR 1.3) and right how it changes with IOR (1.0 to 2.0):

This is physically correct behavior. By knowing this you are now able to create a panoramic fish-eye lens camera from simple perspective camera and a refractive quad (if the engine can do refractions but has no such camera option:)

But what Cycles doesn't do on it's own is to change the ray from refractive to reflective after the critical angle just with the Refractive shader (naturally) - it is just black. For this there is the Fresnel node that after the critical angle gives 1.0 mixing factor to mix in Glossy shader:

The glass shader has all this already build in.


How to assign random numbers to phase value for all noise F-Curves modifiers? I think that the question is pretty straightforward. I been trying to do it by my self for a while but I'm stuck.

This is the script I've made:

import bpy
import random

for i in bpy.data.objects:
    i.types.FModifiers.phase = random.random*5

... which of course fails.

Thanks in advance.

Explained in the inline comments:

import bpy
from random import random

# Only selected (thus visible), editable objects
# bpy.data.objects would affect all objects in all scenes!
for ob in bpy.context.selected_editable_objects:

    # OPTIONAL: Ignore object types other than mesh
    if ob.type != 'MESH':
        continue

    # Is there an animation?
    if ob.animation_data is not None and ob.animation_data.action is not None:
        action = ob.animation_data.action

        # Iterate over all F-Curves
        for fcu in action.fcurves:

            # Iterate over all F-Curve modifiers
            for mod in fcu.modifiers:

                # Only act upon Noise modifiers
                if mod.type == 'NOISE':
                    mod.phase = random() * 5


How do you make custom shapes? In a lot of tutorials the authors start out with a custom shape that they don't explain how to make. By custom shape I mean something that isn't based on one of the primitive shapes, so no extruding, etc. A good example of what I mean is something like https://www.youtube.com/watch?v=QY7iJmqsJf8 when he shows the bullet he made but didn't show how. I am also curious as to how to go about this with more complex shapes, like for example highly detailed models.

I apologize if this is a very easy to answer question, but all of the tutorials I can find talk about advanced automatic features and completely skip the actual modeling which is what interests me most right now.

To clarify, I am NOT talking about just subdividing something.. I am asking how to make shapes from scratch like seemingly almost everyone is able to do in a minute or two.

Thank you for reading and I appreciate all responses because I have a lot to learn.

That's more or less how it's done. You model them, starting from a primitive.

For example, to make a bullet you might start with a cylinder or circle (ShiftA>Mesh) and then extrude (E) and scale (S) to top ring repeatedly, finally merging it into a single vertex (AltM):

Note that you must be in Edit mode in order to edit the underlying geometry of an object (you can toggle edit mode quickly with Tab).

For more complex models, you might use a different primitive. For example, most round objects (e.g. bowl) can be started with a circle, while for a more free-form object you might use a plane or even a single vertex:

This is a rather sloppy example, especially as I could have used a circle as the starting mesh, but I think you get the idea.

There are many great tutorials on modeling in blender (look around on youtube etc.), here's a list of some good resources.

Another thing you can do is watch modeling time-lapses like this one.


How to overlap colors I have a requirement to overlap the colors so that they look a bit appealing. For now they can be seen with clear boundary between them. Please suggest how can I overlap the colors

You could use vertex colors.

Or you could do the fading by hand, you'd need to make an object for each color (or duplicate the mesh) and then move the UVs on an alpha texuture so you get gradients where you want them.

Or of course you can use cycles:


Can I pack an archive with Ranchecker in the newer version? According to the info provided by Ranch the render farm, with the addon Ranchecker you are able to pack the archive, but in the new version that button doesn't exist or I can't seem to find it yet one of the lines says I have to pack my archive before sending it to the render farm. I didn't find an updated document of the process either.
blender 2.91

According to your screenshot, you clicked on the button "Create Archive" (which was called "Pack your project" in the previous version I guess).
Reading the logs, it says that a cup9_16_manu.vub archive was created. This is the file that you can upload to the render farm.


Render plane only where spotlight hits, rest should be transparent I have a block with a logo cut out through it, and I'm shining a spotlight down through it so it shines on the plane below.  I'm trying to render it so the plane is transparent, except where the light hits it. I'd like the logo block to render as well.

I'd like the blue plane to render transparent, and only render where the light hits the plane.

I've seen other posts about how to only render shadows on a plane, but not the opposite, rendering on light on the plane.
I've played with render layers, trying to set a certain color to alpha (like the dark colors) and I'm not having luck yet.

use the color of the non-lit plane for the 'Key Color' attribute.

this makes everything transparent that's with the same color. if your logo also gets transparent then just wait a bit, i'll create a more complicated but better working compositor for you.

Edit: here's the better compositor

for this one you need to also set the plane's pass index to 1

and check the render layer's object index

I can't add more than 2 images so you need to use google for the last part


How does Blender take advantage of normal RAM vs GPU VRAM? I tried searching but could not find a definitive answer on blender stackexchange.
I'm looking to upgrade a rendering Rig, and the RAM is a bit old... I know for most of my work I use cycles which relies on the GPU for rendering.
My question is that, Is there any benefit to upgrading the normal RAM i use? e.g. If I have 16 GB of 2000 mhz ram, is it worth to go to 32 GB of 4000 mhz ram?  Does blender only care about amount (GB) or does it take advantage of the Mhz as well?  I've read the Mhz are useful for high intensity gaming, but what about blender usage?
Does it make sense to leave normal RAM by the wayside and focus all cash towards buying an expensive and powerful GPU with the most VRAM ?

There's a setup procedure that happens when you render (subdiv/displacement, BVH calculation, etc) that is heavily CPU bound and uses system memory until it settles on the final scene data which is then copied over to the rendering device.  There's a balance to be struck.


Texture Jumps Around After Unwrap? Every time I unwrap my mesh, the texture jumps around!

Before Unwrap (look at the label):

After Unwrap:

As you can see, the label on the bottle has jumped around. I can't bake it like this. When I try to move vertices around and get the label back in the right place, I destroy the arrangement of the UV map.

What can I do to keep all the textures in place after unwrap? I tried both the smart unwrap and the lightmap pack unwrap, and the position of the label jumped on both.

In the UV editor you can pin selected vertices from the UV editor menu UV -> Pin or press the P key.

You can also unpin them from the same menu or Alt + P.

There are also other ways to give finer control, for example you can create seams in your UV map effectively cutting it into parts that unwrap nicely.

Too long a discussion for here, but in mesh edit mode you can mark edges as seams, then when you unwrap it will be more forgiving.

You would still need to pin vertices if unwrapping a second time, but gives you more options.


Python exporter set armature to rest pose while exporting meshes I am exporting meshes attached to bones. For each mesh I have transform matrix
that is used to position mesh relative to bone.
This relative matrix is calculated using:

obj.parent.data.bones[obj.parent_bone].matrix_local.inverted() * obj.matrix_local

When I export with armature in
rest position I get correct results.

If I switch to pose position in blender and export, I get wrong results

I think that problem is obj.matrix_local which is based on current bone position.
How can I force rest position, or use other method to calculate object's transform
relative to bone.

armature.data.pose_position = 'REST' doesn't work from script, but looks like
it works from console.

I got armature.data.pose_position change to work
After changing to REST I had to call context.scene.update() and it calculates positions in rest pose. I change it once to pose when exporting keyframes and it is working as well.


Is there a max size for saving openEXR multilayer files? I have a file that has many different render layers. I'm rendering at quite a high resolution, so the combined information I want to save is quite a lot. Blender gives an error when trying to save a OpenEXR Multilayer file. I tried saving a test file, and I was able to save one, so the only difference I can think of between when it works and when it comes up with an error is that that I am trying to save is too large.
If there is a max size, or a maximum number of render layers, what is it?
Thanks.

I don't think there is a limit. In my experience EXR Multilayer Feature works really great in Blender. Make sure that:

you have file permissions to write on your drive,
it is not a compositor issue or
you are not running out of memory.

I once rendered an image which needs to be a 30K EXR Multilayer with all possible passes included, file size was about 12gb. Rendering and Saving as EXR works as expected, but finally the image resolution was to high for the current compositor (2.71) so I can't do the compositing in blender. That's why I suggest you to disable all post processing image operations for the rendering process.

For rendering EXRs with Cycles this answer is also helpful. In this post Brecht even mentioned that rendering EXRs is the only way to write and render the image at the same time. With that in mind it even makes sense to render as EXR for large filesize images.


How to connect a circle to a grid with even topology? I'm trying to connect the pieces shown below together seamlessly, but I can't figure out the correct way to do it.

I have tried a bit of everything, but nothing seems to give me the result I'm looking for. The face density should look even and there shouldn't be any odd geometry. Below is how I've managed to make it. However, I'm really unhappy with the result as there are ugly tris that stick out - they affect shading, among other things.

How would one go about this? I've been trying to figure it out for far too long now.

EDIT:

How would I do this as illustrated by an answer below? Because of a higher polygon density I can't do this by hand everywhere as it simply isn't efficient.

My mesh is rounded as shown below. Think of it as being a part of a sphere.

You are merging 2 meshes with very different densities. The circle is about double the subdivision compared to the rest. Your topology should look similar to this:

the 5 green polys (the E pole vertex in the middle) are responsible for the change in edge flow
both marked edgeloops should be nice and even to produce edges with consistent curvature alongside them

The goal is to use control mesh with the least amount of 3 or 5 edged vertices. Topology like that minimizes any surface artifacts (shows mostly on reflections)

I got this piece by using Shrinkwrap Modifier and projecting the geometry onto a subdivided cylinder.

To project 2 circles with Shrinkwrap onto a sphere is bit trickier, because we get this overlap, that has to be cleaned:

It's more elegant to prepare both pieces beforehand, so they line up together nicely when projected (the math of projecting onto sphere is not that complicated here). We cut each piece with an ellipse that has same width as the sphere, but has the minor axis of √2/2 (about 0.707):

I used the ellipse just as a guide to move and align vertices, but you can use Booleans to be exact.

Now it's easy to join the meshes perfectly:

If this is a mesh not to be sub-surfed, but a high-density game model, you can proceed the same way with a lower-poly control mesh and then apply the subsurface modifier at a level you like.

High-poly meshes are easy to sculpt or generate procedurally, but pain to model with precision.

If you keep a mesh with same size polygons, the smooth shading on it will also produce nice results, long triangles or long polygons do not behave nice. Your mesh from your question is very close to that state, with some cleanup I would call it fine. If you decide to use a normal map baked from the subsurfed high-poly, then even this stops being a problem, because the normals are now defined in a texture and you can have a mesh that looks however you like. The only concern becomes to have enough geometry so the silhouette looks clean.


Render scene with background jpg in python Fairly new to python and blender, so apologies if this is super basic. I've searched around and haven't found an answer.

I'd like to render some procedurally generated objects with a background image. In case it makes a difference, I'm using:

I don't need any interaction between the generated object and the background image so I've left a skeleton script I'm using to render below

import os
DIR ="/home/path/to/folder"
bg_file = os.path.join(DIR, "myimage.jpg")
bg_img = bpy.data.images.load(bg_file)
bpy.data.scenes['Scene'].render.filepath = os.path.join(DIR, "image")
bpy.context.scene.camera = bpy.data.objects['Camera']
bpy.ops.render.render(write_still=True)

I managed to find some scripts that seem to be trying to do what I want online, but none that I could get to work. e.g.

import bpy
filepath = "/home/path/to/folder"
img = bpy.data.images.load(filepath)

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        space_data = area.spaces.active
        bg = space_data.background_images.new()
        bg.image = img
        break

cam = bpy.data.cameras.new("Camera")
cam_ob = bpy.data.objects.new("Camera", cam)
bpy.context.scene.camera = cam_ob
bpy.context.scene.objects.link(cam_ob)
bpy.context.scene.objects.active = bpy.context.scene.objects["Camera"]

Any thoughts/tips would be greatly appreciated!

I tried the same thing above, but didn't work. What worked for me is with the textures. In this case, I think you also have to take care of the Texture fields.

bpy.data.textures['Texture.001'].image=bg_img

It works if you need to Change just background

Also add this,

bpy.context.scene.world.use_sky_paper = True
Set also influence, horizontal

Sorry, I dont have enough credits to comment!


How can I use 2.80 mode!s in 2.79? I can't use models that were made or edited using 2.80 in 2.79 without the UI acting weird.

2.8 was a compatibly braking release, meaning files edited in 2.8x will not work in older versions, even 2.79b.
That interface acting weird is normal and expected when opening a 2.8x file in 2.7x (or any pre 2.8 version). I've had blender flat out crash when trying to open a 2.8 file.
Fear not, you are not locked to 2.8.
Create a new file in blender 2.7x  and append whatever you need from the 2.8 file. I have had appending the whole scene fail, but appending objects always worked for me. Simply
From the Info window File > Append or ShiftF1 then find the 2.8 file. Go to the objects category, and if needed simply select everything.
Proof this really works
I just tested this with this Tesla Model S made for eevee. It is setup for eevee so obviously it's 2.8, even the description says "Blender 2.80 required"
Yet I simply selected all the objects when appending and as you can see it works perfectly (even the materials!)


How to efficiently model a pile of stones or pebbles I'm trying to make gravel for my animation, and so far I've tried particles resembling pebble pieces. This method seems too clumsy, so is there an efficient way to make a pile of gravel with collisions on?

1. Add a plane and Fractal Subdivide it

A Fractal value around 0.5 is good for this size of plane.

2. Subdivide it again

Do a second subdivision of a single cut, this time with a higher Fractal value. In this example I used 3.

3. Add a collision plane below

This is to catch the stones after we explode the fractal plane. Scale it up to be somewhat larger than the fractal plane.

4. Specify the collision plane's settings

This is done in the Physics Context with the collision plane selected.

We just want some Particle Friction and Particle Damping. No need to be exact.

5. Select "Quick Explode" from the Object menu

POW! Why sculpt and cut when you can just blow things up? Huge time-saver.

6. Specify Quick Explode settings

Adjust these while playing your animation in a loop to see what you like best.

Once the settings are committed, they're committed.

7. It's exploded but needs thickness and form

Next we will perform some magic to turn this confetti into rocks.

8. Add some more Modifiers with these settings

Note the Solidify Thickness of 0.1, the Decimate Ratio of 0.3, and the SubSurf Subdivisions of 1 each. There is room to experiment here - these values are not set in stone.

What's happening: First the Solidify Modifier turns the flat shards into chunks with volume, but they still look too uniform and not organic enough. Next the Decimate Modifier crushes that geometry down into a shape that looks more like stones by merging neighboring vertices. Finally a Subdivision Surface Modifier takes care of taming the jaggedness.

How many subdivisions? 1 or 2, depending on how smooth you want your stones to be and what kind of poly count you can afford. Usually less is more, and this can be changed later.

9. Apply all modifiers except SubSurf and set shading to Smooth

The Particle System Modifier is the only one that can't be deleted or applied in this stack.

Instead, navigate to the Particle Context. From there you can click the minus icon-button to delete it. We no longer need it once the stones have been created.

The purpose in leaving SubSurf on is for flexibility. You may later choose to remove the SubSurf altogether or increase its subdivision level to 2 for smoother, hi-poly (but also heavier to calculate) geometry. The Modifier settings from one stone can be copied to the rest. More on the SubSurf Modifier later.

10. Select the stones of desirable shape and size

In Edit Mode (Face Select), select a face which is about the ideal size (meaning area) that you want your remaining stones to have. Then press ShiftG to Select Similar and choose "Area".

Immediately after selecting similar faces a Threshold slider will appear in the Operator Panel. Adjust it until it's catching the appropriate amount of stones.

The goal is not to catch every face of every stone with this method, but just to get selected at least one piece of geometry on each stone you want to keep. After this you can shift-select parts of any additional stones you like. Then press CtrlL to Select Linked and this is how you get the whole stones selected.

11. Delete the rest

While still in Edit Mode and with your desired stones selected, press CtrlI to invert the selection so that only the stones you don't want to keep are selected. Then press X to delete them.

12. Separate by loose parts to get individual stone objects

At this point you may want to rename your object from "Plane" to something like "Stone", before breaking it into a bunch of smaller objects that will be named "Stone.123" etc.

Press A to Select All, then P to Separate. Choose "By Loose Parts".

From Object Mode you may now want to Hide (H) the collision plane if it is obscuring some of the stones.

13. Set Origin to Geometry

Having the origin point of these stones off in an arbitrary location is no good, especially if they will be used in a particle system. Let's set it so each stone's origin point is at its center.

In the Tools Tab use the Set Origin drop-down selector to choose "Origin to Geometry", or press ShiftCtrlAltC.

14. Group your stones

Grouping your stones is not only a good way to stay organized and be able to select them easily in the Outliner or Append them to other .blends - it's also necessary if you're going to use them in their own Particle System.

With all of your stone objects selected in Object Mode, press CtrlG to group them. In the Operator Panel name the group something creative like "Stones".

From here you can either use these stones (rocks, gravel, whatever) as particles or as rigid bodies, or with the Molecular Add-On. Self-collision is possible with the latter two methods. If you want to apply the SubSurf Modifier to all the stones you can press AltC and Convert to Mesh.


How to make a group of objects single-user data? How do I make a group of objects single user-data i.e unlink them? I know that I can do this hand-by-hand, however, there are about 500 objects, and doing them hand by hand would take a lot of time.

Extra notes: Not all of them are linked together. What I mean by this is that objects if I select objects A-E, then objects A, B, and E could be linked together, and objects C & D could be linked together. Also, I want to unlink them because I want to apply all of their scales (Ctr+A: Apply Scale).

Thanks.

You can do this by running Make Single User and then select All when prompted.
Note however that this will bu default only make the Object a single user and not the mesh. You will need to use the menu or change the default in the floating Operator Panel to make the mesh to be single user.


Using "Material Preview" HDRI in Renders? I know that I can use default HDRI maps in Rendered mode in Blender right now, but the problem is when I wan to render the image by F12 (or render movie), my settings are changed to use "scene world". Is there a hidden button somewhere in rendering tab or somewhere else? If I have HDRI correct in rendered mode, why I can't have the same result after F12 render?

This is possible, but at the time of writing it's not a one click solution.

First you need to setup your world to use an environment texture and then load the same HDRI that is used in Look Dev mode. The HDRI can be setup either in the World tab or in the Shader Editor using nodes.

Blender 2.80

Blender 2.81 and later

The HDRIs can be found in Blender's installation directory:

[Install dir]/2.80/datafiles/studiolights/world

In Blender 2.81 you can use the same HDRI from Material Preview mode (formerly called Look Dev) for lighting in the Rendered preview mode in the viewport. Switch to the Rendered mode by clicking on its icon, then open the Viewport Shading options and disable Scene World to ignore the settings from the World tab. One of the HDRI presets can then be selected.

However for the actual rendering you will still need to set it up as described above. In case you've already done that, the Viewport Shading options can be left at their default values with Scene World enabled.


Setting the DPI value in rendered images I'm in trouble with finding a way to set DPI value of files within Blender. I have set up an automated workflow to generate image files for printing, but the volume is too high to open and change the DPI value of each image separately. (PNG for example)

May be this addon is the one you need.

Wiki page about this addon.


Rendering both cycles and internal in one My blender project has the mountain in cycles and the water in internal, how do i render both in one scene. But when i use render, i have to change the engine to see it.

Open the .BLEND Twice.

Render each separately (Make sure transparency is enabled for the top layer)

Go to the Movie Sequence editor in one of the files (You can close the other)

Add in both rendered outputs and layer accordingly.


Blender: Scale a group of vertices using python I have a mesh made of 94 groups of 4 vertices:

I need to scale each group of vertices by a decreasing factor (from 100% to 0%).

I tried two different ways to do that, the first is based on the same function called when using the "scale command" via user interface:

bpy.ops.transform.resize(
value=(0.2, 0.2, 0.2),
constraint_axis=(False, False, False),
constraint_orientation='GLOBAL',
mirror=False,
proportional='DISABLED',
proportional_edit_falloff='SMOOTH',
proportional_size=1)

to begin, I tried to scale the first four vertices:

import bpy

obj = bpy.context.active_object
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action="DESELECT")

verts = obj.data.vertices
obj.data.vertices[0].select=True
obj.data.vertices[1].select=True
obj.data.vertices[2].select=True
obj.data.vertices[3].select=True

bpy.ops.transform.resize(
    value=(0.2, 0.2, 0.2),
    constraint_axis=(False, False, False),
    constraint_orientation='GLOBAL',
    mirror=False,
    proportional='DISABLED',
    proportional_edit_falloff='SMOOTH',
    proportional_size=1)

running the code in object mode with my mesh selected, just switches the enviroment to edit mode and nothing else, however if I manually select four vertices and run this script, it scales the four selected vertices correctly.
so.. why is obj.data.vertices[i].select=True completely useless? and how can I correctly select the vertices in order to get bpy.ops.transform.resize() correctly work on them?

I also tried to use bmesh library as it was recommended in most of the forums and guides I visited.

import bpy
import bmesh
import math
import mathutils

# Get the active mesh
obj = bpy.context.edit_object
me = obj.data

# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)
face = bm.faces.active

vertices=[bm.verts[0],bm.verts[1],bm.verts[2],bm.verts[3]]

# Scale
scale = mathutils.Vector((0.2,0.2,0.2))
bmesh.ops.scale(
            bm,
            vec=scale,
            verts=vertices
            )

# Show the updates in the viewport
bmesh.update_edit_mesh(me, True)

this script actually does something: it scales the coordinates of the first four vertices. this means that for each vertex I pass to that function, its position is scaled respect to the origin of the scene ( the point (0,0,0) ).
But I want it to be scaled respect to the center of the four vertices, as it would be if I manually select the vertices and apply the bpy.ops.transform.resize() function.

So, in the first case, how can I tell to "Blender" to select vertices in order to apply the bpy.ops.transform.resize() function?

And in the latter case, how can I make it to scale respect to the center of the four vertices instead of the center of the image?

I prefer a more low level solution. This particular approach requires the object to be in Object Mode, but a small change using Bmesh would let you do it in edit mode. This will give you some insight I hope.

import bpy
from mathutils import Vector

# replace this with reference to your object.
obj = bpy.data.objects['BezierCurve']

def get_average(vert_range):
    med = Vector()
    for vert in vert_range:
        vec = vert.co
        med = med + vec
    return med / len(vert_range)

verts = obj.data.vertices
num_verts = len(verts)
scale = 1 / (num_verts / 4)
j = 0
for i in range(0, num_verts, 4):
    mid = get_average(verts[i:i+4])
    for k in range(i, i+4):
        verts[k].co = verts[k].co.lerp(mid, 1-(j*scale))
    j += 1

For every 4 verts, it finds their average, and scales those verts towards that average by an increasing value every 4 verts. I may have reversed the direction so instead of 1-(j*scale) you might want (j*scale)

for completeness A Bmesh solution, this works in edit mode

import bpy
import bmesh
from mathutils import Vector

def get_average(vert_range):
    med = Vector()
    for vert in vert_range:
        vec = vert.co
        med = med + vec
    return med / len(vert_range)

# Get the active mesh
obj = bpy.context.edit_object
me = obj.data

# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)

verts = bm.verts
num_verts = len(verts)
scale = 1 / (num_verts / 4)
j = 0
for i in range(0, num_verts, 4):
    mid = get_average(verts[i:i+4])
    for k in range(i, i+4):
        verts[k].co = verts[k].co.lerp(mid, 1-(j*scale))
    j += 1

bmesh.update_edit_mesh(me, True)

As you can see you were going in the right direction.


How to render in command line? I have a very very slow computer, but would like to animate 3D. I'm aware we can render via the command line. but I don't know how. I want to render the entire animation of my Tutorial.blend file in the background.

Firstly open your Command Processor.

  Windows(Command Prompt)
  Linux(Terminal)
  Mac(Command Line).

For Windows:

In cmd first type set path="C:\Program Files\Blender 2.80" replace it with path were your blender is extracted or installed. And press Enter.
Now we to locate the folder where you save your Blender files.
So in cmd, type

cd yourpath

If you didn't get what to type after cd than make a folder named Blender Projects on your Desktop and move the .blend files in it, and in cmd type

cd desktop\blender projects

and press Enter.
You are in the expected location,
Now,
If you want to animate,
run
this command,

blender -b yourfilename.blend -a

Rendering Single Frames

blender -b file.blend -f 10

-f 10 describes which frame you wish to render, in this case single 10th frame will be rendered.

You can also set start frame and end frame for animation just add this block in your animation command

-s 10 -e 500

-s refers to start and -e refers to end, replace numbers with yours.
You can also refer the documentation provided by Blender Foundation.

  Editing is greatly appreciated to this answer for Linux and Mac users.

Hope this information may be helpful. All the best.


Creating Custom hotkey for 'show_wire' I'm trying to make hotkey for this option:

Like that:

But this isn't working.What am I doing wrong here?

Assuming you just want to toggle Wireframe View on the selected Object, you need a different context for the hotkey.

Since what you want to influence is a Checkbox that would be wm.context_toggle

In the Context Attributes Field that will appear when you set this, just paste the Data Path that you copied from the Checkbox, in our case object.show_wire

This should look something like that:


How do I make these green lines in edit mode the default color? The edges are a green color which make it hard on my eyes to edit this particular object.
I was wondering how to return the color of these to default?

I found the solution by looking for any buttons that said edge while in edit mode on this specific object. lol

This is how I got rid of the green outline on this object in edit mode.


How to assign a specific color scale to all specific objects in the scene I have some meshes in the scene (7 mesh objects for example). I want to assign each object a color. The color should vary in a specific scale. For example: green scale. So, first object has green value 0.1, second 0.2 and so on. So in the end, I can able to see a pattern of color.

All this I want as a BoolProperty checkbox button in my UI Panel. So, when I check it, it should show me colors and vice versa.

def switch(self, context):
   bool = context.scene.bool
   objects = bpy.data.objects
   mat = bpy.data.materials['Material']
   if bool == True:
       print ("True")
       for ind, object in enumerate(bpy.context.scene.objects):
           mat = bpy.data.materials.new("BSDF")
           val = 0.0
           mat.diffuse_color = (float(val), 1, float(val))
           object[ind].active_material = mat
           val += .1

    else:
        for ind, object in enumerate(bpy.context.scene.objects):
            object[ind].active_material.delete()

This is what I want to achieve but it's not working.

You only want to iterate thru mesh (or meta i suppose) objects that can have a material.  Here is a sample, changing scene.bool removes material if False, or adds a new material to each object with a differing shade of green.

import bpy
from bpy.props import BoolProperty

def toggle_bool(self, context):

    val = 0.0
    for o in self.objects:
        if o.type not in {'MESH', 'META'}:
            continue

        if self.bool:
            print(o, val)
            mat = bpy.data.materials.new("BSDF")
            mat.diffuse_color = (val, 1, val)

            o.active_material = mat
            val += 0.1
        else:
            o.active_material = None

bpy.types.Scene.bool = BoolProperty(update=toggle_bool)


Difference boolean modifier acts like union but only on a specific object I'm modeling my mouse in Blender and I'm trying to create some indentation with a boolean modifier. The modifier is set to difference and when I look at it in object mode it works like it should.

But when I actually render it out the modifier acts like it's on union.

The catch is that if I have the boolean object intersecting with a different object (than the mouse object), it works fine even when rendering. I tried recalculating normals & removing doubles on both the mouse object and the boolean object. Neither of them is non-manifold as far as I could tell after checking them. I'm really at a loss here as to what the problem is.

Here's the .blend file if it helps: Dropbox link

The reason, that you have different result in viewport and render is because you have different subdivision settings for render and viewport.

The BMesh solver for booleans works faster, but in tiny geometry it can make a mistakes from time to time. In your case it makes errors in tiny lines here:

So you can swich to Carve solver, it works slower but never makes a mistakes in correct geometry:

But maybe you haven't this selector (it depends of version of blender), so in this situation you can change overlap Threshold to like 0.1µm to make them more accurate.

But instead of this you can just make gaps a little bit thicker, or use a texture.


Best method for filling in faces in complex/irregular area What would be the best method for filling in faces in a complex area, like a key (see image below)?
Does Blender have a tool for handling situations like this quickly?  Or is there a few ideal tactics for handling a situation like this?

The solution I settled on is shown below below?  It looks to work fine with the subdivision modifier.  Are there things in this solution that should have been avoided?

In my opinion your topology is a bit messy and you don't need as many vertices, but is it really important? You should not have any artifacts because I suppose it's going to stay a flat surface, you could even use huge ngons. Also don't hesitate to use tris on the round corners:

But here is a try with a bit simpler topology:

or even:


Rendered image shows visible "line strokes" artefacts If I just render the default cube it will look like this:

It is rendered with color depth 16. I can see there are artefacts consisting of visible "line strokes" on some of the cube faces.

The bands seems to not go darker and darker, but alternates between light and dark, or is my eye fooled?

Why?

Edit

Here comes a gradient created by gimp without banding, using the same computer:

The artifact is called color banding and is a common occurence in computer graphics. (Most) computer monitors only have a range of 8 bit per channel. The human eye can differentiate a much greater resolution of light values, especially in dark tones.
See this less specific, but informative article.
Hence, color banding is especially visible in dark gradients. An image with a depth of 12 bit or more viewed on the according viewing device would have practically no visible banding.
Although a bit depth of 16 and higher are today's standard in computer graphics such as 32-bit floating points, which have no banding in theory (most) monitors remain in 8-bit color mode.
Most image related software "solves" this issue by adding noise to the image. This process is called dithering.
Different software manage this in different ways.

The gradient tool in Photoshop has a dither option.

Nuke dithers gradients dynamically in the output viewer.

Blender has a dither slider, this allows the user to control the dithering amount manually.

By default, Blender's dither value is at $0$. That's why you can see the color banding even if the image is rendering in 32-bit floating points. Blender will always render images in 32-bit floating point color depth. Only when you save the image, will Blender convert it to the selected bit depth of the output format.
The image you displayed has dithering already applied. When increasing the contrast we can see the noise, which GIMP added to the gradient.

If we increase the dither property in Blender to $1$ and render the default group, there will be no visible banding artifacts.

Otherwise banding will show (dither value of $0$).

Increasing the contrast afterwards can reveal the dithering noise. (Left, dither at 1; right: dither at 0)

When should I not use dithering?
Do not save images with applied dithering when you plan on processing them further. Save them with a high bit depth (16-bit or more). Postproduction applications can then do color operations correctly and dither the image at the last step if necessary.
Example: A color correction with applied dithering noise would change the amount of noise in some parts of the image thus resulting in uneven dither, which could possibly be visible.
When should I use dithering?
Use dithering in the final step of production, where the product is created which has the chance to be viewed on an 8 bit display. (In other words all final image material.)
Additional Note
Digital movie format (obviously not DCP packages) don't support bit depths higher than 8.


question about importing models whenever I try to import a 3d model from the internet into blender the colors don't show up.  how do you import 3d models from the internet and have the colors show in blender?

thanks:D

there is a lack of information in your question. What is the file extention? The model comes from another .blend file?

If it comes from another blender files the process you're looking for is to append something in your project. When you import a file to your project only the 3D information will transfer (vertices, edges and meshes). If you want to insert another informations such as materials, textures, etc you need to append these informations into your own blend file.

It is a step by step process, so I advise you to  see this video.

I hope it helps and welcome to the comunity :)


How do I tile my textures when I am in Texture-Paint Mode? When I draw in Texture-Paint Mode, the texture gets drawn on the surface but it is stretched out and it will not tile itself, or repeat itself, if you will.

I suppose one simple solution to this would be to make an image with the original image in it and just place copies next to each other, giving the illusion that it is indeed a repeated texture.

You can use a brush texture (1) for which you assign your brush image (2) and use it in texture paint mode and with the "tiled" option (3). So you have your object texture painted with it (4).

To have a more regular result, you can also assign the brush image to your object (in its material (5)) and stretch its UV map (6):


Want to import an STP file to blender with colors I want to transfer a CAD model to blender. It is in STP format. It has colors applied to it and I want the model along with the colors to be imported to blender. I am using "FreeCAD v0.15" currently to view the STP and to convert to other formats(STL,dae,obj),but unable to export to blender with colors. Anyone know of other methods that can do the job? Thanks in advance!

According to FreeCAD's Key Feature's it looks like you could just export to OBJ, DAE or IFC.

OBJ & DAE are natively available import options in Blender.

IFC does have add-on support in Blender, but from what I can tell it's last compatible version is 2.73 (add-on found here). If, howvever, you get the latest from IfcOpenShell's Github repo, they have updated the plugin for Blender 2.80. Blender also now has an IFC exporter which supports recording colour information in IFC format as part of the IfcOpenShell package (v0.6.0 branch).

If these aren't working as expected, then you should be digging further into FreeCAD's export options.


How to assign a hotkey to 'set origin' context menu? How can I assign a shortcut to popup the following menu when pressed?

I have looked around and I found that I can right click and "Assign shortcut" on other menus, like this example on pivot point, but I can't do it on that submenu.

Also, I tried the method of looking on the Python Console to find out the value of that menu, but there's no value on that one (just on the sub choices).

Create a new key map item under 3D View > Object Non-modal and set the identifier to object.origin_set (bl_idname for Object.origin_set() operator).  In order to match the definition of the hotkey in 2.7x, set the event to C and enable ShiftCtrl Alt for the modifier keys:

Note: Assigning shortcuts to enum menus like this (operator in this case), is a known limitation and will hopefully supported in the near future: https://developer.blender.org/T65704


How to created a model polycrystalline I created a model polycrystalline from a cube, I use Cell Fracture for that, so the problem I always find is that there are intersections of the faces and overhang face, this model then export in STL format, can you help me solve these problems in cell fracture..

Model polycrystalline

If you want to join the faces back together, you can either select both faces, and press F in edit mode, or you can select the vertices around the faces and press F.


How do I fill the space in the centre of my circuit in 2.79? I'm learning how to make custom tracks for a game called BallisticNG and it requires me to use version 2.79 of Blender specifically due to a neccesary addon not being updated for 2.8.

In the above image is the basic track I created within the game's track creator and exported as an OBJ for the purpose of adding terrain in Blender. My current goal is trying to fill the center hole along the top most edges of the inner wall. I've tried the Grid Fill option but for somereason it just doesn't want to work with this track.

File Here:

If I understand correctly, what you could do:

First clean your mesh a bit, make W > Remove Doubles to remove the doubles and merge vertices, and untriangulate with AltJ.

Now as you have merged the vertices you can select the rim with a simple Alt left click, fill the face with F and join some vertices so that its more blender friendly. It is still a ngon though, do you need a quad grid?


How to update the connection shortest line between the vertice of a cube and an Ico sphere? I have a cube and an icosphere and the cube inside the icosphere is rotating.
The vertices of the cube will connect to the vertices on the icosphere by its shortest distance which I use KD tree to implement. But when the cube is rotating, the shortest connection line will not update. Below is the code I use:
bpy.ops.mesh.primitive_cube_add(size=0.51,location=(0,0,0))
mycube = bpy.context.object
bpy.ops.mesh.primitive_ico_sphere_add(radius=3,location=(0,0,0))
mysphere = bpy.context.object
mymodifier = mysphere.modifiers.new(name="wire", type='WIREFRAME')

degp = bpy.context.evaluated_depsgraph_get()
cube_eval = mycube.evaluated_get(degp)
cube_mesh_eval = cube_eval.data

sphere_eval = mysphere.evaluated_get(degp)
sphere_mesh_eval = sphere_eval.data
spheresize=len(sphere_mesh_eval.vertices)
kd = mathutils.kdtree.KDTree(spheresize)

for i, v in enumerate(sphere_mesh_eval.vertices):
    kd.insert(v.co, i)

kd.balance()

for v in  cube_mesh_eval.vertices:
    print(v.co)
    #co_find = (0.0, 0.0, 0.0)
    co, index, dist = kd.find(v.co)
    print("Close to center:",v.index, co, index, dist)
    #add line
    bm = bmesh.new()
    v1 = bm.verts.new(v.co)
    v2 = bm.verts.new(co)
    bm.edges.new((v1, v2))
    me = bpy.data.meshes.new("Mesh")
    bm.to_mesh(me)
    bm.free()
    # Add the mesh to the scene
    obj = bpy.data.objects.new("line"+str(v.index), me)
    bpy.context.collection.objects.link(obj)

mycube.rotation_euler.z =0
mycube.keyframe_insert("rotation_euler", frame=0)
mycube.rotation_euler.z =30
mycube.keyframe_insert("rotation_euler", frame=totalmoves)
degp.update

Using the animation system

Result of making an "edge object" parented to cubes zeroth vertex to the closest vertex point on the ico sphere. A cone is constrained to tip of edge and tracked to the cube.  Its motion path has been calculated and displayed for 100 frames
Set Up
Set up your scene, blender rotation unit is natively radians,  Using Q code and for this example adding keyframes to rotate cube one revolution in total_moves plus one frames.
import bpy
from math import radians

bpy.ops.mesh.primitive_cube_add(
        size=0.51,
        location=(0,0,0))
cube = bpy.context.object
bpy.ops.mesh.primitive_ico_sphere_add(
        radius=3,
        location=(0,0,0))
ico = bpy.context.object
wfm = ico.modifiers.new(name="wire", type='WIREFRAME')

total_moves = 100

cube.rotation_euler.z = 0
cube.keyframe_insert("rotation_euler", frame=0)
cube.rotation_euler.z = radians(360)
cube.keyframe_insert("rotation_euler", frame=total_moves + 1)

Add the "edge" mesh
Next will set up the shortest edge mesh. Contend that instead of creating an edge mesh for each frame can create a single edge mesh and move it.  (would also note its possible that all verts of cube are equally close to a vert on ico,)
Make a two vert one edge mesh, both coords at origin (0, 0, 0)  For use later have added one vertex to vertex group "Tip".
Consider all variables to be "as above" if not defined.
verts = [
    (0, 0, 0),
    (0, 0, 0),
]

edges = [
    (0, 1),
]

me = bpy.data.meshes.new("Edge")
me.from_pydata(verts, edges, [])
edge = bpy.data.objects.new("Edge", me)
vg = edge.vertex_groups.new(name="Tip")
vg.add([1], 1.0, 'REPLACE')
collection.objects.link(edge)

Parenting
Parenting can be our friend here. If we parent the edge to the cube, then the location of the edge can be set using local coordinates of cube.
Instead I'm going to use vertex parenting. The example below parents the edge to the zeroth (index=0) vertex.
edge.parent = cube
edge.parent_type = 'VERTEX'
edge.parent_vertices = [0, 0, 0]

Could set the location (and or parent) to cube vertex and the location of other vert of this one object using code in question in a frame change handler for example.  See https://blender.stackexchange.com/a/183688/15543 re handler code using (non vertex) parented edge object to cube.
Shrinkwrap
Instead I'm going to put up the idea of using shrinkwrap.
swm = edge.modifiers.new("SWM", 'SHRINKWRAP')
swm.target = ico
swm.vertex_group = "Tip"

Image shows the result. The closest point on the wireframe ico is a halfway point on an edges (Since the verts are on sphere surface, a straight line to another cuts into the sphere...)  Motion trail from tip to vert (gif above) displays the vert chosen.
Make a disc on vert shrinkwrap target
Make another ico with arbitrarily small faces at its verts.
from mathutils import Matrix
import bmesh

bm = bmesh.new()
for v in ico.data.vertices:
    co = v.co
    M = v.co.to_track_quat('Z', 'Y').to_matrix().to_4x4()
    M.translation = v.co
    bmesh.ops.create_circle(
            bm,
            cap_ends=True,
            segments=16,
            radius=1e-6,
            matrix = M
            )

me = bpy.data.meshes.new("IcoSpots")
bm.to_mesh(me)
ico2 = bpy.data.objects.new("IcoSpots", me)
ico2.matrix_world = ico.matrix_world.copy()

collection.objects.link(ico2)

This object can now instead be used as a target of the edge objects shrinkwrap modifier.
Notes.
This is put forward by way of concept. It is only creating the one edge object and parenting it to one vertex by way of demonstration.  I also didn't use the modified ico mesh to make the "spot" mesh.
To display the shortest would be tempted to add an edge for each cube vert, and drive its visibility based on other lengths.


Adding texture to the model, getting a pink model Can you explain please how to activate a texture on a model? I have both but all I could achive is a pink model. I am a web developer trying to build a game and my final goal is to render 8-direction isometric unit sprites, but obviously can not achieve this without a texture. I am a newbie in Blender.

The link to the model is here

You need a material. There are few in the file, but they are not for Cycles. Open Material tab in the property panel, and create one. Hit "Use nodes", then in the Node editor add a "Texture/Image texture", and set the image file in this texture node. Then play with the shader settings.


How to "join" edges to one loop I've tried different ways to join the two edge loops to make them into one.

The result I'm looking for is one complete loop that I can grap and slide.

In the current state I need to select both set of edges and slide them simultainously.

E.g. when starting Blender with default cube. If I insert an edge loop. I can press g twice and slide the edge as one. Looking at my example I need to connect the two set of edges into one so that I can press g twice and the slide the edges.

I've tried to fill between the verts. I've tried to bridge the edges and then delete the resulting faces. I've tried to extrude on vert and merge it with the snapped vert. None of it Works ?!?

A set of edges must fulfill some prerequisites to work as an edge loop. To simplify: they all must be connected in a row, part of a surface, and surrounded by quads.


Emboss text onto curved surface I am fairly new to blender and I am trying to do something which I am assuming is fairly straight forward with no success. All I'm looking to do is emboss some text onto the curved part of a yogurt pot. Image attached below. What is the quickest and easiest way of doing this?

Thanks in advance

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

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

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

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

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

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


Editing a primitive's values AFTER initial placement first time posting in here so please forgive any protocol mishaps, I will try to adhere to the rules as much as possible!

So this is an often asked question and I'm not so sure how or why the absolute correct answer has never appeared.

Is there a way to change the parameters of a primitive object once one has exited the initial pop-up window that appears bottom left upon placement of a primitive?

Here are screenshots:

Apologies for the sacrilege, but in Cinema 4D, until you make the primitive editable, you can go back and change parameters way after initial placement:

!]3

As a switcher from Cinema, it's little things like this that can make the transition questionable initially. For all of the far superior mdelling tools in Blender 2.8 compared to Cinema, this is an essential oversight. Yes one can simply delete and start again, but that really shouldn't be part of the equation…

Thanks

No, you can't do that right now. Blender is a software that focus primarily on artistic rendering of complex scenes, and not much on motion graphics or other kinds of precise projects. That's why Blender doesn't have effectors or parametric objects, and why its modeling style is quite destructive.

Once you create an object, Blender sees it as a mesh, so a 3D model with a number of vertexes, edges and faces, so it doesn't know anymore if it is a cylinder or a sphere. This could change in the future, but I've heard Ton Roosendaal (Blender Foundation's Chairman) doesn't consider it a priority.

You can also check the answers of this similar question: How to edit Parameters for an Object after it is created?


How To use Visual Studio Code to write blender python script integrated with blender? There are different options out there of Ides to write integrated python blender scripts.

I'm a visual studio person and, even though there is no way to use it for that purpose, I was hoping with Visual Studio Code would be different.

I researched and I can use python there, of course, but I was wondering if I can use integrated with blender (intelisense, debugging, blender diagnostics)

please any new finding is welcome. I'm not expecting someone to have the full answers but I am hoping I can compile a soluiton and post here

thanks

For Blender 2.8 Jacques Lucke started working on a new VS Code extension that offers the best integration I found so far between VS Code and Blender. You can find it on GitHub.

You can already create, start and debug Python scripts and addons from VS Code with it. Auto-complete is at the point of this writing missing but planned for the future.

Here is a nice video explaining the setup and how to work with it:

https://youtu.be/q06-hER7Y1Q


Pebble shader in cycles I need to make some pebbles for my scene. How do I get the realistic looking pebble shader in Cycles? This is what I am going for:

And I have got this:

Here is what I came up with:

It is mostly procedural, I did use an image texture for the grooves but you could take that out and use a voroni texture (I just liked the way the texture looked).

If you are trying to make a ground plane with thousands of pebbles I would NOT go this route. I would use a pebble texture and use displacement. However if you are going for a close up pebble shot this shader should work well.

The trick is to build up the layers of detail.

The main left box is the main rock color, It is just broken up with a noise texture and 3 different colors. Use the color ramp to clamp the pattern.

*Notice I put a hue/saturation node (highlighted) I did this to quickly change the color of different rocks (or you could just change the 3 original colors).

The middle and front box are just for the scratches and grooves in the rock. The most important part here is to use the texture as a bump with a different color and material for the chipped grooves.

I added in a texture and mapping node to just change the look of the textures across the different rocks (So they don't all look the same).


How do you make Blender Game the full screen? I know when you press P you go into game mode but it only shows the game in the 3D editor window. Is there a way to make the game your entire screen?

Yes, there is an option in the properties menu.


Select specific joined object I have an object to which another object has been added.
However, only the first object appears in the outliner.

I'm able to select it using the B key and then trying to catch all vertices of this object, but if the 2 objects were even overlapping, this wouldn't be possible.

Is there a way to select the attached (or the original object) with a shortcut instead of having to select each vertex of it?

with L you can select a whole separate mesh


Why is it becomes oval? Do you have any idea why is it oval?

I need it to be like this

I downloaded your file and I found 2 modifiers on the cylinder. For this you did not really need modifiers. If you still want to use a Subdivision Surface modifier then, in this case, you would use the Simple mode instead of the Catmull-Clark one. Not really sure what you wanted to achieve with the Displace modifier.
It was easier to start with a new cylinder.

I deleted your old cylinder and did the following:

Added another cylinder
Rotated it 90 degrees on the Y axis.
Scaled it on the Y axis so looks a bit like the one on your image.
Entered into Edit Mode and selected Face select mode.

Selected one end of the cylinder and tapped the Delete keyboard and from popup menu selected Faces
Selected the other end and did the same delete sequence.
Re-positioned the open ended cylinder to roughly match your image.
Switched back to Object Mode
At the Tools menu clicked on the Smooth under the Shading, see below

End result below.


The circle wont render without it being distorted, how to make it smooth after render. Help Every time i render the artwork it creates a strange surface instead of the smooth texture i can see on the edit screen.

any ideas why and how to fix this?
I have a feeling its the object but could possibly be something to do with the settings I have set for the materials.

I am sort of new the 3d modelling...

I have tried to insert a replacement circle into the position but do not know how to scale and rotate to the same axis as the original.

Ok...kicking myself after noticing the layers which are turned off in the layers panel still show up in the final render..

so... lesson learned... DELETE the layers you do not use as they will cause a problem.


Is it possible to combine spline IK for the body and regular IK for limbs? I've got a centipede model with an IK rig.
I would like the spine to move along the spline curve in the background, following its curvature, while still letting me pose the legs like normal to make it look like it's running along the wall. None my attempts have worked out - either the body won't stick to the curve properly or I'm unable to move the legs without them glitching out.

Here's a link to an album where I list the methods I've tried so far, including gifs of what the model looks like trying to move along the curve.

as far as your question goes it is possible, it has to be set-up correctly - Where is your 'Spline IK' ??

  I would like the spine to move along the spline curve in the
  background, following its curvature

That would be a 'Path' and could be done several ways 'Clamp To' or 'Path' constraint. The set-up on the legs does not look good to me, your leg bones with the IK should be shifted forward to what is prob the current IK targets and a new or that large bone re=scaled to be the IK targets. That is why the legs are 'Glitching out' on you. I will try and mock up a file for you if you want.
DISCLAIMER: This file created in v2.76 - If using 2.7x it will open fine,, If using 2.8x 'APPEND' the objects from the 'Object' folder.


How to export without Normals I was advised to export a model - which I'm using in a THREE js website - without Normals.
How exactly do you do that? I'm not seeing that as an option when I try to export it (it's a ".gltf" file - but I also have it as a ".obj" file.)
I have a model that has 4,832 Vertices in it and I was hoping to display maybe 3,000 instances of it on screen at the same time. It's working - but its severely slowing down my machine - sometimes the browser crashes. So I'm trying to figure out solutions to this - and that's where the suggestion to export without Normals came in. I'm quite new to 3D Modeling - just downloaded a free version of Blender a week go.

For some reason, at some point, Blender versions started hiding the relevant section, displaying it in the export window as collapsed by default, leading to its options not being immediately visible at first glance. The section in question is called Geometry. Expand it, and you will see the Write Normals checkbox.


How to simplify this geometry? How would you go about simplifying this geometry?

(Some more info: I wouldn't really be worried about it but at the moment it takes ages to render in cycles and I think it may be because of the amount of verts in the scene?)

It is in fact really easy. Select all the geometry of the object with too many vertices in edit mode by pressing A. Press delete or X, depending on which you prefer, and click limited dissolve.

After that, your mesh will look clean.


Liquid goes THROUGH rigid body with effector. Mantaflow (Blender 2.82) I will start by showing the issue so it's super clear what the problem is:

Alright. So the cup has fluid type effector, with Effector type Collision.

The cup is parented to the plate so they will act as one.

The plate then has a rigid body so it will fall and is also an effector so the liquid should interact with it once it spills over (that was the idea xD). Here are the settings for the plate.

Then we have the domain which is baked and then the meshes are baked with rather ok settings I guess (I followed a bunch of tutorials and draw some conclusions myself).

And that's all the info I think should be needed. So, how come the liquid is still just falling down through the cup?

You are supposed to change your surface thickness. it defines how much of the mesh that will be considered an obstacle. The surface thickness is the same as the value of the volume of your cup. What you do is to multiply the three dimensions of the cup. Whatever value you get is the correct surface thickness of the cup. Hope this helps.


Adding pole bone to IK ignores IK constraints I'm trying to rig my character's legs with IK. The way I set it up seems pretty standart, and I see it in many tutorials: I have a foot controller (IK) bone near the foot, which controlls the shin bone with the chain of 2. I have some constraints so that knee doesnt bend sideways, and for the hip joint as well to limit it's movement. When I test it just like that all constraints work like a charm.
However I need some way to control knee orientation, so I add a pole bone to my IK which works out nice, except that the hip constraints are ignored now. Knee constraints still work, but the hip can now bend at any angle imaginable - I can pose character's leg straingt up and so on.
Would really love to hear how I can avoid that problem. Also I'm a programmer, so maybe there's some script or something I should look into, I just dont know where to look because I'm new to blender and modelling in general.

Your problem is limiting Ik bones ranges with constraints. You need to use this panel for Ik:

A simple leg Ik rig is here: How to IK rig legs

How to handle pole bones and their angles precisely is here: How to Set/Calculate pole angle of IK constraint so the chain does not move?


Locking the viewport headers to a default position In Blender 2.80, the headers in the viewport seem to jump around arbitrarily.
One moment they're at the top of the viewport, then they suddenly jump to the bottom if I open a different file.
My workflow keeps getting interrupted by this since it takes a little extra time to find the function I need.

I'm aware there's a shortcut(F5) to flip the position of the header, which also does not seem to work consistently(or generally, hardly). However, the header still moves around and having to toggle every time also impedes workflow speed.

Is there any way to lock the position of the headers to a certain side of the viewport?

This will depend on the file that you're loading as the GUI layout will be loaded with the file. You find this happens a lot when loading files which were saved in previous versions of Blender.
 You can prevent the current GUI setting being overwritten on load by unchecking Load UI in the file load window:


Glossiness map with reflection in the BGE I know that the blender game engine doesn't support real-time reflections, but I want to be able to make some areas of my gun model look like it has some edge wear (the paint is gone on the edges and the bare reflective metal underneath is visible), I have been able to achieve this effect in cycles with a sky color and just the diffuse color and a glossiness map generated in substance painter, it looked like this:
So I tried to do basically the same thing in BGE (except I used the glossiness map image as a specular map) but it just looked more specular, which is not what I want. So I want to be able to use a reflection image, for instance a sky texture, like I did here:
Except the fake reflection should only show up on the edges using a glossiness or a metalness map, like on the fisrt image. I know using a fake reflection like this is not very realistic, and I know it's still going to show a sky reflection even when the gun is inside a house or whatever, but I just want the edges to look like metal.
Thanks in advance for any help you are able to provide.

Something you could do is use a node material and mix between a material and a reflection texture (here i map the reflection texture to the geometry normals but you might want to do something more realistic), using a metalness map as the mix factor.

here is a simple example image:

and results:


Draw line from armature animation Is there a way for me to draw a line from an armature. Currently I have a basic solar system made, circular orbits around the sun, heliocentric with orbital rings showing there paths. Easy, now I took that same animation and had the camera map to the earth, no orbitals paths, the geocentric model. I want to draw the orbitals in relation to the earth.

So I have armatures anchored on the earth stretching to the other planets, is there a way to get the armature at the other planets to draw a line, or path, using that animation.

So I can draw the lines kinda like this:

You could try the BTrace Blender Addon for that purpose.
I don't know if it can track armatures, it might only work on meshes, not sure but you can probably easily add a mesh to your armature to accomplish the desired effect


Move object along a list of objects in Animation Nodes I have a list of objects and I want to move an object along the path connecting each two consecutive object in the list, where the object takes one second to move in each path.

Currently, I have this node tree that only moves the object between two cubes, I want to extend it to work with a list of objects.

This can be done by dynamically changing the objects used as the starting and ending vectors of the Animate Node.

First of all, we add our objects to a group and get them using the Objects From Group Node, we can then optionally sort them in whatever way we think it fits, in this case, I sorted them by name. The time of the Animate Node should maintain its range, that is, if the objects takes one second to move between the two objects (24 frames assuming the fps is 24), then the time should maintain that range and goes back to zero as it exceeds it, this can be done using the modulo operation. All we have to do now is find the two objects that we will use for the start and end points, it is obvious that if the start object has the index i, then the end will have an index i+1, so the problem reduces to finding i. i is zero at the first 24 frames, 1 at the next 24 frames, 2 at the next 24 frames and so on, this pattern can be generated using the floor division operator. By implementing that, we get the needed animation:


Blender problem UV texture after applied subdivision surface Can someone help me to fix this UV texture please ? Thank you. The texture should be like first image after I applied smooth in Subdivision Surface in Modifier. Thank you for any helps !

It looks like part of your mesh isn't unwrapped and the subdivision modifier streches that part out.

But maybe the newly created geometry is dragged around your entire UV Map similar to this:
In that case try separating part of your leaf using P and then joining both objects again by selecting both in Object Mode and pressing CTRL + J


Weird lighting on some faces of mesh in Blenders and in UE4 I am having a weird shading or lighting problem in a mesh.  See in the picture the faces are half-light grey and half-dark grey.

What is causing this?  When I export as an FBX and import into UE4 I get the same shading problems.

EDIT:  It seems to be worse with smooth shading of faces, with flat shading it seems to go away, but then the model looks a bit ugly

Ok, Solved this, a combination of sharp and smooth edges is needed, so I learnt a new thing today :)


Pointing a bone towards an axis (in pose mode) So I just spent the better part of a day looking everywhere for a solution, to no avail.

Basically, I wanted to rotate a bone to where it points perfectly towards an axis (the global axis, not a local axis) in pose mode, preferably without using object constraints. Like "snapping" a bone's rotation towards one of the 6 axes, if you will.

Is this even possible to do?

While you ask for a way without constraints, I think you will need to use one, at least temporarily, to get the bone positioned.

Align an empty to the head of the bone.
Move the empty on the global axis you want to align to.
Add a TrackTo constraint to the bone and set the empty as the target.

Now that the bone is pointing the direction you want, you can use ⎈ CtrlA->Apply Visual Transform to Pose and delete the constraint.

You can also use I->Visual Rotation to keyframe the values used after constraints have been applied to the bone.


Use Python to add multiple colors to a NURBS curve I have a NURBS curve which has some thickness (since I set the Bevel Object to be a circle).

I have a list of RGB values specifying what color the curve should be at each point along the NURBS curve.

How can I achieve this with Python?  It may have been easy if NURBS curves allowed vertex painting, but it appears that they don't.

I figured out a way to do it.

I created a script that first remembers all the locations of the control points of the NURBS curve (each of which has a color associated with it in a separate variable).  Then I converted the curve to a mesh.

Next, for each vertex of the mesh, I loop through all the original NURBS control points, see which one is closest, and then color the vertex of the mesh with the corresponding color.

Here is the result:

It's not perfect, it would be better if the colors slowly blended into each other, but if you have many control points, it might be OK.

I'll include the script I used in case anyone finds it useful:

import bpy
from mathutils import Vector
import copy

def color_nurbs_curve(nurbs_obj, color_list):
    """Converts the NURBS curve which should already have a bevel object so it has some width.

    color_list should be a list of colors each of which is a 3 element list with [R,G,B]."""

    nurbs_coords = copy.deepcopy( [ nurbs_obj.data.splines[0].points[i].co for i in range(len(nurbs_obj.data.splines[0].points)) ] )

    #Error checking
    if len(nurbs_coords) != len(color_list):
        raise RuntimeError('The color list must have a number of colors equal to the number of control points of your bezier curve')
    if nurbs_obj.data.bevel_object == None:
        raise RuntimeError('Your NURBS curve must have a bevel object')

    scn = bpy.context.scene

    #Convert to mesh
    scn.objects.active = nurbs_obj
    nurbs_obj.select = True
    bpy.ops.object.convert( target='MESH' )
    #sometimes this conversion results in a bunch of doubles, so I remove the doubles
    remove_doubles(nurbs_obj)

    mesh = nurbs_obj.data

    if len(mesh.vertex_colors) == 0:
        bpy.ops.mesh.vertex_color_add()

    nurbs_obj.active_material = bpy.data.materials.new('material')
    nurbs_obj.active_material.use_vertex_color_paint = True

    print("test",nurbs_coords[1])

    #loop through each vertex
    num_verts = len(mesh.vertices)
    for vert_i in range(num_verts):

        #record shortest separation. -99 signals unset.
        shortest_sep = -99

        #loop through all the original bezier points to see
        #which one is closest and then color it with the corresponding color
        count=0
        for b_point in nurbs_coords:

            b_point.resize_3d()
            temp_sep = (mesh.vertices[vert_i].co -  b_point).length

            if temp_sep < shortest_sep or shortest_sep == -99:
                shortest_sep = temp_sep
                color = color_list[count]

            count += 1

        color_vertex( nurbs_obj, vert_i, color )
        print( "Finished vertex: " + str(vert_i) + "/" + str(num_verts) )

def color_vertex(obj, vert, color=[1,0,0]):
    """
    Paints a single vertex

    """
    mesh = obj.data
    scn = bpy.context.scene

    #check if our mesh already has Vertex Colors, and if not add some... (first we need to make sure it's the active object)
    scn.objects.active = obj
    obj.select = True
    if len(mesh.vertex_colors) == 0:
        bpy.ops.mesh.vertex_color_add()

    i=0
    for poly in mesh.polygons:
        for vert_side in poly.loop_indices:
            global_vert_num = poly.vertices[vert_side-min(poly.loop_indices)]
            if vert == global_vert_num:
                mesh.vertex_colors[0].data[i].color = color

            i += 1

def remove_doubles(obj):
    """ Removes doubles using default settings"""
    bpy.ops.object.mode_set(mode='EDIT')
    bpy.ops.mesh.select_all(action='TOGGLE') #I believe objects are created with the vertices all not selected
    bpy.ops.mesh.remove_doubles()
    bpy.ops.object.mode_set(mode='OBJECT')

##Example Usage
##nurbs_obj = bpy.data.objects['NurbsCurve']
##color_list = [  [1.0, 0.0, 0.0], [1.0, 0.25, 0.0], [1.0, 0.5, 0.0], [0.5, 0.0, 0.0], [0.0, 0.75, 0.0], [0.0, 1.0, 0.0], [0.5, 0.5, 0.5], [0.75, 0.15, 0.9]   ]
##color_nurbs_curve(nurbs_obj, color_list)