text:
Bake animation from complicated IK rig to simpler rig for export to Unity
I made a character, gave it 8 animations that look great (as good as I could) in Blender and they break down in Unity. What else is new.
The problem has to do with the constraints "fighting" when the animations are baked. The rig involves IK constraints on the spine and both arms, Copy Scale constraints, and a Limit Scale constraint. By default, scaling a parent bone causes its children to scale uniformly as well. I changed this in the Relations settings for some bones to "Inherit Scale: None". I do not think this is acknowledged in Unity.
ANYWYAY!
In Unity, there is weird stretching in some animations. I can replicate these problems in Blender if I bake the animations and choose to apply the constraints. Again, this seems to do with Blender not knowing how to replicate the resultant transformations from the constraints.
What I would like to try is duplicating the rig I have, deleting the non-deformation bones, deleting all bone constraints, and baking all the resultant transformations from the original rig to this new rig, and using this new rig to animate. I saw a video that did this a while ago but I can't find it.
Is this solution going to work?
How can I set this up?
Here are 2 example animations, success/failure:
"Close" (success in Blender, no weird stretching):
https://www.deviantart.com/onewingedchronothing/art/ChimpInTheBox-Close-852627603
"Close" (failure in Unity):

"Sweep" (success in Blender, no weird stretching):
https://www.deviantart.com/onewingedchronothing/art/ChimpInTheBox-Sweep-852359442
"Sweep" (failure in Unity):

I succeeded in saving our character but the way I did it was hard-won. I hope this will be helpful to others who learn the hard way that their armature is not setup to be interpreted properly by Unity. Note that I have been advised by a professional that this is over-complicated compared to the minimum that really needed to be done to "save" the character, but the optimal solution apparently does involve a copy-transform rig.

I duplicated the armature I had and removed all the non-deformation bones from it.
Then I cleared all its ("Armature.001") bones' constraints, disconnected and de-parented all of them, and re-parented all of them to the root bone.
I put a "Copy Transform" constraint on the root with the other Armature as the target, but did not set the bone target.
Then I copied that constraint to all other bones at the same time.
One-by-one, I set the bone target to the bone with the same name in the other rig. This took about 10 minutes just to be thorough.
Now I was ready to re-create  the actions:
In the Action Editor, I set the active action for each armature to the same action.
With the new armature selected, I clicked the button to make a new action: "ActionName.001"
In pose mode, I selected all bones, set my Keying Set to "LocRotScale", and re-keyed every single frame.
(I did this for every Action).
Through trial-and-error, I determined that I needed to bake these actions one-at-a-time with the following options activated:

Only Selected (not required, probably)
Visual Keying (most important)
Clear Constraints (equally most important :) )
Overwrite Current Action (preference)

I was only able to remove the constraints ^ and have the new armature continue to respond to the keys when it was done this way. I also remembered to delete the channels belonging to the non-deformation bones that didn't exist anymore. I did this after baking just to make sure it wasn't causing problems.
After clearing constraints, the other actions break. I anticipated this, and every time I baked an action, I saved it in its own file.
Finally, from the file version before all this baking happens, I removed all the actions, deleted the original armature, and appended THE ONE BAKED ACTION from each new file I saved. DO NOT FORGET to append JUST THE ONE YOU BAKED from each file each time, otherwise you will think you messed up when you are just appending the wrong action from the wrong file. Obviously, I got very nervous for a second because I forgot!
When all the animations were appended, I was able to export.
Before I did, I de-parented all meshes and rotated everything about the X-axis by -90 degrees, applied that rotation, and rotated it back 90 degrees. This corrects the axis disparity between Blender and Unity.
Here is evidence of my success (sorry, it was too big to embed):
https://i.sstatic.net/L9Z1Q.jpg


text:
Separate object from origin deformation
I have started using blender for rendering figures and I really love it.
The problem is that I reached a point I do not know how to resolve my issue. I wanted to bend a cylinder, so what I did was to use the "simply deform" modifier into a cylinder and use a circle for reference (Origin).
Now, I like the state of my new object, so I what to play with this mesh. The problem is that now, everytime I modify the object, is still based on that circle. Is there anyway I could have this object without modifiers but keeping the same shape ?
This way I could play with the transformation I got.
For example, I want to rotate the item but it's referencing the circle so the shape looks weird.
Thanks in advance

Just apply the modifier . . ?

Yes. In the upper left hand corner of the modifier pane, click the "apply" button, and this will make the modifications to the cylinder mesh permanent parts of the object.

Thank you, omg it was very easy! I cannot believe I didn't see it :S

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Parenting/Joining a helmet to a skeleton rig
I'm looking for help on how to parent/join this helmet:

With this skeleton rig:

Sorry if it's super simple I just can't seem to figure it out for the life of me. I feel like it's obvious but whatever I try it doesn't parent with the rig when I try to animate.

The helmet consists of 2 elements msh_vents_topSide and msh_visor. You need to select both of them with SHIFT+click, then still with Shift select bone "head" (it's top most circle in "rig" rig), then press CTRL+P and choose Bone. This way whole helmet will be parented to head bone with weight 1 and no need for weight painting.

It should parent the same way as any other objects, but you'll have to go into "weight-painting mode" on the helmet with either your head or neck bone selected and paint the entire helmet. I'm relatively new to blender myself, but I just had to do this for a character's hat. Just make sure you only have it painted on one bone or the other, not both. Hope that helps!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
same displacement want it to appear similar on two objects
I am trying to apply a displacement texture onto an object.However the same displacement is only appearing correct on the sphere (1) object and not the box (2).What am I doing wrong?

I think that you need proper UV map. Upload your blend file to: http://blend-exchange.giantcowfilms.com/

thanks just uploaded

I will need this screenshot (47).jpg file as well ;)

done posted on question


text:
I cannot get correct scale on bevel for nurbs curve
Im trying to get a 2mm bezier circle to bevel onto a curve .The circle is not appearing in the correct scale on the curve.
How do I fix this?

I've just seen your blend file and i've found why you get this problem (and how to fix it) :)

Select your curve
Edit mode
Select All vertices
In the properties tab (N key), change the Mean Radius value (your actual value is 0.008) to 1.

That's all ;)

Found the answer!! Scale in edit mode from the beginning ( add bevel object first ).Dont use object mode for scaling!


text:
Is it possible to limit the number of GPU cores in new MacBooks M series?
I am using blender 4.1 with a MacBook M3.
I am rendering using the CLI and while rendering some scenes I would like to keep using the computer to do some other stuff, so I was wondering if there is any way to limit the number of GPU cores that blender uses while rendering.
I am not hurry with the render process, so I would like to avoid overheating the computer. After a couple of minutes of ~100% GPU usage the computer's fans sound as if the computer is going to take off.
Without any configuration blender takes ~100% of GPU cores.
I tried changing the number of threads, but this seem to modify CPU threads and not GPU ones.
Also I tried to play with the tile size, but with small tiles still blender ends up using 100% of the GPU.

I can switch to CPU instead of rendering on GPU, and limit the threads, but this is super inefficient because GPU cores are much more faster than CPU ones. At 20% capacity using GPU cores it still render much faster than using 100% of CPU cores.
Thanks!

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
How to export curve vertex animation to gltf/glb file?
I have animated a curve with 2 vertex in python by changing the position of the two vertex coordinates, and when exporting to glb the curve does not move.
I am using blender 4.1.
I animated the curve like this:
def create_straight_curve(point1, point2, curve_name="StraightCurve"):
    # Create a new curve object
    curve_data = bpy.data.curves.new(name=curve_name, type='CURVE')
    curve_data.dimensions = '3D'

    # Create a new spline and add it to the curve
    spline = curve_data.splines.new(type='POLY')
    spline.points.add(count=1)

    # Set the points of the spline
    spline.points[0].co = (*point1, 1)
    spline.points[1].co = (*point2, 1)

    # Create a new object with the curve data
    curve_object = bpy.data.objects.new(curve_name, curve_data)
    bpy.context.scene.collection.objects.link(curve_object)

    return curve_object

curve = create_straight_curve((x_a, y_a, 0), (x_b, y_b, 0), "StraightCurve")
for frame in range(n):
    curve_data = curve.data
    spline = curve_data.splines[0]
    points = spline.points
    points[0].co = (x_a_v[frame], y_a_v[frame], 0, 1)
    points[1].co = (x_b_v[frame], y_b_v[frame], 0, 1)

    points[0].keyframe_insert(data_path="co", frame=frame+1)
    points[1].keyframe_insert(data_path="co", frame=frame+1)

