text:
How to deal with geometry nodes attributes
How to get maximum attribute value for each vertex, but the max value should be max among faces that connected with that vertex?
I have "face_count" attribute on faces. Now a need that every vertex have that attribute too, but the value should be the max value among faces that include corresponding vertex. How can I achieve that?

Face attribute copies to a face corner unchanged, so all you have to do is to find the face corner with the maximum value, which you can do by sorting them by that attribute and taking the last (-1):

Imgur mirror (SE image hosting has problems)

@SergeiKrumas yea docs are incomplete but even when negative indices are not supported you can just multiply the weight by -1 and take the first element

@SergeiKrumas https://i.imgur.com/hPIguqO.png

I've done it on my own. Geonodes is a really strange thing.

EDIT: Later I improved the setup thanks to @MarkusvonBroady input and updating Blender from version 4.0 to 4.3. Blend file attached. The setup now supports arbitrary edges count for each vertex, earlier it was locked to 3.

You don't need the "store" node here; just connect "face neighbors" instead of "named attribute".  You can replace"sample index" with "evaluate at index" to reduce the number of links. You can remove "index" nodes,  as the implicit input for that socket is the same.  Your solution only works with triangles.

@MarkusvonBroady thanks for the input, indeed it is useful! Yes, my solution only works with triangles, but how can I achieve the the same result with arbitrary count of faces connected to vertex? Do you know the solution? Not sure that geonodes allow me achieve that right now. I'm using Blender 4.3.

Sorry, I misunderstood the setup, both solutions have the problem of assuming 3 neighbors, but it's not an assumption of triangles, rather that no vertex has more than 3 neighboring faces. It will fail in a typical quad topology, where most vertices have 4 face neighbors and especially in UV sphere poles.

@MarkusvonBroady Yes, but the second solution is much smarter, we can just change the value of "iterations" socket to 4 and it will support 4 edges too, so don't need to duplicate the nodes as in the first solution. Or we just precalculate the maximum edges count for all verticies before Repeat zone and feed it to the "iterations" socket.

@MarkusvonBroady Yes, in UV sphere not all vertices have the same amont of adjacent faces as poles do, and repeat zone will overiterate on some vertices, BUT it still works due to wrap-around nature of "Sort Index" socket AND my task is completed albeit in a strange manner. I do much better work for this task in Houdini, but in Blender I must follow that concept rules. This is the situation when you can write code for the task faster then trying to build something out of geonodes concepts.


text:
Animated GIFs in Dynamic Previews Enum
Is there any possibility to load animated gifs as a custom icon, which then would be viewed as animated sequence right in the preview? for now, it's just blank and no static preview generated
For testing I used the "Ui previews dynamic enum" template in python templates (in Text editor)

EDIT: IF there is no possibility to load gif, anyone here knows the alternative?   Maybe fake somehow animated preview, but for user it'll be looked like gif animation

AFAIK animated gifs are not supported by blender.

One option coul be to draw your own stuff with bgl module somewhere in the UI. You would have to update that draw call in app.handler to make an animation or to use a modal operator if you needed to react to user input.

Fudge it via the draw system.
Emulating the frames of an animated gif by using the 4 triangle icons. The simple panel template has been edited to add this "animated" icon to a label.  The icon will step thru its list when the draw is called and panel updated. Mousing over the area, scrolling the area etc will tick the animation.
import bpy

class LayoutDemoPanel(bpy.types.Panel):
    """Creates a Panel in the scene context of the properties editor"""
    bl_label = "Layout Demo"
    bl_idname = "SCENE_PT_layout"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"
    i = 0
    icons = ['TRIA_RIGHT',
             'TRIA_DOWN',
             'TRIA_LEFT',
             'TRIA_UP']

    @classmethod
    def icon(cls):
        cls.i += 1
        if cls.i >= len(cls.icons):
            cls.i = 0
        return cls.icons[cls.i]

    def draw(self, context):
        layout = self.layout
        layout.label("Anim %d" % self.i, icon=self.icon())

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

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

if __name__ == "__main__":
    register()

Ok that's not too impressive, need some way to tie it to time better.  As an example  redraw the properties area on a frame change. Run code and start an animation to see effect.
import bpy

def redraw_props(scene):
    for a in bpy.context.screen.areas:
        if a.type == 'PROPERTIES':
            a.tag_redraw()

bpy.app.handlers.frame_change_post.append(redraw_props)

source: Stack Exchange

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

sort: votes


text:
Compositor: How to crop an image into multiple versions?
For cases where we want to batch process an image into multiple versions, it's fairly straightforward if only changing the scale. But if we want to vary the cropping things get complicated. This is because using the Scale node's Crop mode on either Render Size or Scene Size. Neither of these values can have multiple instances or be key-framed to change over time.

In the screen shot above, the resizing (cropping) only works correctly because the Render Size is set correctly.

But this can only be done once. Even if we create another scene with different render dimensions, only the current scene gets used by the Scale node.
Using the Scale node in Absolute mode causes stretching instead of cropping.
It seems like there should be a way to do this. Am I overlooking something?
Update: I've made some progress with the size by using a Translate node followed by a Crop node, but the crop is off-center.

It could possibly be done with Python. Could you tell more about the batch process you need?

@MartinZ Your comment made me realize I'm probably using the wrong software. I think I should be using imagemagick for this, not Blender. Still, it's frustrating to think that maybe Blender can't do it... Blender can do ANYTHING! ;-)

@MartinZ The batch process I need

@Mentalist You can use python in blender for batchrendering and everything you do by hand (except for knowledge only you as a human have and can't possibly share)

If you tell me the workflow as good as you can I can help you write the script

@WhatAMesh Thank you. Basically I will have a hi-res master image that will need to be resized to various different smaller sizes. These smaller sizes have aspect ratios different from the original, so the only way to prevent stretching is to crop the smaller dimension.

@WhatAMesh Before you go digging into Python code to help me, I should let you know I've found an app called XnConvert that does exactly what I need. It would've been fun to do it in Blender (tried imagemagick too, but its documentation quickly frustrated me)... however I found another solution. Since others may want to do this in Blender, I think the question is still valid and worth answering. But I'm not going to lose any more sleep over these nodes. Thanks for being helpful!

@WhatAMesh Sorry, I jumped to conclusions. XnConvert is good, but after further tests I've discovered it doesn't keep the image centered when scaled and cropped. Maybe I will need to use Blender after all to get precise control.

What do you plan to do with the images after you cropped them? Just save them? It sounds to me like you just have an image and want to crop it at different parts to get different image ratios

It's possible in Blender, but it will be easier to do with Imagemagick.

@MartinZ I tried using imagemagick, looking at examples of scripts others have made and piecing together something custom of my own, but my syntax is wrong somewhere and I don't know where. In the end, using Photoshop Actions (Image Size & Canvas Size) turned out to be the most effective solution. I realized that outputting images of multiple sizes in Blender is impossible because after scaling down a transparent border remains since Blender's image will always be the dimensions of the main scene.

@MartinZ Update: While doing this in Ps was working, some aspects of the Actions flow was annoying me, so I decided to give imagemagick another try. I got some help over at Stack Overflow and now have a script that does exactly what I want  - instantaneously. :-)

This is usefull. Thanks for sharing the solution.

This can't be done in Blender, because the image pixel dimensions will always be that of the Scene from which the Render button was pushed.
I used a File Output node to test this, saving rendered data from different Scenes, each with different render dimensions. Their dimensions were overridden by the dimensions of the main Scene.
I'll post the .blend for anyone curious. It's nothing special.

What this means is that even if you use nodes to get the scaling and cropping right, you will just end up with transparency around the image. (If scaling up your image will be clipped instead.)
This sort of task should be done with other software, such as imagemagick or Photoshop (using Actions). Here is how to do it with imagemagick using scripting.

You have Python in Blender. There is no such a thing as 'can't be done'. You can batch process a folder with images in Blender with a script changing the dimensions and rerendering the compositor nodes only with Render Layer nodes muted. It is not as elegant or practical as with ImageMagick though.

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


text:
MixRGB nodes don't add up Value as I expected. What knowledge am I missing?
Why don't these add up to 1?
I have seven RGB Input Nodes that are greyscale and have Value of the following amounts:
0.18333
0.2
0.15
0.18333
0.1
0.06667
0.11667

I would expect these to add up to 1 and become white, but that is not what happens.
Instead I get a dull grey (#686868):  Why is this?
(There are no other lights in the scene.)
This is my node set-up:

Next I tried using Add Shaders to see if that would make a difference, but it did not:

Update & semi-answer: This works ↓ (but I don't know why)
I had been adding the Value:

I should be adding the RGB if I want them to add up to white:

I didn't realize that the value is sort of a result of the RGB. Nodes that add are adding the RGB, not the Value.
(I'd be happy to accept an answer that explains how the two are related.)
The answer is probably in here somewhere.

Go get white you have to pass something that will increase the color. For example... You have add and a factor of 1.000. This means you are not mixing the colors, but instead using one input of the node.
Just curious though, what are you trying to do? Why not just use a white shader?

Your suggestion did not work. I need more explanation. Moving the sliders to 0.5 gives a result of #4B4B4B. Moving them to 0 gives #2F2F2F. Actually, even adding RGB didn't work! (gives #E7E7E7) Re:"What are you trying to do?" This is part of an experiment to separate the spectrum of visible light into seven proportionate bands, then refract each one at a different IOR. These will need to be recombined with Add shaders in the final project (think of a prism), but I noticed colors aren't being added back up to white so I have to find out why.

Never mind the part about RGB not working - for that mix I had forgotten to change the Emission Shader's Value to 1 (It's 0.906 by default). Then when I combine 3 Emission Shaders of solid red, green, and blue via two Add Shaders it works. But actually this gives a hint to the nature of the problem - a discrepancy between RGB amounts and the Value amount. I think the simple answer is that adding RGB and adding Value are different things. A MixRGB Node and an Add Shader both add RGB values, not Value. I would like to know how RGB and Value correlate though (which may not be Blender-specific).

Glad I could help. :) Sometimes, actually many times; it doesn't work quite how we expect and with adding or tweaking things makes it work.  Try playing with a variety of node setups or lights too. I'm sure it can be done, but as I mentioned it's finding that magical combination.

I'm sure you thought about this too, but the presence of all colors will give black where with light you will get white.

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


text:
How to make a perfectly flat bottom for 3D-printing topographic relief?
I'm trying to print a topographic relief, I'm close to the end but I can't find a way to have the back of my object perfectly flat without changing the top.
(I tried to SY 0. didn't worked)

why not just select all the vertices on the bottom and scale along the Z to 0?

can you show the wireframe, and how is it generated , does it have modifiers ?

@X-27 he mentioned that he tried it ( unless in object mode )

I think this is using the solidify modifier, so  you will have to create a bottom first than flat it out ( looking at the Rim)

@SelmaB can you add more details ?

I imported it from sculptris !
Found the solution, I just extruded it the wrong way, scale along Z to zero worked finally worked !
Thanks for the quick answers ;)

@SelmaB please write the solution as an answer and accepted so this get closed

@Chebhou Don't say closed, sonds like we are going to close it as off-topic :P But yes @ selmaB, post an answer. The site's stats are negatively affected otherwise :)

