(Scripting) Import & assign material from another blend file I am trying to import materials from another blend file and assign the nth material to the active object.
I have tried multiple solutions but I always hit errors.

Approach 1

Here the error is: "list indices must be integers or slices, not str" (in the approach shown below):

with bpy.data.libraries.load(path) as (data_from, data_to):

     data_to.materials = data_from.materials
     mat = data_to.materials
     cnt=0
     for m in data_to.materials:
        cnt=cnt+1
        if (cnt>1):
         break
        # Assign material
        obj=bpy.context.scene.objects.active
        material1 = data_to.materials[cnt]
        obj.active_material = data_to.materials[material1]

Approach 2

When I try to assign the material by using an index instead the error is: "bpy_struct: item.attr = val: Object.active_material expected a Material type, not str" (in the approach shown below):
obj.active_material = data_to.materials[cnt]

I guess, I haven't fully understood what data_from/data_to objects are and how to use them. Can somebody help me here?

Thanks in advance,

Gemor

data_from are just string lists, in this case, the names of materials in the Blend file designated by the path. data_to is a string list of the names of the materials you want to be loaded. So, whatever names you put in data_to.materials will be loaded from the designated Blend file's material data block into the current material data block. After that, you access those materials in the material data block, i.e., bpy.data.materials. So, your code should read:

with bpy.data.libraries.load(path) as (data_from, data_to):

    data_to.materials = data_from.materials
    mat = data_to.materials
    cnt=0
    for m in data_to.materials:
        cnt=cnt+1
        if (cnt>1):
            break
        # Assign material
        obj=bpy.context.scene.objects.active
        material1 = bpy.data.materials[mat[cnt]]
        obj.active_material = material1

Note that this could give unexpected results if a material name already exists in the material data block.


How to make different objects follow and bend with different curves with AN? how to make each lines to follow each curves as my pic shows?

I shall describe a method to deform an object along a spline. You can extend that to multiple splines/objects using a simple loop.

First, we choose one of the local axis of the target mesh to be the axis along the spline tangent, let that be x in this demonstration. We then get the vertices locations in the local space of the mesh, and normalize the chosen local axis such that it ranges between zero and one, this can be done by remapping it based on the local bounding box, however, for simplicity, we are going to use the value of the x dimensions.

Then, the normalized x locations are used as the parameters of the spline evaluation process, the tangent and normal are normalized and the cotangent is computed using the cross product. Then, a linear combination of the tangent, normal, and cotangent is computed using the x, y, and z locations of the vertices as the coefficients respectively. Then the evaluated locations are added.

Finally, a new mesh is constructed from those vertices and output.


Menu position for skin modifier resizing (Ctrl + A) Ctrl + A allows you to resize vertices with skin modifiers applied.
You can also search for skin resize in f3.
But I didn't find this feature in the top menu.

Do you know the menu location for this feature?

As far as I know there isn't, but you can access the x and y sizes from the Tool panel > Transform > Radius X/Y. You have to be in edit mode, in vertex select mode and you have to select at least one vertex.

You can't use the proportional editing that way though.


Adding a modifier to the top of the stack of multiple objects without overwriting previous modifiers I would like to add a triangulate modifier to all of my objects on top of all my other modifiers. This is different from Ctrl+L link modifiers because this overwrites modifier data. Either an option I'm missing or a bit of python scripting would be super helpful. Thank you!

Heres one, this works on all selected mesh objects:
import bpy

class AddTri(bpy.types.Operator):
    """Add triangulate modifier on top of stack"""
    bl_idname = "object.add_tri"
    bl_label = "Add Triangulate Modifier"

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

    def execute(self, context):
        act_obj = context.active_object #record active object

        for obj in context.selected_objects:
            if obj.type == 'MESH':
                obj.select_set(True)
                context.view_layer.objects.active = obj # make object active for bpy.ops to work on specific object

                mod = obj.modifiers
                md = mod.new("Triangulate", "TRIANGULATE")
                # quad_method: 'BEAUTY' 'FIXED' 'FIXED_ALTERNATE' 'SHORTEST_DIAGONAL'
                md.quad_method = 'SHORTEST_DIAGONAL'
                # ngon_method: 'BEAUTY' 'CLIP'
                md.ngon_method = 'BEAUTY'
                md.min_vertices = 4
                md.keep_custom_normals = False

                # modifier UI settings
                md.show_expanded = False
                md.show_in_editmode = True
                md.show_on_cage = True

                bpy.ops.object.modifier_move_to_index(modifier=md.name, index=0) # bring modifier on top of stack

        context.view_layer.objects.active = act_obj # make old active object active again
        return {'FINISHED'}

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

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

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.add_tri()


How to texture paint low poly model with normal applied I have a high poly model and a low poly model and baked a normal map from high poly to low poly. Now, I am wanting to texture paint the low poly model but am having diffculties because when I enter texture paint mode, I am only able to see the low poly model without the normal map. This makes it hard to properly texture paint the model.

Is there anyway I can do this so that when I texture paint, I am able to see the cracks, crevices, etc. from the normal map? I am using Blender 2.82.

I was facing exactly the same problem as you and fortunately I found the solution.
What you need to do is to apply the texture you're painting to the low poly model.
To apply the texture to the model, just go to the shading tab and create a 'Image Texture' node. Select the texture you're painting and finally plug the color to the base color of Principal Node.
In the end, you will get something like this:

Don't forget to select 'lookdev' mode in order you can see the texture and the normal map while painting.


How to speed up modifiers? In my model I use a couple of difference modifiers for some meshes to achieve complex surfaces or simple holes, the problem I have is Blender becomes stressed about it very quickly. Every change to the mesh results in complex recalculations. However I absolutely understand of course it is not easy to recalculate the surface with multiple modifiers. But I am wondering if I am doing something wrong or could it do better. I want to keep the flexibility of being able to remove or change the modifiers. So is there a better approach for this?

Hard to tell without looking at your specific mesh and modifier stack.

Anyway there's not much one can do with complex meshes, if there's a lot to be calculated there is no way around it other than watching your modifier stack order and keeping poly count low.

Here's a few things you can do from most destructive to least destructive.

See if there's any point in your modifier stack bellow which you don't plan to make any more changes. If so, then apply all the modifiers above that point, keeping live only the ones that matter. Be sure to do this in a copy of the object, keeping the original safe in case you need to go back for some reason.
Watch the modifier stack order. When possible keep calculation intensive modifiers (like the Skin modifier, or Bevel) before the simpler ones whenever feasible. Like if possible modify before mirroring, arraying, or deforming. Limit bevels by crease or angle, etc..
Keep viewport subdivisions low, to speed things up, and increase only the render subdivisions so you won't lose quality in final images but keep viewport responsive.
Watch out for any modifier that have "Viewport Settings" and "Render Settings". Be sure to keep the viewport ones low, if they don't negatively affect your work.


Why is there nothing in the Materials tab? Where'd everything go? I'm just starting with Blender and I thought I was doing everything as in tutorial i watched yesterday, i mean there are like three steps, but clearly something's wrong.

Just scroll up. I know its weird I don't know why it does that.


Blender Game Engine not displaying World texture I'm trying to add an equirectangular image as a world texture in the game engine. The texture displays just fine on other objects, but I can't get anything to show up in the sky. Am I just missing a setting somewhere? I've tried everything suggested in the the other threads for game engine texture display (I think!).

Here's the file:
https://www.dropbox.com/s/g5plirpm22vqf7l/BGE-textureProblem.zip?dl=0

And here's what the camera shows when I run the game.

I can't actually find anything which says that sky textures are unsupported in the game engine, but there are a lot if things which are unsupported in the game engine..

One thing you could do instead is use a skydome, which is basically a UV sphere  with a sky texture mapped to it.

Add a UV sphere and scale it up so it covers your entire scene.
In edit mode, select everything (A) and press ⎈ Ctrl⇧ ShiftN to flip the normals.
To avoid extreme distortion around the poles, you can make infinitely small holes in the top and bottom of the sphere.
In top view (Numpad 7), select the polar vertices. Press ⎈ Ctrl⇧ ShiftB and type in a small value like .001. Press ⏎ Enter and ⌦ Delete>Faces to delete the new faces at the poles (creating holes), then press S 0 to scale the holes to infinitely small points.

Make sure the vertices are not merged when you do this, otherwise you'll be back where you started.
From side view (Numpad 1), press U> Sphere projection and enable Scale to bounds in the redo panel (F6).
Add a material to the skydome and enable Shadeless under materials > Shading:

Add your texture with UV projection:


Import 3D model from Garry's Mod (GMod) I have a 3D model in Garry's Mod "addon" format.
The model is in a rar file which contains "*.mdl", "*.vtx" and "*.vvd" files (among others).

How can I import this model (and its textures) into Blender?

vtx files contain textures, and i think you can easily import/export them using: http://nemesis.thewavelength.net/index.php?c=178#p178 by nem

mdl files are compiled model files (probably for performance reasons), the original source files are in smd format which you can easily import into blender using the official Valve script for the smd format:
http://developer.valvesoftware.com/wiki/Blender_Source_Tools

As for the mdl decompiling you can use Crowbar:

https://developer.valvesoftware.com/wiki/Crowbar


Can't move in pose mode, only rotate I followed Royal Skies' rigging/weight painting tutorial to get this far but when I try to move the bones in pose mode only the ones that aren't directly connected to the tail of another bone are able to move, the rest are only able to rotate. I know this has been asked many times but i've been looking through the answers for the whole day and none of the solutions seem to work for me.
I've tried both painting the weights myself and automatic weights and neither works. Auto IK is off. Location isn't locked, its simply greyed out for the bones that can't move.
Another thing is that the bones don't follow the mesh, as can be seen from the screenshot below.
And finally using CTRL-ALT-S to scale the bones in place doesn't work. I can see the numbers increasing or decreasing, and I can change them in the little box at the botttom left but absolutely nothing happens.
Thanks in advance
Blend file:

Apply the rotation of your mesh (CtrlA) and reparent it to the armature, it should work.


Shadows in camera tracked scene I'm having some issues with setting up the compositing on a camera tracked scene.
Here is the scene:

In the background layer i have a wall that my charactor will cast a shadow on,  (circled in red), but as you can see in the above image, the camera then moves behind the wall.
The problem now occurs:

as you can see, the wall casts a shadow on its self causing an unwanted artifact in the render.
I am using (pretty much) the default "setup tracking scene" node layout

I have tried playing around with the ray visibility, but havnt had any success.

Thanks for answers in advance

This isn't a complete solution, because it doesn't work for the ambient occlusion, but you can get rid of the shadow in compositing.

Create a emission Material, with the Backfacing output of the Geometry node fed into the Color in the Emission node.

Then create a new render layer, that includes the same layers as the Background layer, but replaces the materials with this new one, using the Material option in the render layer panel (you still want no materials on the actual objects, to keep the correct shadow calculations).

In compositing, use a Mix node with an Add blend mode to combine this render layer with your shadow/AO nodes.


How to smooth a mesh imported in .wrl format? I imported a mesh in .WRL format representing molecules (I did it in PyMol).
This is what I got:

As you can see, there are big chunks of triangles everywhere. They are pretty big and it's not nice to see. Even putting the red material took no effect.

I also tried to export the mesh in .FBX format in Unreal Engine 4, but nothing changed.
Still not sure if it's a rendering configuration problem, or I have to find a way to smooth the mesh adding more polygons.

Is there a way to solve this? Thanks!

I'm fairly new to Blender myself, so take what I say with a grain of salt, but in general, there's two ways to deal with this, depending on what you need the file for.

The easiest way is to just go object mode > select the object (for all objects, just press "A") > right click > shade smooth. That only makes it look more smooth though, it doesn't actually change anything about the file.

To actually change your mesh, use the subdivision surface modifier. In this video, both approaches are explained fairly well:

https://youtu.be/RaT-uG5wgUw?list=PLjEaoINr3zgEq0u2MzVgAaHEBt--xLB6U&t=584

PyMol itself is most likely using some type of modifier/effect when displaying Objects, while the base object has a rather low vertex count.


Running simulations and extracting data from Blender for analysis Suppose I want to build a scene in Blender where many balls collide. Once everything has settled, I want to find out if a particular ball has rolled outside the circle, where the collisions occurred. I have a couple of questions in that regard:
A) How can I extract data from Blender to learn if the ball has left the circle?
B) How can I vary the initial conditions of the scene slightly and simulate many instances of the scene to discover the relative frequency with which the particular ball leaves the circle?

This is a very interesting question, and I would love to see what you come up with. I just spent some time trying to figure out A). I've looked before without luck, but today I discovered the object matrix_local contains the current translation matrix of an object. That means you can do this to find out the location, rotation, and scale:
import bpy

C = bpy.context
D = bpy.data

loc, rot, sca =  D.objects['Sphere'].matrix_local.decompose()
print('Location:', loc, '\nRotation:', rot, '\nScale:', sca)

You can find distance from the origin with:
loc.magnitude

And finally:
 (Vector( (1,1,1) ) - loc).magnitude

gives the distance from the point (1,1,1).
See the docs on Blender Matrix and Vector types and this answer on accessing matrix elements


How to select multiple images when importing textures? Is there a way to select multiple textures when applying them to a mesh? I have many maps I'd like to select at once instead of selecting them individually.

I am not sure what do you mean by "applying images to a mesh" but you can import multiple images for later use.
Just switch to UV/Image editor, click Open and select multiple images by any of these methods:

mouse drag (lasso select)
ShiftLMB for selecting multiple
or CtrlShiftLMB for select from the first to the last clicked


Sculpt tool will not work on mesh Attached is the picture of the tree I am currently making from a tutorial. I am trying to sculpt the icospheres, however the sculpt tool does absolutely nothing to them. Any ideas?

I figured it out. The icospheres were not duplicated while in edit mode before trying to sculpt.


Auto Smooth Shading of old file I tried to use a .blend file that is 1 year old. I wanted to use the mesh to animate something, but I noticed I used EdgeSplit instead of auto-smoothing a year ago. Here is the problem, when I "remove doubles" and turn on auto-smooth nothing happens. Is the file corrupted, does Blender doesn't support older .blend files? Please help, I literally sat 3 hours here pressing random buttons like a monkey and nothing seems to work <3

https://drive.google.com/open?id=0B_kJOb3u2J0gX0VCWUU2aW02ckU

Apparently Auto Smooth wont work if you have custom split normals, if you want to use it you will have to remove any custom normals and loose it's data.

In the Properties Window > Object Data (Mesh tab) > Geometry Data Panel > Clear Custom Split Normals Data button and you should be able to use Auto Smooth

Otherwise just add an Edge Split Modifier


Texture in 3D view won't update as I manipulate the UVs in the UV Editor I'm a new Blender user coming from 3DSMax and Maya, and the UV editor behavior is really weird. Any changes I make to the UVs in the UV editor won't show up on the 3D view.

As you can see, even if I overly stretch the UVs the texture continues the same on the object.

I think it's a setting issue since it can be done in Blender, as seen on this video https://youtu.be/SnKNTANTtd8?t=437

What can I do to solve this? Using Blender 2.8 currently.