and it is working fine in blender. I can see the curve moving and changing it size. Basically I am changing the location of the vertex (this is important, I don't want to do object translations, I want to change the position of the vertex).
However when I export this as a gltf/glb file the curve is always static.
I tried adding a mesh (a cube) to the file and animating it, and the cube is moving fine but the curve is still static, so I guess it is something related to the curve type (splines?).
I would like to keep using curves because my end goal is to create an animation with 1000s of curves with bevel and animate them. If I convert each of them to a mesh and animate them it is going to be really big the file.
gltf supports curve objects with bevel, they are displayed as they should, but not the animation.
Thanks!

Exporting is infamous for losing data, since the formats are not as versatile as a Blend file. glTF likely does not support curve animations, but I’d have to look at the official spec to be sure.

I was suspecting that, but I wasn't able to confirm it yet .

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Solidify modifier causing volume loss in self-intersecting mesh
I'm encountering issues with the Solidify modifier on a self-intersecting mesh.
The mesh is generated from a curve that's been screwed around an axis. As shown in the first image, the curve crosses itself.

I then add a Solidify modifier to the mesh and apply a volumetric shader.
The result, as seen in the second image, lacks volume where the mesh self-intersects. My impression is that there's no "inner volume" in that part.

Is there any way to avoid this lack of volume in the intersecting region? Note how on the overlapping region there is no emission and there is a thin line of nothing.
I'm aiming to use the Principled Volume shader in this case because I want to emit light from a very thin mesh. I don't want to use a surface shader.


text:
Volumetric shaders in blender: unexpected 'hollow' appearance
I am having some issues understanding how Blender is rendering volumetric shaders in certain cases, where objects appear to be hollow when they shouldn't. When I say hollow, the density of the volumetrics changes along the line where the faces merge. In my opinion, it looks like something is wrong, but maybe I have a misunderstanding about how volumetrics should work.
My case using cycles in blender 4.2.1: I created two planes intersecting each other in different ways:

I created a plane, added a solidify modifier, duplicated the plane, and rotated it 90 degrees. After that, I joined the two planes with a boolean modifier. Then I recalculated the normals to face outwards. (see image with volumetric shader)

I created a plane, extruded it along z, then added loop cuts, and extruded one face upwards and the other downwards to get something similar to the case above. After the process, I recalculated the normals to face outwards and applied the volumetric shader.

Same as case 2, but I added a remesh modifier with a very small voxel size. I applied the boolean modifier.

Same as in case 1, I used two planes with a boolean modifier to join them. But I also duplicated the planes and added a second modifier that only keeps the intersection. So basically, I have a very tiny mesh in the center of the object that is only the intersection of the two planes. This is the only case where the object looks as expected and not hollow.

So my question is, why do objects seem to be hollow? Is this how they are supposed to look? As far as I understand, volumetrics should fill the whole volume inside the faces. If the normals of the faces are correct, everything should look like case 4. But I only manage to make it look like this by adding an extra volume.
How can I make everything look like case 4 without manually adding extra volume?
I already tried to increase the light paths, decreasing the volume step rate and still the same problem.
Thank you very much.

Apparently this is the expected behavior, quoting an answer that I've got from another place:

Everywhere else in the object you’re looking through two consecutive volumes, but at this particular point (line, really) if you trace a ray it’ll immediately exit the volume on the opposite corner


text:
"Updating Objects Flags" -- Best ways to get around long rendering times?
I'm currently trying to render an animation that taking 15 minutes to render one frame. Whilst watching the render, I can see "Updating Object Flags" stage seems to be the main culprit. The scene is not that complex but has two particle systems.
Q: Could anyone give me some tips on the best ways of getting around this and reducing render times?

You can try steps described at blender-guru http://www.blenderguru.com/articles/13-ways-to-reduce-render-times/

Thanks Photon. I've found this link already but the tips only make a very small difference :(

Are you by chance using volumetrics? This can result in an $O(n^2)$ run of ObjectManager::device_update_flags.

I am not sure about @alphaman_9, but I am using volumetrics, and pretty intensly too

@Nate_Sycro27 The only (obvious) way for reducing the runtime of this particular function is having fewer volumetric objects for which the intersections are computed.

Could you upload your blender file so we can take a better look at what might be slowing down your scene (https://blend-exchange.giantcowfilms.com)?  Also, what CPU and graphics card are you using?

Here is my file (a short film I'm working on of a blimp). https://drive.google.com/file/d/1TArgLpMkJvwzFhjIp9K1SJwxNSSSo_QG/view?usp=sharing
(File too large for .blend exchange).
It has intense volumetric particles.
I have dual 8-core E5-2680 0 xeons, and dual quadro 4000's with 128gb of RAM.

@Nate_Sycro27 Could you upload a picture of one of your rendered scenes.  I tried rendering it on my laptop, and (surprise, surprise) Blender crashed.

Here is a render:
https://drive.google.com/file/d/1ugDsB8d04bG0fi4gztZa8R0Di0N4IvbR/view?usp=sharing
FYI you need at least 32 gigs of RAM to render.
This photo was at 120 samples, and composited with denoise and fog glow. About 1 day compiled render time, so impossible for an animation.

There are a couple of things you can do to try to decrease render time.  For example, you could try decreasing the number of volumetrics by using the glare node rather than volumetrics to create glares around lights, by faking clouds with textures or images, by replacing 3D explosions with 2D explosion special effects, by creating hazes with planes that have a transparent cloud texture on them, or by simply eliminating some or all of the volumetrics altogether.  It all depends on what you were using the volumetrics for.  Of course, it won't look as good as with volumetrics, but that's the price of shorter render times.
Another thing to try is using the denoiser node and reducing the number of samples you use (and the number of light bounces).  For best results, check "Denoising Data" under Properties -> View Layer Properties -> Passes -> Data.  However, you're still beauty for time.
Whatever you try, there's ultimately no solution for long render times except progressing Computer Science research and render farms (hundreds or thousands of high-end computers working together to render animations).  Actually, 15 minutes is pretty good, even for an animation.  It takes Pixar about twenty-four hours to render each frame for their animated films.  The only way they can render the entire animated movie in a reasonable amount of time is by using huge render farms of thousands of computers working together.
The good news is that there are several online render farms that you can use.  The bad news if that they cost money.  However, they're still a viable option (better than half a year of rendering for you).  You can read more about some of those options here:

https://www.blendernation.com/2019/09/06/8-blender-render-farms-compared/
https://renderpool.net/blog/best-online-render-farm/

Hope that kind of helps, and sorry I can't give you a better answer.

I am currently using Sheepit distributed render which makes most of my cycles animations possible. I have considered renderfarms, but like you said, they cost money and this animation would be intense. (6000 frames and 24 hrs a frame). I have decided to render the scene without the particles, and keep most of the volumetric planes. I also set the branched path tracing samples to 20 for volumetrics (which can be fixed with intel denoising), and from 120-1000 for subsurface, etc. Producing a total render time of about 1hr per frame (on my pc). Thanks for the help.

@Nate_Sycro27 I just saw your picture.  You should definitely be able to majorly cut down in render times by using textures instead of volumetrics for the clouds.  You could probably find some tutorials online that teach you how to make beautiful clouds without using expensive volumetrics.  Another option that might be faster but still have the realism of volumetrics would be to use one large rectangle for the clouds and give the volume density a cloud texture.  Again, I'm sure there are cloud tutorials that would use this approach as well.


text:
Blender 2.8: Switching between Vertex/Edge/Face Selection?
How can I toggle between vertex, edge and face selection in Edit Mode?

Its the 1, 2 and 3 keys above the letters (not the numbers pad)

Those hotkeys do not work on an MPB with the 2.8 official release, even with 'Emulate Numpad' disabled. Further there appears to be no way to switch selection modes through the menus. The three selection mode icons in the screen capture above are not displayed.

This saved my life. I hate how many unfixable UI issues blender has, like not showing the shortcut for these buttons when hovering over them like random other buttons happen to

I'm using Emulate Numpad, and in this case 1, 2, 3 are assigned to change views (front, side, ...), so these keys don't work anymore to toggle between vertex/edge and face select mode.
So what I did is change the hotkeys assigned to vertex select mode, edge select mode and face select mode to Shift + 1, Shift + 2, Shift + 3.
Here's how to do it:

go to Edit > Preferences > Keymap
Go to the field next to Name enter Select Mode

Now you should see under Mesh all the hotkeys for the different
selection modes (for me, none of them works to toggle between
vertex/edge/face select) I changed the first 3 to the keys that suit
me, you can also choose different ones.

To change the key, just click on the field on the right with the 1 for example, then it tells you to press the keys you would like to switch it to (I choose Shift + 1 which appears in the field as Shift + Numpad 1 but the key I press to go to Vertex select mode is Shift + 1, so probably that's also because I use Emulate Numpad.

Many Thanks. I use Emulate Numpad and for me, 1, 3, 7, for switching views was so baked into my head that I left those as they were and thanks to your post have now got 2,4,6 for vertex/edge/face selection mode. Again, Many Thanks. Much appreciated.

Welcome :) I'm happy that it was helpful!! The only thing I realized recently is that with Blender 2.82, you can have edge/vertex/face select on at the same time! so I usually forget deactivating for example edge select when switching to vertex select, and loose some time there... but I guess I'll get used to that :D

With respect to Blender 2.8(2018-12-02), using a Mac PowerBook, before the 1,2,3 buttons work...you must: Go to the Edit Menu >
Preferences > Uncheck 'Emulate Numpad'.
Hopefully, saves someone some time!

Just in case anyone else was having an issue with these tools dissapearing all together, make sure you have only the object selected that you want to modify! I had multiple objects selected apparently and could not find the option to toggle the modes at all.

Small remark, when you use numpad emulator and want to remap Selection Mode hotkey, better to remap with:
alt+1
alt+2
alt+3
because shift+.. already mapped with other selections modes and works incorrectly.

This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review

Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

to anyone reading the actual question and answers this answer makes sense! thankfully stack exchange has improved since the rather toxic attitudes previously


text:
Material applied to vertecies not changing color
As shown in the pictures below the green material I changed to this blueish color, doesn't change in solid mode but it does in material preview and render preview mode. Did some reading regarding the issue but couldn't find anything I could fix it with.
Still bit of a newb in Blender and 3D, I do not understand many concepts but I hope someone can give me some pointers. Any tips and help is greatly appreciated, thanks in advance guys!

There is an additional field further down in the material panel for the viewport display :

Colors in Solid Mode and real colors visible in Material/Render preview are independent.


text:
Update object with Simulink data
I'm trying to simulate a simple dynamic system with Simulink (a bouncing ball) but the Simulink's 3D really sucks (because I'm on Linux and don't have the V-Realm Builder) so I was thinking to use Blender as a 3D world. I made a ball above a floor and I was thinking to change the ball's position using the data generated from a Simulink model. I'm using UDP to exchange data (and it works fine) but I can't achieve to update the scene in real-time because the refresh is really really slow. I'd like to move on the next step using data from an IMU and update the scene in real-time but I'm stuck on that.
I'd like to achieve something like this
How can I obtain a decent refresh rate?
Python code
import socket
import struct
import bpy

port = 8888
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
address = "127.0.0.1"
s.bind((address, port))
print("Waiting for data...\n")
sphere = bpy.data.objects["Sphere"]
sphere.location = (0, 0, 20)

for i in range(1000):
    data, addr = s.recvfrom(1024)
    data = struct.unpack('!d', data)
    z = data[0]
    sphere.location = (0, 0, z)
    print("Location:", sphere.location)
    bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)

Simulink model

EDIT
Solution #1
I found a possible solution in this related question, which says that you'll have to edit the template. In my case, it will be something like this (and it works fine; now the only problem is that I have got some delay, maybe because of the UDP)
import bpy
import math
import socket
import struct

port = 8888
address = "127.0.0.1"
base = 20
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind((address, port))
sphere = bpy.data.objects['Sphere']
sphere.location = (0, 0, base)

class ModalTimerOperator(bpy.types.Operator):
    """Operator which runs its self from a timer"""
    bl_idname = "wm.modal_timer_operator"
    bl_label = "Modal Timer Operator"

    _timer = None

    def modal(self, context, event):
        if event.type in {'RIGHTMOUSE', 'ESC'}:
            self.cancel(context)
            s.close()
            sphere.location = (0, 0, base)
            return {'CANCELLED'}

        if event.type == 'TIMER':
            data, addr = s.recvfrom(16)
            data = struct.unpack('!d', data)
            z = data[0]
            sphere.location = (0, 0, z)
            print("Z:", z)

        return {'PASS_THROUGH'}

    def execute(self, context):
        wm = context.window_manager
        self._timer = wm.event_timer_add(0.1, context.window)
        wm.modal_handler_add(self)
        return {'RUNNING_MODAL'}

    def cancel(self, context):
        wm = context.window_manager
        wm.event_timer_remove(self._timer)

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

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

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.wm.modal_timer_operator()

(I'm confident that there is a simpler way to achieve that)


text:
Partial shape subtracting only
Im trying to make some dice but one of the shapes is not subtracting from the cube
 properly. The sun on the right side is only partially subtracting.
I started with some svg vector saved from inkscape, imported and then extruded them.
My plan was to subtract.
Any help?

Edit:

Edit:
Sorry I never Checked my Curves from Inkscape properly. I had some unlinked shapes. I would have thought that blender would say. "Yo, dude... your vector sux"
One of the vector files I saved out from Inkscape had some duplicate nodes that were not linked.
I went back into Inkscape and tidied up the vectors and made sure the shapes were full complete enclosed shapes with no duplicate nodes

In theory, this should work. Upload your blend file to blend-exchange.giantcowfilms.com so we can take a look.

if booleans act weirdly, the problem is usually always on normals (all should point outside), but also check before that you have not a negative scale... that would invert normal visualization...

@Leander http://blend-exchange.giantcowfilms.com/b/2058/

@m.ardito I'm not sure what negative scaling is. I have been googling it still seeing if i can figure it out. I have Checked the normal's of the sun all the lines point outside. Although all the normal's of the cube were pointing inside. I had to Mesh > Normal's > Recalculate Inside to get them pointing out.... howver this still does not work.

Sorry, I meant: in Blender you can set scale to -1. It makes no sense to me, but it is possible and can happen by mistake. When you do that, normals that visually seem to point "outside", are really pointing "inside" (due to negative scaling), thus what you see is wrong, and booleans logic is inverted...

I think I found the problem with that boolean: duplicate vertices!
I've hidden other shapes, to better see the two objects involved by the boolean, and here is you wrong result:

then I selected the "sun" shape, in edit mode and removed duplicates

It had 78 duplicate vertices:

And, after that, the shape works better with booleans...

authors: Василь Свердликівський


text:
How to calculate mean twist of a curve?
Similar to this, But i want a slider that adjusts the mean twist of the curve. As stated in that post the content I need is defined outside of Python API, I and would have to write an operator to do it. I can do that, but I need to know how to do the calculation for the mean twist.

I figured it out. I made a FloatProperty and put the function I was going to write as the update:
bpy.types.Curve.mean_twist = FloatProperty(name='Mean Twist', step=10.0, default=mean, unit='ROTATION', update=get_twist)

Then I wrote the function which got the average tilt of all the points, subtracted that from the floatproperty to get the difference after the change, and added that to all the tilts: tilt + (floatproperty-averagetilt)
def get_twist(self, context):
    cur = bpy.context.active_object.data
    points = cur.splines.active.bezier_points
    rot = cur.mean_twist
    tilts = [p.tilt for p in points]
    mean = sum(tilts)/len(points)
    new_twist = [t + rot - mean for t in tilts]
    points.foreach_set('tilt', new_twist)

Then I just added the float property to a panel as a slider. It changes the actual mean twist and works in Object mode.


text:
Boolean (difference) not working properly on rather simple geometry
This topic seems to be asked a lot.
I am very new to blender, so I am still learning the in's and out's. I am trying to use the small cube to cut out a section of the latch, however, each attempt instead removes the latch and leaves the cube. I have tried the three recommended solutions of eliminating duplicate vertices, recalculating the normals, and making sure the geometry is all closed up. Still, even with those checks, when I try to use the boolean difference modifier, it doesn't work properly.
dropbox file

https://i.sstatic.net/FUXUv.png

Make Sure all the Scale values of the Smaller Simple Block are Positive ... greater than zero.
The scale values should all be positive.  Remove the negative sign.
The smaller item in the picture needs to have all scales positive for clarity and to have the boolean modifier work.
Here are suggested settings for the modifier.

Thank you for the suggestion. Were you able to get the modifier to function properly because following your suggestion didn't work for me. I tried both manually removing the negative sign and then using CRTL + A to set the scale (and even rotation). Neither worked, I simply got the same result. I also checked the larger piece's scale.
I was messing around a bit more with it and the problem seems to be originating with the larger piece. I added a new (third object) cube and was able to remove material from the little block but got the same odd problem when trying to remove from the big piece.


text:
Applying Mirror Modifier with Shape Keys on a rigged Model
Question:
Is there a way to quickly apply a mirror modifier on a rigged character with shape keys?
Story:
I have a rigged game-character and use shape keys to later transit between a muscular and thin person ingame. I use this procedure for clothing as well. Since its not possible to apply the mirror modifier with shape keys the FBX export fails to export the shape keys, which makes it impossible for me to use them in my game.
After intense searching i found out that this is partly possible to do by Hand. The next problem is the Weight-Painting. Since i duplicate my low poly character, to model my trousers or shirts, I need the exact same weight painting, which will not be mirrored correctly during the process I mentioned.
Further research explained me how to mirror the weight painting by hand. My Problem is, that i have to do a lot of Models for the game and it will too much time to do everything by hand.
I doubt that i am the first to have this problem and hope someone resolved this already.
Thanks!

There is repo https://github.com/przemir/ApplyModifierForObjectWithShapeKeys with python script for this. Not posting as answer bcs its only link... Also, it does not work when shapekey produce more vertices, which can happen with mirror pretty easily (ie, your modifier goes on the other side of mirrored object) But you can give it a shot.

For anyone who still wants to know (P.S. I did this in Blender 2.79):
This doesn't fix it entirely, but....
You can remove the mirror modifier,
and duplicate and then reverese the vertices onto the other side.
(E.g. move 3D cursor to centre of mesh, duplicate verts, and scale along x-axis by -1 around the 3D cursor)
Some of the shape keys might be close enough.
But some may need tweaking.
Depending on how lucky you are, this may or may not be easier than removing shape keys, applying mirror modifier, and re-do-ing all the shape keys again :/


text:
How to make fake anisotropic shader
How do I make these kinds of materials?
https://cdnb.artstation.com/p/assets/images/images/010/258/877/original/dzung-phung-dinh-pisciasa-clothesshader-sample.gif?1523458872
https://cdna.artstation.com/p/assets/images/images/010/258/888/original/dzung-phung-dinh-pisciasa-anisotropic-sample.gif?1523458877
To be clearer I want to make something like this:
https://80.lv/articles/stylized-character-production-techniques-in-ue4/
(the stylized anisotropic shader part)

Your question is not clear enough because you didn't specify the version of Blender you want to use.
If its Blender 2.79 internal render,
All you just need to do is to click on "Tangent shading" under the material panel

I'd like it to be Cycles.The examples were done in Unreal engine, so it's a rasterization engine

These could be done procedurally. The last one seems simple, a principled bsdf, metallic: 1, and then you set the anisotropic amount you like. If it had this radial or line reflection it is called anisotropic.
The second one seems to be more complicated and would require lots of nodes. A good start would be to use voronoi as a base. And play around with vectors. This part really seems to complicated to put into words as it requires lots of fiddling around.
The different layers could be achieved using a layer weight node. Plugging the facing value into a color ramp with the desired colors would give you the effect. Afterwards you could use color mix to overlay or add this with the voronoi pattern underneath. This color output you then plug into the color input of the principled shader and I crease the clear coat value with some anisotropic to give the shine effect.
Or you can use two shader nodes with an add shader:
The voronoi pattern without anisotropic under the other one with anisotropic

Is there a way to make the anisotropic follow a fake light source?
So far how you described the effect needs a real light source and would change the further the object is from a light source. Which is okay, but I would also like to know how to make it work without lightsources

i just came to that thought on the fly so it migth be flawed, you can try to get a single point as color input,mask out an area with some color ramp nodes, and plug a texture coordinate node with the reflection vector into the vector of an shader with the masked out are as color input.


text:
Multi animation?
My problem is when I want to add new animation to my project. I find both animation interrupted. Some time it changes it places. this one example when only change frames. Please explain step by step.

I'm sorry but I cannot understand your question. Could you be more specific?

These images show you strange issue i faced when i want to make multi animation. My question is how to make multi animation correctly ?

Ok! That's what you asked, but i'm sorry, looking at the images I don't understand which are the issues you face...

Man, in the second image I didn't change the position of the sphere. If I done from the first animation, and start with the second one. some objects change it position when I change the frame value. Why ? I don't know.

Ok!
Wich way are you making "multi-animation"? Just creating more "actions" in the Dope Sheet Editor or do you do something also in the NLA Editor?

Just creating more "actions" in the Dope Sheet Editor for two objects. first action both objects moving together. second action, both goes far and get close. third action........ and so on.

Ok! Sorry for all the questions :-) Just wanted some info in order to understand. I'm sorry but I can't figure out what's happening. Could you attach a .blend file?


text:
Objects change their places?
I don't know where is my mistake ? every time when make I animation of objects and then change the frame rate, all objects moves to the selected one ?!! I don't want them to change their places like that. How to solve this ?

Could you upload your.blend file to be able to help you

The number highlighted below indicates that your objects share one action which means that they all share the same keyframes.

You can create an copy of the action for the active object by clicking on the number. After that you should be able to modify the object's keyframes individually.
Update:
If you want to affect multiple objects by a single action, I think the default approach would be to add an armature with a bone for every object, add a Child-Of constraint to each object, choosing the specific bone, and then creating an action which animates the bones.

But like this I will have 3 animations for every object rather than 3 animations for all objects. Example, "first action", all objects moves around. In the "second action", all objects go up  and down. How to do this ?

@user43474 I expanded the answer to include a method of grouping related animations for different objects together in one action.


text:
smoke domain casts shadow
I messing around with a scene where smoke blasts into a room from a tube in the wall.
The scene works out fine. I have set the domain to adaptive domain.
The only problem i have now is that the adaptive domain casts shadow on the room.
I have added a screenshot of the scene and a screenshot of the node setup for the domain.
Any clues on how to avoid that ?

blend file
]

Based on pictures I'm guessing that the non-smoke areas still have some density, and that could probably be fixed by clipping the low density areas. I cannot, however test that without a file. could you please upload one here http://blend-exchange.giantcowfilms.com/?

ofc and thx alot, i have uploaded the file here

Finished the test, didn't appear to fix it :/

oh well thx for trying anyways.. hope someone else has an idea how to fix that shadow

solution for now is to make the domain the same size as the room.. its not perfekt and baking takes forever, but i cant figure out how to solve the shadow casting from the adaptive domain.

select your domain, under properties panel go to object--> cycles settings--> deactivate shadow

ohh i will give that a try thx alot :-)