The solidify modifier can be removed, if you need to do this kind of thing a few times do this instead:

Select your Mesh, go to Edit Mode, Select All geometry.
Hit E to Extrude, Then Z followed by Z again to constrain the direction
Then move the mouse to the right, and the newly extruded geometry will start to move down. You can see by exactly how much in the bottom left (by default the contrast between the text and the panel make this unnecessarily hard to read (April 2015). But it looks like this

You can use the mouse, or left / right keys, or even type the number you want directly with the num keys.

then to flatten the new geometry, hit S, Z, follwed by number 0.

Here's a view from the underneath before and after the flatten.

Cons:
there are all kinds of factors that can interfere with how straightford this is, the location of the reliefs Object origin being one of them. If I had to do this repeatedly, it would be something to write a small python script for.
The recipe for such a script might be:

find lowest z coordinate of the original mesh
extrude all faces a little bit
replace all z values of the newly geometry with the lowest z of the original mesh minus the desired thickness.

This would produce a mesh with a minimum thickness.

In case you are using the solidify modifier :

create two materials in the material tab :

change the material index offset to 1 as follows :

apply the modifier ( click apply button in the above image )
in edit mode hit A to deselect all the vertices ( nothing is selected now)
in the material tab select the second material and click Select  (the first image )
All bottom vertices are selected now hit S then Z and last 0

Select bottom vertices, press S > Z > 0.

This site is in English so please write in it. Note also that more in-depth answers were already added long ago and there's no reason to add less detailed. You might want to take a look at tour page to see how this site works.

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


text:
How can I spawn a moving object in BGE?
I know how to use the Add Object actuator to add an object while the game is running, but the angular velocity is not affecting the mesh. Is there something else I should have done as well? Workarounds that access the mesh and assign a velocity after creation are fine as well, but no python would be preferred.
I am using Blender 2.72, the objects are added correctly when I press the button, and the added objects also respond to physics when colliding with each other. Just the initial velocity is not working.
Here is my current Logic setup:

Your problem here could have a few very simple solutions. First, your projectile must be either a dynamic object, or a rigid body object. Static objects can not have angular or linear velocity.
Another solution could be that your projectile is getting lodged in the collision bounds of what is probably (in your case) a static character. The best way to make a gun turret is to have a static base that controls the rotation, a no collision barrel parented to the base, and an empty on the end parented to the barrel. Of course, you could just have your no collision barrel Emmit the projectile.

Logic setup of base

Logic setup of Barrel. Note- half of the logic here is simply to limit the rotation so you can not rotate the Barrel into the base.
(collapsed view)

Expanded view of the logic for Barrel

Logic setup for the Empty, Note- the property sensor and the property actuator are to limit the ammo, and do not really matter for this answer. Nevertheless, it is way more realistic and funner to have limited ammo, so Your ammo is limited.

Physics options for the projectile.
Notice that the X and Z location is locked. that means that the only way the bullet can move (only effects angular and linear velocity) is along the local Y. locking those two axes can be useful if you want to shoot lasers that do not drop due to gravity.If you want to have a hits based projectile instead of a physics based projectile, you can check the box enabling Ghost option, (below the actor check box) this will still register the collision, but it will not make the target physically react on collision. you could also then add a armor property to your target, and have each collision remove one of the armor points, then when the target's armor property reached 0 it could disappear. Locking the rotation along the X,Y and Z will only make the projectiles look more realistic if it is physically colliding with the targets.

If you had trouble following that, or simply want to examine the blend to see first hand how Everything works,  you can always http://x.27 download the Blend file

You can simply add this logic on to your object that will be added via the Edit Object actuator.

All you need is a Always sensor triggering a Motion actuator. Set the motion to be local, with the L button.

I noticed that with this setup, collisions between the moving object and a stationary one look weird as the moving one hits, bounces, stops then starts moving again.

After some trial-and-error, I have found a solution. Apparently the physics sim 'freezes' the spawned object inside of the spawning object, making it incapable of moving. What you need to do is use an empty. The same logic setup can be used as in the question.


text:
How to make 3D model and UV map from picture
I want to make a 3D model of an image but not for animation or other 3D stuff. I just need to have a model of my object to be able to apply textures to different faces of the object correctly.

In this picture I want to to apply the pattern with three.js. How should I do that?
Do I need to make a 3D model of that or UV map or both or something else?

I have found a instruction for that ,But I can't follow the steps. http://www.wikihow.com/Turn-a-2D-Image-Into-3D-Using-Blender .Is that what I need

There isn't really a simple way to do that, and certainly not one that looks good. Here's what I do, using an example from one of my own projects. This is what it looks like without the finishing details, just the UV mapping/modeling done:

And here is the texture that is applied, which is where you want to get to:

First, I had to model the chair as a whole (which for what looks like you want should be much simpler, there are tutorials on basic shape creation and extrusion modeling all over the place). Then I looked for textures that looked close to what I wanted and applied them to the individual parts (see Adding UV mapping to mesh), giving me the result I asked about in this question: Possible to bake texture to new UV map?
You can then brush in details on the edges in something like Photoshop or GIMP.

.Thanks,I'm newbie in blender and graphics.Could you give me a tutorial source for Making a model ,Please?

.Thanks,I'm newbie in blender and graphics.Could you give me a tutorial source for Making a model ,Please?

Check out Blender Cookie's series: https://www.youtube.com/watch?v=K1DnYxd3iTw


text:
How are bones & armatures connected to the rest of a model?
Let's say I'm really new to Blender, and have just barely figured out what keyframes are for. Explain a Blender skeleton to me like I'm five. Do I need to use it, and how exactly does it connect to the rest of the model?

OOOkay.This is
Armature in a Nutshell
Armatures and bones are for posing stuff, just like you would wiggle your arms and nod your head. All of your bones move whenever you move.
Same thing for blender bones, they help stuff move and get into different poses, like statues. (okay I'm gonna stop the five-year-old thing now)
All you have to do is make an armature that looks kinda like the shape of a skeleton.
See the stuff highlighted in orange? That's his skeleton. each one of those tetrahedron shapes is a bone.

you can make an armature like this by going into Edit Mode and extruding the bones by pressing E. When you do this you want to make it the shape of your model. See how it all is the shape of the robot-guy-thing? It's actually inside him, i just turned on an option called X-Ray so I could see it.
Build your armature until you think it looks good enough to be the moving skeleton of your model.Once this is completed, parent the object to the selected bones using Ctrl+P > With automatic weights.
This'll make the armature move the model when it moves. To try this, switch to Pose Mode and right click on a bone you wan to move. Press R to move a bone around, watch your model follow.
This was a very basic explanation and i'm kinda gritting my teeth right now not to write a novel on it but you'll find a lot more stuff as you get better with Blender.
If you want to see some of it, and it's pretty complicated, just search IK on this site. Your brain will go boom.
Sorry if I went to long.

So, "parenting" in Blender = attaching the object. I think I get it though, thanks a bunch! Two questions though, Does each piece of the character's limbs need to be a separate object before I can give him a skeleton? And how do I activate X-ray mode?

X-ray is an option for any object in the orange box object tab of the properties thing, under draw. It's been a while but basically an armature is attached to an object with a modifier and vertex weight groups say how much each bone affects each vert. You don't have to seperate anything, the armature can bend the verts anyway, this is why clothes and skin are animatable.

About the "seperated objects per limb": You don't need this, because this is what the weights are for. Every bone will store data about WHICH vertex will be influenced by this bone and HOW MUCH the bone influences the vertex. (So, a shoulder-vertex can in fact move a little bit if you turn your head, and can also move a little bit if you move your arm, but it will never move as far as your arm or your head itself will move)

In the particular picture, the objects were separated, so it wasn't a perfect example. But normally, you wouldn't separate them unless you needed to; (or didn't know how to =p) See this relevant Beta post: http://blender.stackexchange.com/questions/19313/character-made-with-multiple-objects-one-armature-or-different-armatures/19316#19316


text:
How do you make objects not collide and pass through each other?
In the game engine I'm trying to make the different types of enemies pass through each other, and only interact with either the player or the player's weapon. I've made them rigid body objects, and tried adding them to different collision groups but that doesn't seem to do anything.

Collision groups are the correct way to do this.
Set your "bad guys'" collision group and collision mask up like this.

Set the "good guy" up like this.

Now here is why. The Collision group is conceptually assigning a number to the object say 1-8. Your good guy has collision group one. The Collision Mask is what number collision group it can collide with.
So looking at your bad guy, it can only collide with other objects that are assigned to collision group 1. Itself is set to collision group two so it will not hit other bad guys. Your good guy is set to collision group one, and it can collides with all groups.
Blend file with bge collision demo.


text:
Can Blender make alphas?
This is something I did a lot in Zbrush; make a black & white image containing height map data from a viewport snapshot.
Since I don't own Zbrush, I'd like to do this in Blender if possible. Is there a way?
I'm a big fan of Blender's sculpting tools (and Substance Painter), and this would benefit me greatly.

Yes, this definitely sounds possible, though not knowing what an "alpha" is in the context of zbrush, I'm not sure how best to translate that to blender. I can think of a couple different approaches to "create a heightmap from a model", but I don't know which works best for what you want to do. By "snapshot", do you mean an actual screenshot? Or..? If a little setup is acceptable, one way is to use cycles

related: http://blender.stackexchange.com/questions/46620/how-to-make-a-brush-alpha-image-using-cycles/46629#46629

do a google image search for Zbrush alphas and you'll see what I'm talking about. In Zbrush you can sculpt on a surface, make it face the camera, and take a snapshot of the viewport as a black & white image, creating a stamp that can be used for future sculpting and painting. I'd like to make these in Blender if it's possible but I'm not sure how.


text:
Is there an 'insert mesh' brush or addon for blender's sculpting workflow?
I've been spending more time sculpting in Blender. I would love to see a brush like Zbrush's insert mesh brush.
The insert mesh in Zbrush draws a primitive of your choosing right on the mesh in the direction of the normal. As you drag horizontally or vertically while holding down the stylus, the primitive's size/diameter change as needed.
Is there anything out there like this? It seems like a simple function, yet no addons exist that come near to it.
It is extremely useful for character modeling. I would love to know if there's an addon that does this.

See if this works for you: MifthTools Draw Clone https://www.youtube.com/watch?v=repgVyh7PnY

That's the closest I've seen to the Zbrush tool, thanks :) The Zbrush version has extra control, but I can't complain, this works pretty well.


text:
Morph between different facial expressions?
I want to use Blender to make a dynamic character. I want to know if it is possible to make a number of keyframes for facial expressions and then have the ability (using python's game engine) to choose which face I want the current face to morph into?
Ok, so I have been trying to master Python scripting with Blender's Game Engine. I would like to make a basic game where you can tell the face, within the Python Console, what expression to do, running code from the Text Editor. Here is some code I wrote in the text editor after making two keyframes 'Basis' and 'Surprise' in Blender Render:
def Face(Expression):
if Expression == 'basis':
    C.object.data.shape_keys.key_blocks['Basis'].value=0.0 #I believe this should make the animation morph to the Basis as defined in my key frame
    print('basis')
elif Expression == 'surprise':
    C.boject.data.shape_keys.key_blocks['Surprise'].value=1.0 #Again this is defined in my key frame
    print('surprise')
else:
    print('invalide entry')

When I click Run Script it seems to compile with no errors. When I enter the Python Console and type "Face('basis')" I get the following error:
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
NameError: name 'Face' is not defined

Firstly is the game engine capable of making a game where you can change character's facial expressions. Would it be better to manipulate bones in the face rather than morphing between key frames? And, how do I call the function I wrote in the text editor in the Python Console? I also want to know if I called the 'object.shape_key' from C properly from the python code?
Very detailed Q I know, thanks for the help guys!

There are at least two ways to create and animate facial expressions, not even involving python (although it's possibly to automate this):

Shape Keys - allows you to deform mesh vertices and blend multiple "states" together and also animate
Armature - a skeleton to control the mesh, with strong control over deformation using vertex weights, but also more complicated

I recommend to try out Shape Keys:

Start Blender and remove (X) the default cube
Add a Monkey (aka Suzanne)
Go to Object data tab in Properties Editor
Click the plus button + in the Shape Keys panel twice (will create Basis and Key 1)
Switch Suzanne into Edit Mode (Tab)
Deselect all (A) and pick some vertices, e.g. the right eyebrow
Enable Proportional Editing if you wish to deform nearby, non-selected vertices as well
Move the vertices up a bit (G)
Go back to Object Mode (Tab)
With Key 1 in the Shape Keys panel selected, move the Value slider to see the transition between the base shape and the keyed shape.
Use I over the slider or right-click and pick Insert Keyframe to animate the value and thus the facial expression transition!

You can create a Shape Key with Python like:
shapekey = bpy.context.object.shape_key_add(name="Key", from_mix=True)

See the API docs - Object.shape_key_add for details.
The value slider can be animated by inserting a keyframe, here's the most simple way:
# we stored the shape key reference above in the variable "shapekey",
# which should be equal to bpy.context.object.data.shape_keys.key_blocks['Key']
shapekey.value = 0.3 # set value
shapekey.keyframe_insert(data_path="value", frame=15) # now keyframe 0.3 at frame 15

See the API docs - keyframe_insert()

More on Shape Keys:http://wiki.blender.org/index.php/Doc:2.6/Manual/Animation/Techs/Shape/Shape_Keys
If you look into Armature pose animations, make sure to have a look at the Pose Library panel!
It's also worth to have a look at the NLA editor (non-linear animation). It allows you to blend multiple Actions together:http://wiki.blender.org/index.php/Doc:2.6/Manual/Animation/Editors/NLA

@CubeBot88 If this is what you want, please consider to mark it as your answer. :)

This thread pretty much answers my question, thanks anyways guys! http://blenderartists.org/forum/showthread.php?246315-mulitple-shapkeys-with-the-action-actuaor-in-the-bge/page2


text:
MakeHuman models' teeth show through face in the BGE?
I am having trouble trying to get a MakeHuman model to be controlled through a python script in the BGE. The model either doesn't show the teeth, or the eyes, inner mouth and teeth appear over the model, as per the attached image. My game logic is simply a loop connecting the python script to run the armature movements.
.
Here is the code, note that I use numpy to manipulate a matrix which is imported using h5py library (this all works fine, moving the mouth bones). I think my problem lies in my settings, of which Blender has many, or my PC is unable to handle the graphics calculations... Any help would be greatly apprecitated!
import bge
import code
import aud # audio
import numpy as np
import time
import h5py

cn=bge.logic.getCurrentController()
ow=cn.owner

##The default logic tic rate is 60 times per second (60Hz float number)
bge.logic.setLogicTicRate(25.0) #running at 25fsp

global PUpLipMid
global PLoLipMid
global PMouth_R
global PMouth_L
global PTongue
global Pjaw

global j
j=0

def main (cn):
    global j
    boneInit() #init bones to move armature
    if j<119:  #before dataMatrix runs out
        print ('main ', j)
        [TL, BL, J, MW]=getDataPoints(j)
        SKM = ratioFunction(TL, BL, J, MW)
        print('SKM\n', SKM)
        MovesBones(SKM)
        j+=1
    sa1() #sound

###################  boneInit  ########################
def boneInit():
    if not "init" in ow:
        ow["init"]=1
        cn.activate(cn.actuators["Armature"])

################  read data matrix  ##################
def getDataPoints(j):
    print ('getDataPoints ', j)
    with h5py.File('test.h5', 'r') as f:
        points = f['/Points'].value
        NumDataPoints=points.shape
        #print(NumDataPoints[0])
        colm=NumDataPoints[0]/4
        points.shape = (colm,4) # TL,BL,J,MW
        #print (points)
    TL=points[j,0] #Dist from nose to: Top Lip
    BL=points[j,1] #Bottom Lip
    J=points[j,2] #Jaw
    MW=points[j,3] #Mouth Width
    return TL, BL, J, MW

###################  Ratio Function  #####################
def ratioFunction(TL, BL, J, MW):
#SKM matrix generated for PUpLipMid, PLoLipMid, Pjaw, PMouth_R, PMouth_L
    #print('TL=',TL,'BL=',BL,'J=',J,'MW=',MW)
    SKM=np.zeros(shape=(5,3)) # SKM 5 bones [x(0),y(1),z(2)] coordnts
    SKM[0][2] =(-0.002*TL-0.05) #PUpLipMid
    SKM[1][2] =(0.002*BL) #PLoLipMid
    SKM[2][2] =(0.0005*J) #Pjaw
    SKM[3][0] =(0.002*MW) #PMouth_R
    SKM[4][0] =(-0.002*MW) #PMouth_L
    #print(SKM)
    return SKM

###################  Move bones  ########################
def MovesBones(SKM):
    global PUpLipMid
    global PLoLipMid
    global Pjaw
    global PMouth_R
    global PMouth_L

    PUpLipMid=ow.channels["PUpLipMid"] #boneName=ow.channels["Bone"] #BL_ArmatureObject.channels["ChannelName"]
    PUpLipMid.location=[SKM[0][0],SKM[0][2],SKM[0][2]] #zero bone's local location
    print("PUpLipMid: ",PUpLipMid.location)
    PLoLipMid=ow.channels["PLoLipMid"]
    PLoLipMid.location=[SKM[1][0],SKM[1][3],SKM[1][2]]
    print("PLoLipMid: ",PLoLipMid.location)
    Pjaw=ow.channels["PJaw"]
    Pjaw.location=[SKM[2][0],SKM[2][4],SKM[2][2]]
    print("Pjaw: ",Pjaw.location)
    PMouth_R=ow.channels["PMouth_R"]
    PMouth_R.location=[SKM[3][0],SKM[3][5],SKM[3][2]]
    print("PMouth_R: ",PMouth_R.location)
    PMouth_L=ow.channels["PMouth_L"]
    PMouth_L.location=[SKM[4][0],SKM[4][6],SKM[4][2]]
    print("PMouth_L: ",PMouth_L.location)

###################  audio  ########################
def sa1():
    global i
    sound = aud.Factory('sa1.mp3') #.file('sa1') #wav file in blender file
    #print ("I TURNERED OFF THE SOUND @ main STEP2 sa1 Func!")
    if not 'play' in ow: #will play sound only once
         ow['device'] = aud.device()
         ow['device'].play(sound)
         ow['play'] = 1
    i=3

I have been playing around with many setting, including that one that you mentioned (thank for clarifying where the clipping planes option was). Your solution does help to an extent, but only if I cut through half the head, and even then the model is not full stable, as per the images below where I have the exact same settings but sometime the teeth and eye pop out when I run the GBE.

What are your near and far clipping planes set to in the viewport? If the near plane is set too small, you can start to get errors that look a lot like this.

If you disable your script and run the game, does the model still have the problems?

Thanks for the replies guys. If I disable the script I get the same effect, yes. @Justin, I am still a noob with Blender, I have Google'd clipping planes but could not fine anything helpful. Can you be a bit more specific? I cannot find many problems of the same kind on the web, but it is common for such distortions to occur in the BGE if your graphics card or RAM cannot handle the worklooad? I have a i7, 6GB RAM PC with Gefroce GT 630m-2GB Nvidia graphics card, surely that should handle a single character mesh being manipulated in the BGE?

The graphics card ram does not cause this kind of artifacts. To me it looks like the depth test is deactivated. This will cause objects to always be drawn on  top of the previous ones. Under which circumstances are the teeth and eyes on top and when is the body on top?

@maddin45 -It seems like the teeth and eyes pop over the face randomly, but after a lot of clicking it does seem to go in a some vague cycle of showing the eyes and teeth, then no eyes and teeth, and then a mix of teeth or eyes over the face. How does one go about activating the 'depth test'?

I have not found a setting in Blender but, you can try calling opengl functions directly from python. Make sure to import bgl and call bgl.glEnable(bgl.GL_DEPTH_TEST). Not sure if it will work, but it is worth a shot ;)

Thanks for the help, but it didn't seem to do anything, in the python console and in the script (but no error came up so I am assuming it accepted the code), I think I should point out I am using Blender 2.70a. I can share the .blend file if it will help?

To change the clipping planes, put your mouse in the 3D view, hit 'N' on your keyboard and look for the 'View' options. The setting you're looking for is called 'Start' under 'Clip.' If this is set to a really small value, you may start to see things show up that are actually behind something closer to the camera (like teeth instead of lips).

Thanks, I added more to my original questions post in response to this. In short it didn't solve the problem, it just made it less likely to happen. But now this brings up another quick question, if my now have a floating face (which if fine for the work I need to do) how do I get the clip settings to be applied to the camera view in the Standalone Player in the BGE?

I still cannot solve this problem? I might swap to Unity...

I had similar problems, it seems to be a problem with depth sorting in blender. What helped me was setting:
Materials > Game Setting > Alpha Blend > set it to "Alpha Clip"
You should do this for the teeth and eyes, maybe skin aswell(try one at a time).
Other options that may have an effect on this problem are "Back Face Culling" and "Transparency".


text:
How to animate Rubik's Cube rotations
I’ve built a blender scene of a Rubik’s Cube to create animations of different move sequences for solving the cube.  I’ve got a lot of sequences to create, so I need the simplest way possible to create each animation.  However, I’m finding that animating rotation is a nightmare.
When I rotate one side of the cube (nine pieces around the cube’s centre), I’m struggling to get the individual pieces to behave.  With XYZ Euler, the first couple of rotations are fine, but on the third rotation the pieces spin about into position.  With Quaternion WXYZ, the pieces separate slightly.
I’ve also tried creating Child Of constraints, but it’s too much work as rotating one side means that I have to create keyframes for setting the influence of the parent to 1 for the nine pieces and then again to set the influence to 0.  It takes an age.
Here’s a link to my blend file using XYZ Euler:  https://www.dropbox.com/s/pp8iztzkz5mr5ki/Cube_XYZ_Euler.blend
I got the idea to use Quaternion rotation from this video, which also uses the same method for performing the rotations as me: http://www.youtube.com/watch?feature=player_detailpage&v=4fs01zdvtg0#t=855 The URL jumps to 14:15 which shows exactly how I’m doing my rotations.  However, it works for the guy in the video!
In the video description is a link to the blend file.  When you load this blend file and play it, the rotations look perfect (using Quaternion rotation).  However, if you delete all the keyframes and start rotating it yourself, the pieces start to separate.  Is this because the blend file was created on an older version of blender where the rotation worked better?
I feel like I’m close to getting it, but just missing one last piece of information.  It’s driving me insane!
I’d really appreciate some help on this, as I’ve been struggling for days on it now and I need to move on.

I've made a tutorial on my Youtube Channel on how to Animate a Rubix cube. Hope it helps: https://www.youtube.com/watch?v=O4-FYkTPzZc

Here's my solution for rotating multiple cubes using Geometry Nodes: Realistically randomize Rubik's Cube And here's older solutions using Animation Nodes: Animation Nodes Rubik's Cube

Actually, even the video recorder himself didn't get the expected result during the video (see 18:24 of that video).
To make an expected Rubik's cube animation, it is important to keep below points in mind:

Setting rotation mode to Quaternion for all cubes are highly recommended for expected result. Otherwise you have to key among the Euler modes, which makes it more difficult.
Make sure the F-Curve key interpolations for all rotation channels are set to Linear, otherwise it just works weird.
Make sure to have the selected cubes keyed BEFORE rotating them.

A comparison file based on your scene. FYI. Hope it helps.

I thought the answer lay somewhere around the F-Curves, but I did try setting to linear without effect, so I obviously done something wrong.  I take it I need to select all the rotations in the graph editor/dope sheet, Key->Interpolation Mode->Linear?  Also, is that right, I need a keyframe for every piece of the cube, not just the pieces that have moved and the ones that are about to move?

Hi, the answer just updated.

Yes, Interpolation mode can be switched in the menu, or press T for shortcut. And, if you want to make Linear as the default key interpolation, you can make it as default in the User Preferences setting, but you have to restart blender to make it work.

Thanks, this worked perfectly.  I have no idea why I couldn't get this to work when I messed around with the interpolation mode myself.

I'm just thinking; if I'm using linear interpolation, how difficult is it to create ease in and ease out, something that's easy with bezier?  Would it mean inserting extra keyframes just after and before the main keyframes and manually create the easing?

I see your point. Or this is kinda bug?

I'm happy with this method and not too bothered about easing at the moment.  If I want to go with easing later, I might try using armatures (as noted here http://blenderartists.org/forum/showthread.php?326072-How-to-animate-Rubik-s-Cube-rotations&p=2570435&highlight=#post2570435), but I've yet to play with these.

Just reported here. Let's see if this is strictly a bug. :). Yes, armatures might work as well. Never tried that yet.

Wow, that got closed quick!

let us continue this discussion in chat

You definitely need to use Quaternion rotation, but you don't have to use linear interpolation. If you set it to Bezier and set the handles to Automatic, then select all in the Graph window, then hit Shift+S, you can select Flatten Handles, which will help fix the problem of different cubies moving at different rates than their neighbors.
You should also add keyframes for all cubies whenever you record a turn, so that all the handles are the same widths. These two things together will completely solve your F-Curve troubles.
You should also move the individual centers of your cubies to the center of the whole cube, so they rotate correctly, and so that the only keyframes you'll need are those of Rotation.


text:
MSI Installation issues
I am trying to help a friend who uses this program,  The issue she is having is trying to install 2.76.  It gives her a message she has an older version already installed. She then uninstalled the older versions but now when she tries to install the only version that will install is version 2.74 which is an executable. When she tries to install version 2.75 it tells her there is a newer version installed. When she tries to install 2.75a or 2.76 it tells her there is an older version installed. Any help would greatly be appreciated.
Thanks
Mark

I installed over an existing older version in Windows before and had no trouble with it. The shortcut will update to the latest installed version anyway.

I never got that message on Windows 7 here. Latest install was 2.76 RC3

She has done the unzip version and is able to get it running, but she still wants to resolve the issue so she can get to the root of the problem. Is there a registry Key entry that would cause this issue?

I will have her try that , are the startup.blend and the  userpref.blend in the registry?

Ok I see they are hidden files, but I believe she had deleted all hidden files also but I will ask her. Thanks for your help Ill let you know how things are going.

She actually did this a couple of times and the problem still remains. She also rebooted after deleting files and the programs. Any more ideas?


text:
Is there a way to temporarily 'ignore' keyframes on a specific frame?
In the Dope Sheet I have numerous keyframes. Is there a way to temporarily "ignore" the keyframes on a specific frame so they aren't considered when running the animation?

Doesn't appear to be a duplicate. I'm looking for a way to disable the entire column of keyframes, or ignore them.

I can only go by what is in the question. I have edited it to be clearer about what you mean.

Why don't you just delete the keyframes in the column. You can always restore them with Ctrl + Z, when you're not happy with the result.

@PaulGonet Blender counts changing the current frame as an action, which you would also have to undo, so if you moved in the timeline a lot you could potentially run out of undo steps.

You can't disable them as such, but you can move them out of the way.
Select the keyframes you want to 'disable' and ensure the current frame is frame 0. Press S to Scale and type -1. This will scale using the current frame (zero) as the origin and swap the keyframe to the other side of the axis - so, for example, keyframes on frame 20 will be moved to frame -20. This will move them outside of the normal range of animated frames and effectively disable them (provided you have a keyframe at the start of the animation to set the initial state).
Enabled - the keyframe is in it's 'normal' position

Disabled - the keyframe has been moved to the opposite side of the axis

To 're-enable' the keyframes you can simply repeat the same action to mirror it back to the positive side of the axis (ie, frame -20 scaled by -1 becomes frame 20 again).

Very smart and helpful solution!


text:
Is there a way to have a mesh extrude or retract itself during an animation while rigging with bones?
Basically, I've got this mechanical mesh I'm making where I need a lid to hinge down to cover the top of a cylinder-ish shape.

This hinge is rigged to the lid. It rotates from a 45 degree tilt to a 90 degree tilt as the lid closes from a 90 degree tilt to a 0 degree one.

See? The bottom part of the hinge extends through the bottom of the mesh. Do you guys know a quick fix?

When I try to make this hinged lid shut, part of the hinge sticks out of the bottom of the mesh. What would you guys recommend I do? If I flat-out shorten the bottom of the hinge arm, then it won't connect correctly and would look like it's floating. If I keep it like it is, the hinge can be seen poking through the bottom. What should I do?

You can consider using a Shape Key.  The wiki page explains it better than me:
https://www.blender.org/manual/animation/techs/shape/shape_keys.html
The basic idea, though, is that you can animate the vertices directly.  In this case, you make a shape key that goes from base-shape to a "retracted" shape.  Then you add two keyframes, one of it in its base position when it's open, and one of it in its retracted form when closed.

I tried using shape keys, but I can't get it to animate. I made a shape key where the bars were shorter so they didn't go through the bottom of the mesh for a rest shape key, and then set the value to 1 for frame 0 and created a keyframe. I then went to frame 70 (end of animation), set the value to 0, and created a keyframe. Then, I created another shape key that was the longer bar, set the value to 0, created a keyframe at frame 0, then went to frame 70 and set the value to 1. And created a keyframe. But nothing happens. I don't know why the object isn't deforming like it's supposed to.

Are you setting a Shape Key keyframe?  You have to press "i" while your mouse is over the value that you're setting, like so:  http://i.imgur.com/9coaLwq.png
Your mouse has to be hovering over that "Value:  ___" bar.
When done correctly, it should be yellow when on a keyframe, and green otherwise.

I know how to do it. I've done all that, followed tutorials word-for-word, but it doesn't work. I asked a question on stack exchange: http://blender.stackexchange.com/questions/40472/blender-shape-keys-arent-animating-properly

Ok, so I downloaded the .blend from that question, deleted the Shape Key, and redid it.  Your process must be wrong, because it works perfectly for me.
Here's the working file, hopefully i'm understanding the effect you're going for:
http://www.pasteall.org/blend/38764

I deleted the shape key and re-did it... and it worked. I can't believe I didn't try it first.

Add a stretch to constraint to the bone that deforms the connecting rod. In the constraint settings you will also want to set volume variation to 0.0 so that the connector doesn't shrink as it gets stretched.


text:
Archimesh vs Archipack
So now, with 2.79, there are two architecture addons.

Do they serve different purposes?
Do archipack replace archimesh?

Archimesh basically is a collection of existing cad addons packaged and extended by Antonioya. (window maker, door maker, a wall generator, blinds..)
Archipack is a framework intended to provide parametric objects developpers a fast and easy way to program, focusing on mesh generation, and providing on-screen real-time manipulation, native preset and material handling, and strongest support for linked objects.
Inspired by archimesh, current implemented objects are ment to boost users productivity with a fast and reliable way to get "ready to render" models.
See Archipack wiki

Does this mean that Archipack will eventually supersede  Achimesh

Users will choose and only time will say. Archimesh still provide blinds / kitchen / and some furnitures. On the other hand, archipack does provide a powerfull roof object.

...and a better stair object.

what about an integration between both ?

An integration [1] for missing features is planed, but the logic behind is somewhat different and those missing objects will require som work.
In the meantime nothing prevent you to use both.
[1] https://github.com/s-leger/archipack/projects/4

You should probably disclose that you're slightly biased as the author of Archipack

Nothing hidden here, contributed in archimesh for 2.79. Archimesh was not fitting with my needs so made my own. So would rather say well informed.

I don't agree: you should add a disclaimer saying that you sell your software (49 €)... So your judgment is necessarily biaised (although your add-on looks great, but it is not the question here).

In 2.79 / 2.80 era, archipack was free and shared right in blender's sources, and there still is a free version available. Commercial (sustainable) version was not available at time of writing (2017) so basically you are just plain wrong.


text:
BGE: Change Actuator's Track-to Time value using Python?
I want to change the Time value for an Edit Object: 'Track to' actuator in-game. Seems like something that should be achievable with Python - but I can't find any documentation on this.

To add to the confusion, the documentation I could find refers to refers to this actuator as the TrackTo Actuator, although no such actuator appears in the list of actuator types:

Instead, Track To is listed as a subset of Edit Object. It is also listed this way in the documentation for the Edit Object Actuator: Track To
(Although this page doesn't go into any details about Python).
This Blender Artists thread was helpful for at least getting one object to track to another, but the Time value is not mentioned. And I can't even get the tracking to update with each tick.

After reading that thread I looked to the API to try to better understand alignAxisToVect(). It takes three arguments, one being a factor of how much to align, but it seems that any updating over time would need to be programmed manually, and I'm not sure if it would look smooth.
There is an angularDamping attribute as well, which seems like it ought to do something similar to the track-to Time value. But at this point I'm speculating.
If anyone knows how to get at this Time value or emulate its functionality with Python so that it can be updated in-game, please share.

Did you tried in Python cont.actuators["TrackToActuator"].time = any_value? Reference: https://docs.blender.org/api/current/bge.types.KX_TrackToActuator.html#bge.types.KX_TrackToActuator.time

@JoelGomesdaSilva I've got it working! Thank you for that very helpful comment. Would you like to post an answer officially, or shall I?

I did it, if you could accept it. ;)

Try in Python:
cont.actuators["TrackToActuator"].time = any_value

Reference in API
Edit - example file by Mentalist (from link in comment):


text:
How to generate Automatic Weights if not parenting?
When parenting a mesh to an armature, we are presented with some options, such as to generate Empty Groups, and to generate Automatic Weights.

If we choose not to parent the mesh to the armature and instead add an Armature Modifier directly, we are not presented with these options.

Is there a way to generate Automatic Weights or Empty Groups separately in the menu somewhere?
It's not a big deal since we can parent it and then unparent it and rearrange the hierarchy, I just feel like I should know how to do it without this extra step (if there's a way).
Thanks

Since it only makes sense when you try to deform mesh with bones, so it has to be like that, or you have to do it by scripting maybe. I'd say there is no shortcut currently. Maybe you can tell more about why you want to do that?

Yeah, I considered that too, but I thought maybe there was a way to generate this data from a selected mesh object to the active mesh object. I am working on a rig and mesh that are both parented to a collision object for game use, and this is my first time working with this kind of setup, but it got me thinking more flexibly in terms of how rigs can be structured. So I thought it would be useful to know how to generate this data without changing the parenting hierarchy. I admit it's a nerdy question, and based more on curiosity than need.

It's not nerdy at all, it's very valid question to speed up workflow. I do not know an answer other than what you said in last paragraph, which is also the way I do it. Maybe this could be a feature request to optimize workflow. But when I think about it there are many more things in blender that should get a design review and an improvement.

For generating/transfering weights beween objects, you can: 1. use transfer data operator; 2. use "copy vertex group to selected" feature; 3. use Data Transfer modifier.

@LeonCheung Thanks for those ideas. I'll play with them.


text:
Why does armature change normals in UE4?
After hours of testing, I've encountered a strange problem.
I have an animated scifi table asset I've imported into UE4. I've also imported the exact same asset without animation. Both assets were exported with the same fbx parameters. Both are using the same material and textures. They are the same in all ways except that one has an armature.
The one with the armature has bent normals. The one without an armature looks correct. I ran several more tests after encountering this strangeness. The mesh with an armature doesn't render correctly.
I've added a screenshot of the two assets side by side. The one on the right has an armature. They are in all other ways the same, including export presets and material.


text:
Can image texture parameters be accessed from python?
I would like to create a new image texture and define its name and size entirely via Python. The closest I can get is to generate the popup window where I change these parameters. I can't seem to find the answer anywhere. Is this possible?
I'm trying to create a script that auto-bakes a color ID map, tied into a single fat "Bake" button. I want the image texture's name and size to be predefined when generated.

Ah, nevermind! I found the answer almost immediately after posting.
bpy.data.images.new("StringName", 1024, 1024)

...I wasted an hour looking for this simple answer...


text:
For game assets is it ok to intentionally stretch UVs, or does this interfere with pixels per units?
I have a question about texture stretching and environment design, and was hoping a Blender/asset creator guru/environment artist could give me some answers. I was reading about something games use called "pixels per units", which is apparently supposed to optimize a game. I'm not sure how.
In the following screenshot, I've been stretching a sci fi object's UVs to better fit the texture details. Is this bad? It certainly breaks the pixels per units rule, or is this a common practice? I've noticed this sort of thing in AAA titles, where they stretch or squish UVs to use a single texture in a variety of ways. But is this discouraged or not optimal?
Just a curious thought. I can't seem to find an answer online about intentionally stretching/squishing UVs to fit a texture.

I don't think there's anything wrong with stretching UV's from a technical perspective, it might even be desirable.
The main thing is that from an aesthetic standpoint it looks good. I would say that as long as it looks good, and is not giving you a blurred or pixellated effect (unless that's what you want), then you should be fine.

I didn't think so, but it was a nagging question. Thank you Todd :)


text:
Noise reduction blur / postprocess in blender
I use Photoshops Surface Blur to reduce the noise, but it operates only on 2D
Isn't there a way to blur in Blender, but also smarter then PS maybe using some extended info that Blender has?
I found http://mattebb.com/weblog/surface-blur/ , but the sample link is broken and quite old
Any idea how to make "smart" blur directly in Blender?
Before

After

tutorial http://cgcookie.com/blender/2013/02/18/blender-bilateral-blur-compositing-node/

isn't there a setup which doesn't need to be configured for each scene individually?

There is a nice setup in the demonstrated here, which uses the bilateral blur node while taking the normals into account. It also allows you to control the blur on glossy/diffuse/transmitted etc. passes separately.

Is your example image a render or a photograph? If it's a render, take this as a compliment ;)

I bet for a render (all those toys must be expensive) :D

Blender Compositor work only in 2D too..
"using some extended info that Blender has?" - You show a Photo.. What Info should Blender have that PS doesn't? ;-)
What you have in your Image here is actually not Noise, but Compression Artefacts.
I found this solution with Bilateral Blur works quite ok on your Sample:

I doubt that any Noise Reduction on Images(not rendered) in Blender is much better than dedicated ones in Gimp or elsewhere. While Blenders Compositor allows some neat things, it does not give direct access to Pixels, which i think is needed for any decent Noise reduction. (Of course Node do access Pixels, but you have no way of access Pixels in you Node Setup)

hi, is there a .blend file for your node setup? thx

I would have to recreate it.. But it's only 3 different Nodes: Separate/Combine YUV in Converter (shift+a) and Bilateral Blur in Filter. I think you can easily do this?


text:
Error: import Point3D of Geometry Module of sympy0.7.5 in Blender2.71
I want to use  Geometry Module of sympy0.7.5 in Blender 2.71 (64 Bit).
  But I got some error when I try to do "from sympy import Point3D":
        ImportError: cannot import name 'Point3D'.
Here is what I have done:

Clone the latest sympy0.7.5:
git clone https://github.com/sympy/sympy

Install it in python3.4.0 [MSC v.1600 64 bit (AMD64)] (same python version in blender 2.71 except MSC v.1800 64 bit (AMD64)). The sympy's location is in c:\Python34\Lib\site-packages\.
Test from sympy import Point3D"- in python3.4, everything is fine.
Copy sympy folder in
c:\Python34\Lib\site-packages\ to
c:\Program Files\Blender Foundation\Blender\2.71\python\lib\
In python console of the blender, it works for
   from sympy import *
   from sympy import Point
   ...
  but failed for
   from sympy import Point3D

I found the solution:

get a fresh copy of sympy by git;
simply copy the subdirectory "sympy" into the corresponding site-packages directory of my blender:
  c:\Program Files\Blender Foundation\Blender\2.71\python\lib\site-packages\
Every is fine now.

ouyang

When I installed sympy like you did, an import raised an ImportError saying "SymPy now depends on mpmath on an external library". I asked about it on StackOverflow, and @sambler was able to help me out with that. Basically, you add the path where mpmath is, or download mpmath from Git and install it just like Sympy. The installation process has sort of changed since you posted your answer, but thankfully just a little bit.


text:
What are all values in bound_box?
I want to compute the total scene bounding box, so I can fit the scene in rendered image automatically. I have found bound_box. But why are there so many values
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>
<bpy_float[3], Object.bound_box>

There should be 6 values (x_min,y_min,z_min) and (x_max,y_max,z_max)

related: http://blender.stackexchange.com/questions/14073/blender-api-return-value-of-bpy-data-objectsid-show-bounds-and-bound-box

maybe you run the code twice and didn't realize, what code are you using and what object? (screenshots welcome)

@zeffi I probably did that

You will get 8 values only,
>>> obj = bpy.context.active_object
>>> obj.bound_box
bpy.data.objects['Cube'].bound_box

>>> [v[:] for v in obj.bound_box]
[(-1.0, -1.0, -1.0),
 (-1.0, -1.0, 1.0),
 (-1.0, 1.0, 1.0),
 (-1.0, 1.0, -1.0),
 (1.0, -1.0, -1.0),
 (1.0, -1.0, 1.0),
 (1.0, 1.0, 1.0),
 (1.0, 1.0, -1.0)]

for Suzanne it would be:

Here's some code I wrote about 2 years ago to get x.min, x.max, etc., and distance over the axis for x, y and z. With instructions how to use it. (I have this tucked away in a module so I just import the function when I need it)
import bpy
from mathutils import Vector

def bounds(obj, local=False):

    local_coords = obj.bound_box[:]
    om = obj.matrix_world

    if not local:
        # Use @ for multiplication instead of * in Blender2.8+. Source: https://blender.stackexchange.com/a/129474/138679
        worldify = lambda p: om * Vector(p[:])
        coords = [worldify(p).to_tuple() for p in local_coords]
    else:
        coords = [p[:] for p in local_coords]

    rotated = zip(*coords[::-1])

    push_axis = []
    for (axis, _list) in zip('xyz', rotated):
        info = lambda: None
        info.max = max(_list)
        info.min = min(_list)
        info.distance = info.max - info.min
        push_axis.append(info)

    import collections

    originals = dict(zip(['x', 'y', 'z'], push_axis))

    o_details = collections.namedtuple('object_details', 'x y z')
    return o_details(**originals)

"""
obj = bpy.context.object
object_details = bounds(obj)

a = object_details.z.max
b = object_details.z.min
c = object_details.z.distance

print(a, b, c)

"""

Ah, so it contains the coordinates of the box vertices. Then I need to loop to find the two min and max points

For the above, change * to @ in worldify = lambda p: om * Vector(p[:]) for Blender 2.8x and above. Otherwise element-wise multiplication error will occur.

Each object that has a bound_box property will return 8 values that represent the bounding information. The 8 values describe the corners of the bounding box itself.
If you have 16 values I presume that is because you have 2 objects in the scene (though it isn't clear from your question what you might have typed in to return all 16 values).


text:
How to prevent the decimate modifier from working on vertices outside the vertex group (with python)?
I am using the 'decimate modifier' to decimate my mesh. The modifier should only work on a given vertex group. But sometimes (when the ratio is getting lower) the modifier is working on vertices outside of the group. But I really don't want that! How can I disable this behaviour? If the modifier can't decimate more than it should simply stop.
Can I somehow find out if the modifier is working outside of the group and simply set the ratio to a higher value (with python of course).
Thanks!

Old answer below!
My solution was terrible slow. So I got the blender sources and changed the modifier. It was fairly easy!
I added following code on line 311 (https://git.blender.org/gitweb/gitweb.cgi/blender.git/blob/master:/source/blender/bmesh/tools/bmesh_decimate_collapse.c#l311)
// Only work on vertex groups
// vweights is false when no vertex groups are used
    if (vweights) {
        float weight_v1 = roundf(vweights[BM_elem_index_get(e->v1)]);
        float weight_v2 = roundf(vweights[BM_elem_index_get(e->v2)]);

        if (weight_v1 != 0.0f && weight_v2 != 0.0f)
        {
            eheap_table[BM_elem_index_get(e)] = BLI_heap_insert(eheap, cost, e);
            return;
        }
        else
            return;
    }

As you can see I used the weight to find out if the vertex is really in the group. I need to do that because in deform.c (https://git.blender.org/gitweb/gitweb.cgi/blender.git/blob/HEAD:/source/blender/blenkernel/intern/deform.c#l742) the weight is set to 0.0 even if the vertex isn't inside the group.
If you need this you need to add vertices to a group and set any value between 0.01 and 1 as vertex weight.
Old answer
I wrote a simple (stupid) decimate algorithm which only works on a vertex group or the whole mesh. It is only collapsing edges and the angles are totally ignored. It is not trying to preserve the shape really well.
Here is the code, it is not optimized (I am pretty new to python) and I know I could optimze it here and there (all the bpy.ops api calls could have faster api methods) but for now I am happy. Nevertheless: Here is the code!
If you have an idea how the algorithm would be faster, spit it out. Thanks!
# how_often: how often should a edge be collapsed
# group_name: if it is None it will work on the whole mesh or on a given group.
def decimate_mesh(self, how_often=0, group_name=None):
    import bpy
    ob = bpy.context.active_object
    mesh = ob.data

    # go to edit mode and deselect everything .. just to be sure
    bpy.ops.object.mode_set(mode = 'EDIT')
    bpy.ops.mesh.select_all(action='DESELECT')
    bpy.ops.object.mode_set(mode = 'OBJECT')
    how_often_decimate = how_often

    if group_name is None:
        # decimate all edges
        while how_often_decimate != 0:
            edge_length = dict()
            # calculate edge lengths
            for edge in mesh.edges:
                edge_length[(mesh.vertices[edge.vertices[0]].co-mesh.vertices[edge.vertices[1]].co).length] = edge
            # pick the shortest edge, collapse it and make all polygons concave
            min_key = min(edge_length.keys())
            edge_to_collapse = edge_length[min_key]
            edge_to_collapse.select = True
            bpy.ops.object.mode_set(mode = 'EDIT')
            bpy.ops.mesh.merge(type='COLLAPSE')

            bpy.ops.mesh.select_all(action='DESELECT')
            bpy.ops.mesh.select_all(action='SELECT')
            bpy.ops.mesh.vert_connect_concave()
            bpy.ops.mesh.select_all(action='DESELECT')
            bpy.ops.object.mode_set(mode = 'OBJECT')
            how_often_decimate -= 1
    else:
        # decimate edges where both vertices (of the edge) are part of the vertes group
        group_index = ob.vertex_groups[group_name].index
        while how_often_decimate != 0:
            vertices_which_are_assigned_to_group = set()
            edges_which_can_be_decimated = set()
            edge_length = dict()
            # I am unsure if I really need to do this every time. I know that the indexes could be altered by blender
            # but I need to know which vertices are inside the group. So yeah...
            for vert in mesh.vertices:
                for vert_group in vert.groups:
                    if vert_group.group == group_index:
                        vertices_which_are_assigned_to_group.add(vert.index)

            for edge in mesh.edges:
                vertex_0_index = edge.vertices[0]
                vertex_1_index = edge.vertices[1]
                if vertex_0_index in vertices_which_are_assigned_to_group and vertex_1_index in vertices_which_are_assigned_to_group:
                    edges_which_can_be_decimated.add(edge)

            if len(edges_which_can_be_decimated) == 0:
                print("No edges anymore!")
                break
            for edge in edges_which_can_be_decimated:
                edge_length[(mesh.vertices[edge.vertices[0]].co-mesh.vertices[edge.vertices[1]].co).length] = edge

            min_key = min(edge_length.keys())
            edge_to_collapse = edge_length[min_key]
            edge_to_collapse.select = True
            bpy.ops.object.mode_set(mode = 'EDIT')
            bpy.ops.mesh.merge(type='COLLAPSE')
            bpy.ops.mesh.select_all(action='DESELECT')
            bpy.ops.mesh.select_all(action='SELECT')
            bpy.ops.mesh.vert_connect_concave()
            bpy.ops.mesh.select_all(action='DESELECT')
            bpy.ops.object.mode_set(mode = 'OBJECT')
            how_often_decimate -= 1


text:
How to create recesses in a curved surface?
I want to make a simple cylinder box that has a very simple twist lock. I have seen a lot of maze puzzle boxes on the net but I just want something simple.
Ideally The lid will have 3 'L' shaped recesses in it that a lip with 3 pins in the base will key into. The lid presses down with the pins in the recess and then a twist to close.
The base would look something like this:

[Edit] I found the torus mesh. It seems like I need to play with some maths but this is kind of what I'm after, but without the continuous loop really (oh, and imagine a closed top).

Can anyone provide any good examples or links on how to do this easily.

Would be good if you could add some images of the object you are trying to make.

@Ray, I haven't made it yet :) The image above is what I have for the base at the moment. I'm looking at a lid, or a better way to do the whole lot.

I have found the torus mesh which can give a nice channel. You could cut some some bits out and then add half spheres on to make it rounder. I struggled to get sizes and tolerances in as well. Hopefully there is an easier way?

@ray, added another screenshot of the lid bit I'm trying to make a little better, hopefully it makes more sense now.

Anything that has to be cut into a curved surface, I tend to build flat and curve into shape later. Using this method I have a model of one 'L' section and a bezier circle (origins of both objects matching each other):

Using an Array modifier with a count of '3', followed by a Subsurf set to '2' subdivisions and finally a Curve modifier:

I get this result:

Using modifiers allows you to easily manipulate the original non-curved section, while also seeing how it will look when curved into a circle.
Once you are happy, modifiers can be applied and the two ends of the circle can be merged (either by W> Remove Doubles, if the vertices are close enough, or more manual merging if they are not).
Also note that increasing the resolution of the curve on the curve's 'Data' tab will improve results. This example had a curve resolution of 30.

Nice one. Easy and flexible. If the vertices are not close enough, retopology is also an option.

@ray, is there some way I can message you some screenshots or a link to my blend file directly as I can't get the subsurf to work properly, as it destroys the ridge inside. To be fair I did use a mesh instead of a plane as I think you have (I'm relatively new to blender so I don't get how make this into a solid object)

Actually, I made it in the end. I went with the plane, then had to fiddle a lot to get the normals in the right direction and then add a topp and bottom, then used the booleans. I did that for both parts of the lock and it's finally busy printing :)


text:
Combine 2 Scenes / Volumetric Fog from BI to Cyles
I have a complex scene rendered in cycles and now like to add some volumetric fog rendered in BI.
I have linked some objects from my cycles scene to a new BI scene and added a  cube with a volume material. Now the fog is in front and behind my linked objects.
Now I like to render the Volume Fog and combine it with my cycles scene. How can I block rendering the fog behind my objects from my cycles scene without rendering them self?

Okay after some tries i found a simple solution.
create a new BI-Material, set diffuse and spec to "0" enable transparency and change to mask and alpha to "0".
This works fine for me!


text:
How can I create a "volleyball sphere" for sculpting?
When sculpting, I have seen many people use a sphere with a special topology as a starting point in blender. While a regular UV sphere has smaller faces near the two poles, this type of sphere had equal-size faces all around.
Unfortunately, I don't know it's name, so I can't really search how to add it. I'd expect it to be easy to add given how many people use it, but I haven't had any luck finding it in Blender. It's shape reminds me of the seams of a classic volleyball, hence the title:

I'm not sure if this is exactly what you're looking for, but if you enable the Extra Objects add-on (Edit > Preferences > Add-ons) you can use Add > Mesh > Round Cube to create something similar.

@RobertGützkow ah, that plugin also tells me the name! "quadrilateralized spherical cube", or "quad sphere" for short. I'd pick this as an answer if I could, since the add-on gives a better result than the other answer.

Give me a moment and I'll post it as an answer.

A quad sphere also known as quadrilateralized spherical cube can be created with the Extra Objects add-on.

Open the add-on preferences (Edit > Preferences > Add-ons)
Search for Extra Objects and enable the Add Mesh: Extra Objects add-on by ticking the checkbox.

Add a quad sphere through Add > Mesh > Round Cube. The default preset that the operator is a quad sphere. You can adjust the parameters in the Adjust Last Operation panel in the lower left corner. The arc property controls the number of arc curve divisions.

You can make such object as well.

Start with a default cube
Add a Subdivision Modifier
Add Cast Modifier, factor set to 1, to make it into a sphere

This is clever! However it doesn't produce the equal-area property that the add-on that was also mentioned does. So I'll prefer that when it's available.

Sure, the addon is way more practical :). This was just to show how it works.

Instead of the Cast Modifier, you can also go into Edit Mode, select everything, then hit Shift-Alt-S and drag your mouse to the right.

You can also bevel the default cube.
Then you can easily choose the number of sides.

Bevel the default cube (Bevel modifier)
Merge double vertices (Weld modifier)
Done.


text:
Best way to send network requests from timer modal
I'm working on an addon that has a polling loop (using a timer modal) that needs to send a network request on every iteration (once a minute):
class PollingLoopOperator(bpy.types.Operator):
    """Polling loop"""
    bl_idname = "wm.modal_polling_loop"
    bl_label = "Polling Loop"

    _timer = None

    def modal(self, context, event):
        if event.type == 'TIMER':
            # Run network polling request

        return {'PASS_THROUGH'}

    def execute(self, context):
        wm = context.window_manager
        # Run every minute
        self._timer = wm.event_timer_add(60, context.window)
        wm.modal_handler_add(self)
        return {'RUNNING_MODAL'}

At first I was thinking of just using the requests library, but then I realized that wouldn't work because it's blocking, and sending a blocking network request every minute would be terrible from a UX perspective. I can't use another thread because Blender is not thread safe. So far I've thought of the fallowing possible solutions, but they don't seem that great:

Use multiprocessing to run the request in another process, I could still use the requests library, but it would have the added overhead of an additional process
Use asyncio.open_connection, seems like maybe the best solution so far
Keep a non blocking socket open and push data from the server, the polling loop just checks to see if the socket has any data. This is a pretty low level option and would require manual ssl handling and building a custom protocol. Plus, it would be harder to build the backend for. But it would have a few major benefits:

The polling loop could run much more frequently then 1 minute because all it would do is check to see if there is any data in the socket
Less overhead because there is only a single socket connection opened

Which of these would be the best solution? Or, is there an even better solution I haven't thought of?

I ended up doing the same thing as the Blender Cloud Addon and run a requests call in a threading executor:
import asyncio
import requests
import functools

async def do_request():
    partial = functools.partial(requests.get, 'http://example.com')
    loop = asyncio.get_event_loop()
    response = await loop.run_in_executor(None, partial)
    print(response)

if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(do_request())


text:
Can Blender be used to composite HDR photos?
So, I know Blender can render out to .hdr format. And I am also familiar with Blender's compositor. What I don't know much about is the processes or algorithms used to produce HDR photographs, or what sort of node setup would need to be constructed for this - if even possible.
For clarity, here is an example of what this process looks like in Photoshop, compositing three exposures:

I would like to do this with Blender's compositor.
What I usually do currently is render a Radiance HDR (.hdr) file out from Blender and then load it into a Mac application called Luminance HDR. There are some limitations with this though, so I am wondering if the same or similar results can be achieved within Blender.
Being able to use .hdr files would be ideal, but working from multiple bracketed exposures would be alright as well. I would like to know if there is a way to do this. Thanks.

What are your inputs and what output do you want? Am I guessing correctly that your inputs are bracketed exposures of environment, you want to add 3d element inside and output an hdr? Is this question about a compositing setup to merge hdrs? If yes it's not complicated at all if you know the exposures. If you don't know or they might differ that is a problem and you will have to eyeball stuff.

I hadn't thought as far ahead as a case where CG would be added to an HDR photo, but I'm glad you mentioned it. This question is for two use cases: 1. A 3D scene has been rendered and saved as an .hdr (or .exr) file from Blender, and we are compositing it in Blender to a final format of .png (for example) where the whole dynamic range is visible. 2. We have some photos of a subject at multiple exposures and want to composite them into a single HDR image. In either case the desired result is to get an "HDR look".

The basic steps are (1) leverage a proper HDR tool to capture the scene referred values and save as an EXR. (2) load into Blender and leverage the output view transform to map the scene referred ranges to the display referred domain. This can be via either (A) a view transform LUT or (B) the colour management curves.

I think the term you're looking for is tone mapping.
In the photography world, "HDR" is used loosely to describe the entire process of shooting multiple photos at different exposures, combining them into a 32-bit image with a high dynamic range, and then tone mapping it down to an 8-bit image that you can display nicely on your 8-bit monitor.
In the 3D world, we can render 32-bit images directly and therefore don't need to go through the process of combining exposures to make an HDR image (we already have one), so we can proceed straight to tone mapping.
There is a special node just for tone mapping actually:

And with a bit of tweaking you can do this:

If you'd like to play with it, here's the original .hdr file: http://adaptivesamples.com/files/original_untonemapped.hdr - this was made by taking several bracketed photos and merging them to an HDR, but the same method applies to raw 32-bit renders.

I recommend you get Bloch's HRDI handbook, your two assumed questions cannot be answered in short, really; your question mixes topics for whole volumes and even while the answer is "yes", it does come with thw caveat of "why would you want to use Blender for getting HDRI look from photos?" and "why do you want to render bracketed results for compositing if your render output has all the lighting data in it?" :-)
There are a lot of free sw alternatives for hrdi photo composition (and the required pre-steps), you get good insight from the book on what to use for what... And I am not associated with the author in any way.

Thank you. 1. One reason for wanting to use Blender for this is the possibilities for animation. Another is for the sake of pushing Blender to see what other capabilities it has that people may not have thought to explore yet. Another is the convenience of keeping one's project all in one .blend that can be easily shared with anyone without needing to tell them they must also download or buy some other program (possibly only available on some other OS). 2. The rendering bracketed results case is for when you have actual photos you've taken and want to use Blender to do it (for reasons above).


text:
How can I dynamically generate operator classes?
I am trying to generate dynamically operator classes.
The code below is based on the code at the end of this link
cls.CustomOp = []
for i in ['a', 'b']:
    idname = "object.operator_" + i

    def func(self, context):
        print("Hello World", self.bl_idname)
        return {'FINISHED'}

    opclass = type("DynOp" + i,
                   (bpy.types.Operator, ),
                   {"bl_idname": idname, "bl_label": "Test", "execute": func},
                   )
    bpy.utils.register_class(opclass)
    cls.CustomOp = cls.CustomOp + [opclass]

I have tried the code above in poll and draw contexts, but always the same :

"RuntimeError: register_class(...): can't run in readonly state 'DynOpa'".

What does readonly context mean?
How to do it (and from where) in a non-readonly context?

The question for me is what is behind needing to dynamically generate operator classes?

@RayMairlot at the base this is related to solve this http://blender.stackexchange.com/questions/56727/changing-tooltip-for-menu-entries-which-use-the-same-operator. But that can be a more general question

You can not run any commands that change properties whithin a poll or a draw function. As far as i know the only context where you can change something is when an operator actually runs or within a callback function that is started "on property change" when you for example set an option in a panel.

ok @GaiaClary, so this kind of approach cannot work in the context of your question ? or is it possible to apply this in another context (before a poll or a draw) ?

As you found, you can't register operators during some actions such as drawing or polling. We can define custom operators within an addons register() or within an operators execute() method, you can also manually run your script from blender's text editor without any issue.
For brevity I'll replace your for loop with a function called create_custom_operator()
def create_custom_operator(i):
    idname = "object.operator_" + i
    .... # rest as above

You can then use it in an addons register() -
def register():
    for n in ['a','b','c']:
        create_custom_operator(n)

Or you could use it in an operator's execute(). Note that I use a file list to define the operators here, we can do this in an operator's execute but not while registering an addon as we can't access the filesystem during addon registration.
class MakeCustomOperators(bpy.types.Operator):
    """Create custom operators"""
    bl_idname = 'object.add_custom_ops'
    bl_label = 'Add operators'
    bl_description ='Dynamically create multiple operators'

    def execute(self, context):
        for f in os.listdir('/path/to/data'):
            create_custom_operator(f)
        return {'FINISHED'}

I have given a more complete example in answer to the question that inspired this question.

Thanks a lot. So for instance the list of custom operators could be defined either in the register part or in an execute function of a modal operator (in order to have this list dynamically updated), isn't it ?

Yes if you want to dynamically update the operators you will want to create an operator that will create them when run, it can read a file, list a directory or scan objects in the scene to define the list. This could be used for a refresh button in a panel or menu. If you keep a list of the operators you can remove the old ones before creating a new list so you don't get duplicates or stale operators.


text:
How to perform basic tasks in Cycles vs. Blender Internal?
In Blender Render let's say I want to texture a box.
This would be my process:

Model than UV UNWrap
Bake AO to a image set blend mode to multiply
Add diffuse texture with appropriate blend mode on a DIFFERENT UV Map to allow changing the size of the wood grains.
Add normal or bump with appropriate blend mode on same UV Map as AO.
Add "grunge" layer in which to add decals etc on same UV MAp as AO.

Doing this in Blender Render was really easy.
In cycles I'm getting VERY lost trying to do these exact same tasks. Even after looking at the manual. I think nodes just scare me I'm not sure. I've made SOME progress and I see the power of nodes, but helping me clear up how to do some common functions like these would probably set off a chain reaction of "Oh I see now".

Do you mean in the Node Editor ?

Well yes that is what I mean I guess. Sorry new to the node stuff =/

In future, I would suggest asking one question at a time as many of the individual processes you were looking to convert from Blender Internal to Cycles have already been answered on the site.

Introduction to Nodes
Well, you can have all sort of nodes, mostly it's quite strait forward what the node does, for an instance the Transparency node or the diffuse, glass, glossy or emission node. Depending on what you want to make you might want to Mix two nodes, for that you would use a Mix Shader node or an Add Shader node, the difference is that the Mix Shader node has a more controll over the Factor that the two nodes are displayed. I'll give some examples of how you can do basic things with nodes.

Giving material an Image Texture

To give a material an Image Texture you would create a Diffuse Node then connect to it the Image Texture Node and plug the Diffuse Node in to the Surface slot in the Material Output Node.

Giving material a normal map

There are couple of ways that you can give your material a Normal Map but a common one would be by simply connecting a Normal Map node into the Normal slot  of the Diffuse Node, also for Normal Map to work properly you have to plug into the Color slot of the Normal Map node another Image Texture Node, this Image Texture would be your Normal Map.

Adding Decals to your material

Adding Decals to your model is slightly more difficult, to add a Decal to your material you would need to connect MixRGB Node into the Diffuse Node, then you will have to connect your Base Texture into the bottom slot and the Decal Image Texture into the upper slot of the MixRGB and finally use the Alpha value as the factor for them both, just like so:

This is an excellent post Igor this helps me a lot! One final question. cegaton mentioned you don't bake AO you use a node for this. Is this done with an add shader or a mix shader? It seems like with nodes you just have to know where to plug them in properly.

Here's a bit of info on how to bake AO using Cycles.  http://blender.stackexchange.com/questions/27964/how-to-add-wear-tear-effect-in-a-texture

I prefer to just disable GI and set a Diffuse material to pure white (1.0, 1.0, 1.0) but you can use the light path node to cancel GI for deeper surfaces as shown here, it's configurable and you can use this to do colors and textures grim easily.  http://blender.stackexchange.com/questions/14400/how-to-get-length-of-specific-ray-type-and-use-that-as-color


text:
How to enable ambient occlusion in the Viewport with Python?
I have been trying to access different functionality in blender using python and I stumbled upon this really difficult problem. I can’t find out how to enable or disable the Ambient Occlusion using Python in the viewport. I have looked at the info panel that records the Python actions and it returns a weird (null) method. I did some research on the python function and found their operations, but I can’t figure out how to get Blender to recognize it. I checked all the buttons around it but they didn’t lead to any conclusion. I am at a complete loss of what to do and any help would be awesome

These types of properties are properties of the 3D view, and so that's what you need to access to access them.
This following code accesses the Ambient Occlusion property but this is dependent on how your screen is laid out:
bpy.data.screens['Default'].areas[4].spaces[0].fx_settings.use_ssao = True

'Default' relates to the current screen layout and 'areas' to the various views that might be open (we need the 3D view). The problem with this is if the screen layout changes then the 3D view might not be in areas[4] anymore (as the list of areas will have changed). To solve this we can instead use the following code which will loop through the areas until we find a 3D view:
for area in bpy.context.screen.areas:
    if area.type == "VIEW_3D":
        area.spaces[0].fx_settings.use_ssao = True

You guys are awesome! I honestly couldn't get this to work, but this is exactly what i was looking for. Thanks again!

import bpy

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        for space in area.spaces:
            if space.type == 'VIEW_3D':
                space.fx_settings.use_ssao = True

something like this. You either have a reference to a window and that will let you access 'space' directly, or you can iterate over all open VIEW_3D areas and set it that way. break early if you need to.


text:
BGE Chaging the position of a vertex in real time
I'm using the BGE and I need to change the position of a group of vertex of a soft-body while the game is running. I've tried with the code below but I don't see any change. If I print the new position of the vertex I can see in console that the value change but in the soft-body I don't see anything different. I've tried using obj.reinstancePhysicsMesh(obj,mesh) at the end of the code but that change the position of the entire mesh. How could I do?
import bge
import bpy
cont = bge.logic.getCurrentController( )
own = cont.owner
scn = bge.logic.getCurrentScene( )
obj = scn.objects["object1"]
mesh = obj.meshes[0]
for v in range(0,1000):
    vert = mesh.getVertex(0, v)
    vert.XYZ = [1.0, 1.0, 1.0]

I think it is not possible with a soft body, because Blender calculates every Frame a new position for every vertice with the position of the vert in the frame before. So Blender dont expect a position changement while running, Blender is using the mesh of the frame bevore. (Its just a guess, I'm not shure.)(It works fine with other Physics types)

Thank you. I see, if I change the object to rigid body it works.

Note that the loop should look like: for v in range(0,mesh.getVertexArrayLength(0)): otherwise an exception occurs.

Yes, look at the code used in this video, the waves are by changing mesh vertices in real time PREVIEW
1:56
blender game engine :waves
YouTube · vicent adnawm
Jan 29, 2016


text:
How do I rotate an object with a custom button and panel using python scripting?
Im making a Boeing 787 model and I just finished rigging it however I thought that maybe I would go deeper and try make a custom panel to control the rig. I've got the panel itself done using one of the default templates but I'm a complete noob at scripting new text.
Basically what I want to do is use a code to create a button in the panel, and when pressed, it will rotate one of the bones used for rigging, say for example the rudder. I really need help with this. By the way, Ive never seen it done but what would be even better would be a slider. This would mean I have more control over the rotation.

One way might be a modal operator which tracks mouse movements and applies it to pose bone rotation. The operator modal template (Goto Scripting View -> Templates -> Python -> Operator modal) should be a good starting point.
Here is a small example:
import bpy
from bpy.props import IntProperty, FloatProperty

class ModalOperator(bpy.types.Operator):
    """Rotate a bone with the mouse, example"""
    bl_idname = "object.modal_operator"
    bl_label = "Simple Modal Operator"

    first_mouse_x = IntProperty()
    first_value = FloatProperty()

    def modal(self, context, event):
        if event.type == 'MOUSEMOVE':
            delta = self.first_mouse_x - event.mouse_x
            self.pbone.rotation_euler.x = self.first_value + delta * 0.1

        elif event.type == 'LEFTMOUSE':
            return {'FINISHED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        self.first_mouse_x = event.mouse_x
        self.pbone = context.selected_pose_bones[0] # <- put your bone here instead
        self.first_value = self.pbone.rotation_euler.x

        context.window_manager.modal_handler_add(self)
        return {'RUNNING_MODAL'}

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

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

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.object.modal_operator('INVOKE_DEFAULT')

You can then add your operator to your panel

Thats good, however its too 'free'. I want a set number for it to rotate so that its more realistic. For example the most the flaps can move is I think 40 Degrees so I want to have a button that says: Flaps, 10,20,30,40. Then you would be able to press each one and the bone controlling the flap would rotate x about of degrees.


text:
Decimate multiple objects at once
I have a scene containing a few hundred objects (meshes). I can decimate one object at a time by selecting it in the scene and add modifier->decimate. Doing this for all objects separately would of course take forever.
How can I decimate all objects at once?

Start by selecting all the objects you want to have the same modifiers applied to.
Add the decimate modifier to the active object. The active object is the one that is highlighted in a lighter colour than the others, it is also the one that you can alter in the properties window.
Press CtrlL and select modifiers. This copies the modifiers from the active object to all other selected objects.

If you want more control there is an addon called "Copy Attributes Menu" that you can enable (it is included with blender) that allows you to copy selected modifiers.
If you then want to apply the modifier to all objects you can use AltC and select Mesh from Curve/Meta/Surf/Text, it may sound odd to convert a mesh to a mesh but it applies all modifiers to the selected objects.

Thanks for that applying modifiers trick! Still I think the features like these should be easily accessible via GUI.

Both the make links and the convert options are available in the object menu of the 3d view header.


text:
Zoom with camera in an animation
Is it possible to animate zooming in on an object, or is moving the object the only option available to get it to appear closer to the camera?

You can animate Focal length in camera properties panel

Go to the first frame of you animation and insert a keyframe on the focal length, right click over the focal length and select Insert Keyframe value or press I)
Move to a different frame, change the focal length value and insert another keyframe.
Animation example

Moving and keyframing has already been covered here but there a couple of other things that can help make this very easy to work with.

To start with, if you select the camera and press the Number Pad 0, the viewport display switches to the camera's view point.  You can also access this feature using the menu shown in the following image.

For now, if you move anything then the view will return to the normal viewing but in Orthographic mode, however! if you open the numeric panel using n or the tiny little plus tab that sticks out at the side of the viewport, you should see an entry named "Lock Camera To View".

When you have the camera selected and you activate the checkbox, you should now be able to move the scene around from the camera's point of view just as you would normally do if the camera wasn't selected, only now it's actually the camera that is moving.
It's very intuitive to use and works flawlessly for aligning the camera to your scene.  When you exit that mode by deactivating the checkbox and you move the view again, the normal viewing should return except that maybe it will be in orthographic mode which has no 3D perspective.
You can return to the 3D view by pressing NumberPad5 or by using the menu shown above where it says "View Persp/Ortho"
And the customary animated .gif.(Unfortunately I had to go fast because I kept exceeding the 2MB limit for file size uploads.)

If you find that you can only rotate the view but you can't really pan around very quickly then you need to reset the view.  This happens often with Viewport navigation and can be fixed with either NumPad . which zooms to the selected object or Shift+c which zooms to the entire scene.  That happened to me when I recorded the .gif.