[

You need a Mapping Node and a texture coordinate node.

Hope that helps.

Good Luck


Export from Blender to Photoshop with same camera angle I want to export 3d model from Blender to Photoshop - with same angle and position of camera. I exported as collada and obj, but when I import them in Photoshop, camera is not in same position. How can I export it, to get exactly same scene in Photoshop, as in Blender? Thanks

Photoshop has its own camera. We cannot import the Blender camera position.

But, you made me think of a solution:

Select the object and so the camera. Make a parentCtrl+P.

Select just the camera.

Go to front view 1.

Now go to View > Align View > Align Active Camera to View.

The camera now has the same position as Photoshop camera and the object has the same view because it is parented to the camera.

Once exported, the object can be opened in Photoshop as you see it in Blender. More or less.

Remember to undo the changes you made in Blender.


How can particles be emitted from particles? In a scene with two particle system configured as boids and boids brain set to fight, one swarm attacks the other. I would like to emit child particles as lines (laser or something) to visualize some fighting action.
I couldn't find a way to setup the line emitting particle system, either they are created from the plane or further cones will be added.
Is there a way to do this as I saw on a firework animation tutorial but I didn't get the trick?
Blend file here

At blendersushi blog the author says:

PARTICLE INSTANCE MODIFIER > PARTICLES
With this stacking thing, we can now pretty much emit Particles from emitted Particles, > if you know how to set it up. Not very obvious, but basically you Instance some meshes > (using Instance Modifier) and then add Particle System to the object with Instance > Modifier.
Make sure you have "Use Modifier Stack" turned on.

But I can't get this to work.

The trick is, you use the particle instance modifier on one particle system, and the particle system is recognized as one object, so it can then be emitted from itself.

Create a baseObject (that will be emitting the particles that emit the particles).
Create a ps1Object (it will be the object that is emitted in the first particle system)
Give the baseObject a particle system.
Select the ps1Object, and give it a particle instance modifier. In the object tab, select baseObject. Make sure to reset the location of the ps1Object, so it looks like it's emitting from the baseObject.
Give the ps1Object a particle system and check Use Modifier Stack in the Emission tab.


Blender keeps adding "limit location" bone constraint to an entire armature? Just move to 2.8.

I am unable to add bone constraint: limit location to a bone in an armature.  Everytime I try, the constraint is applied to the entire armature.

What gives?

Thx

Maybe you're confusing bone constraints with object constraints? To give a bone a constraint, you need to switch your armature to Pose mode, then you'll have access to the Bone Constraints tab, which is not the same as the Object Constraints tab.

Shortcut ctrlshiftC


How to prevent my volumetric lighting cube to reduce my main light in the scene When i created a cube that surrounds the whole scene it looked pretty however it decreased my sun lamp's emission effect on my bushes and doing so it decreased glossy level of my plants which its not a thing im comfortable with i tried to increase my sun's emission level but didnt do it

If you are using volume scatter and/or volume absortion, some of the light intensity will be lost due to... scattering or absortion.

There is no need to change the materials for the other objects, just change the light intensity.

It is perfectly normal/valid to have high values as long as you get the results you want.

As a different note, the default values of 1 for volume absortion or volme scatter are usually way to high. Play with them and bring them down to get the effect you want.


Bones change rotation to first frame of last animation I want the bones rotation of my model to be at 0,0,0 when exporting. But it automatically sets the rotation of the bones to the the first frame of the last animation used. I cant seem find anything on the internet about this and I've been looking for ages. How do i fix this?.

Make sure the action isn't still associated with the object, either via the action editor or NLA.  To see if an object has an animation look at the outliner

Here the Cube has an action (CubeAction.001) a driver and has NLA tracks.  The camera has no animation.

How to clear all animations.

Select all the bones (pose mode)  and  clear transform

You can make a "zero" animation action here by inserting a LocRotScale.


What is this Fresnel node? I was trying to reproduce defmaka's Node setup from this BA article seen here, and came across this Fresnel Node:

It looks like a Geometry Node, but is called a Fresnel Node.

Alternatively, I couldn't make the Edge Detection part of the setup or the material look anywhere near their result.

I've tried moving around several sets of values, but I can't understand what I'm doing wrong.

What is wrong with my setup?

Real objects both reflect and adsorb light. How much reflection you see at each point of the object depends on the angle at which you look at it.  Think of a lake of clear water.  Up close, none of the water is reflected, so you see to the bottom. Farther away, the water reflects more, so you see less into the water and more of what is reflected by the water.

The fresnel node applies this effect.  There are several good tutorials on Physics Based Rendering (PBR) that talk about Fresnel effect and using the Fresnel node.  I recommend a two part tutorial by Blender Guru. Part 1 contains a pointer to part 2.


how do I smooth an object together? Weird title, I'm sure, but I'm trying to sort of smooth some objects together... I started by making four pieces. Then I joined the four pieces into one, thinking I could use the smooth tool to make it look less...jointed.

As an example, I went and tried to smooth it, but instead of it making it look less segmented, this is what happened

please be gentle I don't use Blender a lot.

Actually you've joined several objects to make one object but it is still made of several separate meshes. As long as they are separate you won't be able to create any welding, except a fake one with this welding node but I don't know if it's already available. So the simplest is to use the Boolean tool: Go in Edit mode, select all your meshes except one (use L to select a mesh), go in the horizontal header menu > Face > Intersect (Boolean), and in the operator box (bottom left of the 3D View), choose Boolean > Union. Now your meshes are merged into one and you can create a welding effect, in sculpting mode if you want, or with bevels...


create drop-down list in menu panel I tried to create a menu panel for drawing the mesh, so I applied:

import bpy

class CustomPanel(bpy.types.Panel):
    """A Custom Panel in the Viewport Toolbar"""
    bl_label = "Generate"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'

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

        row = layout.row()
        row.label(text="Generate objects:")

        split = layout.split()
        col = split.column(align=True)

        layout.label(text="Primitives:")
        layout.operator("mesh.primitive_plane_add", text="Plane", icon='MESH_PLANE')
        layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
        layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
        layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
        layout.operator("mesh.primitive_ico_sphere_add", text="Ico Sphere", icon='MESH_ICOSPHERE')
        layout.operator("mesh.primitive_cylinder_add", text="Cylinder", icon='MESH_CYLINDER')
        layout.operator("mesh.primitive_cone_add", text="Cone", icon='MESH_CONE')
        layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')

        #
        col.operator("mesh.primitive_plane_add", text="Plane"),
        col.operator("mesh.primitive_cube_add", text="Cube")

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

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

if __name__ == "__main__":
    register()

but when I try to ecris as a drop-down list, like this:
How to make compare with Menus
I haven't succeeded, someone help me how writing in menu panel?

the easy way by reusing existing UI code

code:

import bpy

class CustomPanel(bpy.types.Panel):
    """A Custom Panel in the Viewport Toolbar"""
    bl_label = "Generate"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'

    def draw(self, context):
        obj = context.active_object
        mode_string = context.mode
        edit_object = context.edit_object

        layout = self.layout
        col = layout.column()
        col.label(text="Generate objects:")

        if mode_string == 'OBJECT':
            layout.menu("INFO_MT_add", text="Add")
        elif mode_string == 'EDIT_MESH':
            layout.menu("INFO_MT_mesh_add", text="Add")

def register():
    bpy.utils.register_module(__name__)

def unregister():
    bpy.utils.unregister_module(__name__)

if __name__ == "__main__":
    register()

code (the explicit way)

Gives something like this:

import bpy

def execute_operator(self, context):
    eval('bpy.ops.' + self.primitive + '()')

class MyShortAddonProperties(bpy.types.PropertyGroup):
    mode_options = [
        ("mesh.primitive_plane_add", "Plane", '', 'MESH_PLANE', 0),
        ("mesh.primitive_cube_add", "Cube", '', 'MESH_CUBE', 1),
        ("mesh.primitive_circle_add", "Circle", '', 'MESH_CIRCLE', 2),
        ("mesh.primitive_uv_sphere_add", "UV Sphere", '', 'MESH_UVSPHERE', 3),
        ("mesh.primitive_ico_sphere_add", "Ico Sphere", '', 'MESH_ICOSPHERE', 4),
        ("mesh.primitive_cylinder_add", "Cylinder", '', 'MESH_CYLINDER', 5),
        ("mesh.primitive_cone_add", "Cone", '', 'MESH_CONE', 6),
        ("mesh.primitive_torus_add", "Torus", '', 'MESH_TORUS', 7)
    ]

    primitive = bpy.props.EnumProperty(
        items=mode_options,
        description="offers....",
        default="mesh.primitive_plane_add",
        update=execute_operator
    )

class CustomPanel(bpy.types.Panel):
    """A Custom Panel in the Viewport Toolbar"""
    bl_label = "Generate"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'

    def draw(self, context):
        layout = self.layout
        col = layout.column()
        col.label(text="Generate objects:")
        col.prop(context.scene.my_short_addon, "primitive")

def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.my_short_addon = bpy.props.PointerProperty(type=MyShortAddonProperties)

def unregister():
    bpy.utils.unregister_module(__name__)
    del bpy.types.Scene.my_short_addon

if __name__ == "__main__":
    register()

You were close..   Do I need to explain what's going on here or do you think you can figure it out?


Copying and pasting keyframes from a source camera to a destination camera (with no keyframes inside) remove all the keyframes from the source camera I'm trying to copy all the keyframes from the camera 1 (called camera) to the camera 2 (called voodoo_render_cam) that's connected to an empty. What I do is : (in the dope sheet window) I select first all the keyframes of the camera 1 and then the camera 2 (it has no keyframes) and then I press CTRL + L and then "animation data" and happens that both the cameras have anymore keyframes embedded. All the keyframes are deleted. What's wrong ? what I'm trying to do ? I would like that the camera 1 (camera) disappear and that the camera 2 (voodoo_render_cam) take its place. It could also not disappear but I want that the camera 2 is placed on the same position of the camera 1. Maybe there is another way to do that. I have attached a video to show you what happens.

you can find the blender file here.

What you need to do is simply select the camera you want to copy the keyframes to, then select the other camera which has the desired animation, and hit ctrl-L and select Animation Data.  You have to select the camera with the desired animation LAST


Blender cloth animation isn't working properly? I am using Blender 2.8 and I have been trying to make a realistic-looking fabric on my bowl. But it is starting animation early and becoming something like in the photo. I have tried it on a cube to look if the problem is on collision or cloth physics, but I think the problem is cloth physics. I have tried to making origin at the center or bottom or top, but nothing changed. Please help me.

Make sure you hit the self collision check box in the cloth modifier setting as and keep the quality steps high to get a good cloth simulation(The more the quality step the better the quality and slower rendering).

I hope this helps.


How can I use the Blender compositor to blur multiple objects in a scene? I currently am trying to blur 7 different objects (1 particle system and a bunch of pictures on planes). I gave each of the objects an ID Mask which leads to their own blur node. However, I'm not sure how to combine these blur nodes. Using a mix node alone seems to make the image "glow" more than blur.

I'm able to use this method to blur one object at a time, allowing me to animate the images at different times, but it doesn't seem to scale just by using a mix node (in all of its configurations). I have no idea if this even scaleable.

Thanks in advance :)

Instead of using multiple identical Blur nodes and combining the result you should combine the outputs from the ID Mask nodes and use that as te input to a single Blur. You can easily combine them using Math nodes set to Maximum, chaining one to the other until you have combined all ID masks and finally into the single Blur. Since there is only one Blur this should also be considerably more efficient to render.

To allow the blurring of each object index to be controlled individually you can add some additional maths nodes to multiply each by a variable value (shown in Cyan) as follows :

This can produce the following result :

You can keyframe the Value inputs to vary the blur for each ID - with 0.0 for no blur, up to 1.0 for full blur.


Moving Cylinders into specific points I've been trying to model molecular structures on blender using coordinates I've gotten off scientific papers.

The only problem i've been struggling to form bonds between them consistently. When I use a cylinder mesh and set the faces to the centre of the spheres it cylinder itself has been distorting, as shown here.

Moving cylinders manually into place is very inconsistent. I would like some help figuring out how I can achieve something looking like this.

Like is there a way to snap each cylinder face to the centre of each sphere without affecting the cylinder shape? Or is there something else entirely I should be doing?

Poly Curves and Bevel Object

You could try to take advantage of curves instead of meshes.

This way you'll just have to control the cylinder main axis with two control points for each connection, you don't have to worry about the deformation because the cylinder is being built automatically and it's much easier to change the section size/shape.

To set up the curve like in the shown image sequence, choose a "Poly" Spline type once in edit mode and fill the Bevel Object field with the wanted section shape (in my case the little black bezier circle you can see near the origin).

Note: it's not your case, but if needed the cylinder ends can be capped by enabling the Fill Caps option in the Geometry panel of the Curve tab.


Is it possible to render as it is displayed in Material Preview? I am trying to render an image. When I am in Material preview, it displays the objects in the scene without any lighting or shadows. All that can be seen is the texture.
When I render it however, what is displayed are the objects shaded with lighting. Is it possible to render an image the exact way it is previewed when it is in Material Preview?

You can turn off your overlays, then in the 3D viewport go to View -> Viewport Render Image. You can render even viewport animation from this menu.


Cloth Simulation - Sleeves keep sliding off arms I've done a cloth simulation however everything manages to stay on the mesh except the sleeves. Why is this?

It's difficult to tell without seeing it animated or seeing more settings... however, this is likely an issue with the Collision settings on the model mesh.
Firstly, ensure you have 'Applied Scale' on all of your meshes - this is good practice anyway but if you haven't done this it can cause strange effects with your simulation.
Next check the Collision 'Cloth and Soft Body' settings. Reduce the 'Inner' and try the simulation again (free and re-bake) to see if that helps.
The 'Inner' boundary needs to be less than half the thinnest part of your mesh that's involved in the collision - otherwise the collision bound can "leak" out of the back face of your mesh and upset the collision.

After reviewing the uploaded Blend file, the issue was actually just that the Modifier stack was in the incorrect order :

In the original file the Collision modifier was above the Armature modifier. This meant that the collision was working correctly but was on the unposed model - which was obviously in a different position to the 'base' model.
Simply swapping the Collision to be after the Armature modifier resolves the problem and the collision is on the posed mesh.


Whats the best way to make smooth waterslide type tracks? Im creating game inspired by Wipeout games everything is good except, im relatively new to blender and was researching past two days for a way to create tracks like in wipeout fusion, super smoothly rotated  and all that good stuff i have tried:

Making a curve bevel it make a track then make curve into the mesh didnt worked because imported into unity these meshes didnt had empty space inside them aka ship was stuck instead of falling on the mesh AND it was a full circle i didnt need that
Make a straight cubes then use deform and bend these cubes and connect into one track, literally impossible to work with takes hours and couldnt connect bended cubes together perfectly
again, make cube then bend with shift + W, didnt worked either because endings were rotated as well no matter what i did cause of that track was full of obvious connections due to bumps weird stretches etc.
Ask for solutions in various discord groups noone answered what could help.

I hope someone knows a way how can i make these tracks, thanks.