At least, I've tried with your data and it seemed to work

I know it´s quite a while since this Thread was active, but I had the same problem and no of all the solutions (and I searched a lot of other threads..) solved my problem.
My Problem was.. the Render Settings!
Increase your "Light Path"-Settings, and it works.
I hope I could help somebody, too.

Would something like this do?  Vanilla 'OpenGL' render, using smoke images on multiple planes which can be coloured, scaled and slid out from the pipe to suit.

It only takes about 6 secs to render. (10 secs at full size) I d/loaded your file but as you mentioned, it takes an age to render in cycles,

thx for the suggestention , but no it has to be a real raytrace to get it more photorealistic as i am going to use it in a composite with a model (a real human model that is)

authors: Кирил Кирилов


text:
How do I fix these weird lines in my model
I was following along with Darrin Liles character modeling tutorial, and I was doing well, but then I left edit mode and turned off wireframe. I got lines like this (by nose and jaw):

I have no idea how to fix this. Help?
Here's the .blend file:

Hi and welcome to BlenderSE. Please use http://blend-exchange.giantcowfilms.com/ to provide .blend files for analysis. Links to other services often get invalid after a while because people might delete their files.

Those lines are a result of mesh distortion. It means that your polygons aren't "flat". Mesh distortion results in shading errors.
Blender's Mesh Analysis functionality helps you checking with these kind of problems. In the screenshot below you see all the distorted polygons in your mesh. Grey is ok, then it goes from blue to green and finally to red (which means bad).

