text:
How can I find two vertex indexes per face on a mesh to create a secondary alignment vector
I've had troubles in the past with instance spinning when using "Align Euler to Vector" to align instances to face normals on deforming meshes.  I have a setup that eliminates all spinning problems by aligning one Euler to the face normal (Z) and then also locking a second axis (X or Y) by aligning to a vector created from two of the vertices that make up the face.  There is one major shortcoming of my setup that I need help with - currently I am manually stating the vertex indexes that form this second vector (nodes highlighted green).  I want the vertex indexes to be automatically ascertained by somehow sampling the faces.  I have a feeling I need to use the Corner-of-Face node but just can't figure it out.

Here is the blend file with the setup.
Take a look at the above blender file and you will see that on the single triangle the "spike" object is aligned to the face normal AND one the face edge between vertex 0 and vertex 1 - perfect!  On the icosphere however things go wrong as they are all trying to align to verts 0 and 1 rather than two vertexes from each of the faces that spawn an instance. Automatically using the correct vertex indexes will provide a golden solution to instance spinning on deformed meshes.

If you just want to stabilize them so you don't really care about which edge of the face they're on they align with, you can simply Sample Nearest edge for its index, then Sample Index for that edge's directional vector using the two Positions from Edge Vertices:

Update: Stabilize for animation
To stabilize the rotations when the mesh is deformed, instead of referencing the nearest edge dynamically, we can do as you've suspected we should, and employ the positions of certain two face corners instead. The Corners of Face node with its Sort Index set to $0$ can get us the first corner. Using Offset Corner in Face set to Offset: $1$ we can select the very next one. We can now subtract the positions of these two corners and capture that information as an attribute on the Face domain to use later in the nodetree for alignment:
 Left: Align to nearest edge Right: Align to the first two face corners