Create a bezier circle. Go into the curve properties, and increase the Extrude property.

Go into edit mode, select all the control points with A and set the tilt to 90°. (Press N to open the right hand panel if it is closed)

Tweak the tilt of each control point to have some kind of curvature.

Add a solidify and edge split modifier to get depth.

Select two control points and richt click > Subdivide to add a new one between the two. Tweak them, tilt them to your liking.

Adjust the resolution units to keep the poly count low

If you want a custom profile, add a bezier curve

And use it as your bevel object

Result : 676 verts


Warped UV for simple model [Update: The original had lots of extra vertices for some unknown reason. I recreated the object from scratch to remove them. .blend file and images updated.]
I'm trying to create a UV map, and it always ends up warped.
Are multiple independent seams allowed? If so, I'm at wits' end.
I tried creating the object a number of different ways. This particular one was created from a cube, moved z face, extrude x face, extrude y face, limited disolve, inset z face, extrude inset z face.
Complete beginner!
Tile9d.blend

Expected:

(I can always condense that by splitting it into two and flipping and rotating one of them.)

When you are UV unwrapping, you're basically trying to flatten out a box. You can cut seams around all six faces, but that leaves separated parts. Try to find the edges where the geometry has to spread and mark those as seams, like this:

You can see I made seams down the 45 degree bevels, and just cut the bottom out separately.
After removing all the extra geometry it becomes much easier to achieve the UV layout you wanted:


Texture painting without rendering vertex paint I need to apply a texture paint to a mesh that already has vertex colors attached to it:

When I want to draw on this mesh in texture paint mode the vertex colors get applied too:

As you can see, the vertex colors make it hard to see anything of the texture paint in the dark areas.
How do I disable the vertex colors during texture painting?

As a less important side question: How do I disable lighting as well?

I just want the pure texture to be displayed during painting.

Switch to GLSL shading and enable Shadeless in your material settings:

With GLSL enabled in texture paint mode, wireframe view will display only the vertex colors, solid will display both, and textured will display only the textures.


How can I sepearate objects into individual files? I started modeling a rifle, and I also did a sight with it.

The thing is: I want to make both the sight and the rifle into 2 individual files. Is there a way I can do this?

If the purpose of your question is to manage your items separately I would recommend making groups - which is done by selecting the objects and CTRL G. The advantage of this is you can choose to have one file with them both linked in, and the other two groups appended into separate blend files. This gives you the freedom to work on them separately and then just update the mother files...as it were.


Import STEP file to Blender I'm trying to import a STEP file to Blender, but it doesn't work!

This is how I do: I open the STEP file in Freecad and I select everthing, then I export it as a .stl file, but when I import the file into Blender, I only get parts of the object and some of the parts are in wrong position. Very frustrating and the client is waiting. I have also tried to export it as .obj and .dae file without any luck!

Can someone give me some advise how to solve this?

You can use the STEP importer Addon, that was released for Blender 2.8x on January 27, 2020. It's an paid Addon, but not expansive and worth every cent.
You may visit the support thread on Blenderartists. There you'll find the link to get the Addon, too:
https://blenderartists.org/t/step-import/1203804


Objects material strange behavior when rendered Here is image and it will tell everything. Left is rendered, right one is as you can see object mode shown as materials.

I am learning blender and this is my first project after watching one tutorial so i have never came up this problem.

It looks like you have more than one bench, occupying the same point in space. And this can destroy reality. Try to grab your bench with RMB in any direction. If there is another one, just kill it. Maybe it's hidden from the viewport, so first press Alt+H to reveal your hidden stuff.


Multiple camera panels per viewport layout, aka "Area" I am struggling with what I believe to be a very simple task. I merely wish to view the framing of multiple cameras at the same time. It seems that it is not even possible to view the camera framing and a User Perspective view at the same time. This is shocking to me, I've been using 3D programs since 1991, and this is a new low in usability.
I am aware of the options "'n' > View > Local Camera" and "'n' > View > Lock Camera to View". These do not help me. The "Local Camera" only affects the top right panel. The backtick key to load the "pie menu" only affects the top right panel. It appears that Blender has extremely limited options for controlling the Quad viewport layout, and we can only change what appears in that top right panel.
The only workaround I have found is to copy the viewport "Area". From there I can choose whatever I want in that "Area". But it is a poor solution because 1) it duplicates all of the UI widgets (super cluttered) and 2) it limits my ability to go fullscreen. The new child "Area" is always visible.
I can also copy the viewport "Area" out to a floating window, which is better, but still, this is a poor solution to a problem that should not exist. I should be able to choose whatever I want in any of the four Quad panels, like in any other major DCC.
Please tell me that I am missing something and that there is a way to make Blender view more than one perspective view at the same time, in the same "Area".
Thanks
Aaron

Hi Aaron,
If you have multiple camera's and some 3D viewports as shown in the picture. You can select a different camera in each viewport, by using the N key and then to the view tab, check the local camera and then choose the camera you want to use.
Best regards Gladys


How to read a bone's quaternion rotation and convert from local bone to world space I am writing a custom exporter to export from blender to my opengl program.
To read the roatation, as well as convert from blender's cordinate system to my game's system, i use this code:

e = poseBone.rotation_quaternion.to_euler()
quat = Euler((e[1], e[2], e[0])).to_quaternion() #write this quat to file

Bones in blender, as demonstrated by this image, have their own local space:

I believe this difference in local bone space vs world space is the last thing causing incorrect rotations in my opengl program. How would convert bone.rotation_quaternion from local bone to world space prior to export? I have seen several similar questions, but none that helped me.

Based on some simple experiments it seems that

debone = Matrix([[1,0,0,0],[0,0,-1,0], [0,1,0,0],[0,0,0,1]]) #because bones are wacky
m = armature_object.matrix_world * poseBone.matrix * debone
o2.rotation_mode = 'QUATERNION'
o2.location, o2.rotation_quaternion, o2.scale = m.decompose()

will align o2 with poseBone (unless o2 has a parent causing its matrix_local to not be identical to matrix_world)


Mesh not following Armature I created a basic human model, then copied the vertices and used a shrinkwrap modifier to make spandex-type clothing. I then connected the clothes to the body using Boolean union modifier.

However, when I try to pose the body using armature, the clothing falls away from the body, even though they are joined. I've tried parenting the clothes to the body as well, with the same results.

Model File:

Why did you choose boolean instead of a simple join (select your different objects and ctrl J)?
I guess you have several solutions:

The easiest would be to remove the body mesh under the cloth, or, if you want to keep it, make it invisible with the Mask modifier: Select the part of your mesh that you want to hide and assign it a vertex group, give your object the Mask modifier, in the Vertex Group dropdown menu of the modifier, choose the vertex group you've just created, and, on the right of this dropdown menu click on the inverse arrow.

If you want to keep the body you can try the Mesh Deform modifier as explained in this video by Daniel Kreuter:

Parent your body with its clothes to your armature (if the clothes are another object, choose CtrlP > Armature Deform).

Delete all vertex groups from the clothes (select the vertices and on the right of the vertex groups list, down arrow menu and Remove From All Groups). Assign these vertices to a new vertex group.

Create a mesh that is fully closed and that will encompass your whole clothes, i.e. that will be your « cage ».

Select your cage, then shift select the armature and CtrlP > With Automatic Weight. Give the necessary corrections in Weight Paint mode.

Give your body a Mesh Deform modifier (put this modifier above any Subsurf modifier) and in the modifier choose the clothes vertex group. Choose the cage as the Object and click on Bind.


Is there a way to select edges marked as sharp via python? There is an operator to select sharp edges, and an operator to select edges marked as sharp if you have already an edge marked as sharp selected, but is there a way to select edges marked as sharp when you have nothing selected?

Maybe add a temporary edge, mark it as sharp, select similar, delete temporary edge? I don't know how to do that though.

I can see that bmesh.types.BMEdge has a seam attribute, but no sharp(?). So I guess it's not possible to loop through edges selecting the ones marked as sharp...

There isn't a single command for this, but a script to do this is quite simple:

Note that with BMesh, the same smooth option is used for faces and edges (not smooth == sharp).

import bpy
import bmesh

obj = bpy.context.edit_object
me = obj.data

bm = bmesh.from_edit_mesh(me)
for e in bm.edges:
    if not e.smooth:
        e.select = True

bmesh.update_edit_mesh(me, False)


What is this extra geometry which cannot be edited in edit mode? I just saw this on the "bar" I'm trying to create, I can't edit it since it doesn't appear to be a face, what can I do?

That 'extra' geometry seems to be created by the modifier stack so can't be selected in edit mode unless you apply the modifiers.

I would dare say it actually looks like a face with a wrong normal producing that artifact with a solidify modifier. If that's the case in edit mode select all your geometry and press Ctrl+N to Unify Normals and see if the artifact is gone.

Edit

Your problem are overlapping extra faces, you probably created them accidentally by extruding your faces and inadvertently creating zero sized faces.

Switch to face selection mode by pressing Ctrl + Tab, select and erase the extra zero sized faces by pressing X, then select all by pressing A.
After remove doubles by  access the Specials menu (W) > Remove Doubles et voilá mesh clean.


Hair filtering through weightmap? How do I paint (vertex group -paint¿?) the area where I want to filter the hair?

I want to limit the hair to grow in the mesh in the area painted (vertex selection group?) but then how can I make it smooth it towards the border?

I come from a Softimage background. Back in the day we created a weightmap (in Blender it would be a vertex group) where we painted the area where the hair was to be emmitted.

In the image above you see Particle Edit Mode offered. Weight Painting is also offered.  The yellow arrow points to

Textures Panel associated with a Particle System while the Cycles Render is offered. Blender has

Vertex Groups can control density and length as an abbreviated explanation
Textures can control density and length as an abbreviated explanation
Textures can have higher control Density than a low poly mesh
Weight Painting a Vertex Group. So weights can be [0.0 to 1.0 floating point],  .55 or .77 for example. This can be searched here at BSE. Again a video probably offers the best introduction to weight painting.

There are many BSE answers related to weight painting.  Weight painting will seem quite ordinary to you once you see 33 free minutes of training video on noonoob. What follows is some collection of ideas you may find useful after you see one of the many discussion and videos of weight painting in Blender.