This is OK to a certain extend, but it depends on the purpose of your model. I would stay in the grey and blue-ish area to keep things safe.
The solution in your case would be working with a little more polygons, for example by adding loopcuts and then moving the vertices until the polygons change their color into blue or turquoise.

I can't seem tp get it to work in my version of blender

How did you get it to work?

@Ian - You have to deactivate the Mirror Modifier to get it working. Mesh Analysis also doesn't like Matcaps as well as several other modifiers.

authors: Саша Парубец


text:
Blender braided beard
I'm trying to figure out how to do a braided beard (fantasy dwarvish'ish style, a bit like this: http://dariofish.deviantart.com/art/Dwarf-Braided-Beard-Test2-409580675).
I am trying out the particle hair. But I can't really make it behave. Here's my results so far:

A couple of things annoy me with this result:
1) Each individual strand looks too thick.
2) It's not braided very nice.
3) The two braids go in a strange direction towards the screen (can't really see that from the picture).
The guy over here made some results I think look much more even:
Large Braids with Hair Particles
But if I try to replicate his settings it all gets much worse.
Does anyone have an idea what I may be missing in order to get closer to the other SE posters results? His braid looks nice and even and the hairs are much thinner.

I doubt that the braids in your first link are done using particles.

I agree. It was just to show what kind of result I was aiming for.

Important stuff I missed was:

Use Simple children instead of interpolated for this
Lots of steps in render settings (using 9)
Cycles Hair Settings -> Thickness to get better looking hair (subjective, I know)
Other settings can be seen in image below.

Now I just need to figure out how to get rid of that fur-ball attached to the monkeys chin...


text:
How to share node value with another node to keep them sync
How should I setup a driver to keep two values same across blend file?
Like ...
World > Mapping node > Z Rotation  value to Object > Mapping node > Z Rotation
It would be handy in case like when you reconstruct environment from equirectangular texture set for World shader and same texture is used for an object I reconstruct like here.

You can simply copy-paste the driver, the values should be the same.

RMB > Copy as New Driver from one Mapping node
RMB > Paste Driver into the second one
Done.


text:
Python: how to effectively rotate 2pi on local axis?
I am trying to rotate an object over it local axis in 2pi using python. Basically I want to animate this, so the problem in rotating the object in 2pi is that it returns to the original position (and not to the position + 2pi), so there is no way I can animate this.
If I rotate the object using the cursor it works. This means, I select the object, press R to rotate, two times Z so I rotate it with the mouse until I reach 360 degrees on the rotation box value. If I follow this procedure I can animate the object rotating over its own axis (not all coordinates, only x and z, since y also returns to the initial position it is not rotated).
Python code for the rotation:
import bpy
import numpy as np
from mathutils import Euler

def set_loc_rotation(obj, value):
    rot = Euler(value, 'ZYX')
    obj.rotation_euler = (obj.rotation_euler.to_matrix() @ rot.to_matrix()).to_euler(obj.rotation_mode)

# add then cubes and add as child of the previous axis
i = 0
bpy.ops.mesh.primitive_cube_add(
    size=1,
    enter_editmode=False,
    align='WORLD',
    location=(0, 0, 0),
    scale=(1, 1, 1))
bpy.context.object.name = f'cube_{i}'

# make axis parent of cube
bpy.ops.object.empty_add(type='PLAIN_AXES', align='WORLD', location=(0, 0, 0))
bpy.context.object.name = f'e_{i}'
bpy.data.objects[f'e_{i}'].rotation_euler = (np.radians(30), 0, 0)
bpy.ops.object.select_all(action='DESELECT')
bpy.data.objects[f'cube_{i}'].select_set(True)
bpy.ops.object.parent_set(type='OBJECT', keep_transform=True)

# rotate the object around the axis in and add keyframes
bpy.context.scene.frame_end = 100
scene = bpy.data.scenes["Scene"]
scene.frame_current = 1
set_loc_rotation(bpy.data.objects[f'e_{i}'], (0, 0, np.radians(0)))
bpy.data.objects[f'e_{i}'].keyframe_insert(data_path='rotation_euler', frame=1)

scene.frame_current = 100
set_loc_rotation(bpy.data.objects[f'e_{i}'], (0, 0, np.radians(360)))
bpy.data.objects[f'e_{i}'].keyframe_insert(data_path='rotation_euler', frame=100)

Result:
 The position is basically the same and I can't animate this.
So how can I do this with python so the axis actually rotates?

Does this answer your question? How to rotate an object?

@L0Lock thank you for the reference, but following that I still have the same problem... Seems that these operations involve the sine and cosine of angles so rotating multiples of 2pi is the same as doing nothing, I am missing the 'phase'.

It's the same(almost the same) value when you do matrix multiplication (360d), so the keyframe values are the same, to fix this,
Change to:
import bpy
import numpy as np
from mathutils import Euler

dic = {
    'X': 0,
    'Y': 1,
    'Z': 2,
}

def set_loc_rotation(obj, value, mode='ZYX'):
    old_mode = obj.rotation_mode

    obj.rotation_mode = "QUATERNION"
    obj.rotation_mode = mode
    obj.rotation_euler[dic[mode[0]]] += value[0]
    obj.rotation_euler[dic[mode[1]]] += value[1]
    obj.rotation_euler[dic[mode[2]]] += value[2]
    return mode, old_mode

# add then cubes and add as child of the previous axis
i = 0
bpy.ops.mesh.primitive_cube_add(
    size=1,
    enter_editmode=False,
    align='WORLD',
    location=(0, 0, 0),
    scale=(1, 1, 1))
bpy.context.object.name = f'cube_{i}'

# make axis parent of cube
bpy.ops.object.empty_add(type='PLAIN_AXES', align='WORLD', location=(0, 0, 0))
bpy.context.object.name = f'e_{i}'
bpy.data.objects[f'e_{i}'].rotation_euler = (np.radians(30), 0, 0)
bpy.ops.object.select_all(action='DESELECT')
bpy.data.objects[f'cube_{i}'].select_set(True)
bpy.ops.object.parent_set(type='OBJECT', keep_transform=True)

# rotate the object around the axis in and add keyframes
bpy.context.scene.frame_end = 100
scene = bpy.data.scenes["Scene"]
scene.frame_current = 1
# set_loc_rotation(bpy.data.objects[f'e_{i}'], (0, 0, np.radians(0)))
bpy.data.objects[f'e_{i}'].keyframe_insert(data_path='rotation_euler', frame=1)

scene.frame_current = 100
obj = bpy.data.objects[f'e_{i}']
mode, old_mode = set_loc_rotation(obj, (0, 0, np.radians(360)))
obj.keyframe_insert(data_path='rotation_euler', frame=100)
obj.rotation_mode = "QUATERNION"
obj.rotation_mode = old_mode

Animate the object by axis-angle
This example shows the cube rotating 360d around the arrow

import bpy, math
from mathutils import Vector, Euler

# Add cube
bpy.ops.mesh.primitive_cube_add(location=(1,1,1), rotation=(1,1,1))
cube0 = bpy.context.object

# Add empty and make parent
bpy.ops.object.empty_add(radius=2, location=cube0.location)
empty = bpy.context.object
cube0.location = 0,0,0
cube0.parent = empty

# Add a direction reference
bpy.ops.object.empty_add(type="SINGLE_ARROW", radius=4, location=empty.location, rotation=(2,2,2))
ref = bpy.context.object

# Animate the empty
bpy.context.scene.frame_current = 1
empty.rotation_mode = "AXIS_ANGLE"
loc, rot, sca = ref.matrix_world.decompose()
up = rot @ Vector((0,0,1))
empty.rotation_axis_angle[1:] = up
empty.keyframe_insert(data_path="rotation_axis_angle")
bpy.context.scene.frame_current = 100
empty.rotation_axis_angle[0] += math.tau # 2*pi
empty.keyframe_insert(data_path="rotation_axis_angle")

# Add a copy to check if it's true
loc = 7,1,1
bpy.context.scene.frame_current = 1
bpy.ops.mesh.primitive_cube_add(location=loc, rotation=(1,1,1))
cube1 = bpy.context.object
bpy.ops.object.empty_add(type="SINGLE_ARROW", radius=4, location=loc, rotation=(2,2,2))
empty1 = bpy.context.object
cube1.parent = empty1
cube1.matrix_parent_inverse = empty1.matrix_world.inverted_safe()

Thanks for your answer. The problem with this approaxh is that I am rotating over global axis and not local axis.  And I want to rotate it using local axis coordinates, thats why I was trying to use the rotation matrix.

If you want to animate an object by rotating around a given axis, you can keyframe the rotation_axis_angle instead of rotation_euler. Because the axis of rotation_euler does not increase linearly, It can be increased several times in both directions (positive and negative)

So the key here is to define the single arrow to define the orientation and keep only the z projection. Thanks!


text:
My code works differently when its wrapped in a function
I am new into scripting in blender. Currently I am testing code snippets by running them into the python console.
Currently I am facing an issue for a while that I am not able to fix.
I have this code snippet, in which Basically I add a new axis and use it to animate some stuff.
I I run this code snippet everything seems to work fine:
tf = 200
bpy.context.scene.frame_end = tf
i = 0
scene = bpy.data.scenes["Scene"]
axi = bpy.data.objects[f'empty{i:03}']
axx_i = bpy.data.objects.new(f'emptyx{i:03}', None)
axx_i.empty_display_type = 'PLAIN_AXES'
bpy.context.scene.collection.objects.link(axx_i)
x_location, y_location, z_location = get_location()
axx_i.location = (x_location,y_location,z_location)
k = np.random.choice([1,2,3])
#
axx_i = bpy.data.objects[f'emptyx{i:03}']
axx_i.rotation_mode = 'XYZ'
#
scene.frame_current = 1
axx_i.rotation_euler = (0, 0, 0)
# THIS IS THE IMPORTANT PART
axx_i = bpy.data.objects[f'emptyx{i:03}']
axi = bpy.data.objects[f'empty{i:03}']
axi.parent = axx_i
axi.matrix_parent_inverse = axx_i.matrix_world.inverted()

however if I wrap the code in a function it works differently. In this case I think that something related to matrix_parent_inverse is not working correctly.
For example if I run the same code but wrapped in a function.
tf = 200
bpy.context.scene.frame_end = tf

def func(i):
    scene = bpy.data.scenes["Scene"]
    # <...>
    # ALL THE CODE FROM ABOVE
    # <...>
    axi.parent = axx_i
    axi.matrix_parent_inverse = axx_i.matrix_world.inverted()

func(i)

the parenting seems to be not working.
How can I get the same results when wrap the code in a function.
As I said, both snippets have been run in the python console.
Blender Version 2.93.3 (2.93.3 2021-08-18)

It took me a while, but just after the axi.parent = axx_i  operation I needed to add this line to fix it
    axi.parent = axx_i
    bpy.context.view_layer.update()
    axi.matrix_parent_inverse = axx_i.matrix_world.inverted()


text:
Why I need to run my script twice to get it to work?
Basically I am trying to write a script to

create a square image
add some objects to it
get the positions of the objects in frame coordinates of the objects.

There is a second part of the script in which I render the frame and also save the positions of the objects in a pickle file but I am not including it to make the script shorter.
The idea is that then I am going to create some bounding boxes to the objects in python and use them for other purposes. So I need to be able to render the image and export object locations in frame coordinates.
If I open the script from blender, the first time I run it it has an error, but the second time I run it it works fine and I get these values
**cube
[0.0035274855948945524, 0.24358138840914842, 0.7366971959744029, 0.9738736891060572]
**********************
**sphere
[0.43452719267736106, 0.5654728073226389, 0.43452716000590824, 0.5654728399940917]
**********************

which are the correct one.
If I run the script from the command line it fails because view3d_camera_border is not working as expected and I get the same error as when I run the script from the GUI:
blender -b --python test_camera_blender.py

So it looks that I have some missing/wrong initial config in the file that after I run it two times it is fixed. I have been tying to debug the whole thing but I am not able to make it work.
Any ideas which configuration I am missing?
Script:

"""
Some usefuleful referenes:
- https://blender.stackexchange.com/questions/55300/how-can-i-get-the-x-y-location-of-an-object-at-each-frame-of-animation
- https://blender.stackexchange.com/questions/237428/get-pixel-coords-for-vertex-in-viewport
- https://gist.github.com/simonecesano/2cefcfac7485939a18249c4672e4a5ff
- https://blender.stackexchange.com/questions/6377/coordinates-of-corners-of-camera-view-border
"""

import bpy
import numpy as np
from mathutils import Vector
import bmesh
import bpy_extras

# make the output dimensions square 1920x1920
create_objects = True
im_size = 1920

def to_rad(deg):
    return deg * np.pi / 180

def delete_all_objects():
    """
    Deletes all objects in the current scene
    """
    deleteListObjects = [
        "MESH",
        "CURVE",
        "SURFACE",
        "META",
        "FONT",
        "HAIR",
        "POINTCLOUD",
        "VOLUME",
        "GPENCIL",
        "ARMATURE",
        "LATTICE",
        "EMPTY",
        "LIGHT",
        "LIGHT_PROBE",
        "CAMERA",
        "SPEAKER",
    ]

    # Select all objects in the scene to be deleted:

    for o in bpy.context.scene.objects:
        for i in deleteListObjects:
            if o.type == i:
                o.select_set(False)
            else:
                o.select_set(True)
    # Deletes all selected objects in the scene:

    bpy.ops.object.delete()

def toggle_camera(context):
    for area in context.screen.areas:
        if area.type == "VIEW_3D":
            space = area.spaces.active
            r3d = space.region_3d
            plane_no = r3d.view_rotation @ Vector((0, 0, -1))
            region = area.regions[-1]
            area.spaces[0].region_3d.view_perspective = 'CAMERA'
            area.spaces[0].region_3d.view_camera_offset = (0,0)
            area.spaces[0].region_3d.view_camera_zoom = -1000
            break
    else:
        assert False, "Requires a $D view"
    return region, r3d, area

def region_3d(context):
    for area in context.screen.areas:
        if area.type == "VIEW_3D":
            space = area.spaces.active
            r3d = space.region_3d
            plane_no = r3d.view_rotation @ Vector((0, 0, -1))
            region = area.regions[-1]
            break
    else:
        assert False, "Requires a $D view"
    return region, r3d, area

def vertex_positions_2d(obj, region, r3d):
    bm = bmesh.new()
    bm.from_mesh(obj.data)
    bm.transform(obj.matrix_world)

    v_2d_co = np.array(
        [
            bpy_extras.view3d_utils.location_3d_to_region_2d(region, r3d, v.co)
            for v in bm.verts
        ]
    )
    return v_2d_co

def view3d_camera_border(scene, region, r3d):
    obj = scene.camera
    cam = obj.data
    frame = cam.view_frame(scene=scene)
    print("**cam frame")
    for f in frame:
        print(f)
    # move into object space
    frame = [obj.matrix_world @ v for v in frame]
    print("**cam frame world debug")
    for f in frame:
        print(f)
    # move into pixel space
    frame_px = [
        bpy_extras.view3d_utils.location_3d_to_region_2d(region, r3d, v, default='NOOTTT') for v in frame
    ]
    print("**frame_px debug")
    for f in frame_px:
        print(f)
    return frame_px

def rescale_2d_to_cam(xy, cbounds):
    x_min, x_max, y_min, y_max = cbounds
    x, y = xy
    x = (x - x_min) / (x_max - x_min)
    y = (y - y_min) / (y_max - y_min)
    return list((x, y))

def get_min_max_from_list(l):
    min_x = np.min([v[0] for v in l])
    max_x = np.max([v[0] for v in l])
    min_y = np.min([v[1] for v in l])
    max_y = np.max([v[1] for v in l])
    return [min_x, max_x, min_y, max_y]

def to_camera_view(scene, cam, obj):
    _c = []
    for vert in obj.data.vertices:
        # local to global coordinates
        co = obj.matrix_world @ vert.co
        coords2d = bpy_extras.object_utils.world_to_camera_view(scene, cam, co)
        # print("coords2d: {},{}".format(coords2d.x, coords2d.y))
        _c.append(coords2d)
    return _c

def create_objects_func():
    # add cube
    bpy.ops.mesh.primitive_cube_add(location=(2, -3.9, 7.2), rotation=(0, to_rad(45), 0))
    cube = bpy.data.objects["Cube"]
    cube.name = "cube"

    # Make a sphere at the origin named 'sphere'
    bpy.ops.mesh.primitive_uv_sphere_add(location=(0, 0, 0), rotation=(0, 0, 0))
    sphere = bpy.data.objects["Sphere"]
    sphere.name = "sphere"

    ## Add a camera facing the cube from 45 top angle
    bpy.ops.object.camera_add(
        location=(15, 0, 15), rotation=(to_rad(45), 0, to_rad(90))
    )
    camera = bpy.data.objects["Camera"]
    camera.name = "camera"

    ## Add a light source
    bpy.ops.object.light_add(
        type="SUN", location=(25, 0, 25), rotation=(0, to_rad(28), to_rad(20))
    )
    lamp = bpy.data.objects["Sun"]
    lamp.name = "sun"
    lamp.data.energy = 1

def main():
    for scene in bpy.data.scenes:
        print(scene)
        scene.render.resolution_x = im_size
        scene.render.resolution_y = im_size

    context = bpy.context
    scene = context.scene
    toggle_camera(context)

    print("______________________")
    print('**debug resolution', scene.render.resolution_x, scene.render.resolution_y)

    region, r3d, area = region_3d(context)

    if create_objects:
        delete_all_objects()
        create_objects_func()
        scene.camera = bpy.data.objects["camera"]

    area.spaces[0].region_3d.view_perspective = 'CAMERA'
    area.spaces[0].region_3d.view_camera_offset = (0,0)
    area.spaces[0].region_3d.view_camera_zoom = -1000

    # get the cube position in world coordinates
    cube = bpy.data.objects["cube"]
    loc, rot, scale = cube.matrix_world.decompose()
    print("**cube world coords")
    print("**loc", loc)

    # Get info of objects
    print("**DEBUG", region, r3d)
    frame_px = view3d_camera_border(scene, region, r3d)
    print("**frame_px", frame_px)

    cam_min_x = np.min([v[0] for v in frame_px])
    cam_max_x = np.max([v[0] for v in frame_px])
    cam_min_y = np.min([v[1] for v in frame_px])
    cam_max_y = np.max([v[1] for v in frame_px])
    cam_bounds = [cam_min_x, cam_max_x, cam_min_y, cam_max_y]
    print("**camera bounds", cam_bounds)

    print(region, r3d)
    final_positions = {}

    for name in ['cube', 'sphere']:

        positions = vertex_positions_2d(bpy.data.objects[name], region, r3d)
        positions_scaled = [rescale_2d_to_cam(xy, cam_bounds) for xy in positions]
        print(f"**{name} ")
        print(get_min_max_from_list(positions_scaled))
        final_positions[name] = get_min_max_from_list(positions_scaled)

        print("**********************")

    print("______________________")

main()

```

The error does not pop up for the first time only, you can provoke it also when running the script multiple times. After running the script, move into the sphere (such that you are inside) and run the script again. This will tigger the error again.
The reason is that, as you noticed, view3d_camera_border is not working correctly, but actually it does. Within that method you're calling
bpy_extras.view3d_utils.location_3d_to_region_2d(region, r3d, v, default='NOOTTT') for v in frame

and when inspecting the debug prints you should notice there are NOOTTT values in frame_px causing the error:

... ufunc 'minimum' did not contain a loop with signature matching types (dtype('<U32'), dtype('<U32')) -> None

As the docs state for location_3d_to_region_2d:

default – Return this value if coord is behind the origin of a perspective view.

This gives you the clue that something with the camera view from the 3D region is wrong. If you run the script for the second time it works because the scene camera's view and the region's view do match accidently. And thats why you can provoke the error again if you're moving the region's camera to a position where "coord is behind the origin of a perspective view".
What you need to do is to update the region after you changed the the view data so you get the correct camera data to work with. You have two places in code where you do:
area.spaces[0].region_3d.view_perspective = 'CAMERA'
area.spaces[0].region_3d.view_camera_offset = (0,0)
area.spaces[0].region_3d.view_camera_zoom = -1000

one in def toggle_camera and one in def main (you should use toggle_camera there too). Change that to:
area.spaces[0].region_3d.view_perspective = 'CAMERA'
area.spaces[0].region_3d.view_camera_offset = (0,0)
area.spaces[0].region_3d.view_camera_zoom = -1000
area.spaces[0].region_3d.update()    # <-- here

and it works like desired.

Hmmm, definitely something changed with this, but you are going to see that the print of the **cube and **sphere coordinates are sill different the first and second time I run the script. I am not obtaining the NOOTTT, so that is good. If I run the script from command line I get a segmentation fault error.

Sorry my bad, coordinates are correct only when I run from the GUI, from the command line I get the segmentation fault error.

I tried it on two different computers with different OS and blender versions and both of them have segmentation error problem. It is when executing the area.spaces[0].region_3d.update() line.

@Iván can confirm. Tbh i didn't checked the command line version. There is another post with exactly the same problem, unfortunately unanswered https://blender.stackexchange.com/questions/279152/exception-access-violation-when-running-python-in-background-mode-and-calling-re Maybe a bug?

Hmm, :( . Actually I need to run this script in the command line version. There is no workaround for this, right?
I am having problems with blender 2.79 and 3.6.1.

Apparently it is not a bug... https://projects.blender.org/blender/blender/issues/102738

Oh wow well.. at least this fits with the crash logs, last call is a GPU_matrix_..._set. If you run the cmdline without -b it works. Maybe that's acceptable for you to have Blender open (maybe minimized)?

I need to run 100k iterations of a similar script in a server to generate a dataset. So having the GUI is not an option :( .

:( Looks like you need to implement your own version of region_3d.update() calculating the updated matrices for region_3d.

FWIW here's the lines in the source code. https://github.com/blender/blender/blob/8e843920d473ac83a70bddfd3bfe0c1bcd6b5e42/source/blender/editors/space_view3d/view3d_draw.cc#L105-L114 @Iván If you know your way around c++ or can find / hire someone to navigate it you might be able to create your own logic there. Expect complicated and heavy matricial calculations though.


text:
How to create a stipple or halftone effect on objects with volume shaders?
I'm trying to create a stipple or halftone effect in Blender on images composed by objects that use volume shaders like these (mostly principled volume shader and playing with emission and density).

Reference stipple, halftone:

I'm looking for guidance on how to achieve this effect.
I've considered a few approaches:

Mapping the textures created with volumetrics to surfaces, and then using the same shaders/geom nodes that are typically used for surfaces.
Applying the effect in the compositing stage.

What would be the best approach and how I can achieve it?
Thank you!


text:
Is it possible to cut a set of lines with the boolean modifier?
I am trying to fill an object (in this case a sphere) with a lines pattern.
So my naive way to do this is to restrict the lines with a boolean modifier by:

Create some lines (here I just duplicated a single line and convert them to meshes and then join them)
Make them a mesh
Apply a boolean modifier to "cut" them so they are only display inside the sphere.

However none of the options of the modifier allow me to do this. All lines disappear.
Why I am not able to do this with the boolean modifier?
The problem still holds if I try to do this with only 1 line.
Also, is there a better way to do this? By this I mean filling a mesh with a line pattern.

Booleaning simple edges doesn't seem to work, if this is what you're trying to do...

Ok @moonboots, so the answer to my question is that this is not possible. Do you have any link or resource then that I can use to obtain what I am trying to do? cheers.

Maybe with geometry nodes? Or use a mesh with faces instead and once you've applied the Boolean, delete the faces only?

I would use GN. But just out of curiosity, what's the point of having a bunch of edges without faces? You can't render them at all, can you?

Boolean Intersection
For boolean you need manifold geometry. After boolean you can reproduce the original edges (except for their changed length) by collapsing the geometry back to an edge. Below I'm removing the 'long' faces (I capture the caps and input geometry surface to reliably select the faces that are not original caps / current caps after cutting, delete them, and then scale the remaining faces (caps), which collapses the edges:

This is how it would look like if the beveling was 100 times thicker:

Cool, this worked! With which parameter are you controlling the beveling?
Honestly, when you make this in geometry nodes I have the feeling that you guys are wizards. I am still really far of being able to think in terms of GN. Thanks!

With the "Scale Elements" node I can control the face size but the sides are only lines and don't are filled with faces.

I am almost there Markus, which parameter are you using? Cheers!

@Iván show your setup; literally all you need to do is to increase Size X and Size Y from $1$ to $2$ in both of my setups. See edits in both answers for .blend files.

My question was related to the firsts frames of your gif, where all the lines are filled and not just the portion that interect the faces of the sphere. I am getting this https://ibb.co/1mVZSdY with your code, which only show faces filled where they intersect the sphere but they are not fully filled. Is there any parameter that controls that? I am not being able to reproduce that part of the GIF that is what I want. I want the the lines to have some thickness and not just the wires of the structure :) . THanks!

@Iván for presentation purposes I dragged the Scale from $1$ to $0$, and before that I was unmuting previously muted nodes to show it step by step. So if you actually need thickness, then just spawn curves, bevel them, and then use an ordinary boolean. The entire solution, both this and the other one, are based on the assumption you want to 'boolean' single lines without thickness, which is harder. Also if you use the raycast method for performance, just add "curve to mesh" at the end, and a "curve circle" as a profile.

Raycasting
If you have convex geometry (otherwise you would need to do it iteratively, like Hulifier does here), you can raycast towards the normal and in the opposite direction, get the average of the two (center), and position a line there, scaling it up to fill the space between the two ray hits:

It's much more performant (and reliable, even if you decide to implement repeated raycasts for non-convex geo) than my other answer:

Hey Markus, thank you very much, but still I am not getting the final result. My sphere is not fully populated by the lines, but partially. I think I followed your explanation, not sure if I am missing something. I upload a picture of the result and my nodes https://ibb.co/6r8ctCx  https://ibb.co/xFD6dv8

Sorry, this was a comment to your other answer, but I am having the same problem as well with this some. Thanks!

@Iván increase your grid's size (or decrease your sphere's size) - you can see in my answer the lines also don't fill the sphere completely, which was done on purpose.


text:
Shading after Boolean
How do i fix this kind of shading after using boolean mod?

EDIT:
I can make the shading better by applying the modifiers and fixing the topology this way.

Possible duplicate of Applied boolean modifier leaving shading artifacts with flat shading

your boolean must have created a bad topology, maybe it would be simpler to create your holes manually

@moonboots How would i cut that kind of hole manually? And isn't there  a  way to fix the topology and shading?

All of these questions have been asked before https://blender.stackexchange.com/questions/5856/cutting-a-circular-hole-in-a-hollow-cylinder-without-distorting-the-cylinder also https://blender.stackexchange.com/questions/3260/how-to-cut-a-rounded-hole-in-a-sphere/3262#3262

I guess there are 2 main ways to do it in a clean way: with Boolean or with LoopTools > Circle.

With a Boolean modifier you must make sure that your boolean object is well placed and has the right amount of vertices. You will probably make some vertices merge. Don't forget to bevel the ring so that it stays clean and sharp.
With the LoopTools > Circle tool, you must first delete some faces, use the LoopTools > Circle, then extrude inwards and close it manually.


text:
Shape key and driver Problems Blender 2.8
I'm rigging a character and I would like to fix spots that weight painting won't fix with shape keys.
But assigning bone as a driver doesn't do anything.
It's controlled by an IK bone and doesn't seem to have any rotation information of it's own.

Can you include some pictures of the driver in question?

Can i upload the blend file?

@Skullfaceguy use https://blend-exchange.giantcowfilms.com/. Unfortunately due to how constraints are implemented, you don't always have local space rotations available from them. https://blender.stackexchange.com/questions/112657/how-to-drive-shape-keys-based-on-the-angle-between-two-bones?rq=1 has one way of getting around this

I tried this in 2,79 and they did have their own rotation values, so this might be a 2,8 issue


text:
How do I get rid of this annoying axis?
I'm working on a Roblox rig in Blender. Everytime I set the pivot point (origin) to the selected mesh of the bones, an axis seems to be following it and showing up anywhere I set the origin of the object. It also appears under the root bone. How do I get rid of this?

Hi, welcome to the site! Just to be clear, which axis are you talking about? The red-green-blue transform widget, the big white X-Y-Z thing, or something else?

It seems to be an empty type of axis that I never even added. I don't see it anywhere in the outliner either.

That's interesting. Not even parented to the bone or something? If it's not anywhere in the scene, did you enable any addons? (Blender comes preinstalled with quite a few.)

Or if not, perhaps the file has an embedded Python script that runs automatically when you open the file. (Can't remember if that's on by default, but you can turn it off.)

I just fixed the problem. I simply went into "Properties", went to the "Object" section of the bones and unchecked "Axis" under Display. Thanks for the help!

You're quite welcome, although I didn't do all that much. (: Would you mind taking the time to write up an answer to your question? It'll let people know that your problem's been fixed, and it'll help other people who come here with the same problem.

(I'd do it, but then I'd be getting all the fake internet points instead of you, and that wouldn't be very fair. :D)

I have resolved the problem. I realized that I had "Axis" checked under "Display" while looking at the properties of the object.


text:
SVG file consisting of curves does not import into Blender
Importing https://upload.wikimedia.org/wikipedia/commons/4/46/Bitcoin.svg, a file which looking at the source code appears to be made of paths and have no raster images in it, does not make any objects appear, either in the viewport, or in the list of objects, when I import it into Blender 2.79b. Does anyone have any idea why this might be happening, and how I can fix it?
Edit: The question linked as a possible duplicate does not solve this, because again, this file only has curves, not rasters.

Possible duplicate of Cannot Import .SVG File

That svg file works fine in blender 2.7b here on linux.

Strange. I will try in a different file with a different rendering engine.


text:
Find the largest open editor window, split it and set its type
I currently have
class OpenNodeEditor(bpy.types.Operator):
    """Open the node editor"""
    bl_idname = "scene.open_node_editor"
    bl_label = "Open Node Editor"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        bpy.ops.wm.context_set_string(data_path="area.type", value="NODE_EDITOR")

        return {'FINISHED'}

This works, but when I press the button, it switches the space that the button is in (active editor), in this case, the properties editor, to the node editor. How can I make it open up a new section in the layout or open the node editor in the largest open editor?

a better and more general title (useful to more people) would be 'Find the largest open editor window, split it and set its type'

Your code is working as expected as it is setting the type of the context area, which is where the button is, or the text editor if run from there, or the py console if run from there etc.
You could fix by overriding the wm.context_set_string operator.
However it's prob much easier to find the other area with maximimum area.
import bpy
from bpy.types import Operator
from operator import itemgetter

class OpenNodeEditor(Operator):
    """Open the node editor"""
    bl_idname = "screen.open_node_editor"
    bl_label = "Open Node Editor"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        screen = context.screen
        areas = [(area, area.width * area.height) for area in screen.areas
                  if area != context.area]
        if len(areas):
            maxarea, a = max(areas, key=itemgetter(1))
            maxarea.type = 'NODE_EDITOR'
        else:
            #split areas
            direction = 'HORIZONTAL' if context.area.width < context.area.height else 'VERTICAL'
            bpy.ops.screen.area_split(direction=direction)
            screen.areas[-1].type = 'NODE_EDITOR'

        return {'FINISHED'}

Also note: your operator above is the equiv of
row = layout.row() # some layout
op = row.operator("wm.context_set_string")
op.data_path = "area.type"
op.value = 'NODE_EDITOR'


text:
How to fill ngon with quads?
Using knife project I have created a custom mesh for a modular Unity asset so it works for my use case. I now have a n-gon that creates a really ugly topology in Unity:

I would like create quads from my ngon. It should be simple but I can not find a way to do that. The knife tool does not snap to vertices initially. Once you start the first cut it seems to snap to vertices but then I would have to start cutting again to start at any other existing vertex.
If I right-click a edge I get teh Knife topology tool which lets me snap on a vertex. I ended up with this topology, not too bad for a noob?

I was going to suggest using  Knife with the C constrain option to keep  cuts parallel to X and Y. .. but, hey.. now @batFINGER has given you a button to push.... forget it :)

I ended up using C constraint. Trick was to get knife to snap to the first vertex, you get that with the knif topology tool.

Bisect with boundary edges.
Based on the rectangular nature of the corners of given mesh.

Sample result, far from optimized as some edges above could be dissolved.
A script to create a plane from all the boundary edges. The plane coord is edge center, the plane normal is nominated up direction (Z axis) crossed with edge direction.
Script, run in edit mode.  Note in hindsight should limit this to selected ngons, and edges.  For test sake make the ngon its own object, place in edit mode.
import bpy
import bmesh
from mathutils import Vector

ob = bpy.context.edit_object
me = ob.data

bm = bmesh.from_edit_mesh(me)

up = Vector((0, 0, 1))
def as_plane(e):
    return (
        (e.verts[0].co + e.verts[1].co) / 2,
        up.cross(e.verts[1].co - e.verts[0].co).normalized(),
        )

planes = [as_plane(e) for e in bm.edges if e.is_boundary]

while planes:
    plane_co,  plane_no = planes.pop()
    if plane_no.length < 1e-4:
        continue
    bmesh.ops.bisect_plane(
            bm,
            geom=bm.edges[:] + bm.faces[:],
            plane_co=plane_co,
            plane_no=plane_no,
            )

bmesh.ops.remove_doubles(
        bm,
        dist=1e-4,
        )

bmesh.update_edit_mesh(me)

That is so elegant (Sweetie) !


text:
Reflective and transparent material on poster
I'm doing an interior scene and on one of the walls, I have a poster with a thin fram around it. To make it a little bit more realistic, I want to create a material just like a thin and transparent plastic board above the poster with reflections.
I made a separate object close to the poster, but I guess I could also apply this effect on the image texture?
But anyway, I tested to use window glass materials like this, but it is perhaps too much reflections:
How can I make a more realistic glass shader?
Any suggestions of node combinations to create a transparent and reflective plastic material or reflections on image texture?

As you do not need anything like refractions, I don't think you need to consider the Glass shader.
In this situation, I would personally create a simple mix of Transparent and Glossy shader, and adjust the mix until you got the look that you wanted. Obviously it will be a mix of high transparency, and just a little glossy.
To get a physically accurate result, you could use the Fresnel or Layer Weight nodes to control the mix (so you get more Glossy on the glancing angle, and less Glossy when viewed straight on). Add a Math node to multiply the Fresnel and you can play around until you get the result you want.


text:
exporting UV texture
I am new to blender, I made a rocket model with a texture and it looks fine in blender
however when I export it and put it into a game engine the texture is not right

any tips on how I can correct this?

Do you have more than one UV map on the mesh?

what do u mean? I am using one texture, but all the components of the texture are seperate

I used a smart UV project

You can have multiple UV maps on one mesh. Also the texture looks different color, are you sure you are using the same file? Can you add your blend file to see whats wrong? http://blend-exchange.giantcowfilms.com/

the yellow is on the bottom of the rocket, for some reason it is smearing over the side too. I do not know how to attatch a blend file

The texture is not packed in the blend file, but I dont see any reason in the UV to show a result like that. You have some unnecessary overlapping faces and Unwrapping could be done better. Which format did you use for export the model?

I used a .obj file, yes I was just testing with this model and did not put much time into stuff like that

sorry, I forgot to do that, this one is packed I believe

I got it to work using a different way of obj loading....but my previous obj loader still doesnt work, I may be making a mistake with exporting because the old one works with all my other models...


text:
Weird Black Spot with Glossy Material
Why am I getting a black spot in the cylinder. The scene is nothing special consists of few objects with no materials except for the cylinder, and lighting comes from the environment map.

The cylinder is smooth shaded and simply using a glossy material with the default settings.

Could this possibly have to do with render settings. I have tried re-adding the cylinder and creating a new glossy material but with the same results.

does your cylinder have a face at the end? If so that is what is causing the shading artifacts.

The problem is caused by the smooth shading that you hve applied to the cylinder.
So you can try just adding a loop cut all the way to one end and then another loopcut all the way to another end.

Why is this the case? What makes it work internally after adding those loop cuts?


text:
Does bmesh guarantee order of vertex in a edge according to the time they were added
I would like to represent directions in a single edge in a mesh similar to a curve.
However I cannot use curves themselves due to performance issues when dealing with huge amount of curves and not able to have more than 2 endpoints. Linked:
Creating/Handling pathfinding large world waypoints in Blender
So I am thinking to represent the order of vertices in an edge as direction. Then I would simply either expose the direction via a gl draw or in the UI panel and also allow to invert the direction by deleting the edge and adding it again in opposite order.
For instance, I add a place using the following code
    vertex1 = bm.verts.new((-0.5, -0.5, 0.0)) # 0
    vertex2 = bm.verts.new( (0.5, -0.5, 0.0)) # 1
    vertex3 = bm.verts.new( (0.5, 0.5, 0.0) ) # 2
    vertex4 = bm.verts.new( (-0.5, 0.5, 0.0)) # 3

    bm.verts.index_update()

    # How to create edges
    bm.edges.new( (vertex1, vertex2) ) # 0
    bm.edges.new( (vertex2, vertex3) ) # 1
    bm.edges.new( (vertex3, vertex4) ) # 2
    bm.edges.new( (vertex4, vertex1) ) # 3

Later when I access the bmesh again, using
    obj = bpy.context.edit_object
    me = obj.data
    bm = bmesh.from_edit_mesh(me)

    # are the vertices stored in edge guarentee'd to be
    # in order at the time they were added
    bm.edges[0].verts[0] == bm.verts[0]
    bm.edges[0].verts[1] == bm.verts[1]

I have tested it and it does seem correct for few of my test cases. However, I would like to be certain.

The order of both vertex indices stored in an edge (me.edges[#].verts), or the vertices references respectively (bm.edges[#].verts) should not change unless you make it so (by flipping an edge I guess).
That is because the order is important. Think of a line of 3 connected edges: if you flipped the vertices referenced by the middle edge, it would still look like the same edge. But both vertices would need to be switched (as in coordinates) - but that doesn't work because they are used by other edges.
(Unscientific) stress test:
import bpy

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        break
else:
    raise Exception()

ctx = bpy.context.copy()
ctx["area"] = area
ctx["region"] = area.regions[-1]
bpy.ops.ed.undo_push(ctx)

ob = bpy.context.object
me = ob.data
bpy.ops.object.mode_set(mode='EDIT')
print()
print()
t = {}
for e in me.edges:
    v1, v2 = e.vertices
    t[(v1, v2)] = "{: 8.4f} {: 8.4f} {: 8.4f} | {: 8.4f} {: 8.4f} {: 8.4f}".format(*(me.vertices[v1].co[:] + me.vertices[v2].co[:]))

bpy.ops.mesh.sort_elements(type='RANDOMIZE')

bpy.ops.ed.undo_push(ctx)
me.update()
bpy.ops.transform.translate(value=(0,0,2))
bpy.ops.object.editmode_toggle()
bpy.ops.object.editmode_toggle()
bpy.ops.ed.undo(ctx)
bpy.ops.mesh.sort_elements(type='RANDOMIZE')
bpy.ops.mesh.flip_normals()

for e in me.edges:
    v1, v2 = e.vertices
    if t[(v1, v2)] != "{: 8.4f} {: 8.4f} {: 8.4f} | {: 8.4f} {: 8.4f} {: 8.4f}".format(*(me.vertices[v1].co[:] + me.vertices[v2].co[:])):
        raise Exception()

The order of geometry elements is not guaranteed on the other hand (me..index / bm..index), although it is practically stable, as long as you add and remove in stack principle (last in, first out).
If a vertex / edge / face other than the one with the highest index is deleted, all elements with a higher index will shift to fill the gap.
There are also mesh operations to sort mesh elements based on properties like distance to camera, or randomize the indices even.
You could use a custom data layer to store an explicit order (e.g. bm.verts.layers.int), but beware of the value propagation: if you extrude a vertex for instance, that custom data will be carried over to the new vertex.
This patch might be interesting for you: https://developer.blender.org/T42865

Hmm, Doesn't the edge only hold pointers to BMVerts and not its indices? What if other vertices are deleted but not the ones in the current edge. Would vertices data order inside the edge would still be true?
I basically need a way of representing a direction inside an edge like a vector. A custom data layer for an edge seems to be suitable rather than for the vertex?

Sorry, I misread your question. Edges point to vertices, no matter what the indices are. In polygons, the order of vertices matters, because it determines in which direction it faces. The order is therefore retained. I assume it's the same for vertices referenced by edges, although I can't tell for sure.

There's a bug in bm.*.sort(), so I couldn't test it properly, but I think the test I added to my answer would fail in case of edge key flips - but doesn't. Also see me rationale above.

The test code fails to actually run using blender 2.74.
    RuntimeError: Operator bpy.ops.mesh.sort_elements.poll() failed, context is incorrect

You need to have a mesh in edit mode,.

Yup it fails in the last condition now. What are edge flips though?

It fails even with a mesh selected and in edit mode? It doesn't do that for me... By edge flip I mean to swap the two verts an edge references. But Blender doesn't actually allow this it seems (at least the bmesh module will reject a 2nd edge of there's already one with reverse vertex order)


text:
Is it possible to add physics to geometry nodes?
I'm instantiating lots of objects with geometry nodes and now I want to add rigid body physics to those objects so that I can make an animation of them falling. Is it possible to do this?
I don't want to apply the geometry nodes modifier and then simulate just one configuration of this setup. I want to be able to change the geometry nodes parameters on the fly and then simulate them.
I'm using Blender 3.3.1.

without applying...up to now...no.

You can add cloth physics, but not rigid body.

Too bad, it would be really neat to have this type of thing so that I don't have to apply every time I want to see my objects in action :/


text:
How do I paint only one side of a mirrored object without effecting the other?
Im creating an avatar and the character im making is supposed to be half and half colors. The issue is, i mirrored the right side of the character so whatever i paint on the right appears on the left and vice versa.
Im wondering if theres a way to texture paint only one side of an object with out it appearing on the other?
Thanks in advanced.

Apply the mirror modifier then you can paint each side separately.

I have the mirror modifier already enabled, im trying to paint only one side of the body without it mirroring to the otherside.

You say that you have it enabled, but have you applied it? If it's not been applied one side of the mesh doesn't really exist so you can't paint on it directly. Hover the mouse over the modifier in the modifiers panel and hit Ctrl-A to apply it.

I tried out some other ways i didnt think of before and they worked, apologies for taking up some of your time ^^"

No problem. Glad you're sorted. It would be helpful for others searching for the same problem if you could explain what you did to get over your own issue. You should be able to add an answer below to your own question.


text:
Normal map not doing what it should, weird shading
Hi I recently tried baking high poly normals to a low poly mesh for the first time and I encountered a weird issue. My normal map seemed to differ between project files. In my baking project file the normals were exactly how i wanted them, but when trying to apply it to the same mesh in another project the normals were super wonky.
In the below image you can clearly see that the topology of my low poly mesh is somehow impacting the normals even though I've assigned a normal map.

Here is my normal texture as seen through the viewer node in the same project file. I can see nothing wrong with the texture itself

...and here is a wireframe view as well

The UV map is fine

Here is the viewport from my baking project file, it's how the normals are supposed to look (if you ignore the small artifacts from the material preview).

When i baked I used "object space" because it gave me the best result and both projects have non color data selected for the normal texture.
I have no clue how this is happening and I hope some expert can help me! Thanks for reading.

Your normal map has colors that are out of the spectrum, maybe share the high-poly object you've baked (and the low-poly)

I would have to see a file.  But seeing as you baked exploded, the most likely cause here is that there was some rotation or non-uniform scale involved in putting the revolver back together.  Object space normal maps have no tolerance for those kinds of deformations.  The normal map image represents the remapped object space normals of each sample.  Those are no longer valid under most kinds of deformation.  Like if you rotate the cylinder, the face that used to point in object +Y is still going to be pointing in +Y via the normal map, even though the face has now been rotated to point in +Z.

I agree with what's mentioned above, however, I also wonder how much the abundance of Tri's and Poles are complicating the mix. Blender does have some tolerance for these things, but smooth shaded objects with rounded (curved) surfaces are normally the worst offenders.

@Nathan Okay, would applying transforms help? And also how am I supposed to bake details without doing it "exploded". I tried baking everything unexploded but that gave a very poor normal texture as the different meshes in the object intersected with the high poly mesh in some places.

No, applying transforms after the bake is going to make things worse.  You can bake exploded, but you can't deform (including whole-part rotation or non-uniform scale.)  Once object is baked, you cannot apply rotation or scale, you cannot deform, you cannot leave live modifiers to deform dynamically, you cannot join objects with different rotation or scale.

@Nathan Thanks for the input, I will try redoing the bake without doing any sort of adjustments to the objects themselves and report back.

I finally figured out what I was doing wrong, turns out I should not be using object space when baking. http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Tangent-Space_vs._Object-Space
Also Nathans answer helped me understand how you bake normals better. Thanks for the help everybody.


text:
Cannot access UV: Squares despite it being enabled on Blender 3.0
I am going through the Blender Guru donut tutorial. I'm stuck on Part 5, Level 3: Condensation at the 9:30 mark. The issue I am having is that I have installed UV: Squares on my computer and it seems to be enabled in Blender, but I can't find the toolbar. I've spent hours working this out and I am very confused. Please Help

That tutorial is for Blender version 2.83. If you're using Blender 3.0 or above you should be using the donut tutorial which has been completely rewritten for version 3.0. https://www.youtube.com/watch?v=nIoXOplUvAw&list=PLjEaoINr3zgFX8ZsChQVQsuDSjEqdWMAD

Looking at your Preferences image you appear to have two entries for the addon which may be confusing Blender. Try removing one of them and try again.


text:
Issues with symmetry, possibly Origin?
Doing a sculpture of a face, I'm having issues with the symmetry tool, I've been trying to mirror the left side of the face to match the right side. But every time I do it merges the face weirdly in the middle and cuts out the nose.

I think that it might be an issue with the origin, but I've reset it using the 3D curser, and setting origin to geometry, but neither work.
I also tried using the mirror modifier and that yields the same results.

Also maybe apply the rotation of your object?

That fixed it, Thanks!

Your object is not aligned with the global orientation, so it doesn't symmetrize as expected. Just apply its rotation.


text:
1920 x 1080 res to 1080 x 1080 res
I'm taking a video I made for youtube in 1920 x 1080 that I want to fit formats on intagram which are 1080 x 1080. I've taken the video rendered at 1920 x 1080 an dropped into a blender sesson set at 1080 x 1080. I've then shrunk down the video. so I am left with a gap and a chunk of the frame from the 1920x 1080 chopped off.
Heres a screen shot. I hope this problem is clear? Im expecing to have the 1920 x 1080 to maintain its ratio and for there to be gaps at the top and bottom?
thank you very much.

If you want to use a larger video in a smaller project you will discover some serious design flaws in the video sequence editor. I'd advise you to do the transform with the compositor.

uh oh, i haven't use the compositor before. what do I do here?

In your transform strip properties set the Scale to 1.0x0.55. Works for me with a 1920x1080 source video and Blender set to 1080x1080 and rendered to video fine.

@ rob I tried the transform but I was hoping to illustrate in the screenshot that despite scale the screen blender and lopped off part of the original frame, its just not there? edit I see what you mean....that will work for now thats very much!!...it would be good it work out the ration so you don't how to judge the scalling?