With more complex geometry and deformations, even when you stabilize the two axes, the third one can still randomly switch between one direction and its opposite, resulting in unwanted movement. To stabilize the third axis, you can finally align it to the Cross Product of the two previous ones (a third vector that's perpendicular to both):
 Left: Two axes stabilized. Third sometimes switching sides. Right: All three axes aligned

Thanks for the input.  Because the mesh deforms with time the "nearest" edge changes which results in the instances changing alignment to different edges (at least I think that's what is happening) - which isn't desirable.  Have a go scrubbing through the timeline so that the animated deformation occurs and you'll see the effect.  Feels like you're way closer than me though... any way you can adapt your setup?

@DavidM Sorry about being hasty with my answer, I missed the animation issue. Updated the answer with another solution.

Perfect!!!  Rock solid instancing off faces - been after this since I started Blender.  Thank you so much.  It actually solves an earlier question I posted a while back here: [link] (https://blender.stackexchange.com/questions/278372/how-do-you-prevent-geometry-node-instances-spinning-on-deformed-geometry-second)  If you want to pop over there and reference this answer I can mark it as the answer there too - don't want to take any credit from you. :)

@DavidM Glad to be of help. I think duplicate questions are supposed to be closed, so I'm gonna do that. The "closed" banner will have a link to this one so we don't have to copy paste the same answer. Cheers.

@DavidM Noticed that they can still flip orientation if you don't align all three axes. Updated the answer with a third alignment setup.

Wow! Perfect - totally bomb-proof - thanks for update!  Assuming the flipping occurs when a quad is broken by a vert crossing the imaginary line between the two other verts it is connected to....

@DavidM That's one possibility. There's no bulletproof logical reason why it should align to this side or the opposite, maybe it prioritizes some directions (away from the origin? the shorter triangulation for the quad?) or something like that, but it'd be impossible to predict all corner cases so it's better to just strap them all down :)

This question should be renamed as "How to calculate face tangent"

I want to use this method but using "Distribute Points on Faces" as the spawn points rather than relying on a single face spawning a single instance but it appears beyond me!  The distribution of points on faces has to occur before the deformation (to prevent re-calculation of number of distributed points and resulting instances popping in an out of existence) and to have them move along with the underlying geometry.  I'm guessing that sampling nearest face will come into it but... too tricky for me!  Can anyone help? @Kuboå perhaps? :)


text:
Cycles, material with color based on height and backside in different colors
I am trying to set up a Cycles texture to render figures for a math textbook.  I am new to blender and am having trouble.  I am looking for an effect similar to

or

Ideally the front and back surfaces would be rendered in different colors and a surface would be transparent enough to see another surface behind it, but its back faces would not show up in the transparent parts.

Please explain in more depth what you are asking. Is it the texture or the graph you want to replicate? And what do you mean with the back faces not showing up in the transparent parts?

What have you tried so far and what specific aspect of this are you having trouble with? Is it the modelling or the material?

I have no trouble generating the geometry.  I have trouble with the specularity, diffusion, and making the front and back surfaces different.

I think you can find your answer here: http://blender.stackexchange.com/questions/2082/how-can-i-make-a-material-only-apply-to-a-side-of-a-plane

source: Stack Exchange

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

sort: votes


text:
Backface culling from blender to unity
I've got a finished model which is made up of circles on top of circles with a cylinder on the bottom, trying to resemble a pine tree.

When i export the model as .fbx with the 6.1 ACII to unity, the model shows up in a wierd way and i have no idea why and how to fix it. It looke like this:

Thank you.

Try checking normals (http://blender.stackexchange.com/questions/3606/why-are-some-faces-in-my-mesh-darker) and apply transforms (http://blender.stackexchange.com/questions/7298/why-is-it-important-to-apply-transformation-to-an-objects-data). If it doesn't help please provide your file.

You can preview the backface culling in Blender with the check box in the shading panel. To fix your problem, just tab into edit mode, then hit Ctrl + N to recalculate normals.

I already found the solution, I needed to do what you said and then solidify the mesh so that the inner faces are visible,  now the outer and inner faces can be seen with no problem.  @MrZak

You actually don't need to solidify the mesh. This adds unnecessary geometry (that isn't good for game engines like Unity); please see my gif.

I already saw it but I also need the inner faces visible (like if you were looking under the tree) and flipping the normals only makes the outer faces (when you see the tree from the front) visible on the mesh and I need both inner and outer, thanks for your help anyways, it speed up the process of figuring it out.

The fact is, Game engines uses the Backface Culling to speed up their real-time render engine.  You had to enable the double-sided feature in 3D game engines or create the solidified model so you do not see any culled parts.  Blender had no part in this.

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


text:
Animation stutters at beginning and end of loop
I am pretty new to Blender so I apologize if this is a stupid question. I know it has been asked before, but during the past hour of trying, I have been unable to implement a satisfactory answer.
I have an animation (of a hippo's tail) moving back and forth in an idle animation. I am using Bezier interpolation to get a nice smooth animation and it works great with the exception of the first and last frames of the loop. I could probably get around this problem in a number of ways. I could add additional negative and positive frames at the beginning and end of my animation and loop only the central portion. I could manually edit the curves to be approximately correct. I could turn the interpolation to linear and deal with the associated issues.
What I want though is to be able to  indicate that the first and last frames are actually the same frame and have the loop working properly. I've tried adding the cyclic F modifier, but I can't get it to work properly.

Thanks very much for the help, it is much appreciated.

I should examine your .blend file to be sure, but I think that  the problem lies in the fact that your loop starts at 1 while the animation starts at 0. Instead of using 0, 8, 16, 24, 32....., use 1, 9, 17, 25, 33 ....
You'll end up with a 1-129 group of keyframes, go to keyframe 128, select all the rim and insert a new keyframe, then set the loop 1-128. If Keyframes 1 and 129 are identical it should loop perfectly.
Another way to loop an animation is via the Non Linear Editor (NLA).

The reason your animations are stuttering at the start/end is because Blender doesn't know that the animation is supposed to be a loop during preview, it just plays the animation through over and over. This means the first and last frame are getting played back-to-back!
If you are going to keep the animation in Blender, you can just set the playback to exclude either the first or last frame. This will immediately fix the animation Timeline previews (but that's it--use the NLA editor as suggested above). But if you are exporting an animated model to Unity, you can set the playable frames for looping animations to be all but the first or last during import.
Also: You will probably get a better match for the loop if you choose the Interpolation for the first and last frames in Blender to be "linear" in the Graph Editor.

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


text:
How to select a face of a torus using python?
I have to automate the face selection process of torus.
What is the python command to select the face ?

How can I extend this to select a loop of faces?

I want python script which when run will select a face of torus

What is the criteria to select the initial face?

For 1 click script
Add torus -- go to edit mode --- select a single face (confirm that ur in face selection) -- run
import bpy
bpy.ops.mesh.faces_select_linked_flat(sharpness=0.261799)
bpy.ops.mesh.select_nth(nth=3, offset=0)
bpy.ops.transform.translate(value=(0, 0, 0.5), constraint_axis=(False, False, True), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, release_confirm=True)

If you just want to select a face loop
Add torus -- go to edit mode --- select a single face (confirm that you're in face selection) -- run
import bpy
bpy.ops.mesh.faces_select_linked_flat(sharpness=0.261799)

I want to automate the complte process pls help!

2 method given above as u said 1st is full automate just add a torus and select a face and run and 2nd is just to select face loop

But selecting a face is not automation.Is there a command to select the face? Pls help


text:
How to add a shortcut for 'Reload Scripts'?
Blender 2.7x used to have F8 to reload scripts.
As an add-on developer I rely on reloading the scripts a lot and having to press F3 and search for "Reload Scripts” every time I update the add-on I develop and that's pretty much inconvenient IMHO. I tried to add shortkey in the keymap section of the settings but it seems that 'Reload Scripts' doesn’t exist in the list of operators that can be attached to shortkeys.
Q: Is there any way to get F8 back? And in general, how do I go about adding a shortkey to any other operator that is not listed in the keymap section?

New shortcuts can be added in the preferences Edit > Preferences > Keymap.
With the keymap tab open, navigate to the Window category of shortcuts. Click the Add New button to create a new shortcut. The operator for reloading scripts is bpy.ops.script.reload() therefore the identifier for the shortcut is script.reload. Click on the shortcut field and press F8 to set the key binding.

In the default keymap for Blender 2.80 there is no existing key binding on F8 which means you can add the shortcut without any problem.

you can add the reload scripts to Quick Favorites. Doing this, you just have to press Q button and access the Reload Scripts.
To do this, you type reload scripts in F3 search - right click in reload scripts - add to Quick Favorites

not the best answer yet,
but you could try with these commands,
from the script-editor or console-window:
import bpy
bpy.ops.preferences.addon_refresh()
#
# OR:
# (replace module name !) - first disable ...
bpy.ops.preferences.addon_disable(module="space_view3d_align_tools")
# ... then re-enable
bpy.ops.preferences.addon_enable( module="space_view3d_align_tools" )

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


text:
How can I render Volume Scattering on all my layers?
I have an interior scene in witch I want to have atmospheric falloff (dust effect).
I've created an object that contains my room and I gave it a volume scatter shader (I'm working in Cycles).
The problem that I have is that my scene is very big and I need to render seperate layers. How do I deal with my volume in such a case ? I can't add it to each layer because when I combine them the volume will be to dense. I tried adding it only to the lights layer but it doesn't work.
As I said, it's a very big scene and I need to light it with a sun (can't use a spot light) so world volumetrics can't help.
I can do that in the compositor with my Z pass but this is not the answer I'm looking for.
I hope you understand the question.

You should use the render layers mask feature.  First divide up your solid objects between render layers however you would like.  Then, place your volume object on its own separate layer.
With the volume layer active, select the squares that correspond to the solid object layers using the "Mask Layer" selector.

Here is a sample result I put together.  Each cube is in its own render layer.

And this is what the volume layer looks like by itself.  You should combine the layers using the alpha over node.

I just noticed (after so long) that I had upvoted but not thanked you.
So thx a lot for your answer, it helped me at the time. :)


text:
How to make changes to my vertex groups with python
I need to mirror my weight paint from one side to the other. The mirror modifier isn't working for me because I have existing weight paint and groups for both sides. Unfortunately it's not feasible for me to manually copy and mirror each group like what has been done in a way suggested by another answer.
But it did inspire me to put myself into the position of not yet having the other side of groups yet. I tested this theory out by deleting my 'b__L' groups then using this script:
import bpy
obj = bpy.context.active_object

vg = obj.vertex_groups[:]

for g in vg:
    if not g.name.endswith('.L'):
        obj.vertex_groups.new(g.name+'.R')
        g.name = g.name+'.L'
    else:
        obj.vertex_groups.new(g.name.replace('.L', '.R'))

I added the modifier and this worked! So is there a way for the script above to be modified to:

DELETE all starts with 'b__L' groups
Ignore anything that doesn't start with 'b__R'
Add suffix '.R' to groups starting with 'b__R'

THEN

Duplicate the remaining 'b__R' groups (ignore others)
Replace title text of duplicates ('b__R' to 'b__L')
Change the suffix of duplicates, '.R' to '.L.'

THEN something to simply remove the suffixes finally for import to game.
I'm aware this means I will have to remember to always delete the left hand side of my model to use mirror w this. I have no experience with Python and I’ve tried making some changes myself and it’s just returning me errors. Appreciate any help.

Ultimately what was missing here was another look at the core issue. Only toggling a suffix on and off was not the answer. My groups had names that differed by one character to their counterpart and regardless of having the correct .L/.R suffix, meant they could not link with the mirror modifier. I did not need to delete the vertex groups relevant to the mesh side I had deleted as previously thought.
That being said, this is the code you're after if you need to achieve something similar.
In my case, remove the prefix that caused the group names to no longer be linked to their counterparts [4:]. Add the correct suffixes. Revert both of these changes when the script is run again for import back to game.
import bpy
active_object = bpy.context.active_object

vertex_groups = active_object.vertex_groups[:]

for vertex_group in vertex_groups:
    if vertex_group.name.endswith('.L'):
        vertex_group.name = 'b__L' + vertex_group.name.replace('.L', '')
        continue
    if vertex_group.name.endswith('.R'):
        vertex_group.name = 'b__R' + vertex_group.name.replace('.R', '')
        continue
    if (vertex_group.name.startswith('b__L') | vertex_group.name.startswith('b__R')):
        suffix = '.L' if vertex_group.name.startswith('b__L') else '.R'
        vertex_group.name = vertex_group.name[4:] + suffix

Thanks to my lovely sister for this script. Hope it can help someone else out there!


text:
button switch properties constraint
I want to do switching between FK / IK using the button, not a slider, and do this in the form of a 2 button ( fk and ik)
Pressed fk button - value 1 in the constrain copytransform fk (copytransform ik = 0)
Press ik button - constrain copytransform ik = 1 copytransform fk = 0
without driver
Here is the standard panel code:
import bpy
class RigUIPanel(bpy.types.Panel):
    bl_label = "My RigUI"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_category = "RigUI"

    def draw(self, context):
        layout = self.layout
        obj = context.object
        row = layout.row()
        row.label(text="FK/IK Switch")

        row = layout.row()
        row.operator("mesh.primitive_cube_add")
        row = layout.row()
        row.operator("mesh.primitive_cube_add")          #here is a button for example, but it            now performs the function of adding a cube#

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

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

if __name__ == "__main__":
    register()

One method for doing this is to create a scene bool prop 1 for each custom prop, this could then use an update 1 or get/set 1 call that would allow it to update the custom prop for false = 0 true = 1 but I do not understand how to do it


text:
How to render small object, as pixel art, without losing any of the pixels (Cycles render)?
I am creating pre-rendered sprites like in those classic pixel art games such as Commandos or Desperados. I use low render resolution 60x60 but the render results were blurry. And I found a nodes tutorial for render layer that makes the rendered image have sharp edges. This all works fine for bigger objects but when rendering the smaller ones as gun or knife it sometimes just crop all the pixels and the result is that the object is not visible in the end. I also use freestyle line set for my character though the gun is in a group that's not have apllied freestyle on it. And I am wondering if it is possible to keep the blurred pixels but give them color and not look transparent?

Render at a higher resolution, then use the compositor to achieve pixelation.

I don't have the privileges to comment so posting this as an answer. Did you ever solve this? Also what does your Shader node graph look like. This is one of the better pixelation effects I have seen.

I would render at some multiple of the target pixel dimensions, and then take it into Photoshop.  Edit the original and/or the downsampled result to get the features you want.  For something that small, with just a few missing details, just paint it in using the pencil tool: turn anti-alised smudges into crisp (oversized) blocks; adjust the location of an edge so it downsamples nicely; etc.


text:
Are Meshes within Meshes bad?
The pink spikes seen below are meshes for the model's hair with partical effects and are connected to bones with a damper chain modifier for "bounce".
-Do I have to delete these inside meshes and connect them to the base of the head and or other solution?
-Will these inside meshes be problematic for the unwrapping process?
I am in the process of making this model into an Animaze Avatar.

if it currently gives the result you are expecting you don't have to connect them to the head. You can remove the faces that are not visible as they are not useful

Thank you for your answer, I'll definitely get rid of some face then, my comp is so slow

Intersecting objects are "bad", because the intersections don't get smoothed by the Subdivision Modifier or smooth shading. It may also be problematic for 3D printing, or e.g. unwrapping a papercraft, or unwrapping UV if you intend the color to not change suddenly between the objects. If those and maybe some similar issues are not a problem, then it's not bad.


text:
How do I duplicate node with connections
I got a node with multiple connections. How can I duplicate it so I wouldn't need to reconnect them all over again? Maybe there is a way to copy connections from one node to another?

If you use Shift+Ctrl+D instead of Shift+D to duplicate nodes, the duplicate keeps the (input) connections.

Damn. That's right. Thank you. No such option in the menus, so it didn't occur to me to check the shortcuts.


text:
How do you prevent geometry-node instances spinning on deformed geometry (Second Align Euler To Vector?)
I have a sphere (but could be anything) that I am deforming over time and I want to have instances distributed on the surface.  I've got it almost working except that I am getting unwanted spinning of some of the instances - See Blend File base of sphere and scrub around fame 100.  In my setup I am aligning the euler to a single vector (the normal of the vertices) which works great for making the instances point outwards BUT recognise that without a second axis being defined there is nothing to prevent the instance spinning around on this vertex normal axis... which they are clearly doing.  I assume that I need to define a second axis (X or Y) to prevent this unwanted spinning... but have no idea what vector to use and how to achieve it... and assume because it's deforming it's going to be harder to achieve?
The scene: Blender File
Internally Blender appears to be able to solve this as when I mute/disable the instancing in the geometry nodes (but keep the deformation node group) and then within the sphere's Object Properties >Instancing choose to instance on faces it works fine - no spinning of the instances.  I recognise that this second approach is instancing on faces rather than vertices but the same issue arises in the geometry node setup if I choose to instance on faces (via points on faces and capturing the face normal).
Not sure if this affects any possible solution but I often want only a few instances, not one for every face on a sphere, and so actually cut a few faces from a sphere and use those (and then the remaining faces are used to spawn different instances in a separate object)
I want the power/flexibility of the geometry node setup as the Object Properties instancing is super basic... but definitely need to avoid the uncontrolled spinning. Can anyone help?


text:
How do I render with frame_change_pre handler active?
I am working on a Python-driven scientific animation using Blender 2.83.1.  The animation includes four watt meters which are visually represented by Text objects.  Each text object has a custom property named "kw" which stands for kilowatts and is the value I wish to display.  The text objects are driven to show the corresponding value using a handler and animated with keyframes.  The color of the text is also changed to red or green depending on the sign of the number.
The problem
When I scrub through the timeline it works just fine in preview.  However, when I attempt to render it, the hander does not seem to do anything and the rendered frames are all identical.
The ugly workaround
After studying Execute Python script between rendering animation frames and Handler frame_change_pre doesn't work in render which seem to be describing the same problem, and finding that the proposed solutions there don't work for me, I came up with an ugly workaround shown in the code below as a Python routine called slow_render.  For each frame, it sets the frame, temporarily reduces the animation length to a single frame and renders that animation.  This is ugly, slow, and only works if output is a series of still images.  Also, I found that I had to set the frame twice to get the intended effect.  I don't know why.
Questions

Is there a better way to do this?
Why doesn't frame_change_pre seem to work during renders?
Why did setting the frame twice seem to be necessary?

Screenshot

Code
The code I'm using to drive this is relatively simple.  It has a handler called my_handler which uses the value of the custom kw property to alter the text body.  It also has a main routine which installs the handler as a frame_change_pre handler and then sets up key frames for the significant events in this simulation.  The meters are named meter.load, meter.solar, meter.batt and meter.net.  The first three are driven from data in the script and the last is calculated as the negative net value of the other three.  In other words meter.load + meter.solar + meter.batt = -meter.net.
import bpy

def my_handler(scene, depsgraph):
    for meter in bpy.data.objects.data.collections['meters'].objects:
        #meter = meter.evaluated_get(depsgraph)
        kw = meter.get('kw')
        color = 'delivered' if kw < 0 else 'received'
        meter.data.body = "{:+.1f} {}".format(kw, "kW")
        meter.active_material_index = 0
        meter.active_material = bpy.data.materials[color]
        print(scene.frame_current, meter.name, kw, color)

def slow_render():
    scene = bpy.context.scene
    lo, hi = scene.frame_start, scene.frame_end
    for f in range(lo, hi):
        bpy.context.scene.frame_set(f)
        bpy.context.scene.frame_set(f)
        scene.frame_start = f
        scene.frame_end = f+1
        bpy.ops.render.render(animation=True)
    scene.frame_start, scene.frame_end = lo, hi

if __name__ == "__main__":
    alreadyInitialized = len(bpy.app.handlers.frame_change_pre)
    if not alreadyInitialized:
        bpy.app.handlers.frame_change_pre.append(my_handler)
        meter_name = ['meter.net', 'meter.load', 'meter.solar', 'meter.batt']
        # define the power for (load, solar, batt) at each point
        #         predawn    morning           noon           afternoon         evening      night
        kws = [0.2, 0, 0], [4.1, 0, 0], [2.7, -5.5, 2.8], [3.2, -0.9, -2.3], [5.9, 0, 0], [12.1, 0, 0]

        # calculate net value using list comprehension
        [m.insert(0, -sum(m)) for m in kws]
        # now assign values
        framenum = 1
        for pwr in kws:
            print("Frame: {}".format(framenum))
            for i in range(len(pwr)):
                bpy.context.scene.frame_set(framenum)
                meter = bpy.data.collections['meters'].objects[meter_name[i]]
                meter['kw'] = float(pwr[i])
                print("\t{} = {}".format(meter.name, pwr[i]))
                meter.keyframe_insert(data_path='["kw"]')
            framenum += 30
    else:
        slow_render()

Other details
These are probably not relevant to the solution to this, but here are some additional details that may help reproduce exactly what I have here:

I'm using the Eevee render engine
I'm running on Fedora 32 Linux
My default F-curves are set for linear interpolation
The background is set to use the Holdout shader (black under Eevee, transparent under Cycles)
For Cycles renders, I'm using CUDA and a GeForce GTX 1060 6GB card
System is Intel Core i7-6700 CPU @ 3.40GHz
The two materials used are simple Emission shaders; a red one called "delivered" and a green one called "received" which represent negative and positive numbers, respectively.  Both have Fake Users so they will always exist.

Results
Based on the helpful feedback I received here, the video is complete.

Hi. Does this help? https://blender.stackexchange.com/questions/167551/sun-object-not-moving-when-rendering-animation

Have you tried using frame change post?

@RayMairlot: I read that too, and tried what I think it suggested (see commented out line in handler) but it didn't work for me.

@batFINGER: yes, I've tried both post and pre and have the same problem either way.

Ed Vid looks great.  Love Kermit the Frog's narration.

@batFINGER:  :)  Thanks for your help!

Use frame_change_post, and evaluated object

Test script.
Have added a collection to scene collection containing font objects with a "kw" custom property.
This property has been animated using keyframes.
To get the animated custom property value use the evaluated font object.
import bpy

def handler(scene, depsgraph):
    meters = scene.collection.children.get("meters")
    if meters:
        for m in meters.objects:
            print(m.name)
            em = m.evaluated_get(depsgraph)
            m.data.body = f"{em.get('kw', 0):4.2f}  {m.get('kw', 0):4.2f}"

#bpy.app.handlers.frame_change_post.clear()
bpy.app.handlers.frame_change_post.append(handler)

In your opinion, is this a duplicate of the question I mentioned?

I'm working on applying this to my project, but still don't understand, so I'm unable to fully duplicate it.  Why post rather thanpre and why is the evaluated get only used to retrieve the value?

@RayMairlot  50 / 50 above uses the evaluated objects (em) data, but sets the objects (m) data. m.data.body = str(em["kw"])   Prob should make more of using an object in the scene. Evaluating some object in bpy.data that is not linked to scene is probably not going to work as expected either.

@Edward  AFAIK the depsgraph passed to pre is always None.

... in other words its not yet evaluated for that frame.  We are changing the body of the font object linked to the actual object, not that of its evaluated copy. eg em.data.body

Thanks for your patience.  I've read this about depsgraph and this about handlers, but they're rather terse and I still don't completely understand what's going on.  Is there something else I should be reading?

For some reason frame_change_post is not called when rendering the animation from the render menu. Any idea how to run the handler function every frame while rendering the full animation?

dunno... the image in question is result of  render animation from the render menu.


text:
Wrap an array around an object without a curve
I have an array of cones I am trying to wrap around another object like in the reference photo:

When I am trying to use the array modifier's "Object Offset" all cones are thrown randomly all over.
When I try to add a shrink-wrap modifier it just flattens out the cones into circles.
I also tried revolving the array using the Curve modifier but am getting this weird result:

Is there a way to wrap around the object the cones like in the picture without adding a new curve from scratch?
Original Blender File

A solution, but with a curve: Let's imagine that this is the neck of your character, use the knife to cut the shape of the necklace (K to activate, C to cut through):

Duplicate the edge loop you've just created, separate it as a new object (P) then in Object mode select the new object and convert to curve. Now use this curve as Curve modifier target for the pearl object:

I tried implementing your solution but got some weird results, I edited my question to show how it ended up like. Am I doing something wrong in the process?

Could you please share your file?

Yes, I edited the original post and added a link to the file at its ends

You need to put the curve and the object at the same location: first select the curve, right click > Set Origin > Origin to Geometry, then Shift S > Cursor to selected, then select the object and Shift S > Selection to Cursor. If it's not correctly oriented, select it, switch to Edit mode and rotate it 180°


text:
How to approach a character's face?
I noticed I am struggling with the same concept over and over.
I try to model a character inspired by a referenced photo, I finish with the general body of the character but when I reach modeling the different parts of its face (mouth and eyes) I have no idea how to do it properly.
Here is an example:

At first, I tried drawing the eyes on the texture, but I have concluded that texturing in Blender is not suited for this kind of stuff and more for well, the texture of the body rather than specific features of its face. When trying to draw on the texture it is never very precise and quite tedious.
I also have dabbled in sculpting but this too seems to be an approach that requires too much precision.
Is there a good rule of thumb for handling the eyes and the mouth in object mode?

There are several solutions for the faces, the eyes and mouth can be either pictures or volume, it really depend on what you prefer, maybe try to model them instead of using pictures. Also instead of sculpting begin with low-poly modeling, make sure to begin with as less faces as possible, but for the moment we can't see the wireframe, please show how it looks like

First you should probably decide if you want to model the face features, or if you only want them as texture. About modeling, try searching for "head topology" on your favorite search engine. It will give you an idea how to approach face features modeling.

@moonboots I have update the photo to show the wireframe of the face.
I assumed I must have it as a volume but I am open to any option that can show decent results without too much complications.

I don't think it is a good idea to begin with a UV sphere, nor to have so many faces at the beginning, nor to have separate parts (body/head/ears/etc), begin with the whole body and with as few faces as possible

I don't think there are any techniques specific to this. Seems to me this is just general modelling and texturing. Can this question really be answered?..

Dear Eule, maybe you could rephrase your question a bit. "trying to draw [...] and sculpting [...] is not precise and quite tedious" - However, many artists use these tools for exactly that purpose. If you can highlight your exact problems with either approach, we could maybe help you more effectively. (But I can confirm, the texturing tools of Blender are very bad. The sculpting brushes however are fairly good.)

Here is a quick breakdown to show you how you can model a character face

It's usually a good idea to start with a subdivided cube, so you'll get even topology
Roughly shape the model to get a similar overall shape as your reference. Here, I changed the mesh proportions and extruded the ears
If you don't have enough resolution for further detailing the model, apply another subdivision modifier
For the eyes, I made a selection of faces in the area where they should be and I did an inset on these faces to get a loop around the eyes (important step topology wise)
I did the same for the mouth, but deleted the inner faces after the inset operation
I then made the mouth bag, the teeth and tongue, the eyes (I just duplicated the eye socket faces and  and made the shape go outwards instead of inwards). I also slightly changed the topology around the eyes and mouth to add little bumps
Next I added simple shading, the scales on the skin and the iris(Btw this isn't the best way to make an eye, I recomend you check how to make cartoon eyes using a lattice)
Final result

Hope that helps


text:
How to get elbow IK constraints to work properly?
So far I have 4 IKs on my rig: 2 arm and 2 elbow. The arm IKs work fine but the eblow IKs are wonky. When translated, the elbow IK is hinged by the arm IK. If I set the elbow IK to chain length > 0, they simply stop working entirely. Any idea what I am doing wrong?
File:

If you set the bicept Ik chain to one, it works pretty well, but generally this kind of rig is constructed with only one IK: the forearm pointing to the arm IK, then you can use the elbow IK bone as the pole target of the single IK constraint.
Don't forget to set the right pole angle (in my example 180 degrees).

So I've done that except changed the chain length to 1 and angle to 0. How do I go about making the IK to move the arm then since this now only moves from elbow down?

In your original rig you could set the upper IK chain to one (from elbow to shoulder) and the lower IK chain to 2 (from wrist to shoulder). In my rig i've set only one IK chain and - as it is in the image - the chain lenght has to be 2 (form wrist to shoulder). In pose mode, after posing the wrist, you can pose the elbow pole bone to set the position of the elbow. Search for free Nathan Vegdahl amazing serie of video tutorial about rigging, they are perfectly explained.


text:
How do you remove Mirror and SubSurface seams?
I'm fairly new to Blender and am trying to make a human face mesh using the Mirror and Subdivision Surface modifiers. When I attempt to do so, the result shows this seam in the mesh and does not have the mirror align properly, as well as the subsurface creating a rip in the center mouth. How do I resolve this issue?
File:

Upload you file: should be a problem of "Clipping" . . . you didn't tick it

How do I upload the file? Or do I need to paste a download link?
Also, is it too late to tick Clipping?

http://blend-exchange.giantcowfilms.com/help/
upload your file will help a lot; then we will understand if we are late or not ;)

See http://blender.stackexchange.com/questions/15347/how-to-lock-center-vertices-with-mirror-modifier and http://blender.stackexchange.com/questions/6063/subsurf-and-mirror-modifier-creating-a-split-in-mesh

Thanks for the link. Uploaded file now. I tried to fix what I could with the seam by using the Clipping so far
Edit: I got it all removed! Thank you so much :)