Image above show Brush Panel in Particle Edit mode.  Comb Brush is selected.

Blender has a Particle Edit Mode for Hair particles.  So you may

Create a Particle Edit .. Particle Cache is the result of Particle Edit mode work. Videos are the dominant way of learning about this for many people.
Place hair anywhere by using Brush panel .. metaphor Hair painting ... using different brushes with strokes
Shorten and lengthen hair and Remove the entire Strand
Comb hair in a direction
Other Attributes can add Hair Children, Spirals
Distinct Meshes
Users often create separate well fitted meshes to limit placement of hair.

For plant life such as grass and the simple human hair crew cut, we can easily state vertex groups and textures are very useful. Such contexts are of low intensity inspection.  Casual, Quick and Dirty.

For highly styled human hair those two items may be less useful.  Particle Edit mode for hair is more precise. This tool is useful when we are in high intensity inspection contexts. I suggest you see a video on some famous website that rhymes with noonoob because hair styling can be quite complex.  I think video will be best once you know what search keywords are best.  This will need a few days to sink into the subconscious mind.

Suggested Keywords ... Hair Styling in Blender.

In the image above we see the Active Data of type Texture associated with a Particle System.

I am avoiding any tutorial content.  This is just perhaps a quick discussion for further research by the reader in the form of text and videos. Videos have an advantage for precise hair manipulation.


Is there a way to realign a not aligned object, which tranforms has already been applied? In this image i show an example of what i ask: http://prntscr.com/o8aa9c
Is there a way to put it on the grip flat. Let's say i can't reset tranforms to 0 because they have already been applied.

Mostly i talk about rotation, because translation, that would be easy, I would just snap it to grid, but it would not be flat on it.

This is a duplicate answer: I can't find @moonboots' original. If found, feel free to delete this one.

Decide which face you want the object to lie flat on. In Edit Mode, select the face, and create a Custom Orientation from it. (In 2.79, CtrlAltSpace. In 2.8,Header > Orientations dropdown > '+')
With all the object's vertices selected, CtrlH hook them to a new Empty. They are now frozen, while you transform their local axis.
In Object Mode with the object to be aligned selected. In menu Header > Object > Transform, click 'Align to Custom Orientation'
Go to the object's modifier panel, find the Hook modifier, and apply it.

Now the object's local Z axis will be oriented normal to the chosen face, and it will be easy to rotate the object to align it with the world, or, by snapping, to any other face. You could, if you want to, ShiftAltO pt yhe origin to center of the face, too.


Blender viewport lags while animating I'm animating a scene in Blender and am experiencing some lag. This makes it hard to preview the animation. I'm in solid mode, I tried enabling frame dropping, I tried turning off visibility for some objects, but still pretty laggy. Using v2.79
Specs:
Windows 10 Home
32GB RAM
Intel core i7 6700HQ @ 2.6 Ghz
NVIDIA GeForce GTX 1070

This is a common problem, the more complex is the mesh, the armature, the weights, the more the animation gets slow.

Youn can use various strategies to check your animations:
1 - hide (maybe using layers, even separating some vertices of the mesh) all vertices you can
2 - building a fake simpler mesh, which will be very fast if done using bone parents instead of weighted vertices: i.e. it's very common to build a characetr using the face as it is and using simple cubes or cyliders for torso, arms, legs, parenting each whole object to its corrispondent bone: in this way you avoid lots of calculations.
3 - making a superfast OpenGL render of the scene, which can be analyzed always running in perfect realtime.

Maybe others users know some more strategies.


A straight indent in a UV Sphere i would just like some help making an indent in a UV Sphere.
I've contacted the person who made the YouTube video but got no response.
An image will be below showing what it looks like. C:

Select the edge loop in center and add an edge crease with
Ctrl + E and set the crease to 1
Bevel the edge with  Ctrl + B
Inset the new faces with I followed by
Ctrl to use depth (intrude)
Add Subdivision Surface Modifier and shade smooth


Why I can't paste a mirrored version on certain axis? I am new to blender and started creating a character of an online template some time ago. I am currently on the animating phase and I am making a walk action. I was following an online tutorial [Video]. I was going to paste the mirrored copied key frames but I could only paste it mirrored on the x-axis, and not on the y-axis which is what I need.

To use the Mirror Copy, your model needs to be symetric along the X-axis. To achieve that you have to rotate your model and your armature in Edit Mode and possibly change your Mirror Modifier on your model to mirror along the X axis.


Textures visible in render but not in UV map I am a newbie to Blender, just starting out with UV mapping of objects.  I'm using Blender Render engine.  I created some meshes that I UV mapped and added textures to.  They look beautiful when rendered, but the textures aren't displaying on the UV map. Has anyone else encountered this problem?

This is a screenshot showing my rendered image with the texture image and path shown on the right:

And here is the corresponding UV map for that rendered image:

As you can see, the UV map is empty! Any help here would be greatly appreciated.

You'll have to tell blender which image to display in the uv/image editor.
As seen in the following image:


How to modify the woodplanks size ? There is possible to modify the size of the woodplanks ? I created a 10x10 meter room and not realistic in this size. With mapping I got weak result. Make the full floor from smaller parts it is not so elegant.