@MrZak Why not mark this question as a duplicate of that second link? It's exactly the same.

@Fuboski: You should provide that as an answer as it solved the question.

Thank you for the comments, I've got it to work now! Issue was I needed to tick Clipping then apply Subsurf after the Mirror modifier.

Accept this as your answer to your question for future users who come asking the same problem. :)

will do. Says I need to wait 2 days before accepting my own answer though

Come back in two days then, don't forget!

You should Fuboski give the possibility to answer and mark that as answered as he pointed you in the correct direction and should earn the reputation for it ;-)

That's an option too. Fuboski, have your comment as an answer and I'll mark it :)

authors: Николай Миров


text:
How can I add a bone constraint to an armature bone if it only lets me select the individual bones outside of Object mode?
I need to add some bone constraints (specifically IKs) to an armature and therefore need to select an individual bone. However, I can only do this in Edit mode which removes the option to add bone constraints in the first place. How can I do this properly?
File:

To create a constraint follow these steps:
1) Select a bone in your edit mode; in this way you are working with your armature and not with your main mesh

2) Then switch from Edit mode to Pose mode

When you clicked on Pose mode you'll see your selected bone changing color from orange to blue
3) Now you can select the bone you prefer and create whatever constraints you need. You found all the types of constraints here in the image below

Thank you! Btw I am trying to make some IK bones and have X-Axis Mirror turned on, but it isn't actually mirroring. Any ideas why?
Nvm I figured it out. I had some double joints that weren't supposed to be selected :)


text:
Shading issue with textured solid model
Seems like something went wrong here.
Already tried to re-unwrap the wrong displayed parts of the mesh, also changing shading mode from smooth to flat and back to smooth. It still looks like this:

However, it seems like it actually doesn't have to do with the material shading. What else can I do to let it being displayed correctly?
Recalculating the normals did NOT work. It still only appears in "textured solid", pure solid mode shows the model like it should. Else no errors in the texture itself.

 .blend-file:

Looks like you need to recalculate normals

Tried, but with no changes to the displayed mesh.

Can you add a snapshot with mode details like UVs, modifiers etc...

It seems most likely to be an issue with the UV map. Those overlapping UVs near the bottom look suspicious, but it's hard to tell what might be going on without a closer look. Is it possible you could upload the .blend (with packed textures)?

If you could explain me what you mean with packed textures and how I can do that, sure.

See http://blender.stackexchange.com/a/5372/599. Packing the textures will embed them into the .blend so that they go wherever the .blend goes.

Okay, done that. How can I 'upload' the .blend file now?

@xDonnervogelx Upload it to some hosting service (e.g. pasteall or blendexchange) and put the link here.

Thanks for your help, managed to upload it (well yesterday).

You have a vertex color layer on the object which is causing this.
Remove it in Properties > Object Data > Vertex Colors:


text:
Partial transparency with node editor ignores other objects behind (draws world background)
How to combine nodes-editor transparency with uv-mapped textures in Blender Render?
This question here is strongly related to the one that came up whilst I worked with that problem there.
Same situation as before;
An object that shall act as a partly transparent mane.
The object below the mane shouldn't be affected by the mane's transparency. (In general no other object).

 As you can see, the result is not as wished. I honestly have no clue what to do since I'm pretty new to nodes editor.
If anyone knows how to fix this, I'd be happy for any help.
If needed, I will try to put up a file with those two objects. Just might take some time until I got all files sorted.

What I now found out thanks to this video (https://www.youtube.com/watch?v=BKxUKzpx--s), which showed me a slightly different way to get my transparency problem fixed, might be just a solution that was fine for me, because I will stick to game mode anyways.  So others who have the same problem and have no use for 'Blender game' might be dissapointed. It only helps in that direction. (Means, if anyone else has got a concrete solution for nodes editor in blender render, shall feel free to share their knowledge^^)
 ---
After I switched into Blender Game, I went to the materials-tab.  There showed up an option that I desperately needed. It's called "Game Settings" and I just needed to scroll through the options to select 'blend alpha'. This made the texture show up with a blended alpha that worked fine.
When I switched to texture view, the texture still looked wrong; not transparent. I checked the transparency-panel in materials-tab, selected raytrace and set alpha to 0. Now the whole object appeared almost invisible.
After I then switched to texture-tab and selected full alpha control by the texture, the surface acted like expected.
Here the screenshots of the told settings:
Materials Tab Texture Tab

I'm not quite sure what I did, but with the Transparency > Alpha: at 0.6, like Img 1, I was able to produce Img 2.
Img 1:

Img 2:

I used Img 3's node setup and it started working. Suddenly, I could see the checker background behind the cube.
Img 3:

Here is the .blend file:

Edit:
Checker Background:

I took a look at the file so far, what I just found out was a different way to solve my problem. Nodes editor seemed to be unnecessary afterwards. I will reply to my question to show what I just found out. It somehow just will work for me, because I needed to switch mode anyways. I explain the rest in the answer, just gets more confusing otherwise.

@xDonnervogelx If my answer helped, please consider accepting it. It would help me greatly and make me very happy. Plus, please consider that even if you accept your own answer, you won't get the +15 rep from it.

I still am a bit confused about what exactly you tried out there. What do you mean by "produce"? I see that you mixed the values there. The thing is, that the texture itself hasn't got blended transparency. Mine does have so. It's hard to understand what way you went and what solution you earned, apart from having the whole texture by 60% alpha. The thing with the checker-background is new to me. Did you render it or enter a specific texture/materials-view? I'd need more information in total that's the problem.

@xDonnervogelx It's in the world settings. See my edit.

Ah okay, I see. But I fear that your reply has not so much to do with my question, maybe you misunderstood my problem in general? But cool thing that the world BG can be influenced by this, too, this is at least something I didn't know before.


text:
How can I add a glow to a tv screen without ruining the video playing on it?
I am producing an animation where there is a tv set playing an episode from the Twilight Zone series.
As you can see on the picture, the image on the screen is crisp and clear, but as I will dim the light in the room, I need to have a glow coming from the screen.
I have tried to use an emission shader for the screen, a point light in front of it, a cube as projector, but all these solutions are ruining the image, rendering it grey or even totally white.
What do you suggest I could do to have the screen glowing and keep video that is playing looking good?

sorry I could not get the image loading.. I must have a wrong link..  if you can confirm what link to use for loading an image or video?  Thanks

http://meta.stackexchange.com/questions/75491/how-to-upload-an-image-to-a-post

Light Path node..  that's it.  I knew there should be a way but I missed it.  Thank you for the answer..


text:
Two armature, two rest pose, fixing animations
So I have one FBX that have it's own armature and one object. Let's call it T pose. I have second FBX that contains one armature with let's say walk animation.
I am trying to assign walk animation to object with t-pose with no success. What have I tried so far:

Adding just walk armature to object won't work. I mean I can add the armature, but walk armature's rest pose is different than t-pose's rest pose. If I just change armature, animation is awkward.
I wrote one simple Python script that copy rest pose of walk animation and paste it to rest pose of t-pose. That didn't helped.
tried Copying FBX animation to armature

Am I right that deformations in animations are just offsets from rest pose?
I see others had same problems like:  Merge multiple fbx animations into single rig
or Import fbx animation
Is there any solution for this? Any comment is appreciated.

The solution is rather simple.
You need to add Bone Constraint -> Copy Transforms to armature without animation. As Target add armature with animation, and as a Bone, bone with the same name. Rinse and repeat for all bones.
Here is the code that automates all:

Creates constraints and link bones with other armature
Iterate over all frames, apply transform, and insert keyframes for all bones
Delete constrains

Just fill source and target armature, and animation from and to.
Moreover, you can just call add_constraints() function which will link armatures and bones.
import bpy

source = "Bip001"
target = "Bip001.001"
frame_from = 0
frame_to = 35

# add constrains and link them with target bones
def add_constraints():
    global source, target

    source_ob = bpy.data.objects[source]

    for bone in source_ob.pose.bones:
        sel_bone=source_ob.data.bones[bone.name]
        sel_bone.select=True
        bpy.context.object.data.bones.active=sel_bone

        trans_bone = bpy.context.object.pose.bones[bone.name]
        if trans_bone.constraints.find('Copy Transforms') == -1:
            if bpy.data.objects[target].pose.bones.get(bone.name) is not None:
                bpy.ops.pose.constraint_add(type='COPY_TRANSFORMS')
                trans_bone.constraints["Copy Transforms"].target = bpy.data.objects[target]
                trans_bone.constraints["Copy Transforms"].subtarget = bone.name

# delete previously created constrains
def del_constraints( ):
    for bone in bpy.context.selected_pose_bones:
        copyLocConstraints = [ c for c in bone.constraints if c.type == 'COPY_TRANSFORMS' ]
        # Iterate over all the bone's copy location constraints and delete them all
        for c in copyLocConstraints:
            bone.constraints.remove( c ) # Remove constraint

def apply_animation():
    global source, target, frame_from, frame_to
    #set keying set to whole character
    #we have all bones selected
    scene = bpy.context.scene
    for frame in range(frame_from, frame_to ):
        scene.frame_current = frame
        scene.frame_set(scene.frame_current)
        # apply visual transfrom to pose Ctrl+A
        bpy.ops.pose.visual_transform_apply()
        # insert all keyframes -> press I
        bpy.ops.anim.keyframe_insert_menu(type='__ACTIVE__', confirm_success=True)

def select_all_bones():
    global source, target
    ob = bpy.data.objects[source]
    for bone in ob.pose.bones:
        b=ob.data.bones[bone.name]
        b.select=True
        bpy.context.object.data.bones.active=b

ks = bpy.data.scenes["Scene"].keying_sets_all
ks.active = ks['Whole Character']

ob = bpy.data.objects[source]
# uncomment line below if you are using Blender version below 2.8 and comment out 2nd line
#bpy.context.scene.objects.active = ob
bpy.context.view_layer.objects.active = ob
bpy.ops.object.mode_set(mode='POSE')
#select_all_bones()
add_constraints()
apply_animation()
del_constraints()

Thank you for that plugin code Izzy. I just ran it on Blender 2.8.8lts and it works great, with one caveat. The source and target in the code are reversed, it seems. I had to enter my actual source as Target, and my actual target as Source in your code. Thanks again for filling in one of the multiple gaps that the Blender Foundation allows to remain in their software.

You are welcome @nmc. If I get some free time, I may create an addon from it.

Thank you for the code, it works great in the GUI. However, it fails when called from the command line (headless mode). The problem is with the call to bpy.ops.anim.keyframe_insert_menu, which throws a "context is incorrect" error. I believe it's because the call refers to a menu, which is not available in a non-GUI context. Is there any other call that would accomplish the same thing?

@Rafael Idk, maybe in that case you are in object mode. Did you try to switch to edit mode?

@Izzy, I solved the problem by replacing your call to keyframe_insert_menu with a block that calls bone.keyframe_insert for each bone.


text:
Bad faces converting a Blender model into Unreal Engine 1 (1999)
Well, I tried to export a model to UnrealEd 2 (the one from 1999). I tried to check the normals but I have no idea on how to do this conversion. They are all correct on Blender though. Maybe it isn't normals?

As you can see above, some faces are black and Unreal Engine 1 typically adds some "colored salt" over the worst ones.
So if you have experience with UE1, could you help? :)
Oh, and before I forget, script I use to export to clipboard:
import operator
import functools
import bpy
import subprocess