(Sorry for silly question, I'm a ~6 hour blender user and yeah, I skipped the basics.)

Thank you for your help!

David

You could try by changing the scale

Good Luck


I cant create an inset on the face of an extrude I'm modelling a face from a cylinder and ive extruded some faces to create ears
When I try and add an inset to the ears it completely messed up
What am I doing wrong

It appears that you have duplicate vertices in the area you are trying to extrude. Try Mesh>Clean-Up>Merge by Distance, then adjust the merge distance to get a good result. After this, to aid in the help of extruding and beveling, switch to object mode, then press CTRL+A and select Scale to apply scale. Now select that face in edit mode and try inserting face again. It should work.


How do I put a image inside of every brick on the brick texture? I have a question, basically my question is this :, so I have a brick texture  and I have a picture of a light bulb, and I want to put it so that the picture is inside of every brick, but when I put a texture inside of the diffuse node, it just appears over every brick , how can I make it so that the light bulb appears individually in each brick? Thanks

It is not possible to map image textures using a Brick Texture node

For texture placemanet you need texture coordinates. Brick texture outputs only colors. So it is not possible to map any images to the colors of the brick texture.

However, you can manipulate texture coordinates using Math nodes

Texture coordinates are only sort of gradients going in some direction from -∞ to + ∞ and you can manipulate them with all sorts of math functions:

So using various maths functions you can construct the same brick pattern out of
the texture coordinate gradients and use that to map any image you wish in the same pattern:


Operator bpy.ops.rigidbody.object_add.poll() failed, context is incorrect Here's a simple code that works fine as far as the .blend file with the object I'm modifying is already open.

obj = bpy.data.objects['obj']
obj = C.scene.objects.active
obj.select = True
bpy.ops.rigidbody.object_add()
obj.rigid_body.type = 'PASSIVE'

However, if I add a line at the beginning of my code to open the file using python,

bpy.ops.wm.open_mainfile(filepath=task_path+ str(x) +".blend")

I get the following error:
RuntimeError: Operator bpy.ops.rigidbody.object_add.poll() failed, context is incorrect

I'm sorry to ask the same (or similar) question twice, but believe me, I've been working on this problem for weeks, read everything online about the "context is incorrect" error and unsuccessfully tried multiple things to solve it. Nothing works and the problem seems to be related to opening the file using python (bpy.ops.wm.open_mainfile). Any clue about what's happening? Thanks a lot for your help!!

Just in case this is useful for somebody in the future, here's what seems to work for me:

import bpy
from bpy.app.handlers import persistent

@persistent
def load_handler(dummy):
  obj = bpy.data.objects['obj']
  obj = C.scene.objects.active
  obj.select = True
  bpy.ops.rigidbody.object_add()
  obj.rigid_body.type = 'PASSIVE'

bpy.app.handlers.load_post.append(load_handler)
bpy.ops.wm.open_mainfile(filepath=task_path+ str(x) +".blend")


Empty as a hinge does not work I'm following a physifcs course and I added a hinge on a new empty, but it does not behave like I'd expect it to [and what the course shows].
I expected the whole thing to rotate around the hinge, and instead, the whole thing falls down.
Both boxes have active dynamics on it.
you can see there's a line between empty and objects but it does not work.

From what I can see, this is exactly the behavior you are specifying: You have two boxes with active dynamics, so both will react to gravity. Joining them with a hinge will only make them fall together.
The hinge must connect to something fixed in the world, if you want it to act the way you want.


Adding a Procedural Crater to a Terrain Created by ANT Landscapes I created a terrain with ANT landscape that looks like this:

I looked up a tutorial on how to create a crater and followed this video from CGMatter.
I created a crater that looked like this:

Nodes looked like this:

But when i tried to apply this material to the terrain created by ANT Landscapes it looked like this:

Is there a way I can make this work or another way I can have a crater in this terrain?

That can be this kind of settings.

What is happening in the nodes shown in the question is "displacement" node is going along the faces normals, and they should go down.
(this issue does not occur in the video tutorial as he uses a flat plane)
So I've used a "vector displacement" that allows to displace along the wanted vector (0, 0, 1).
(the other parts of the node tree is on the same base as yours)


Can I adjust the rendered view background? The new rendered view background bothers me a lot. The big checkered background literally hurts my eyes to look at it. Is there a way to adjust it on 2.83 or do I have to change it back to 2.81?
Please don't judge the artwork. It's an earlier version I happened to screenshot for critique

You can change the checker size and colors in:
Preferences > Themes > User Interface > Transparent Checkerboard
To get rid of the checkerboard entirely, set both colors to be the same.


Creating a spiral on a sphere I am trying to create the spiral element of the following:

I've tried different methods such as a curve modifier with a capsule shape, and using 'Curve' strokes with sculpting, but I can't get quite the same results. What would be the easiest way to get these results?

You could begin with a spiral curve (you need to enable the  Add Curve: Extra Objects addon):

Convert to mesh, fill the faces:

Add an edge loop:

Move it up:

Create additional edge loops in order to round the profile:

Clean the topology:


Cpu vs gpu vs ram rendering in blender I have an Intel Core2Duo e7400 processor, 3 GB ram, 120G SSD hard drive, and an nVidia Geforce 750Ti 2GB graphics card. When i gpu render vast scenes of about 100MB using Cycles in Blender, I receive the CUDA out of memory error. My motherboard maximum ram support is only 4gb DDR2.

So i wants to ask if I should buy an AMD RX480 8GB graphics card, or alternatively an i7 6700k processor with 16GB RAM to work with my 750Ti graphics card. Which one will be better for rendering large images and animations?

Well, everything depends on your scene.

An 8GB graphics cards will be faster than than your CPU but you will be limited to 8GB (side note: do not keep in your old 2GB graphics card, along with the new 8GB card, Blender will only use the ram of the lowest card)

If you go with the CPU 16GB ram then you will be able to render larger scenes but it will be slower.

I would say get the graphics card with 8GB.


Only Vertices/Wireframe in Blender Render and Object Mode I tried searching around for why this might be happening, I can only assume I hit some stupid hotkey at some point and didn't realize it. My issue is that my model is only displaying as its vertices in Blender Render and in the 3d Full View. I can see the wireframe in Object mode. It renders fine in Cycles for some reason, and in edit mode, I can see all the faces and whatnot perfectly fine. It's not an issue with Maximum Draw Type, as that is set to "textured".

Render View and Object Mode

3D Full View in Object Mode

3D Full View in Edit Mode

Any help would be great! Sorry if this is a stupid question!

You changed your material type to a HALO
In material settings, switch to a Surface type, and you'll be fine


How to import an image sequence into Blenders video editor with each image playing for one second? Is it possible to tell Blender somewhere, that each image should be playing for a certain amount of time or frames when importing them onto the timeline of the video sequence editor?

Yes you can!

Import the frames as a sequence of images like you normally would (which will make each image play for one frame). With the image sequence strip selected, click Strip > Separate Images (or tap the Y key), then you can set the frame length of each image in the sequence.


Texture Inflating in Parts of Mesh I'm working on a mesh and I applied a displacement node, however around the arms and legs the texture gets significantly larger. How do I make the texture the same size everywhere?

Your texture is getting stretched. What you want to do is to go into the UV tab, go into edit mode in the other window, and select the stretched faces. Then, you want to go into the UV workspace, go to the top where it says 'New' and 'Open', and click the picture icon next to that. Click on the texture in the dropdown menu, and the texture should pop up. You should see the selected faces un the UV editor. Scale them up, and that should shrink your texture.


Can't see live changes in edit mode on character I've see the opposite of my problem but I can't seem to find anyone who has had this happen. I can see changes only after a bounce back to object mode, but only for some things. In the images below you can see my character has to do the bounce but the cube I throw in to show you this does not.

Thanks for any help.

The shape keys were pined I found this in my search: Unable to edit the meshes for shape keys

It now works.


'Object does not have geometry data' error when running headless? I have the following blender python script:
import bpy
from random import randint

#how many cubes you want to add
count = 10

for c in range(0,count):
    x = randint(-10,10)
    y = randint(-10,10)
    z = randint(-10,10)
    bpy.ops.mesh.primitive_cube_add(location=(x,y,z))
    print(f'Cube added at coordinates: {x}{y}{z}')

bpy.ops.export_mesh.stl(filepath="C://Users//diego//OneDrive//CFD//output.stl")

And it works perfectly when called by blender --python script.py
but fails when called by blender -b --python script.py, I get the following error:
Error: Object does not have geometry data
Error: Object does not have geometry data

Blender quit

Quoting from https://docs.blender.org/api/242PythonDoc/API_related-module.html :
Background mode examples:
# Open Blender in background mode with file 'myfile.blend'
# and run the script 'script.py':

blender -b myfile.blend -P script.py

# Note: a .blend file is always required.  'script.py' can be a file
# in the file system or a Blender Text stored in 'myfile.blend'.

I have tested it but you can try adding a file in your command line options


How to make Coke Material in blender I'm doing a fluid simulation of a what's supposed to look like coca cola ( like the ones you see in the commercials )
and I want to know what are the Materials and colors I should use to get that distinctive coca cola look .
if anyone has tried it before and could be of any help
I'd be really grateful thanks

PS : I'm using cycles render .
.
.
this is an edit to my Question

soo I accidentally had this look a couple of days ago , and I want to get back to it

this is what it looks like now

Not sure how your looks so I dont know if mine is more what you are looking for, but this is how I would set it up.

Use the principled shader with transmission all the way up (for glass).

I used a mix RGB with a noise factor to break up the color a little bit.

I used an emission shader for the volume with a noise texture (to get those light color swirls). I tried using a volume scatter/absorbtion but I wasn't liking the look it gave me plus the render times shot way up (so the emission shader worked for me).

Then I just added a particle system for the bubbles, and I threw in some Ice Cubes.


is there an inverse function of the circle function (w --> Loop tools) to form a square form a circle? To create a circle from an edge loop in edit mode, there is the function under the specials menu. Access by W > Loop Tools > Circle.

But is there a Function to do the opposite?

By now, I pick a quarter of amount of the circle vertices, scale them to an axis by zero, and doing this for all four quarters of the circle. but this only works as long as the circle is aligned to the main axes and has a number of vertices that can be divided by four.

You could use a Cast modiifer > Cuboid, Factor: 1, and apply it if you want to. It doesn't distribute vertices evenly between the corners, though... and still only plays fair with a nice number of vertices ..


How do I undo a pan? I use mac and if I hit Shift + Two-Finger swipe, I pan, then after I'm done doing what I wanted to do the view is still 'panned'.

I can't do anything with the right angle.

How to undo a pan?
Even if I pan and get really close to where it was originally, it is still not perfect, so my animals faces are sideways.

Blender has many options for viewing the 3D scene.

One of them is probably close to or equivalent or superior to the notion of undo, for some readers, not all readers.

I have focused on Menu Choices below.

I would probably advise you that Blender can provide many good views for you as opposed to a single special view.

Use the numeric keypad with Numlock on to select view orientations such as

Numpad 1,3,7,9.

You can do this the control key as well. This will achieve front right top bottom views. Numeric Keypad

2,4,6,8

rotate the view in known increments.

You can align the view to active, which respects the local axis. You could view the [front] of a model rotated at some unthinkable rotation of 33.5 degrees. Thus you could put a non renderable or renderable object in your scene to recall your perfect view orientation.

Quad View menu choice is quite useful.

Pressing Numpad . (Numpad Period .) will center the view on the current selection.  If you select 2 or more or all objects with A and then press Numpad . you will get more items in view.

Items can also be selected in the Outliner Window which is sometimes easier.

There are probably 20 similar items I have not mentioned here.


Smooth edges on a custom object I have a custom made object (no simple standard mesh, but nothing complex, see below) and lost a lot of time trying to make the edges smooth.
I tried the bevel modifier, sub surf modifier and bevel by select certain edges (ctrl+B). None of them worked fast and reliable.

Selecting them edge by edge (very time consuming) left me with problems where two different bevels where meeting.
the bevel modifier did no work as expected every time
sub surf modifier just created a very distorted mesh.

This is my mesh (viewed from different angles):

I just want all the edges to be smooth. No big deal...I thought :)
I only succeeded on the front ones.

The point is to imagine the several angles your mesh will have to be bent.

It can be composed of an initial shape and 3 modifiers : mirror, simple deform and subsurface.

Here, there is a final curve : the "U" general shape.

But before that the mesh can be flat. Here the mesh before using the two final modifier (simple deform and subsurface) :

The main point is to use quad everywhere so that :

Edges are in the good position to be bend to the "U"
Subsurface modifier works well

Notice the selected line on the screen capture : it is here to preserve the outer edge and avoid the subsurf to deform it too much.

As you want to print it, you may want a "lot" of subdivision.

Here is the modifiers stack :

Here is the blend file


I'm lost in the shader editor Everytime I hold scroll on my mouse to move, it like somehow teleports down and I have to scroll up again. THis time, it was WAY WORSE, as it went too far down and now I can't find my nodes

You can use the Home button or press A to select all of your nodes and then use Numpad . to frame selected.


How to bulk rename objects within a target collection? I have hundreds of objects within a collection (Blender 2.8) and would like to avoid manually renaming each object via the UI. I'm new to Blender and noticed there is scripting support. Could anyone help me produce a script to rename my objects?

For example, I would like to rename the objects in my "Water" collection. The current names do not follow a well defined pattern (even though the screenshot may make it look that way). When renaming is done, I do not care about retaining any semblance of the current name. My only requirement is adding a custom prefix. I'm envisioning the renaming to result in object names like: Water1, Water2, etc.

Iterate over collection objects.

This example is a reasonably simple introduction into scripting blender's python API.

import bpy

wcol = bpy.data.collections.get("Water")
if wcol:
    for i, o in enumerate(wcol.objects):
        o.name = "Water%d" % i

To ensure they keep their previous name order, and to have "Water1" first rather than "Water0"

import bpy

wcol = bpy.data.collections.get("Water")
if wcol:
    for i, o in enumerate(sorted(wcol.objects[:], key=lambda o: o.name)):
        o.name = "Water%d" % (i + 1) # to start from 1


My rig stretches and shrinks I'll cut to the chase.

Problem:
I'm trying to make a stylized foot consisting of only bones and rigged it (so I can pose it later).
Now when I rotate my a_bones (in pose mode) my bones go slower than my a_bones and then proceed to shrink.

|

|

a_bones = armature bones

bones = mesh object

I will upload the file to this question using blendexchange:

Your Master bone influences your whole mesh, so it conflicts with the influence of all the other bones. You can either:

Select the whole mesh and in the Properties panel > Object Data > Vertex Groups, unlock the Master group and click on the Remove button.

Or select the Master bone, go in the Properties panel > Bone > disable the Deform option.


How to get rid of subsurface shading artefacts I notice this radial striping often when I use the subsurface modifier on shapes with curved segments. How can I prevent it or remove it?

Your problem is the huge ngon on the top. Try filling it with a grid-like patch of mesh.