scale = 64

brush_template = """
Begin Map
Begin Actor Class=Brush Name=Brush0
    CsgOper=CSG_Add
    MainScale=(SheerAxis=SHEER_ZX)
    PostScale=(SheerAxis=SHEER_ZX)
    Level=LevelInfo'MyLevel.LevelInfo0'
    Tag=Brush
    Region=(Zone=LevelInfo'MyLevel.LevelInfo0',iLeaf=-1)
    bSelected=False
    Begin Brush Name=BlenderExportedBrush
        Begin PolyList
            {polygons}
        End PolyList
    End Brush
    Brush=Model'MyLevel.BlenderExportedBrush'
    Name=Brush1
End Actor
End Map
"""

polygon_template = """
            Begin Polygon
                Origin   {origin}
                Normal   {normal}
                TextureU +00000.000000,+00001.000000,+00000.000000
                TextureV +00000.000000,+00000.000000,-00001.000000
                {vertices}
            End Polygon
"""

vertex_template = """
                Vertex {x},{y},{z}
"""

def flog(string):
    open("c:\\tmp\\ub.log", "a").write(string + "\n")

def generate_brush(polygons):
    return brush_template.format(polygons="\n   ".join(polygons))

def generate_polygon(vertices, normal, origin):
    normal = [int(x) for x in normal]
    origin = [int(x) for x in origin]

    nm = normal
    onm = nm
    nm[1] = nm[2]
    nm[2] = str(-int(onm[1]))

    og = origin
    oog = og
    og[1] = og[2]
    og[2] = str(-int(oog[1]))

    nm = [-int(y) for y in nm]

    if nm[0] > 0: nm[0] = "+" + str(nm[0])
    if nm[1] > 0: nm[1] = "+" + str(nm[1])
    if nm[2] > 0: nm[2] = "+" + str(nm[2])

    og = [-int(y) for y in og]

    if og[0] > 0: og[0] = "+" + str(og[0])
    if og[1] > 0: og[1] = "+" + str(og[1])
    if og[2] > 0: og[2] = "+" + str(og[2])

    flog(str(nm))
    return polygon_template.format(vertices="\n ".join(vertices), normal=",".join([str(x) for x in nm]), origin=",".join([str(y) for y in og]))

def generate_vertex(x, y, z):
    if x >= 0: x = "+" + str(x)
    if y >= 0: y = "+" + str(y)
    if z >= 0: z = "+" + str(z)

    return vertex_template.format(x=x, y=y, z=z)

def convert_mesh(object=bpy.context.object):
    mesh = object.data

    vertices = [x.co for x in mesh.vertices]
    polygons = mesh.polygons

    result = ""

    polys = []

    for poly in polygons:
        median = [functools.reduce(operator.add, x) for x in [vertices[i] for i in poly.vertices]]
        polygon_vertices = []

        for vi in poly.vertices:
            polygon_vertices.append(vertices[vi])

        polys.append(generate_polygon([generate_vertex(*[x * scale for x in v]) for v in polygon_vertices], poly.normal, (0, 0, 0)))

    return generate_brush(polys)

result = convert_mesh()

p = subprocess.Popen(["clip"], stdin=subprocess.PIPE)

res = result.splitlines()
result = ""

for l in res:
    if l.replace(" ", "").replace(" ", "") != "":
        result += "\n" + l

result = result[1:]

p.communicate(input=result.encode("utf-8"))

Clipboard result of the mushroom:
Begin Map
Begin Actor Class=Brush Name=Brush0
    CsgOper=CSG_Add
    MainScale=(SheerAxis=SHEER_ZX)
    PostScale=(SheerAxis=SHEER_ZX)
    Level=LevelInfo'MyLevel.LevelInfo0'
    Tag=Brush
    Region=(Zone=LevelInfo'MyLevel.LevelInfo0',iLeaf=-1)
    bSelected=False
    Begin Brush Name=BlenderExportedBrush
        Begin PolyList
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.9723204970359802,-0.08801952749490738,-0.08801952749490738
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -118.52799987792969,-128.0,+82.3888168334961
    Vertex -139.83999633789062,+0.0,+75.91569519042969
    Vertex -128.0,+0.0,-127.72618103027344
    Vertex -96.42666625976562,-112.21333312988281,-127.72618103027344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.05548539012670517,-0.09262502938508987,-0.09262502938508987
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -118.52799987792969,+128.0,+82.3888168334961
    Vertex +120.1066665649414,+120.1066665649414,+86.70423126220703
    Vertex +96.42666625976562,+96.42666625976562,-127.72618103027344
    Vertex -96.42666625976562,+112.21333312988281,-127.72618103027344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.99395751953125,-0.10976480692625046,-0.10976480692625046
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +120.1066665649414,+120.1066665649414,+86.70423126220703
    Vertex +120.1066665649414,-120.1066665649414,+86.70423126220703
    Vertex +96.42666625976562,-96.42666625976562,-127.72618103027344
    Vertex +96.42666625976562,+96.42666625976562,-127.72618103027344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.05548539012670517,-0.09262502938508987,-0.09262502938508987
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +120.1066665649414,-120.1066665649414,+86.70423126220703
    Vertex -118.52799987792969,-128.0,+82.3888168334961
    Vertex -96.42666625976562,-112.21333312988281,-127.72618103027344
    Vertex +96.42666625976562,-96.42666625976562,-127.72618103027344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -4.461240266095956e-08,-1.0,-1.0
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -96.42666625976562,-112.21333312988281,-127.72618103027344
    Vertex -128.0,+0.0,-127.72618103027344
    Vertex -96.42666625976562,+112.21333312988281,-127.72618103027344
    Vertex +96.42666625976562,+96.42666625976562,-127.72618103027344
    Vertex +96.42666625976562,-96.42666625976562,-127.72618103027344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.030650785192847252,+0.9995301961898804,+0.9995301961898804
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +120.1066665649414,-120.1066665649414,+86.70423126220703
    Vertex +120.1066665649414,+120.1066665649414,+86.70423126220703
    Vertex -118.52799987792969,+128.0,+82.3888168334961
    Vertex -139.83999633789062,+0.0,+75.91569519042969
    Vertex -118.52799987792969,-128.0,+82.3888168334961
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.03878017142415047,-0.9099699258804321,-0.9099699258804321
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -118.52799987792969,+128.0,+82.3888168334961
    Vertex -94.8479995727539,+227.58399963378906,+144.62783813476562
    Vertex +96.42666625976562,+240.2133331298828,+124.13972473144531
    Vertex +120.1066665649414,+120.1066665649414,+86.70423126220703
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.05260470137000084,-0.8988032937049866,-0.8988032937049866
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +120.1066665649414,-120.1066665649414,+86.70423126220703
    Vertex +96.42666625976562,-240.2133331298828,+124.13972473144531
    Vertex -110.23999786376953,-220.47999572753906,+148.7847900390625
    Vertex -118.52799987792969,-128.0,+82.3888168334961
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.7732755541801453,+0.5755140781402588,+0.5755140781402588
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +120.1066665649414,-120.1066665649414,+86.70423126220703
    Vertex +96.42666625976562,-240.2133331298828,+124.13972473144531
    Vertex +133.9199981689453,-220.47999572753906,+151.67999267578125
    Vertex +139.83999633789062,-116.16000366210938,+125.10479736328125
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.8505507707595825,+0.4358569085597992,+0.4358569085597992
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +96.42666625976562,+240.2133331298828,+124.13972473144531
    Vertex +120.1066665649414,+120.1066665649414,+86.70423126220703
    Vertex +139.83999633789062,+116.16000366210938,+125.10479736328125
    Vertex +113.79199981689453,+227.58399963378906,+146.94400024414062
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.8894340991973877,+0.4570634961128235,+0.4570634961128235
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +120.1066665649414,+120.1066665649414,+86.70423126220703
    Vertex +120.1066665649414,-120.1066665649414,+86.70423126220703
    Vertex +139.83999633789062,-116.16000366210938,+125.10479736328125
    Vertex +139.83999633789062,+116.16000366210938,+125.10479736328125
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.24201105535030365,+0.970273494720459,+0.970273494720459
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +139.83999633789062,+116.16000366210938,+125.10479736328125
    Vertex +139.83999633789062,-116.16000366210938,+125.10479736328125
    Vertex +218.11199951171875,-113.79199981689453,+144.62783813476562
    Vertex +218.11199951171875,+113.79199981689453,+144.62783813476562
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.5814716815948486,-0.8076440691947937,-0.8076440691947937
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -118.52799987792969,-128.0,+82.3888168334961
    Vertex -220.47999572753906,-122.08000183105469,+148.7847900390625
    Vertex -232.32000732421875,+0.0,+148.7847900390625
    Vertex -139.83999633789062,+0.0,+75.91569519042969
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.24174341559410095,+0.9399987459182739,+0.9399987459182739
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +139.83999633789062,+116.16000366210938,+125.10479736328125
    Vertex +218.11199951171875,+113.79199981689453,+144.62783813476562
    Vertex +113.79199981689453,+227.58399963378906,+146.94400024414062
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.24135722219944,+0.9370373487472534,+0.9370373487472534
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +139.83999633789062,-116.16000366210938,+125.10479736328125
    Vertex +133.9199981689453,-220.47999572753906,+151.67999267578125
    Vertex +218.11199951171875,-113.79199981689453,+144.62783813476562
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.4813399910926819,-0.6910233497619629,-0.6910233497619629
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -118.52799987792969,-128.0,+82.3888168334961
    Vertex -110.23999786376953,-220.47999572753906,+148.7847900390625
    Vertex -220.47999572753906,-122.08000183105469,+148.7847900390625
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.47979408502578735,-0.688207745552063,-0.688207745552063
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -118.52799987792969,+128.0,+82.3888168334961
    Vertex -220.47999572753906,+122.08000183105469,+148.7847900390625
    Vertex -94.8479995727539,+227.58399963378906,+144.62783813476562
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.6040775179862976,+0.42923009395599365,+0.42923009395599365
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -110.23999786376953,-220.47999572753906,+148.7847900390625
    Vertex -60.82833480834961,-127.57667541503906,+364.8721618652344
    Vertex -127.57667541503906,-66.74833679199219,+364.8721618652344
    Vertex -220.47999572753906,-122.08000183105469,+148.7847900390625
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.6577453017234802,+0.43105629086494446,+0.43105629086494446
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +113.79199981689453,+227.58399963378906,+146.94400024414062
    Vertex +60.82833480834961,+127.57667541503906,+364.8721618652344
    Vertex +127.57667541503906,+60.82833480834961,+364.8721618652344
    Vertex +218.11199951171875,+113.79199981689453,+144.62783813476562
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.5890870094299316,+0.41763779520988464,+0.41763779520988464
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -220.47999572753906,+122.08000183105469,+148.7847900390625
    Vertex -127.57667541503906,+66.74833679199219,+364.8721618652344
    Vertex -60.82833480834961,+127.57667541503906,+364.8721618652344
    Vertex -94.8479995727539,+227.58399963378906,+144.62783813476562
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.682200014591217,+0.4511701166629791,+0.4511701166629791
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +218.11199951171875,-113.79199981689453,+144.62783813476562
    Vertex +127.57667541503906,-60.82833480834961,+364.8721618652344
    Vertex +60.82833480834961,-127.57667541503906,+364.8721618652344
    Vertex +133.9199981689453,-220.47999572753906,+151.67999267578125
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.9249049425125122,+0.38019853830337524,+0.38019853830337524
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +218.11199951171875,-113.79199981689453,+144.62783813476562
    Vertex +218.11199951171875,+113.79199981689453,+144.62783813476562
    Vertex +127.57667541503906,+60.82833480834961,+364.8721618652344
    Vertex +127.57667541503906,-60.82833480834961,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.0034842712339013815,+0.41460251808166504,+0.41460251808166504
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +96.42666625976562,-240.2133331298828,+124.13972473144531
    Vertex +133.9199981689453,-220.47999572753906,+151.67999267578125
    Vertex +60.82833480834961,-127.57667541503906,+364.8721618652344
    Vertex -60.82833480834961,-127.57667541503906,+364.8721618652344
    Vertex -110.23999786376953,-220.47999572753906,+148.7847900390625
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.9066645503044128,+0.41314348578453064,+0.41314348578453064
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -220.47999572753906,+122.08000183105469,+148.7847900390625
    Vertex -232.32000732421875,+0.0,+148.7847900390625
    Vertex -133.49667358398438,+0.0,+364.8721618652344
    Vertex -127.57667541503906,+66.74833679199219,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.002911187708377838,+0.41515102982521057,+0.41515102982521057
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +60.82833480834961,+127.57667541503906,+364.8721618652344
    Vertex +113.79199981689453,+227.58399963378906,+146.94400024414062
    Vertex -94.8479995727539,+227.58399963378906,+144.62783813476562
    Vertex -60.82833480834961,+127.57667541503906,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.0,+0.7132090330123901,+0.7132090330123901
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +60.82833480834961,-127.57667541503906,+364.8721618652344
    Vertex +30.276165008544922,-64.2167739868164,+427.14312744140625
    Vertex -30.276165008544922,-64.2167739868164,+427.14312744140625
    Vertex -60.82833480834961,-127.57667541503906,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -1.3525801989544561e-07,+1.0,+1.0
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +30.276165008544922,+64.2167739868164,+427.14312744140625
    Vertex -30.276165008544922,+64.2167739868164,+427.14312744140625
    Vertex -64.2167739868164,+33.94061279296875,+427.14312744140625
    Vertex -67.8812255859375,+0.0,+427.14312744140625
    Vertex -64.21678161621094,-33.94061279296875,+427.14312744140625
    Vertex -30.276165008544922,-64.2167739868164,+427.14312744140625
    Vertex +30.276165008544922,-64.2167739868164,+427.14312744140625
    Vertex +64.2167739868164,-30.276165008544922,+427.14312744140625
    Vertex +64.2167739868164,+30.276165008544922,+427.14312744140625
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.4561781585216522,+0.733290433883667,+0.733290433883667
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -60.82833480834961,-127.57667541503906,+364.8721618652344
    Vertex -30.276165008544922,-64.2167739868164,+427.14312744140625
    Vertex -64.21678161621094,-33.94061279296875,+427.14312744140625
    Vertex -127.57667541503906,-66.74833679199219,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.48368340730667114,+0.7294524312019348,+0.7294524312019348
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +60.82833480834961,+127.57667541503906,+364.8721618652344
    Vertex +30.276165008544922,+64.2167739868164,+427.14312744140625
    Vertex +64.2167739868164,+30.276165008544922,+427.14312744140625
    Vertex +127.57667541503906,+60.82833480834961,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.684532105922699,+0.7260647416114807,+0.7260647416114807
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -127.57667541503906,-66.74833679199219,+364.8721618652344
    Vertex -64.21678161621094,-33.94061279296875,+427.14312744140625
    Vertex -67.8812255859375,+0.0,+427.14312744140625
    Vertex -133.49667358398438,+0.0,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.4561781585216522,+0.733290433883667,+0.733290433883667
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -127.57667541503906,+66.74833679199219,+364.8721618652344
    Vertex -64.2167739868164,+33.94061279296875,+427.14312744140625
    Vertex -30.276165008544922,+64.2167739868164,+427.14312744140625
    Vertex -60.82833480834961,+127.57667541503906,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.7009514570236206,+0.7132090330123901,+0.7132090330123901
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +127.57667541503906,+60.82833480834961,+364.8721618652344
    Vertex +64.2167739868164,+30.276165008544922,+427.14312744140625
    Vertex +64.2167739868164,-30.276165008544922,+427.14312744140625
    Vertex +127.57667541503906,-60.82833480834961,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.48368340730667114,+0.7294524312019348,+0.7294524312019348
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +127.57667541503906,-60.82833480834961,+364.8721618652344
    Vertex +64.2167739868164,-30.276165008544922,+427.14312744140625
    Vertex +30.276165008544922,-64.2167739868164,+427.14312744140625
    Vertex +60.82833480834961,-127.57667541503906,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.0,+0.7132090330123901,+0.7132090330123901
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -60.82833480834961,+127.57667541503906,+364.8721618652344
    Vertex -30.276165008544922,+64.2167739868164,+427.14312744140625
    Vertex +30.276165008544922,+64.2167739868164,+427.14312744140625
    Vertex +60.82833480834961,+127.57667541503906,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.5088033676147461,-0.8608828186988831,-0.8608828186988831
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +120.1066665649414,+120.1066665649414,+86.70423126220703
    Vertex +218.11199951171875,+113.79199981689453,+144.62783813476562
    Vertex +218.11199951171875,-113.79199981689453,+144.62783813476562
    Vertex +120.1066665649414,-120.1066665649414,+86.70423126220703
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.5424513220787048,-0.7373111844062805,-0.7373111844062805
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +133.9199981689453,-220.47999572753906,+151.67999267578125
    Vertex +96.42666625976562,-240.2133331298828,+124.13972473144531
    Vertex +120.1066665649414,-120.1066665649414,+86.70423126220703
    Vertex +218.11199951171875,-113.79199981689453,+144.62783813476562
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   +0.5641618967056274,-0.7056682109832764,-0.7056682109832764
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex +218.11199951171875,+113.79199981689453,+144.62783813476562
    Vertex +120.1066665649414,+120.1066665649414,+86.70423126220703
    Vertex +96.42666625976562,+240.2133331298828,+124.13972473144531
    Vertex +113.79199981689453,+227.58399963378906,+146.94400024414062
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.5814716815948486,-0.8076440691947937,-0.8076440691947937
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -232.32000732421875,+0.0,+148.7847900390625
    Vertex -220.47999572753906,+122.08000183105469,+148.7847900390625
    Vertex -118.52799987792969,+128.0,+82.3888168334961
    Vertex -139.83999633789062,+0.0,+75.91569519042969
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.684532105922699,+0.7260647416114807,+0.7260647416114807
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -67.8812255859375,+0.0,+427.14312744140625
    Vertex -64.2167739868164,+33.94061279296875,+427.14312744140625
    Vertex -127.57667541503906,+66.74833679199219,+364.8721618652344
    Vertex -133.49667358398438,+0.0,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.9066645503044128,+0.41314348578453064,+0.41314348578453064
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -232.32000732421875,+0.0,+148.7847900390625
    Vertex -220.47999572753906,-122.08000183105469,+148.7847900390625
    Vertex -127.57667541503906,-66.74833679199219,+364.8721618652344
    Vertex -133.49667358398438,+0.0,+364.8721618652344