Check out this topology guide especially the part about Cylinder Caps


Object Controlling using Arduino I am working on my project for haptics. For this purpose, the task is to create a virtual finger and control its movement using Arduino. The problem now is that I am using Blender 2.80 and the cannot find a way to control the object's movement using a Controller.

The idea was to get the input from the sensors and import the serial data from the Arduino to python and use his data for controlling in Blender.

I imported the data from Arduino to python but can't find a way for further process. the example I saw used the blender gaming engine, but I used blender rather than the gaming engine.

One more thing to ask

Can we control ojects movement in blender 2.80 or we must use a gaming engine for this purpose ??

Need guidance in both these problems.

If you want to do this in real-time, I would investigate using UDP sockets, as they're fast and cheap.

As a test I created a modal operator who was on a timer and listened on a socket on each cycle.

Unfortunately, my modal operator arbitrarily appears to just stop. But as a quick test, this looks promising.

Create a cube. Start this python client (who sends random data).

import socket
import random
import time

UDP_IP = "127.0.0.1"
UDP_PORT = 5006

print("UDP target IP:", UDP_IP)
print("UDP target port:", UDP_PORT)

sock = socket.socket(socket.AF_INET, # Internet
                     socket.SOCK_DGRAM) # UDP
sock.connect((UDP_IP, UDP_PORT))

for i in range(1000):
    time.sleep(0.02)
    MESSAGE = str(random.randint(0, 5))
    sock.send(MESSAGE.encode())
    print(MESSAGE)

And run this modal operator in Blender.

import bpy
import socket

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

    def modal (self, context, event):
        if event.type == 'ESC':
            context.window_manager.event_timer_remove(self._timer)
            return {'CANCELLED'}

        if event.type == 'TIMER_REPORT':
            try:
                data, addr = self.sock.recvfrom(1024)
                self.cube.location.x = float(data)
            except:
                # timed out
                pass

        wm = context.window_manager
        self._timer = wm.event_timer_add(0.2)
        return {"PASS_THROUGH"}

    def execute(self, context):
        self.cube = bpy.data.objects['Cube']

        print("creating socket")
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.sock.bind(("127.0.0.1", 5006))
        self.sock.settimeout(0.18)

        print("adding timer")
        wm = context.window_manager
        self._timer = wm.event_timer_add(0.2)
        wm.modal_handler_add(self)
        return {"RUNNING_MODAL"}

bpy.utils.register_class(ModalOperator)

bpy.ops.object.modal_operator('INVOKE_DEFAULT')


Character Creator 3 to Blender - Reimporting a texture that was accidentally deleted I still have an original CC3 export and I want to avoid starting again as much as possible because I've already done sculpting on the mesh and vertex groups for a dozen hair particles. (wish i was joking)
Is there a video that would help guide me to reimporting the texture i need properly? (std_skin_head) I can bring the texture back in but it's not aligned to the mesh anymore. Before you ask - yes the texture was working fine after i sculpted the mesh.
https://www.youtube.com/watch?v=1fsM5IuFQbI Videos like this that describe material setup are not relevant, they do not cover the application of a base texture.
If you don't know about character creator 3 but you want to help, I'll briefly explain what it does. It's a third party program that you can quickly create a character model in - when it exports it creates armature and textures and maps out all the textures along with the mesh. So /somewhere/ there is something already made that can guide this texture onto my mesh but I don't know where it is or how to apply it.

Figured it out.
CC3's vertex groups can be set to textures. Linking related videos for future CC3 users.
https://www.google.com/search?q=assign+vertex+group+to+texture+blender&rlz=1C1CHBD_en-GBAU900AU900&oq=assign+vertex+group+to+texture+blender&aqs=chrome..69i57j33i22i29i30.8902j1j15&sourceid=chrome&ie=UTF-8#kpvalbx=_hKRrYOfpHuObmgf7g5v4BQ17
https://www.youtube.com/watch?v=GTd8NBg8EZU


Make array follow taurus knot I am messing around with Blender and trying myself forward. I have an idea of an image, and I want to have Array modifier follow a taurus knot. Maybe there is another method to have the rings follow the taurus?
The threads I have found here usually are trying to have array follow a curve (like Bezier curve), which is not regular mesh.

Got the .blend file here.
I just want the rings to follow the taurus knot.
Thanks for the time to look at my problem.

The process is rather simple. First take your torus knot, select one edge loop and press P to separate by selection. Then you are left with 2 objects - the Knot and the "loop"