End Polygon
Begin Polygon
    Origin   +0,+0,+0
    Normal   -0.9723204970359802,-0.08801952749490738,-0.08801952749490738
    TextureU +00000.000000,+00001.000000,+00000.000000
    TextureV +00000.000000,+00000.000000,-00001.000000
    Vertex -128.0,+0.0,-127.72618103027344
    Vertex -139.83999633789062,+0.0,+75.91569519042969
    Vertex -118.52799987792969,+128.0,+82.3888168334961
    Vertex -96.42666625976562,+112.21333312988281,-127.72618103027344
End Polygon
        End PolyList
    End Brush
    Brush=Model'MyLevel.BlenderExportedBrush'
    Name=Brush1
End Actor
End Map

And here is the mushroom's model.
EDIT 2: I'd also like to point out that some faces displays buggily. For example:

EDIT 3: And, for the blend file of a spike I tried as well:

It's result as seen (with and without lightning; that buggy face won't work with lightning, which makes me think the problem can be with normals. Can someone please point me out to it?):

EDIT 4: And finally more info in the Brush Specification.

maybe if you apply the triangulate modifier before exporting?

might also be clipping artifacts

@eromod Tried triangulating, no effect. As for clipping artifacts I'm not sure. Also, I tried with a manifold version of the mushroom, same thing.

so the last image at least indicates that there is something terribly wrong with your uv map. You might want to upload the file to http://blend-exchange.giantcowfilms.com/ . Before you do that, save your file under a different name, then go to "File - External Data - Pack all into .blend" and save it again.

@metaphor_set Unreal does not uses UV maps per brush. It uses instead textures per face and scales and rotates them individually. I only exported the geometry.

I found the solution! Please, nevermind this question. Shall I answer it myself with what I found out to solve it? It's kinda Unreal Engine 1 related though.

Unreal Engine 1's normal calculation involves having the vertices in a counter-clockwise direction from the origin.
In this case, I were inserting the origin always at 0,0,0. Which meant these calculations would not work for all of the faces.
The solution was simply placing no Origin section in the template (Unreal defaults it to the position of the first vert on the list) and subtracting the coordinates of all vertices by the coordinates of the first vertex in the list.
Such as this:
import operator
import bpy
import subprocess

scale = 64

brush_template = """
Begin Map
Begin Actor Class=Brush Name=Brush0
    CsgOper=CSG_Add
    MainScale=(SheerAxis=SHEER_ZX)
    PostScale=(SheerAxis=SHEER_ZX)
    Level=LevelInfo'MyLevel.LevelInfo0'
    Tag=Brush
    Region=(Zone=LevelInfo'MyLevel.LevelInfo0',iLeaf=-1)
    bSelected=False
    Begin Brush Name=BlenderExportedBrush
        Begin PolyList
            {polygons}
        End PolyList
    End Brush
    Brush=Model'MyLevel.BlenderExportedBrush'
    Name=Brush1
End Actor
End Map
"""

polygon_template = """
            Begin Polygon Texture=BKGND
                {vertices}
            End Polygon
"""

vertex_template = """
                Vertex {x},{y},{z}
"""

def flog(string):
    open("c:\\tmp\\ub.log", "a").write(string + "\n")

def generate_brush(polygons):
    return brush_template.format(polygons="\n   ".join(polygons))

def generate_polygon(vertices):
    return polygon_template.format(vertices="\n ".join(vertices))

def generate_vertex(x, y, z):
    if x >= 0: x = "+" + str(x)
    if y >= 0: y = "+" + str(y)
    if z >= 0: z = "+" + str(z)

    return vertex_template.format(x=x, y=y, z=z)

def convert_mesh(object=bpy.context.object):
    mesh = object.data

    vertices = [x.co for x in mesh.vertices]
    polygons = mesh.polygons

    result = ""

    polys = []

    for poly in polygons:
        polygon_vertices = []

        for vi in poly.vertices:
            polygon_vertices.append([x - vertices[0][tuple(vertices[vi]).index(x)] for x in vertices[vi]])

        flog("{}: ".format(tuple(polygons).index(poly)) + str(tuple(poly.vertices)))
        polys.append(generate_polygon([generate_vertex(*[x * scale for x in v]) for v in polygon_vertices]))

    return generate_brush(polys)

result = convert_mesh()

p = subprocess.Popen(["clip"], stdin=subprocess.PIPE)

res = result.splitlines()
result = ""

for l in res:
    if l.replace(" ", "").replace(" ", "") != "":
        result += "\n" + l

result = result[1:]

p.communicate(input=result.encode("utf-8"))


text:
How to make a light emitting material sensitive to external light
Essentially I want to turn a material into a kind of night-light.
For this character I'm working on, I wanted the crystals on him to glow in the dark... And I got them to glow using various shader nodes. However I can't find a balance that looks bright enough in the dark, and not washed out in the light. So I was thinking perhaps there might be a node that could change the light emission of the crystals depending on the amount of light from external sources.
In truth I don't even know if this is the best way to go about accomplishing what I want... Which is to have only barely semi-transparent crystals that glow brightly in the dark and appear as solid colors with a slight emission more like my drawing when in the light.
The other question is... will something like that carry over into unity? Because if not I'd rather save myself a lot of heartache.
Here's a picture of what I have so far:

For the materials part this looks pretty much related, it's whole another topic. As for bringing to Unity part, then it seems "up to certain degree". Some material details, like specularity, glossiness, shiness etc. can be exported via maps, per each shader its own texture which tells shaders where to shine, to be dark, to emit etc. But shaders themselves won't be exported as Blender has its own while Unity has its own ones. So the final result may depend.

So I would have to make what are currently materials to UV maps and textures instead?
It's a little unclear what you are saying. You might have to show me what you mean.

Basically what I wrote is that you want to bake your materials to textures in order to export them and in Unity find adjacent shaders and use baked textures for them. See also  http://blender.stackexchange.com/questions/18362/exporting-multiple-materials-to-a-single-diffuse-specular-map for more info on that. UV maps aren't what you bake to; they control how the texture will be "shown" on the object.

Related

Using the light falling on the material is not something that is possible in cycles. It is, however, possible in blender internal.
The reason this is happening though is because normally in the real world when you turn the lights on, you are also reducing the exposure of the image, which causes the light emitted from the glowing material to be much dimmer. To replicate this effect in cycles you can increase the brightness of light significantly and then reduce the exposure from the colour management section of the scene tab.

I don't think that would carry over to unity, so if I do something like that it will have to be in unity instead.

Yes you're correct, it wouldn't carry over. I haven't used unity much so I'm not sure, but you would have to somehow change the exposure. If not, I am sure the same effect can be achieved by reducing the intensity of all lights.

An easy way to make glowing crystals is simply by putting emission objects in glass objects
It works quite well in both the dark (transparent node to allow light to escape the glass)

And under sunlight

As for unity, I'm not certain it would look the same, but it certainly could be achieved.


text:
Render view showing random seams and causing blurring to textures
I'm a bit new to blender, but I been working on this for about a week now and big hangup came once I got textures applied to the model.
It's hard to see, but there are visible seams in the rendered image down the center of the model, and mirrored seams in the shape of a 'V' on the chest.

On top of that, the textures become more blurry as you zoom out. Obviously, neither of these problems are present in the unrendered view. (Before anyone asks, everything is set to Blender Render.)
The only advice I saw for blurring was making sure the mapping was set UV, which you can see from the picture that it is. The blurring and the seams may be unrelated but they are both hampering my progress severely, so any help would be much appreciated.

Update: For better reference-

I drew arrows pointing to the lines in which I'm referring to. I'm sorry they are faint but they become more noticeable as you zoom out. At first I thought they might have had to do with mirroring the model across the x axis, but the V shape under the circle in the chest disproves that theory, and there is also line around one of the edge loops for the knee.
My knowledge of the program is limited so if you need me to explain more I'll do the best I can.

I updated with new picture to help point things out. As for previewing... you can see I have two open viewports- One for the rendered appearance on the left and one with material shading for doing editing on the right.
I prefer the crisp textures of the right hand side.
As for the "seams" I know they're not blender seams but I can't think of any other word to describe them. They aren't part of the texture or the mesh.

Just educated myself on Ngons I'd like to think this is the problem since the chest is made up of Ngons, but the problem is the seams on the face and knees are surrounded by quads.
Also, I don't understand why triangles would be bad as they stay flat no matter what- as opposed to the topography of non-flat quads and Ngons. Sorry if this doesn't make sense. I barely understand what I'm saying. Oh, and I recalculated the normals.

Generally yes, the amount of verts which form a face should not affect shading.. however that isn't always the case. Try enabling Antialiasing in the Render tab,that should minimize the problem. Also investigating a bit further, I think this is because of the bleeding (islands on the UV map almost exceed textured areas and background of the texture, in your case, white alpha, become to be visible). See related. It looks like you've already done that but I think not enough. I baked new texture from yours with Margin 16 and saw no seams.

Baking did clear up the texture.
I don't know if I can get rid of this blur or not though.
Thanks for the help, regardless!

Related - http://blender.stackexchange.com/questions/32711/black-lines-along-uv-mapped-model (probably even a duplicate).


text:
i'm worked on augment app when i augmented the texture getting disordered
I'm working on an augmentation app.
I created an object, uv mapped and applied material (lambert). After that the baking process,saved the images that I baked and applied textured in gimp.
Applied textured image to the object and when i rendered in blender the textured topology is good, but in app when i'm rendering texture is getting distorted.
I don't understand where I made mistakes please suggest to me correct procedure. i exported my object to .obj format.

Welcome to Blender Stack Exchange.  Can you provide some screenshots.  Details re "the app".

Try Ctrl+A
 "Apply rotation and scale" before exporting, if it doesn't work try reimporting the .obj in Blender and analize what happened. If you still can't figure out, upload your file.


text:
Adding material to spheres sequentially using Python
I have the following script, which I was hoping would add a basic red material to my spheres as they are sequentially created. Unfortunately, the script does not work, in the sense that no material is added to any sphere. Indeed, no spheres are created, but in the absence of "bpy.ops.material.new()" and "bpy.context.object.active_material.diffuse_color = (1, 0, 0)", the script produces spheres.
Could someone please help me tweak the script to make it function as desired?
import bpy, csv
fp = "C:/Blender/Spheres.csv"
with open( fp ) as csvfile:
    rdr = csv.reader(csvfile, delimiter=';')
    for i, row in enumerate( rdr ):
        if i == 0: continue # Skip column title
        # Generate UV sphere at x = row0, y = row1, z = row2, and radius = row3.
        bpy.ops.mesh.primitive_uv_sphere_add(size = float(row[3]), location = float(row[0]),float(row[1]),float(row[2])))
        bpy.ops.material.new()
        bpy.context.object.active_material.diffuse_color = (1, 0, 0)

A snippet of my CSV. spheres.csv
x;y;z;r
2.34;2.45;7.65;0.024
6.78;9.31;6.33;0.0467
3.36;8;1.04;0.3626

You don't give us any information what "it does not work" means. You may also want to reduce your script to the bare minimum (I doubt that running meters.py is realy required) so that we don't have to investigate unnecessary code.

@dr. Sybren, I have ammended the question to address your comment. Thank you.

Can you share (the first three lines of) your CSV file too? Since you say no sphere is created, maybe it never reaches the sphere creation operator?

@ dr. Sybren. I have added a link to my CSV.

Don't link to the file (Dropbox links will go away, it's horrible for archival purposes), just paste the first few lines into the question, like you did with the script. You also may want to change your username from 'user120xxxx' to something more personal.

@ dr. Sybren. I have added a snippet instead.

Since each sphere's material gets the same properties, I think it's a shame to create a new material for each sphere. Here's my solution, which:

Doesn't use an operator to create a new material, but rather calls a regular function bpy.data.materials.new(). This is faster, doesn't create unnecessary undo steps, and directly returns the material;
Uses next(rdr) to skip the first row, rather than using enumerate and checking the index each and every iteration;
Uses bpy.path.abspath to convert a blendfile-relative path to an absolute path that Python understands;
Separates data conversion from the strings obtained by the CSV reader to the floats you need for Blender;
Uses slice notation to shorten the b.o.m.primitive_uv_sphere_add call;
Follows PEP-8 for readability.

import csv

import bpy

# Create the material
try:
    mat = bpy.data.materials['Sphere']
except KeyError:
    mat = bpy.data.materials.new('Sphere')
mat.diffuse_color = (1, 0, 0)

fp = "//spheres.csv"
with open(bpy.path.abspath(fp)) as csvfile:
    rdr = csv.reader(csvfile, delimiter=';')
    next(rdr)  # Skip column title
    for row in rdr:
        # Generate UV sphere at x = row0, y = row1, z = row2, and radius = row3.
        data = [float(x) for x in row]
        bpy.ops.mesh.primitive_uv_sphere_add(location=data[0:3], size=data[3])
        bpy.ops.object.material_slot_add()
        bpy.context.object.material_slots[0].material = mat

A little correction:
add a parenthesis '('
add linkage code
import bpy, csv
#fp = "C:/Blender/Spheres.csv"
fp = "C:/temp/Spheres.csv"
with open( fp ) as csvfile:
    rdr = csv.reader(csvfile, delimiter=';')
    for i, row in enumerate( rdr ):
        if i == 0: continue # Skip column title
        # Generate UV sphere at x = row0, y = row1, z = row2, and radius = row3.
        # add '('
        bpy.ops.mesh.primitive_uv_sphere_add(
                    size = float(row[3]),
                    location = (float(row[0]),float(row[1]),float(row[2]))
                )
        bpy.ops.material.new()
        # add linkage
        bpy.context.object.active_material = bpy.data.materials[-1]
        bpy.context.object.active_material.diffuse_color = (1, 0, 0)

Don't use operators where it isn't necessary. bpy.ops.material.new() can be replaced by mat = bpy.data.materials.new('Sphere'), which is faster and doesn't make you guess that it's bpy.data.materials[-1].


text:
Creating an edge between two vertexes
I'm trying to model a bar front, but I'm having problems extruding the right part of the face.
I keep trying to add a vertex between two points of a sized up cube object but it isn't allowing me to connect the two, giving me the error invalid selection.
Any ideas on how I can do it please?
Its the triangle shape I'm trying to get

Bar front I'm trying to model

Make smart use of modifiers here. You have a repeating shape, use an Array modifier instead of modelling it all one by one by hand.
For the face keep it simple. Just use the Poke Faces Alt + P operator on a simple unsubdivided face.
Move the resulting vertex down to vertically align with the bottom vertex of the face, then move it forward to make the protruding "pyramid" shape.

Wow, didn't realize blender had this! How did you use the array modifiers to dupe the shape?  Edit: Nm found out how, thank you Duarte!

Duarte's answer is perfect, for this case.
In general, if you were trying to create a vertex on an edge by connecting, (J), that won't work. In this context, J connects existing vertices across existing faces. Alternatives include:
Ctrl-E (Edge Menu) > Subdivide, with the edge/s on which you want the vertices to appear selected.
Select a vertex on the edge you want divided, duplicate it with Alt-D and slide it along the edge (GG).
If your new vertex is going to be at the end of a new edge in an existing face, the Knife tool (K) from the beginning of the new edge, using Ctrl if necessary, to constrain the cuts to the center of existing edges.


text:
Rendering with a Luminous Outline on Transparent Background
I am trying to achieve such effect on transparent background:
What I currently have:
Is it possible to get something like this rendered in blender? Or should I use Gimp to manually add my outline?

Found the solution in Gimp link. Still wondering though how to recreate such effect in Blender.

Does this answer your question? Glow effect invisible on transparent background

Apparently they would, but it turns out that they mean a lot more of fiddling around. Gimp solution seems to be actually the quickest and gives decent results. Thanks for the help!

Since your render is black&white you can use this:

Set object material with Emission shader.
In Properties Editor > Render Tab > Film > enable Transparent

Eevee
—
Enable Properties Editor > Render Properties > Bloom.
To control blooming you can do it here or in compositor with RGB Curve node (or ColorRamp) to make effect stronger or lighter.

Cycles
—
In compositor add Filter > Glare node type Ghosts try with Treshold = 0
Output format - I had to switch into OpenEXR file format to keep glowing, glaring, blooming what ever to call this in saved render.

Important
There is an issue with inconsistency of viewport render vs Render (F12) for years.
But also viewport is not showing the glowing here, but the only one thing that you have to do is to plug output also into Alpha socket. Or add Set Alpha node for the same effect.
Output format - PNG (RGBA) is OK here
For full colour render combined with glow or emissive materials (like fire) on transparent background see https://blender.stackexchange.com/a/164940/2214
For effect of coloured glow (like in your reference image) add ColorRamp node.