Then, you can delete the knot, leaving only the edge loop (if that's what you want). Select the loop and convert it to a curve.

Then, add the mesh you want to repeat along the curve and give it an Array Modifier and a Curve modifier.  Make sure the curve is the second in the list. For the curve object, select the "curve" you made from the edge loop.

As usual, you can rotate/transform the "following mesh" (in edit mode) to give different effects.


How can i scale 1 side of the mesh? I try make a model of a bottle, i started the shape from a bezier circle, though the bottle got a rounded, squared look. Extruded it up to the top of the bottle. The problem is that this bottle is not symmetric on both sides so i need in some way to scale only 1 side of the bottle, i just dont know howto. I include a photo of my blender. Would be very glad if some one could tell how to do this. I am new to blender, so this might not be best way to start with a bezier circle? Also glad for advices.

Place the 3D cursor on one of the vertex on the opposite side of the mesh, press . to transform around the 3D cursor, and optionally press O to turn on Proportional Edit mode.

Select one of the top or two top edge loops (as prefered) and scale them with S


How can I make a node setup, where only round emitter glows outside the image? How can I make a light source glow and that only this glow surrounds the emitter?

I tried the following compositor setups:
In this setup the emitter (white) is blurred, so that it glows outside the image. But, what I don't want, the red piece is also blurred to outside the image

In this setup, the red piece is not blurred, but the glow of the emitter (white) doesn't glow outside the image either.

How can I make a setup, where the emitter glows outside the image, but red piece doesn't?

You could enable an emission pass in the render layers tab:

Then blur and overlay the Emit pass:


Custom inteface: Two 3D views with a different header (toolbar) Here is what I am trying to achieve:
I have two 3D views

One for manipulating objects (which needs to have some custom manipulation tools in its header). This view cannot be rotated.
A second one used to view the result from any point of view. This one does not allow to interact with the objects of the scene. It can be rotated.

The goal here is to hide the manipulators in the right 3d area from the user.

But, of course, there's still a plus sign that allows the user to reach those features (not only from the toolbar, but on the sides toolshelves, etc, as well).

I tried different approaches so far.

The most satisfying was to detach the right one into a new window and switch that view to fullscreen (removes anything else but the window region. But, since my app is small sized on screen, I would like to keep both views in a unique window.
Another possibility I tried was to override the draw callback of the header. Of course it leads to removing it from both views:

def my_draw(self, context):
    #...
    pass
bpy.types.VIEW3D_HT_header.draw = my_draw

Maybe there is a way to distinguish between the areas owning the header, and do the regular draw() for the left one and leave it empty for the right one (but I don't think so). But an empty header on the right would be more than enough for me.

I also tried to find a way to sort of mimic the way the region_quadviews work. That would have been a "dualviews" version, but don't really know where to start with that kind of approach.
And last thing I've been thinking about was to use another type of area for the right side and override its window region with the one from the left side area (since I won't need an OUTLINER, neither a RENDER area). But same problem: I read lot of threads here and there, but couldn't figure out if this is something that can be done, and if so how to implement it.

Well, I've read many times that we cannot hide the header via python (just saw a patch allowing it here).

But, if you guys have an idea about how to get close to one of the options above, or have another approach to suggest (even a simple idea) to help having a behavior that is not to far from was I'm trying to achieve, then thanks for your time.

EDIT: To be more specific, I have disabled the 3D Manipulators from user prefs and have a modal operator running on the left side allowing to deal with manipulating the green objects. And I use the code below to lock this same area from being rotated:

# Locks: Prevents from any numpad, mouse, ... rotation, as well as
#        leaving the 'ORTHO' mode
rv3d.is_perspective = False
rv3d.lock_rotation = True

The only way to truly hide portions of the interface from users is to create a custom build of Blender. This would allow you to restrict interface components as well as providing very specific views and screens for your application functions.

There are a number of projects that have done this:

Fluid Designer (by Microvellum) - http://www.microvellum.com/products/fluid-designer/

Interactive Pizza Designer by Daniele De Luca - https://vimeo.com/68119398


Zooming from <10000 meters to 10cm I imported a quite huge model from a GIS with the size of ~10000x10000 metres. Now I want to scale it down to ~10cm. But when I do it, I can´t zoom to my model. At some point the Background raster disapears and I can´t find it.

You need to modify the clip distance, both for the viewport and the camera,
to have a clip distance that uses a much closer range.
See:
How do I increase the render distance?


Timeline modal operator: how to get frame cursor to follow mouse I'm trying to write a modal operator for the timeline, but I'm confused about how to get the current frame cursor in the timeline to follow a 'mousemove' event (and consequently, how to set the new current frame when the operator finishes).

Solved -
in the invoke() function, I set these:

self._initial_mouse = event.mouse_x
self._initial_frame = scene.frame_current

in modal():

self.offset = (self._initial_mouse - event.mouse_x) * -0.1
scene.frame_current = self._initial_frame + self.offset


Mathematical Ratio among three point lights I was working on a interior model and I want to use the three point light system.And I was wondering if there is any mathematical relation among the lights and their position and strength to produce a better result.(You know some like rim light should be certain distance from character with certain strength and other lights also should be at certain position with specific strength and etc etc).Thanks in advance.

There is no such formula, as lighting depends on the intentions of the artist.

Moreover thinking in three point lighting is also quite limiting, Sometimes you just need one light, sometimes you need more than 10 sources...

Some questions to ask yourself are:

What are the characteristics of the object that you want to portray? How is your lighting going to enhance, reveal or suppress them? Where is the main light source coming from? Do you want defined shadows or do you want soft ones? How dark do you need the shadows to be? How is the shadow of an object going to affect others in the scene or how are the shadows of other objects affecting the one you are focusing on? Can the lights affect how you perceive the shape of objects? Should your object be brighter or darker than the background? How would the light help guide the viewer on reading an image? How are the bright and dark areas affecting the overall composition of the image?

There are endless variables, and the history of art going back to cave paintings deal with solutions to particular challenges... Study images you like and think of where the light is coming from and how the the different sources interact.

Try things, experiment with placement, size, intensity and color and you'll find answers according to your taste.


Volumetric lighting is not showing in camera view I currently have a camera inside a box that has a volume scatter node connected to the material outputs volume. I got my lighting set up (just a lamp) and gave it a view port render not in camera view. the lighting was showing up and it looked great. I then looked at it through the camera and the light didn't show up. So, i did my best to figure out what it was. After multiple observations, i realized this was because when my camera is inside the box, the faces of the box are facing the wrong direction. so where ever i move the camera, if there is any dark shading on the faces, the light wont show up there. So i thought, ill just flip the faces. But, now the volume scatter was being applied outside the box. My goal is to have no problem with this.

Here is the view port (this shows the two different shadings of the face-black and grey- in the next picture you will see how the grey shaded area, for some reason, wont let the light be visible to the camera)

And here is the view port render (Notice the relation between the shading and where the light is visible)

This is the position of the camera...

This is the position of the cube...

After going into edit mode and selecting the face of the cube (with volume scatter applied to it) that appeared to have the problem, I realized the camera isn't seeing part of the cube which i'm guessing is causing it to think there should be no volume in that area.

I decided to move the camera so i could get a better look at things and find if a different position will solve the problem. It did not solve the problem, but it lead me to see something odd happening with the shape. By the way, the gray shape is not an object.

Select your camera in order to change your render settings. Change the clipping end to a bigger number.


How to Reassign Input Strip in Blender? (Linux) I want to recycle my already made transform strip but the program wouldn't let me. I can't find any clear help. Using 'Swap input strip'/'Reassign input strip'/... gives me errors.

I think you can follow the procedure as outlined in this video. In summary, you have to duplicate your original strip with its transform strip attached. Then, change the source of the duplicated strip to the one that you want the effect to be copied on.


Why does a multiplied texture with alpha loose detail information? The left image shows the texture mapped to a plane, the right one is original image in the UV Editor. The rendered image looks extremely blurred. What would be the correct material and texture settings to have only the alpha part (check pattern right) invisible?

.blend file

Material and texture settings are:

Setting the Blend Mode to multiply isn't necessary.

Material Settings:

Specular

Intensity: 0.0

removes this:
Transparency: On

Method: Z Transparency
Alpha Slider 0.0

Texture Settings:

Type: Image or Movie
Image: The Texture Image
Use Alpha: On (Otherwise darker parts of the image which are supposed to be opaque will be partially transparent)
Image Sampling

Alpha: Use : On (Otherwise darker parts of the image which are supposed to be opaque will be partially transparent)

Mapping

Coordinates: UV
Map: UVMap

Influence

Color: On (1.0)
Alpha: On (1.0)

Blend: Mix (Default)

Settings to compare:

Result (left rendered, right image editor)
Image source by Luc Viatour / www.Lucnix.be

Result zoomed


cycles adding texture to face via python / import script I am writing an importer for a custom file format. So far I have created my object:

 me = bpy.data.meshes.new(ModelName)
 ob = bpy.data.objects.new(ModelName,me)
 scn = bpy.context.scene
 scn.objects.link(ob)
 scn.objects.active = ob
 ob.select = True

And then I create the vertex, face, and materials:

    myvertex = []
    myfaces = []
    MyTextureNames = []

    for textures in range(0, MtlCount):
        StrLen = struct.unpack('i',fdata.read(4))[0]
        mtlname = fdata.read(StrLen).decode()
        MyTextureNames.append(mtlname)

        new_mat=bpy.data.materials.new(mtlname)
        new_mat.use_nodes = True

        bpy.ops.object.material_slot_add()
        context.object.active_material = new_mat

    for points in range(0, VertexCount):
        # read three coordinates
        p1 = struct.unpack('f',fdata.read(4))[0]
        p3 = struct.unpack('f',fdata.read(4))[0]
        p2 = struct.unpack('f',fdata.read(4))[0]

        #print ("x: " + str(p1) + " y: " + str(p2) + " z: " + str(p3))

        myvertex.append((p1,p2,p3))

    for points in range(0,FaceCount):
        # read three coordinates
        p1 = struct.unpack('i',fdata.read(4))[0]
        p3 = struct.unpack('i',fdata.read(4))[0]
        p2 = struct.unpack('i',fdata.read(4))[0]

        #print ("x: " + str(p1) + " y: " + str(p2) + " z: " + str(p3))

        myfaces.append((p1,p2,p3))

    # Add verts and faces with the following line
    me.from_pydata(myvertex, [], myfaces)

    me.update()

When I run this script I get my object, with vertices and faces intact, and when I look in the materials all my materials are listed and already set to use nodes and Diffuse BSDF. Great.

My question is: How do I now assign the material to the correct faces? (I do have an array containing the information mapping the face to the material, I just do not know how to tell blender "For this face use this material".

I also am unclear as to how I set the UV coordinates which I also have stashed in an array for access.

And not to over complicate this "question" but other things I am trying to figure out how to do are reading the image information which is packed in my file, getting it into memory and then telling blender to use that memory location for the image information to use for the diffuse.

For materials, this is simple: each polygon (face) as a "material_index" property which corresponds to the object's "material_slots" property.

For the UVs, that can be more complex. Here is how Blender stores all that:

UV layers are in "obj.data.uv_layers".

But to create uv layers, you need to go to "uv_textures" and add one via "obj.data.uv_textures.new( 'name' )".

You can now access to "obj.data.uv_layers['name']" and to "obj.data.uv_layers['name'].data". This last data is an array that contains information for each vertex in the mean of uv layer vertex (not 3D vertex, because a 3D vertex can be represented many times in the UV map).

What is unifying all these is the concept of 'loop'. 'loop' is a per face information.

You have a 'main loop' which is into "obj.data.loops" and contains the 3D per face information for each vertex. Say we take "loop_info = obj.data.loops[0]", it contains "loop_info.vertex_index" (the index to find the 3D vertex in "obj.data.vertices"), and other information like vertex "normal".

Now an uv layers is also a per face information (a loop). "obj.data.uv_layers['name'].data" is a loop (organized with the same index order as the main loop).

If we take "uv_info = obj.data.uv_layers['name'].data[0]", "uv_info.uv" is the 2D coordinate in this UV map.

Last thing you need to know (I think), the correspondence between a polygon and the loops: this is stored in the polygon itself. If you get "polygon = obj.data.polygons[0]", then you can get the loop projection of its vertices in "polygon.loop_indices".

For instance, "obj.data.uv_layers['name'].data[polygon.loop_indices[0]]" is valid.

I think the other aspects are relative to your file format.

Concerning images. You can start with "img = bpy.data.images.new(name, width, height)". Color information is in "img.pixels" organized from bottom left to upper right (UV like). "img.pixels" is a 4*width*height float array containing R,G,B,A values (black is 0, white is 1).

Following the comments... I cannot imagine what your file format is.

So I can only, give some advices and a little help...

Warning this code is untested (as I have no data), so surely, there will be some bugs here. But I hope that will help for the principles of how it works:

Materials part: just for the comment at the end

modelName = "xxxx"
mesh = bpy.data.meshes.new( modelName )
obj = bpy.data.objects.new( modelName, mesh )

for textures in range(0, MtlCount):
    StrLen = struct.unpack('i',fdata.read(4))[0]

    mtlname = fdata.read(StrLen).decode()

    MyTextureNames.append( mtlname )

    new_mat = bpy.data.materials.new( mtlname )
    new_mat.use_nodes = True

    #I do prefer using .data instead of .ops because ops often need a context and/or a mode
    obj.data.materials.append( new_mat )

Creating the mesh, with some guess about unpack (as I've never used it).
But that should work and be faster than a for loop.

def ToTuples( aList, tupleSize ):
    return [tuple(aList[x:x+tupleSize]) for x in range(0, len(aList), tupleSize)]

#Shorter... probably much faster than loops
myVertices = ToTuples( struct.unpack( 'f', fdata.read( 4 * 3 * VertexCount ) ), 3 )
myFaces = ToTuples( struct.unpack( 'i', fdata.read( 4 * 3 * FaceCount ) ), 3 )

mesh.from_pydata( myVertices, [], myfaces )
mesh.update()

Face material attribution: 2 examples

#If face/material is describe as face index to material index in your file
for fIndex, mIndex in ToTuples( struct.unpack( 'i', fdata.read( 4 * 2 * FaceCount ) ), 2 ):
    mesh.polygons[fIndex].materialIndex = mIndex

#If face/material is describe just as a sequence of material index in the same order as the faces
for fIndex, mIndex in enumerate( struct.unpack( 'i', fdata.read( 4 * FaceCount ) ) ):
    mesh.polygons[fIndex].materialIndex = mIndex

UV map:

#Assuming you have one UV map and all polygons are tris
#=> you have 3 * FaceCount uv definitions in Blender, so this is the size of the 'loop(s)'
#But I do not know how your file is...
#So, I guess it is defined as the following, assuming the vertex order of the face is the same as above:
# faceIndex, vertex1co, vertex2co, vertex3co
# All these is 7 * 4 bytes * FaceCount

uvTex = mesh.uv_textures.new()
uvMap = mesh.uv_layers[uvTex.name]

for fi, v1x, v1y, v2x, v2y, v3x, v3y in ToTuples( struct.unpack( 'i f f f f f f', fdata.read( 7 * 4 * FaceCount ) ), 7 ):
    #Find the polygon
    polygon = mesh.polygons[fi]
    #In the uv map, get the corresponding vertex using the polygon loop index (for first, second and third) and set its uv coordinates
    uvMap.data[polygon.loop_indices[0]].uv = (v1x, v1y)
    uvMap.data[polygon.loop_indices[1]].uv = (v2x, v2y)
    uvMap.data[polygon.loop_indices[2]].uv = (v3x, v3y)

I don't think this is the place to do more... and doing more needs to know the specifications of your file format...

Hope it helps!