text:
How to stretch 120 seconds of animation over 270 seconds?
I have an object with some animation (120 seconds) and I want to make this animation now play over the duration of 270 seconds. How can I stretch the animation to this new duration?

Select the object and open the Dope Sheet. Set the frame scrubber (the green line) to the starting frame, press A to select all and then press S to scale the keyframes apart up to the required frame. This should stretch the animation to whatever length you want. If you have multiple keyframes, Blender will even these out for you. You can also hold Shift when scaling to snap in small increments.

Note of course that since you are making a short animation longer, it will most likely playback slower.

slower playback is exactly what I wanted, thanks -)

When you scale you can also specify the scale amount. After pressing S type in 2.25 and press enter. 2.25 is 270/120, unfortunately while entering amounts used by operators we don't get to enter calculations like in numeric input fields.

Since Blender 2.80, entering calculations for amounts used by operators (like in numeric input fields) is possible, after you enable Default to Advanced Numeric Input in Preferences → Input.

iKlsR's answer is good, but for completeness:
To do this for the entire scene you can use Time Remapping (in Properties > Render > Dimensions):
Assuming you are rendering to 24 frames per second, your 120 second animation should be 120*24 = 2880 frames long. To make it 270 seconds long, it should be 270*24 = 6480 frames long.
So:

Also see How do I animate time?

This worked great for me! Note, changing the Time Mapping doesn't change the END frame. So if your original was 288 frames and you update it for 648, you will need to make sure that your END frame is updated to 648 as well.  (way way way late comment. :) )

One of the tricky things about time remapping or scaling keyframes is that any value such as an influence on a child of bone constraint that was formerly used as a switch between 2 keyframes (frame 1 influence=1, frame 2 influence=0) will now be gradual and most likely inaccurate. Say if you scale or remap by 2, then you'll have a frame in between where the influence is .5 and your object's location is wrong.
I've not found a solution, especially when using time remapping. However, using keyframe scaling you can least manually add more keyframes and adjust the influence/location.

The solution is to not use two keyframes with linear/bezier interpolation as a value switch. Use one keyframe for each value change, using Constant interpolation.

Adding to the Time Remapping answer, since this feature was replaced by Time Stretching in Blender 3.0 and later:
Access Time Stretching from the Output Properties panel. Set a larger New parameter to stretch, smaller to shrink. Old defaults to 100, so New is essentially a percentage.

As before, this does not change the number of frames in the animation, so adjust the End field for Frame Range as needed.
A caveat: If you need to edit keyframes, there is an unexpected behavior. I'm using Blender 4.0.2. In the animation pane, the playback wiper (blue vertical line) normally has a blue bulb at the top that displays the current frame number. However, when using Time Stretching, the wiper and the frame indicator become disconnected. This is as designed—the wiper indicates which keyframes are being hit, while the bulb displays the output frame. The problem with this is that if you need to make minor edits to keyframes, you need to position the playback so that the wiper is over the keyframe that you want to edit. So, if your stretch factor is 150, then to edit the keyframes at 100, you need to position the bulb at 150. Make the change, then save the keyframe (press I, for instance). But a new keyframe will be created at frame 150, and the keyframe at 100 is unchanged. The workaround is that you can grab and slide the new keyframe back down to 100. If not, you'll have unplanned results.

Because of this—particularly if you intend to edit the animation further, scaling in the timeline is the better solution for final changed. But Time Stretching is the better solution for temporary stretching to try out different timing values, because it's so easy to change the timing by editing a single value. You can always set it back to 100:100 and scale in the timeline once you've made your final decisions.


text:
Get the rotation of an object in the game engine
How would I get an object's rotation and set that as another's velocity? Like if I had Object A, that has the rotation data, and Object B, the object to be moved. How would I get that working in python?
Because of some confusion, here's some of the code:
Gun = bpy.data.objects["Gun"]
rotationOfGun = Gun.globalOrientation

So you want to get an object's rotation vector and use that to set another object's velocity?

That's exactly what I need to do.

I assume that you're using a rigidbody?

no, just a Dynamic

The method for accessing an object's rotation varies depending upon which rendering engine you are using.
In either Blender-Internal or Cycles, you can access an object's rotation by using the Python reference bpy.context.object.rotation_euler or just object.rotation_euler. In your script, just call that reference and set your other object's velocity based on that.
In the Blender Game Engine, you need to instead use object.worldOrientation.to_euler() to retrieve the object's rotation. For example:
from bge import logic
cont = logic.getCurrentController()
obj = cont.owner
rotation = obj.worldOrientation.to_euler()
print (rotation.z)

It says this when I try to run it: Traceback (most recent call last):   File "<blender_console>", line 1, in <module> TypeError: 'bpy_prop_collection' object is not callable

Did you type ...euler or ...euler() ?

Wait... >_< I forgot to import bpy. But it still fails. (I'm blender 2.66)

Try the () tip above. That's what the error sounds like. The only other thing I can think of is that you might not be naming the object right. With the format I gave you, the name should be something like cylinder.001, but if you already have the object as a Python variable, it should be just object_name.rotation_euler

It doesn't work. :(

This is game-engine you should not use bpy!

@V360 I caught my mistake. I had assumed you were using Cycles, but the commands are different in the Game Engine. Try using obj.worldOrientation and let me know if that works.

@Gwenn :( It doesn't work still.

It says Traceback (most recent call last):   File "<blender_console>", line 1, in <module> AttributeError: 'Object' object has no attribute 'globalOrientation'

@V360 Check the code snippet I added in. It works for me in Blender 2.66a.

source: Stack Exchange

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

sort: votes


text:
Script node missing in node editor
Following a osl in cycles tutorial And the option of what shading system to use is missing and also I cannot activate the scripting node when I am in node editing mode. I am using blender 2.67b, And I have tried to use the search option (as shown in attached image). If any body knows what is/or what i am doing wrong could they please inform me. Cheers

First, make sure that your Render Engine is to Cycles and that you are in the Shader node editor, not the compositor.

The Script node is there..

The changes in the Render panel were more than likely made in the space of time from 2.65 to 2.67.

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


text:
Problem with script being invoked twice in BGE
I want to launch vlc.exe when I hit spacebar in the BGE.
I have this script and it does the job:
import subprocess
subprocess.call(['VLC\VLC.exe'])

The problem now, is that the script is invoked twice. It launches vlc and when I close the vlc instance, it launches it one more time. (I tried also with Tap option in the sensor)

This happens because there are two events for key down and key up. To choose one of them replace the print statement with your code to invoke and delete the other unneeded lines.
Script to test the behavior:
import bge

cont = bge.logic.getCurrentController()

sensor = cont.sensors['Space'] # Assumes that keyboard sensor is named as 'Space'
if sensor.getKeyStatus(bge.events.SPACEKEY) == bge.logic.KX_INPUT_JUST_ACTIVATED:
    print("sensor down")
if bge.logic.keyboard.events[bge.events.SPACEKEY] ==bge.logic.KX_INPUT_JUST_ACTIVATED:
    print("Down")
if sensor.getKeyStatus(bge.events.SPACEKEY) == bge.logic.KX_INPUT_JUST_RELEASED:
    print("Up")

One event picked
import bge
import subprocess

if bge.logic.keyboard.events[bge.events.SPACEKEY] ==bge.logic.KX_INPUT_JUST_ACTIVATED:
    subprocess.call(['C:\\path\\app.exe'])

This occurs not just with key presses but all Blender sensors.  All sensors send at least 2 pulses, a positive and then a negative.
sensor = bge.logic.getCurrentController.owner["Sensor"]

if sensor.positive:
    Do something

just check for sensor.positive
so your code should be:
import subprocess, bge

if bge.logic.getCurrentController().sensors["sensor"].positive:
    subprocess.call(['VLC\VLC.exe'])


text:
Run an external application with the bge
I have searched about for an actuator that can run external applications within the bge but I haven't found anything. Does such an actuator exist?
In addition, it is possible to launch a web browser within a blender game:
A plane with firefox, chrome... in the game

This task is fairly simple to do with a Python script.
You could add a python script as a controller to launch a browser:
import subprocess
subprocess.call(['pathToChrome\\chrome.exe',
                 'http://blender.stackexchange.com',
                 'Message'])

To save a screenshot you could use one of the command line capturing tools like:

webkit2png
command-line-program-to-create-website-screenshots-on-linux
you might add an os to google "browser screenshot command line"

Once you have the saved screenshot you could manipulate a plane to use the screenshot as a texture see createTexture in Blender API on how to dynamically change a textures image.

Hello i have tested your script but without success.
In your example i must place the blend file in the chrome's folder?
If i want to run movie with vlc by pressing a key it's the same script? thanks

@GabrielS Sorry if I don't get you right, you were asking how to launch an external app, a browser is an external app, thats what the script does. What do you mean by placing the .blend file in chrome's folder? To start VLC it would be the same script (with another path to vlc's .exe and some parameters)

Ok thanks, i understand what to do with the script.
My script look like this:
import subprocess
subprocess.call(['VLCPortable\VLCPortable.exe'])
And when i hit the spacebar vlc is launching. but when i'm closing vlc, the script launch it one more time (but after that no). you have an idea?

@GabrielS Sorry, I couldn't find out why the script is invoked twice, I tried the Tap option in the sensor and some prints in the script. I guess the event must be analyzed closer, but I'm not familiar with this API. You could ask another question on that.

Ok, thanks i close this question and i post another message about that script


text:
Can I personalize the insert keyframe menu?
In my animation I use a lot of restrict render and restrict view on/off.
Can I do something to display those keyframes when I type the I key (insert keyframe menu)?

Yes, it's done using Keying Sets:

Types of Keying Sets
There are basically two types of Keying Set in Blender: "Builtin" and "Absolute".
Builtin are the ones that are always available (context permitting) in Blender. They are the (familiar) ones that show up in the IKEY menu by default - "Location", "Rotation", "Scaling", and friends. All you generally need to know about these are that they are defined using in Python so that they can check the context to see what properties they should act on. This means that you CAN'T add/remove properties from them yourself unless you edit the Python code which determines what they use. If you're curious to add a few more 'builtins' that you commonly like to use, you can find these under scripts/keyingsets/ in your install directory. Be aware though that the attempts at making these definitions quite "modular" may initially be a little confusing for novice/beginner Python programmers, though they should still be quite easy to grasp. The topic of setting these up shall be left as an exercise to the reader and/or a future post :)
Absolute are the ones that you should be most interested in, as they are the "user-defined" Keying Sets, and are stored per Scene (that they are defined for). By setting up and using these carefully, you can improve your workflow quite a bit. Used appropriately, you can insert keyframes for a whole bunch of related properties with the touch of a key (or single click if you like), saving frustration from forgetting to key one of a bunch of properties and saving time jumping around keying multiple things separately. This has significant benefits, especially for the modern character animator working in the standard pose-to-pose full-pose blocking method, where keying every single control on every key-pose at once is the método comodo.

See the documentation written by the developer of this feature for more info:

Getting to grips with Keying Sets
Coding your own "Builtin Keying Set"


text:
How can I thicken mesh hair?
Is there anyway of making some hair I modelled thicker because what I currently have is too thin and I want it to be a bit thicker.

Please give example pictures so we know what we are dealing with.

"the" anime hair? Is it some kind of primitive?

Since you are modeling the hair and going for an anime style. The Solidify modifier should do this quite well. It might seem subtle but you will get the depth you want.

Flat mesh hair.

Mesh hair with solidify modifier.
After using the modifier, you can apply it and tweak the mesh even further to get better results. Using the modifier is better than just extruding and tweaking as it will do this evenly for your entire mesh.
You can get some unique styles as well if you smooth the hair with a subsurf modifier and play with the settings.

this actually kind of helped me in a way im still new to blender so please excuse me if i don't understand the stuff you describe to me as yet.i can give you an example of the hair im trying to gethttp://www.blendswap.com/blends/view/53566

@tokenten You should be able to achieve something similar using what I have outlined in my answer. An exact, complete walkthrough would take too long to write and tutorials shouldn't be given as answers either.

I did indeed now with the clothes it much much easier to make it fit on my model instead of playing tug of war with it.and the hair is perfect

@tokenten If you intend to continue using this site and want to get access to more features, you might want to consider fully registering your account ;) and see this answer, http://blender.stackexchange.com/questions/1124/how-should-clothes-be-modified-to-fit-a-character-model.

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


text:
Remeshing part of a mesh
As in the following figure if you combine a cylinder with a cube you will find the meshing is something like as in the left; we would like however to have it as in the right.
(at least in the render window when we use a wireframe material for the above.)
How to make something like that?
note: Face beautifier didn't work.

There's no straight-enough solution for this. I personally suggest you have the cube triangulated / subdivided BEFORE combining them together. (e.g. combining by Boolean Modifier)

Note, theres an opensource tool called meshlab which has a lot of advanced operations like this. Its possible these could be integrated into Blender, but you could export models to it.

@ideasman42 Nice point. You just reminded us to use resting meshlab on our system. We will try.

@ideasman42 mehlab does not help as whatever we choose from menus (simplifying, remeshing etc) the highlighted (yellow) lines remain unchanged! If you could we would suggest you to put your idea as another full answer, probably with some snapshots.

While having the magic one button solution is enticing the old manual approach can give more control using basic modelling techniques.
Start by removing the unwanted edges.

See how many vertices you need - you can optionally add corner edges to clarify the targets. In this example I need to add three more vertices to each edge.

Use CtrlR to add more edge loops - use the mouse scroll wheel or + and - on the numpad to change the number of cuts being added.

Select all the vertices in two edge loops to be filled in.

Choose Grid Fill (2.69 or higher) - this is available in File->Faces->Grid Fill or search after pressing space.

For versions before 2.69 you can use Bridge Edge Loops - File->Edges->Bridge Edge Loops or search after pressing space. This is still available in 2.69. You may find this works better in edge select mode without any corner connecting edges being selected, while grid fill works better if you have the corner edges in place.
The grid fill initially uses the order the vertices are selected to fill in the faces, if you initially get a strange fill you may want to press F6 (also available at the bottom of the toolbar T) to adjust the Offset until it fills in nicely.

You can also adjust how the bridge edge loops works

Repeat for each side. This gives you a nice final topology

You can also adjust this along the way by adding lop cuts between the two edges. The bridge edges has the option to do this for you and the grid fill will join these edges when you fill in the last two sides.
If you want the same result on the opposite side, if both are the same, you can select the top vertices and duplicate them, move to the opposite side using snap to vertex to align them and remove doubles to join together.

Note on these instructions (grid fill), theres an area for a step to remove: Notice there is a white vertex. Before running grid fill -- select a corner vertex last, Then grid fill will know to treat this as a corner vertex and it attempts calculate the best square fill to perform without having to adjust settings.

Accepted, because it is an interesting solution, indeed. More interesting is your effort with passion on finding a working solution which is appreciated.

@ideasman42 - a good tip to know but while I could take out adjusting the gridfill options, if someone just uses box select and gets a bad fill they just think it is useless. I think it helps to show ways to fix odd fills and highlight that you can adjust things not just accept defaults. Remembering or noticing which vertex is active or needs to be active is something that can easily be skipped.

You may try adding a remesh modifier to the object.
In the properties view click the tool icon for the modifiers panel.
Without Remesh

With Remesh

Good tool. However we couldn't apply Remesh modifier to selected faces. It seems it can be applied on a whole object for which the result is very acceptable as in your example. You got our up-vote for this.

What might work is entering sculpt mode, box mask the central cylinder (available in trunk builds) from the top view and then enable dyntopo and stroke on the top surface with a standard draw brush with zero strength.


text:
Composite a 3D object into a photograph
I was wondering how you would go about putting a 3D object into a photograph so that portions of the image are:

In front of, or
Behind the model.

For example, a photo taken from the roadside with a tree in the foreground.  I want to show a 3D model of a car in the photo on the road but a section of it is not visible because it is obscured by the tree.
Is this possible? If so, how can you do it?
Thanks in advance.

two posts that will interest you: cycles holdout material and cast shadows on footage/stills

while the answer to the question here is contained in both those links, I don't feel this question is a direct duplicate. It manages to ask a very succinct question and therefore is a good example of how to ask this question.

To bring some sort of closure to this question (as it's sure to get asked in the near future again), to get shadows and add a bit more realism, you can refer to the answer on How to make a model cast shadows onto the world texture/background?.
To answer this question with the one thing not mentioned there. You don't really need to use compositing here as you might have thought, the simplest way to do this is to model an object to mimic the shape of the object you want to use to obscure your other object(s) and while some people have and or will use some complex node setups, you can just add a new material to the 'mask object', enable Transparency, set it to Mask and turn the Alpha to 0 like this..

Here is the setup of my scene, the tree trunk has the 'mask' material applied to it and I have a ground plane to catch a little shadow to make it a bit more realistic.. I grabbed the picture of the tree from here.

and here it is rendered..

How to get it to look better is up to you and what you want..

Is there a quick way to do this in cycles?


text:
How can I convert two numbers to 0 - 1 range in Driver Scripted Expression?
I have a shapekey driven by a bone. I want to configure the shapekey's driver such that scaling the bone to 0.3 results in a shapekey value of 1, and scaling the bone to 1 results in a shapekey value of 0.
In other words:
Shapekey range: 0 - 1
Bone scale range: 1 - 0.3
I'm sure this is simple, but everything I've tried hasn't worked.

For Hulifier's solution, here is how it looks in my particular use case:

$$\frac{v-s}{k-s}$$

s = Range start.
k = Range end.
v = Value.

The result is a value between 0 and 1 if v is inside the range.
In your case:

s = 1.
k = 0.3.
v = the bone scale.

Wow, it worked perfectly!!! Thank you so much!! I have updated my original question with an image of the solution (for my particular use case).

Although slightly more time consuming to set up, you can also do this with just the F-Curve of the driver since it's a simple value mapping.
Doing it this way will make your rig more lightweight than using a Python expression since the graph curve will be evaluated anyway.
The images and shortcut keys below are for Blender 2.79, but work the same on 2.80 and up.

Set the driver type to Sum Values.
Make a Transform Channel variable for the Local X Scale of the bone (easier to understand than having to write the property explicitly down to .scale[0]).
So the values of all variables of the driver (just one variable, in this case) will be summed, and the result will be used as the input "frame" (the time) within the F-Curve of the driver. Let's edit the F-Curve to change how it maps the input.

Set the curve extrapolation mode (Shift+E) to Constant Extrapolation.

Select both keyframes and press (T) for the Keyframe Interpolation dialog, set them to Linear keys (instead of the default of Bezier), which are faster to process.

Place one keyframe on frame 0.3, value 1.0.

The other keyframe goes on frame 1.0, value 0.0.

So when the input is 0.3 you get an output of 1.0, when the input is 1.0 you get an output of 0.0.
PS you can use the View tab to place the 2D cursor with precision and use the (I) key to create new keyframes on the driver curve at that cursor location.

Thanks so much for this great solution!!!! I find it very intuitive and used it to drive the values of the shapekeys on my character. Since I want to scale the bone in any axis to drive the shapekey, I right-clicked the bone's Scale channel and chose "Copy as New Driver", then on the shapekey I chose "Paste Driver" and followed your instructions. I've also added a "Limit Scale" constraint (with "Affect Transform" checked) to the control bone to avoid overshooting my scale values (although the Range Min/Max settings of the shapekey itself prevent keyframing values outside of the 0-1 range).

@Copperplate good call, the Limit Scale should make it more intuitive for the animator (even if it'll be yourself). PS the driver value is also limited by the graph curve, it's that Shift + E constant extrapolation part (if the input is less than 0.3 then the output stays at 1.0, and if the input is bigger than 1.0 it stays at zero). BTW, I said "use the (T) dialog to set the keyframes as Linear instead of the default of Bezier", but Bezier keys have their uses too, like adding some easing to the driver -- might be useful with some shape keys that require soft nuanced changes. Good luck!

Thanks for that additional info! Strangely, the "Driver Value" within the Drivers' window shows as if it exceeds the min/max threshold set by the graph curve, however you are right that it actually doesn't exceed it, because increasing / decreasing the thresholds within the shapekey's "Range Min/Max" settings have no effect (unless the extrapolation of the driver curve is set to something other than Constant). Not sure if the behavior is like that in Blender 2.79 but in Blender 3.1 at least... I now know not to trust the Driver Value! :-)

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


text:
How can I make light that changes its color with path length?
I want to create a light source whose light colour will change with ray length.
Example:

(light src)______________
        |    \           \_______
        |      \                 \______
        |(red)   \ (green)              \(blue)
(plane)_______________________________________________________________

The node setup for the lamp:

Ray length as input
A power for tuning the value
HSV node which shifts the input color depending on the ray length
All connected to the color socket of the lamp

The plane which receives the light is just a simple diffuse shader.
An alternative configuration:

thanks for comprehensive answer, but i wonder why do i need a separate object to get ray length information and not just create some node setup for a light source?

Well... in fact, you can !! Sorry, my answer was bad : I rewrite all that !

@FanciestBanana, I have to say your question above helped me to understand the answer : )...


text:
FBX import: Broken material assignation
I have a 3ds Max scene with two objects with instanced geometry but different materials.
I exported the scene to FBX and imported FBX to Blender.
In Blender, both objects have the same material =(
(But I can see both materials as data-blocks.)
How can I save individual materials for these objects when I importing them to Blender?
Scene in 3ds Max (each object have individual material):
Scene in 3ds Max http://my.jetscreenshot.com/demo/20161124-w13n-144kb.jpg
Scene in Blender (both objects have the same material):
Scene in Blender http://my.jetscreenshot.com/demo/20161124-89eo-174kb.jpg


text:
What values should I use for light paths?
In a relatively simple interior room, what value do I need to use for a good-looking render?

There is no works-for-everybody setting. Basically it's a trade-off between render speed and image realism.
I would suggest to turn down each number of bounces to 0, just so you see what happens then. Then start increasing one of the numbers, and see how it affects your image. The aim is to keep the numbers as low as possible (to get a fast render) while keeping them high enough so that the image looks the way you want it to.

Ok.Thanks.In particulary what causes "fireflies")

Those appear because Cycles randomly samples your scene by shooting "rays" into it and letting those bounce around. If such a ray happens to bounce straight into a lamp, you'll get a white pixel. If it doesn't, you get a darker pixel. With only one sample per pixel you'll clearly see those white pixels. With more samples Cycles can take the average and smoothen them out, removing the fireflies. You may want to read through 7 Ways to Get Rid of Fireflies.


text:
Using drivers to have the camera focus on the lowest object
I have a physics simulator with balls rolling down a slide. Each ball has an empty attached to it. I would like to have my camera automatically focus ("track to") on the ball that is lowest on the z axis.
I have "track to" constraints (on the camera) for each ball and manually keyframe the influence to 1 (and the rest to 0) in the animation. As the objects are changing places a lot, it is very tedious.

Is there a way to do this with drivers, or is there a better way?

if it’s the same ball through the whole course, you can just use the Track To constraint. If the ball changes, I would use several constraints and animate their influence. Unless the animation is super long or which ball is the correct one changes a whole lot, that bit of automation is probably not worth all the trigonometry.

Thank you Thelabcat. I am trying to track multiple. i've been doing it manually, was curious to see if there was another way.

It is possible to do that with help of geometry nodes.

Camera "Track to" Empty.

Empty "Shrink wrap" to Geonodes Setup

All geonodes setup:

Inside "Location_To_Point" Group:

So what is going on here? :)
Geometry nodes create very small Ico Sphere at the location of the lowest ball. Empty drop on the surface of this Ico Sphere. That is why camera can track lowest ball.
File for fun:

Great solution! I saw already from other answers that you love GN too and you have a huge knowledge in this area. Of course +1 too.  And I also love provided blend files in answers as well because you can directly check it out instead of rebuilding for hours.

@Chris I am happy that you like it. :)

Thank you very much for the additional detail! This is fantastic.

If we only need to track altitude, we can do this without drivers, very easily, by using several floor constraints:

Here, the empty, which has an elevated pre-constraint position (z=10000 ought to be safe), is floored to the world -Z of each of the three Suzannes, so it can never rise above the world position of the lowest.  The camera then tracks this empty.  If we want the empty to lie at the base of the lowest Suzanne, we can tune the Offset parameters of the constraints.
We could do this with a driver, but it's more work.  We need a separate variable for the world space Z of every item we want to track, after which we can use a min(var1, min(var2, min(...))) scripted expression to get the lowest of these values and track that.  Setting up drivers is more work (and worse for performance) than just quickly setting up a few constraints via select, shift select, ctrl shift c create constraint.
A different way to handle it, that will track the mesh rather than the object, and will track not just altitude but the lowest point, is to shrinkwrap to a collection containing all the objects.  We can do that with, say, a non-rendering boolean union:

This is probably a waste of performance, but it's very fast to set up with any number of objects.  A single vertex is boolean unioned with a collection, then disabled for renders.  The empty starts at z= -10000 and then shrinkwraps; its initial position is what guarantees it gets the lowest point of any mesh.

maybe i am too dumb...but if i move my 3 objects above the ground (0), the empty stays at 0...so it "works" only if at least one object is at z <= 0.

Thank you Nathan. This is getting me closer to understanding. I am trying to have the camera automagically "track to" the lowest object in the simulation. I have "track to" constraints for each object (balls) and manually keyframe the influence to 1 (and the rest to 0) in the animation. As the objects are changing places a lot, it is very tedious. I've also tried having the camera "track to" an empty and then have the empty "track to" the objects, but I'm basically doing the same thing by having to change the influence manually. My knowledge is still new to all this. Thanks again.

@Chris The empty will only ever lower, so needs to start at an elevated position; z = 10000 ought to be safe.  But I didn't think this through or test sufficiently: it will only ever track altitude via this method.  So I guess I have to edit or delete this answer.

No, don't do that. There is a lot of additional valuable information in it. And you got 10 upvotes and raising...so i am not the only one who thinks that your answer is valuable! +1

Thanks again Nathan and Chris. I really appreciate you taking the time to help me. :)

I would use Python for that. Open a text editor, and paste this code:
import bpy

def getMinObject():

    col = bpy.data.collections["RigidBodies"]

    minZ = 1000000

    minObject = col.objects[0]

    for obj in col.objects:

        if obj.matrix_world.translation.z < minZ:
            minObject = obj
            minZ = obj.matrix_world.translation.z
            print("set to obj", obj)

    return minObject

def my_handler(scene):
    print("in handler", scene.frame_current)
    cam = bpy.data.objects["Camera"]
    cam.constraints[0].target = getMinObject()

def register():
    bpy.app.handlers.frame_change_post.append(my_handler)

def unregister():
    bpy.app.handlers.frame_change_post.remove(my_handler)

register()

Click on run script:

Then start your rigid body simulation.
Here you can see the code in action:

How does the code work?
The function getMinObject() loops over all objects which are in a collection called "RigidBodies".
Whenever the current z position of the current looped object is lower than the lowest z position, the lowest z position will be saved in minZ and the object will be saved in minObject.
The functions then return the object with the lowest z position.
def register():
    bpy.app.handlers.frame_change_post.append(my_handler)

def unregister():
    bpy.app.handlers.frame_change_post.remove(my_handler)

The register function ensures that the function my_handler will be called after each frame.
The unregister function does the opposite: it removes this automatism.
def my_handler(scene):
    print("in handler", scene.frame_current)
    cam = bpy.data.objects["Camera"]
    cam.constraints[0].target = getMinObject()

The my_handler function will be called after each frame. It saves the camera object in cam and then changes the target of the first constraint (which should be track to) to the object which is calculated/set by the function getMinObject.
Note: This code is for sure not super safe and not super clean.
It just works.
But, it is hardcoded and you have to ensure these things, that it runs:

You have to have a collection called "RigidBodies" with your objects in it, which should be considered for the track to functionality. These collection must not be empty.
you camera must be named "Camera"
your camera must have a "track to" constraint as first constraint

With drivers I would do it like this:

So it basically just gets all z locations and uses the minimum values of these.

This is great, thank you Chris! Sorry, I'm still trying to figure out how to ask my question as my knowledge is limited. Is there a way to have the camera "track to" the object that is lowest? I am manually setting keyframe on "track to" influence. Because there are a bunch of objects I am going through the list of constraints (on the camera) and setting everything to "0" and the lowest to "1". Maybe even if there is an easier way to set the keyframe for all the "track to" constraints at once? Thanks again!

sorry, missed somehow that you wanted to have the trackto object changed. I updated my answer with a python solution.

Brilliant!!! This is exactly what I needed. Thank you for showing me the way. Gratitude! :D

Glad I could help. Thank you very much! Sorry that I missed the right answer in my first try.

Chris I upvoted your solution because scripts are so cool and hardcore. Chris and @Admbro please don't miss my alternativ answer. As always I do it with geonodes. And I want to know your opinion. :)


text:
How to rotate an EditBone? is it possible
I have a dict of 2d data and I want to generate bones (skeleton), assuming z = 0 for translation and rotation is across z axis in given dict.
data = {"bones":[{"name":"root"},
{"name":"COM","parent":"root","length":35.18,"x":-128.09,"y":160.22},
{"name":"torso","parent":"COM","length":102.78,"x":127.78,"y":-116.67,"rotation":90},
{"name":"armL","parent":"torso","length":76.14,"x":62.96,"y":-39.81,"rotation":-103.29},
{"name":"armR","parent":"torso","length":92.75,"x":68.52,"y":32.4,"rotation":104.14}]}

here is my blender script to iterate on the dict. I can create bones.
currently placing new bone on top of each other(almost).
what I can handle is,
initial head position directly , on x and y coords
placing tail position directly via length
but
HOW to apply rotation? any ideas
Sample code for current progress..
import json,os,sys
from mathutils import Matrix
from mathutils import Vector
import bpy

def createBaseArmature():
    bpy.ops.object.add(type='ARMATURE',enter_editmode=True,location=(0,0,0))
    ob = bpy.context.object
    return ob
def createBones(amt,bonesData):
    print (str(len(bonesData)) + " bones found")
    for each in bonesData:
        bone = amt.edit_bones.new(each['name'])
        if 'parent' in each:
            bone.parent = amt.edit_bones[each['parent']]
            bone.head = bone.parent.tail
            rot = Matrix.Translation((0,0,0))
            bone.tail = rot * Vector ((0,0,each['length'])) + bone.head
        else:
            bone.head = (0,0,0)
            bone.tail = (0,0,1)

obj = createBaseArmature()
amt = obj.data
createBones(amt,data['bones'])

While you can adjust the head/tail/roll directly, EditBone's have a helper function for this:  EditBone.transform, which I think is the most direct answer to your question, just pass a rotation matrix to it.
This is simply a python helper function, see the code.


text:
How to set attributes in a Blender registered class dynamically?
Is it possible to set an attribute in a class dynamically? That is I don’t want to have the attribute (e.g. could be a property) defined in the body of the class directly, I want it to be defined later via setattr on user input.
# this is the callback from a UI EnumProperty
def update_type(self, context):
      self.update_props()
      # the valueA attribute exists at this point
      print(“valueA = “, self.valueA)

def update_props(self):
    if hasattr(self, "valueA"):
        print("Deleting valueA prop")
        delattr(self, "valueA")
    else:
        # note: it appears that the valueA does not exist
        # even after a second call to this method.
        print("valueA prop not found. Create one.")
        setattr(self, “valueA”, 10)

for some reason (unclear to me at this point) even though the valueA gets set in the update_props() method and it’s visible its caller change_type, the next time the caller invokes the update_props() the valueA attribute does not exist anymore.
Note: this code was added to a blender add-on (sverchok) and I can’t guarantee that the above behavior is a blender or sverchok related at this point. If the above code is added to a simple class in python terminal for instance, it works fine and the attribute gets set permanently in the instance of the class.

What is type(self) in this context?

type(self)= <class 'sverchok.nodes.number.mix_numbers.SvMixNumbersNode'>

Why would you use setattr here in the first place? setattr(self, 'valueA', 10) is exactly the same as self.valueA = 10.

@dr.Sybren setattr allows you to dynamically set dotted attributes from variables. if you had a function that you wanted to be able to pass any attribute to a class to set, you couldn't write that function as def foo(class_name, attr, val): class_name.attr = val, but writing it as def foo(class_name, attr, val): setattr(class_name, 'attr', val) circumvents that. Especially comes in handy when other dynamic functions are passing variables to this function at runtime.

@Jakemoyo setattr is great if the attribute name is variable. If it's just a static string, it is literally the same as just an assignment. In your example, class_name.attr = val would do the same.

As this relates to Sverchok, but more broadly to bpy's PyNodes interface, i'll chime in with the limited knowledge / experience I have.
No you can not trust that variables/properties added to an instance of a class will "stick" to the class instance. You can also not remove a property at run-time. In this sense Node classes are not like regular Python classes. If you dynamically add a property inside a function it might exist for the duration of a function call, but once execution leaves that function then the variable/property ceases to be associated with the class instance. The evidence that this is the case is what probably triggered the question in the first place.
The only things you can trust are the Properties that are included in the Class definition. I suspect this makes node instances more of a "known quantity" and reduces complexity of the PyNode back-end.
We (sverchok) however do use a not widely documented/explained feature for storing arbitrary data (not bpy.props tho..at least I have not tried..) in a class instance. We call it the node_dict. When used correctly The node_dict (class member) gets a unique key per class instance, and we can pass anything into the value.
def some_random_function():
    ...

class SomeNode(...):
    node_dict = {}

    def sv_init(self):
        node_dict[hash(self)] = {}

    def store_data(self, data):
        storage = node_dict.get(hash(self))
        if storage:
            storage['some_function'] = some_random_function

    def process(self, ..):
        storage = node_dict.get(hash(self))
        if storage and storage.get('some_function'):
            storage['some_function']()  # call it.

This is about as minimal i can go to show some of the mechanism for dynamic data storage. There are examples of defining a node class dynamically (the monad Class relies on it) but it's something that I consider obfuscation and possibly a sign of placing importance on the wrong things.
Of course it would be awesome to have more fine grained control over the parameters of properties at runtime like (name, min, max....dynamic operator tooltip), without needing to dynamically define/register/unregister nodes if you want to change a single property-definition.

I was afraid this was the case :D

If you want to store custom properties on ID datablocks (so on Object, Mesh, Curve, etc.) you can use ID properties by accessing the datablock as a dictionary:
bpy.context.active_object['propertyname'] = 123

mesh = bpy.context.active_object.data
mesh['someprop'] = 'hello there'

You'll find those in the 'Custom Properties' panel in Blender's user interface too.
These ID properties are saved within the blend file, and thus survive saving & reloading the file.


text:
Does Blender resume rendering after returning from hibernation in Windows 7?
I have a Windows 7 machine and my Blender render takes about 8 hours or so. Sometimes the laptop goes to sleep or I have to hibernate it to travel to work. Does Blender resume the rendering to avi raw after it comes out of hibernation ?

Seems to me you could have tried this and see if it does. I think it should.

I think the best way to find out is to try it yourself ;)
Alternatives:
Something you can do to ensure your render progress is not lost is to render to an image sequence instead of directly to a video file. See the docs:

The Direct Approach—highly not recommended and not a standard
  practice—is where you set your output format to an AVI or MOV format,
  and click [render] ANIM to render your scene directly out to a movie file.
  Blender creates one file that holds all the frames of your animation.
  You can then use Blender's VSE to add an audio track to the animation
  and render out to an MPEG format to complete your movie.
The Frame Sequence is a much more stable approach, where you set your
  output format to a still format (such as JPG, PNG or MultiLayer), and
  click [render] ANIM to render your scene out to a set of images, where each
  image is the frame in the sequence.
Blender creates a file for each frame of the animation. You can then
  use Blender's compositor to perform any frame manipulation (post
  processing). You can then use Blender's VSE to load that final image
  sequence, add an audio track to the animation, and render out to an
  MPEG format to complete your movie. The Frame Sequence approach is a
  little more complicated and takes more disk space, but gives you more
  flexibility.

Set start frame:
This way if the render render stops you can easily resume it by setting the Start frame to the frame after the last frame rendered and starting the render again. Whereas if you are rendering directly to a video format, there is a high probability the file will be corrupted if the render is stopped partway through. Also see the Hints section:

Unless your animation is really simple, and you expect it to render in half an hour or less, it is always a good idea to render the animation as separate image frames in a loss-less format (TGA, PNG, BMP) rather than as a movie file from the beginning. This allows you an easy recovery if there is a problem and you have to re-start the rendering, since the frames you have already rendered will still be in the Output directory. Just change the STArt frame number to the frame number where you want to pick up from, and click ANIM again.

E.g. If the render stops while rendering frame 30, the last saved image will be frame 29. All that needs to be rendered is frame 30 up to the end, so set the Start frame to 30 and render (CtrlF12):

Disable overwrite:
Another option (as mentioned by Greg Zaal) is to disable Overwrite in Properties > Render > Output. Disabling this will skip rendering the frame if an image file corresponding to that frame already exists.
Rendering an image sequence to a video file
When the render is complete you can render the image sequence to the desired file using the VSE:

Import your image sequence with ShiftA> Image (or Header > Add > Image). This will add a new strip with your animation. Make sure it is correctly lined up with the scene start and end frames.
Set the output format to the desired location and format, then press CtrlF12. This will render the sequencer to the specified output file quite quickly, as all it is doing is encoding the already rendered images into the correct format.

Also see the workflow outlined on the docs:

Frame Sequence Workflow

First prepare your animation.
In the Dimensions panel, choose the render size, Pixel Aspect Ratio, and the Range of Frames to use, as well as the frame
  rate, which should already be set.
In the Output panel set up your animation to be rendered out as as images, generally using a format that does not compromise any quality
  (I prefer PNG or MultiLayer because of their loss-less nature).
Choose the output path and file type in the Output panel as well, for example //\render\my-anim-.
Confirm the range of your animation frame Start and End.
Save your .blend file.
Press the big ''Animation'' button. Do a long task [like sleeping, playing a video game, or cleaning your driveway] while you wait for
  your computer to finish rendering the frames.
Once the animation is finished, use your OS file explorer to navigate into the output folder (".\render in this example). You will see lots
  of images (.png or .exr, etc... depending on the format you chose to
  render) that have a sequence number attached to them ranging from 0000
  to a max of 9999. These are your single frames.
In Blender, now go into the video sequence editor.
Choose ''Add Image'' from the add menu. Select all the frames from your output folder that you want to include in your animation (Press A
  to Select All easily). They will be added as a strip to the sequence
  editor.
Now you can edit the strip and add effects or simply leave it like it is. You can add other strips, like an audio strip.
Scrub through the animation, checking that you have included all the frames.
In the Scene Render buttons, in the Post Processing panel, activate Sequencer.
In the Format panel, choose the container and codec you want (e.g. MPEG H.264) and configure it. The video codecs are described on the
  previous page: Output Options.
Click the ANIMATION render button and Blender will render out the sequence editor output into your movie.


text:
How to set a specific edge length numerically?
I've got this question from one of my best students. The question is the following:
Suppose, that we have Edit mode with some edges, vertices, etc. How to set a selected edge to have a specific length? Numerically?
We already know, that scaling with enabled 'Show edge length' is helpful, but in general, it seems to be easier to just select an edge, and to set its length. This is extremely useful for architecture modeling.

Related: https://blender.stackexchange.com/a/68678/28015

This feature is now in an included addon in Blender 2.79 called Mesh: Edit Tools 2. You have to enable the addon in the User Preferences.

Go to Add-ons
Search "edit"
Click the box for Mesh: Edit Tools 2
Save User Settings

While in Edit Mode, press W for the Specials Menu

Edit Tools > Set Edge Length
Input a target length and click OK.

Hope this helps! I searched forever to find the answer. Shoutout to Danyang Yi for providing the link to a previous version of this addon prior to it being included in Blender.

This is fantastic, and just what I was looking for! Thank you Doug. For those using Blender 2.8, you will find the option in the "N" panel > Edit > Edge Tools > Set Edge Length.

A quick and dirty way is to type in the number like this "{target_length} / {current_length}". For example, if you want to scale the length of an edge from 1.176 to 4, you can switch the Transformation mode to Normal, then press SEnter, type in 4/1.176 for a certain axis, then press Enter.

P.S.: It won't be accurate since the Mesh Display is not so accurate. You need a small script or addon to get the easier and more accurate calculation. I suggest to use the integrated Ruler/Protractor tool. It can save an numeral value with 8 decimal places if you copy (CtrlC) it. (Tip: The snap feature for the ruler only works well with Wireframe mode, currently.)

There is also another question that collects some good ways to do so. How to get selected edges length?

Your post makes no sense if you don't explain how to navigate through the menu. I was unable to follow this.

It's seems you guys will like this addon.

Toolbar > Tools > Mesh Tools > edges set.

Set Length: ShiftAltE
Set Angle CtrlShiftAltE

I found probably the easiest and most obvious way to do this in Blender 2.9.
Activate the shipped add-on Mesh Tools, and in Edit Mode, go to N menu  Edit > Edge Tools > Set Edge Length

One way to set the length of an edge is:

Select the edge in edit mode
Scale to size 1 SNumpad /current edge lengthEnter
Scale again to the desired length in blender units say 2.5 S2.5Enter

An easier way would be to extrude the edges from a single vertext from the start.

Select vertext (Edit mode; vertext select)
EX,Y or Zdesired lengthEnter

For architecture modelling there is also an addon called archimesh.
Other related questions:

How do blender units and meters, feet, or yards correlate?
How to model effectively using exact measurements?
How can I use imperial units when entering measurements?

Clunky and bait for floating point shenanigans.. but it works:

From N menu, show Edge Length.
In Edit Mode using vertex select, choose the vertex you want to keep where it is, then move 3D cursor to it (ShiftS, 4)
In edge select mode, select the edge
Hit main keyboard (not numpad) Full Stop/Period (.) to set 3D cursor as scale/rotate pivot
Hit S, type the current length of the edge and hit / then Enter - this will scale it to 1 unit exactly (/ toggles whether the scale amount entered is inverse)
Hit S again, type the length you want the edge to be in Blender units and hit Enter

I've needed to create a trapezoid with top edge 50 cm and bottom 100 cm.
The easiest way I've found is to:
 1. create a "Helper" plane mesh
 2. (Press N to show the right panel if not seen.) in the Transform section under Dimensions set it's desire axis to the exact length. In my case I've set the Y axis to be 50cm.
 3. Select the real object (your mesh) and enter edit mode (Tab).
 4. At the bottom panel toggle "Magnet" on and choose "Vertex" and "Closest".
5. Now drag (G) the desired vertex to the "Helper" object. The magnet will make sure you do it correctly. After you dragged the 2 vertexes to the correct "Helper" vertexes exit edit mode.
6. Repeat from step 2- in my case I changed it's size to 100 cm and then adjusted the relevant bottom vertexes.
Hope this help, If not say so And I can maybe upload instructions with pictures


text:
Where did the marble procedural texture go? (Cycles)
It seems to me that the procedural textures aren't render engine dependant, I guess I'm wrong. Does anyone know why this is?
Is there anyway to get a procedural marble texture into cycles? (or simulate it in some way?)

Hate to say it, but Cycles Wave is never near to either Marble or Wood in BI. Marble, for instance, has a great set of controls in BI, Wave in Cycles doesn't have them. Probably there are workarounds, but so far all my own attempts to get anything similar to BI Marble from Cycles Wave yielded zilch.

@YuriIlyin Do you have an example of the BI marble texture you want to simulate?

The Wave Texture node has Distortion, Detail and Detail Scale controls that can be used to generate results like the Marble texture.
The textures are different because the whole shading system is different, we decided to redesign it entirely. Some texturing features from Blender internal are still missing because we haven't had time to add them back, we can't reuse the code directly because everything needs to be reimplemented for Cycles to work on the CPU, GPU and Open Shading Language.

So will the marble texture get reimplemented in cycles? or is the wave texture it?

The Wave texture is a replacement for both the Marble and Wood textures, so a separate Marble texture will not be added.

In the Cycles rendering engine, both the Marble and Wood procedural textures are merged into a single texture known as 'Wave'.
You can use the Distortion and Detail settings to achieve the old Marbles look. One setup to achieve a look like the old Blender-Internal Marble texture is:

This returns a texture that looks like:

This is what I get for asking two questions.. I got two answers, but I can't accept both... :P

@gandalf3 looking at the question, it is possible to branch it off into another one. Since brecht already answered the first one, you could ask the second one again as a new question and a followup.

@iKlsR Sorry, I misunderstood what you meant by branch of into a new question and a follow up

@gandalf3 no worries man. It has been dealt with accordingly, everyone gets to keep their rep, and you get both your answers! :)


text:
Convert cycles closure (shader) output to colors?
Is it possible to convert the output of a cycles Shader node to colors?
For example to use an ambient occlusion shader output to multiply or darken act as a mix factor between other shaders?

You've probably thought of this already, but a workaround would be to bake the shader and use the baked color map for whatever.

The simple yet unsatisfying answer is: No. It's not possible.
(Verified by a Blender developer, I had the same question a while back)
Followup explanation:
It would be possible to implement such a feature if cycles would render a second pass, meaning that it would render a complete image with the base shader and then re-render everything on the basis of the result of the first pass. Both passes would have to be noise-free, so this would effectively double the render time for each such connection that you use. And that doesn't take into account that a ray may bounce back and forth several times between two objects, and in theory, you would have to compute a new image for every single bounce then, as the result of every bounce is influenced by the previous one and needs a full pre-computed first pass of it.
Doing this for the full depth of possible bounces is impossible. Doing it only for the first bounce is against the concept of Cycles as an engine that renders continuously instead of in steps or with pre-computing anything. After all, Cycles also has to work in realtime, and that would be impossible to implement because there, you can't wait for two noise-free passes to compute for a usable result.


text:
Editing normals for a cylinder
I have a cylinder completely smoothed like the following (the purple lines are the vertex normals):

My final goal is to reach the result below:

I'm using the Blender4Web Addons, but I can't still achieve the target. I can easily have the situation below:

The problem is creating the right angle for the vertex normals along the curve... How can it be done?

One way would be to copy the normal position, from a duplicate of the mesh, without rim faces. Like this:

Nice one!! Do you think this is the fastest way possible? Or using different addons/methods (just saying, don't know if it exist something related to editing normals except blender4web) the result could be quicker?

I don't know really. I don't edit normals very often, so wasn't looking for the fastest possible way. When I want to get certain look in OpenGL, I usually use edge split modifier.


text:
How do I make a giant clock made of many small clocks?
I want to recreate this animation I found online, of a giant clock that displays the time using many smaller clocks. The minute and hour hands of the smaller clocks rearrange into symmetry and shows the time. This is the particular image I found:

(The clock showing the time.)
(The video: Giant clock made out of tiny clocks)
For sake of simplicity: I want the needles of those clocks moving and align to show a single digit.

Here is the simple scene that I made using animation nodes:

I made 2 arrows, and duplicated it 5*8 times:

Each arrow is sent to the node program, which determines the position in the space and the rotation:

First, I divided the index by 5 and took the remainder of the division to get the coordinates (x and y index) of the arrow:

Next, I just multiplied it to get the correct scale of the arrow's matrix (x and y coordinates):

How to get the rotation? First, I wrote a map, which determines the rotation of each arrow. I made it using a list of "box symbols" ("┌","─","┐", etc..):
┌───┐
│┌──┘
││
│└──┐
│┌─┐│
││ ││
│└─┘│
└───┘

Then I wrote the script, which converts a correct symbol into 2 angles:
out=[0,0]
if(letter=="┌"):
    out=[-90,180]
if(letter=="─"):
    out=[-90,90]
if(letter=="│"):
    out=[0,180]
if(letter=="┐"):
    out=[180,90]
if(letter=="┘"):
    out=[0,90]
if(letter=="└"):
    out=[0,-90]

rot=out[arrow]

So when I put the correct letter and arrow index (0 or 1 - first or second arrow) it outputs the correct angle:

This script block gets the letter from the text "map":

and finally I used the animate float node to make a transition between a random angle and that angle:

As you see, you need to know a little about Animation nodes and scripting. This is the file (NOTE: it will not work without Animation Nodes!):

Well done my friend. Understanding Animation nodes (or just math) is my dream. Sorry for the link but I need to: https://gph.is/2cpbE6Y

@Crantisz How can I make above Blend file work, I couldnt although installed AN

First, the way of representing the digits has to be defined. In this answer, I shall use a low resolution image representing each digit. The image is a $10 \times 12$ binary image like this image representing the digit $4$:

Each $2 \times 2$ pixels represent a clock, so we have $\frac{10}{2}\times \frac{12}{2} = 5\times 6 = 30$ clocks. Each pointer have a limited number of directions it can point at, in particular, it can have an angle $0, \frac{\pi}{2}, \pi, \frac{3}{2}\pi$. By looking at each four pixels of each clock we can determine the orientation of its pointers. Since we have four pixels, then we have $2^4=16$ possible combination, however, if the image is inverted, nothing changes, making the number of possible orientations to be $8$. We can encode the the four pixels in a 4-bit number where each bit represents a pixel. Then one can compute a look up table for each possible 4-bit number that stores the orientation of each pointer. By looking at the reference image, we can find that LUT to be:
p1 = [undetermined, 0   , pi/2, 0 , pi      , undetermined, pi/2  , 0     ]
p2 = [undetermined, pi/2, pi  , pi, 1.5*pi  , undetermined, 1.5*pi, 1.5*pi]

Where p1 and p2 stores the orientation of the first and second pointer such that the index of each orientation is the 4-bit number that characterizes each combination. The undetermined indicates that all pixels are identical or that the first and third or the second and fourth quadrants are similar contrary to the others and thus no orientation can be determined.
In Animation Nodes, I will read the image as a single channel using the expression:
bpy.data.images[imageName].pixels[:][::4]

Where [:] copies the image values and [::4] get us every fourth element because we only need the first channel. (From RGBA we only need R) Then, I am going to get the width and height of the image using the expression:
width = bpy.data.images[imageName].size[0]
height = bpy.data.images[imageName].size[1]

Then, I am going to encode the pixels in the 4-bit number clock by using the following code:
LUT = []
for h in range(height // 2):
    for w in range(width // 2):
        clock = 0
        if pixels[(h * 2 + 1) * width + w * 2 + 1]: clock |= 1
        if pixels[(h * 2 + 1) * width + w * 2    ]: clock |= 2
        if pixels[h * 2 * width + w * 2          ]: clock |= 4
        if pixels[h * 2 * width + w * 2 + 1      ]: clock |= 8
        LUT.append(clock)

Since the width and height is double the number of clocks, we loop over only have of them. We initialize the 4-bit number to be zero and for each pixel, check if it is equal to a non zero and if yes, set its corresponding bit to one using the or operator. Then we append the 4-bit number to a list and return it. We only computed $8$ of the combinations, the other $8$ are identical to those computed as we said except their order is reversed, we could either invert the 4-bit number if it surpassed $8$ or combine the list to itself head to head which we shall do because it is easier.
The next step is to evaluate the LUT at the previously computed numbers, forming an Euler from that and constructing a matrix list along the points of a uniform grid. Those matrices represents the orientation of the pointers and their locations and a simple grid mesh can be transformed along them creating the pointers we need.


text:
How can I remove sharp edges from the final render?
I'm un-wrapping my mesh and these are all my mark seams:

When I render these are the results:

It seems pretty god, but when I went in the back, near the neck I saw them, straches all long my mark seams.

Did I make something wrong or is it usual with mark seams? What can I do in order to smooth this one and render my figure better?

I think the artifacts on the third picture aren't relevant to UV seams Arrows point to the seam in mesh topology which isn't what seams can change. The seams will change UV map but not geometry. Probably you should revise something with it (only if that's not grey texture on the mesh applied using those seams).

Please show a close up of the defective area with the vertices showing and an illuminating angle.  Solid and See transparent .... show all edges.  Not final render.  Edit Mode or Object mode in 3D View Window.

I have already edit mate

i did the low poly and then mark seams. I baked the high poly onto the low poly, so yes there is the normal map of high poly

Are you sure there wasn't any internal geometry in the highpoly before you baked it ? Check the lowpoly for that too. You could upload this part of mesh if anyone is willing to help.

Sorry but i would like to keep my file. I have just checked and there wasn't any internal geometry. Do you think bias could help me? I have set it at 0.101. Should i increase it?

Have you tried removing doubles?

Yes! No Doubles founded

What is the "Margin Overdraw" setting in bake? Make sure your texture is large enough, set the overdraw to 64 pixels, and make sure there is at least a 64 pixel gap around the seams in the UV layout.
This is a typical problem with UV-steams. It is called "texture tearing", and it happens because at the UV seam there is a texture discontinuity.
Select the vertex at the black mark in the center of the spine. Then open the UV editor and look at the location of that point. You'll see that it is at a corner of a UV island, and probably surrounded by empty black. That black on the other side of the seam is blending in and making the black tear.
It can help to over-draw UV seam in the texture, so there is similar data on both sides of the seam line, for all UV islands. If you can get the over-draw color substantially similar, then you won't see the seam line.
It can sometimes help if you increase the resolution of your textures.
Let's consider why the tear happens in detail...
Every rendered pixel you see is filtering some number of nearby texture pixels together. For simplicity, let's just assume it's filtering a circle of texture pixels together around a UV location.
When we're not near a seam, it has a clean circle of pixels around the UV location. When we move to an adjacent UV location, it's the new circle overlaps the old one so the output pixel gradually varies from it's neighbor.
However, at the seam edge, half the circle falls across the seam and outside the UV island. Ideally that other half would be exactly the same pixels which are on the other side of the UV seam, but those pixels are located somewhere else in our texture. In fact, the other side of the circle might just fall onto blank black pixels!
Ideally, the pixels over the edge of every seam would match the pixels on the other side of that seam. Both the bake tools and texture-paint tools try to approximate this using a setting called "Overdraw".

Delete the vertex of the defective area.  Examine for unwanted pixels.  Add back a new pixel.  Correct Seams if required.
Examine the troublesome area in question in Mesh Select Mode vertex, edge, and face view while in Edit mode and remove, adjust stray vertices.

Sorry i did understand; can you explai better? Thank you


text:
Export BGE Soft-body Distortions to 3D view?
Is it possible to get BGE soft-body simulations into the normal viewport? I know you can get the animation of the object itself, (with record animation to keyframes) but how to get the distortions of the softbody?

It does not appear to be possible.  You'd probably have to write a script to export it, but:
"There are no python bindings to control soft bodies, and no logic brick support, except for apply force and add object actuator. " - http://wiki.blender.org/index.php/Dev:Source/GameEngine/BulletSoftBody
(I can't yet reply to your question to clarify.  What are you trying to accomplish?  You have another question about multiple soft bodies colliding, is the problem related? like I said, combining them into one object works, but a drawback is they have to all have the same settings... but with more detail to your problem, there may be a way.)

don't worry about his other question at the moment. Just try to answer this one :)

I answered this one and his other one.
It stinks not being able to reply to questions/answer for clarifications yet.  So I put it in parenthesis.  I'm trying to solve his problem, which appears to have manifested as this question.
My questions:  Why try to export BGE's soft body as a regular animation?  What is wrong with the regular softbody modifier, that is more powerful?
I'm guessing it has to do with colliding softbody objects, which I told him how to do in the other question, but I don't know.)

it's true that the built in simulator is more powerful than the game engine. However, it would be easier to create an animation if you could easily interact with the simulation itself (I think that's the main reason he would use it instead).

Good idea, perhaps he wants to interact with it.  (That's somewhat possible with the regular one too.  Run the sim a few frames, modify the interacting object's animation, and repeat,  But yes, not as easily.)  A little background on what he's trying to do, that's inspiring these questions would make better use of our energy.  I realize the place for me to write these questions is on his question, but I can't yet.  I think I need just one more upvote.

@CharlesL The main reason I want to use the BGE softbody is partly so I can have rigid-body to soft body as well as soft body to soft body collisions, it is also faster (obviously) yet looks passable. (IMO)


text:
How to disable the face overlay in the UV editor?
Is it possible to disable the transparent face overlay in the UV editor?
Since the opacity of each face is added to the collective opacity of all the face under it, sometimes with many faces in the same location the overlay becomes completely opaque, making it difficult to see what is going on.

Is it possible to disable this so only the outline is visible, or limit the opacity to a fixed amount?

Go to your User preferences and under Themes for the UV/Image Editor category, lower the alpha of Face Selected to suit your needs. At 0, only the outlines should still show.

It is also worth noting that there is another option for Face color in the same category, the default color for this is white and the default alpha is ~0.3.
Therefore, if you have alot of faces overlaying each other, this can lead to a white look as it will add up so you can also adjust the alpha value there as well depending on what you need. Setting both Face and Face Selected alpha values to 0 should suffice.


text:
How can I delete mesh parts with python?
Suppose I have identified or can identifiy some meshparts I no longer want in my mesh and want to delete them, how would I do it?
I know that bmesh.ops.delete exists, I just don't know how to use it, because the API is a bit lacking for that function. :)
Thanks

using the bmesh simple template from the text editor, and a bit of snooping around. You should experiment with the geom and context parameters.
The context is enumerated so (source: bmesh_operator_api.h):
enum {
DEL_VERTS = 1,
DEL_EDGES,
DEL_ONLYFACES,
DEL_EDGESFACES,
DEL_FACES,
DEL_ALL,
DEL_ONLYTAGGED
};

This example assumes we have a mesh object in edit-mode and several faces selected. Running the script will delete edges and faces associated with the selection.
import bpy
import bmesh

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

# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)
faces_select = [f for f in bm.faces if f.select]

bmesh.ops.delete(bm, geom=faces_select, context=5)

# Show the updates in the viewport
# and recalculate n-gon tessellation.
bmesh.update_edit_mesh(me, True)

What are the differences between DEL_ONLYFACES, DEL_EDGESFACES and DEL_FACES?

those are the same options you get if you try to delete geometry using X in the viewport,  ONLYFACES keeps edges (and verts), EDGESFACES just keeps verts, ...etc..


text:
Lighting without highly visible shadows
How I can achieve lighting that we have in Autumn mornings using cycles ? We have some ambient light with very blurry shadows - I'm thinking about something like this:

https://farm4.staticflickr.com/3565/3403192179_0c3044e5df.jpg.

A shadow is merely the absence of light. The sharpness or distinction of a shadow is determined by the area from which the light is emitted. Thus, both increasing the size of a light and/or adding more (spread out) lights will create the appearance of subtle or blurry shadows. Simply put, more light means less shadows.
In practice there are a few ways to achieve that sort of overcast lighting:

Large light source
Multiple lights
Environment lighting

1: Large light source
All lamps (except the Hemi) in Cycles have the option to increase their Size:

The exact size value that works for you will depend entirely on the scale of your scene and how far away the light is. A small lamp (left) will cast harsh shadows, while a large lamp (right) will cast soft shadows:

2: Multiple lights
Similarly, you can add more lights which will increase the total area that is emitting light.
On the left is a single area lamp with Size = 6, and on the right are 5 area lamps (with reduced intensity) arranged like a dome above Suzanne, also with Size = 6:

Using multiple light sources is a little more tricky to control, but creates slightly more interesting shadows. Here is a screenshot of the scene rendered for the right image above:

3. Environment Lighting
Cycles allows you to emit light from the World - an infinitely far away sphere around the scene.
By default, the world colour is a dark grey (left), however if you click Use Nodes, change it to white, increase the strength and add some buildings just out of view to block some light, it can be used quite effectively (right):

Here is a screenshot of the scene rendered for the right image above:

In the photograph, the sun is behind the clouds or behind the buildings, so there's no clear directional light source. On the road there are blurry reflections due the rain.
You could use an environment texture that was created in similar weather conditions. On the road you can mix in a glossy shader with textured roughness or bump mapping to simulate the reflections.


text:
Deforming a mesh in realtime (Game Engine)
I have a subdivided plane I want to act as a niveau map.
I want to change the niveau extremes' locations and want the map to display the niveau in the form of z=f(x,y) with x,y as the location of a significant niveau point and want to plot z to the plane with a function f of my choosing.
How can I change and apply the vert's location (z value)?
1) I'd like the changes to be real time. I'd like to show the movement of the niveaus with it.
2) Because of that they need to happen while the game runs
3) Yes I tried to find and change the objects vertices like this:
bpyobject=bpy.data.scenes[scenename].objects[bgeobject.name]
for vert in bpyobject.data.vertices:
    vert.co[2]=vert.co[2]+1
bpyobject.data.update()

But this only updates the mesh after the game engine ends.

Your not really explaining the context here, 1) do the changes need to be real time, 2) do the changes happen in-game, or before the game runs? 3) did you try this already and have problems?

Firstly you'll need to use the bge module, bpy data access wont work since the game engine stores its own data.
For this you will need to use KX_MeshProxy, In the link there is an example for changing a meshes vertex color, but from the API docs you can see how you could change location.
eg:
    from bge import logic
cont = logic.getCurrentController()
object = cont.owner

for mesh in object.meshes:
   for m_index in range(len(mesh.materials)):
      for v_index in range(mesh.getVertexArrayLength(m_index)):
         vertex = mesh.getVertex(m_index, v_index)
         vertex.XYZ = 1, 2, 3 * v_index

Note

that this isnt really optimal from Python, for a high poly mesh the Python script may slow down execution a lot, if the motion isnt so fast you could move N verts per script execution, so at least you dont get jerky playback which would happen if you simply execute the script less often.
You may want to look into GLSL vertex shaders, this is quite invovled but has the advantage that moving vertices about is offloaded onto the graphics card.

Does updating the mesh this way automatically update the collision mesh? Or do you have to call kx_obj.reinstancePhysicsMesh()?

You need to explicitly re-run kx_obj.reinstancePhysicsMesh() since it will rebuild the entire collision shape and can get quite slow.


text:
How to move bones rest position from Python?
I have an armature object with a single bone.
Now I want to change the rest position for animation purposes.
The only way to manipulate bones I have found is via
arm_object.pose.bones

Anytime I change the position of a bone I get that way, for example with bone.rotation_euler = (0, 0, angle) it changes the pose but not the rest position.

You have to access Armature.edit_bones, but they can only be accessed from EditMode.
Example of moving all bones rest positions.
# This script assumes you have an active armature in 'Object Mode'

import bpy
from bpy import context

obj = context.object

bpy.ops.object.mode_set(mode='EDIT')

for bone in obj.data.edit_bones:
    bone.head.y += 1.0
    bone.tail.y += 1.0

bpy.ops.object.mode_set(mode='OBJECT')

Note: instead of manipulating the head/tail directly, it can be more convenient to use EditBone.transform so you can use a transformation matrix to rotate/scale/translate - all at once.
To transform the entire armature, use Armature.transform


text:
Access view orientation from python?
Is it possible to access the alignment of the view from python? (e.g 'TOP', 'FRONT', 'RIGHT', etc.)
I looked in the api docs, but the closest I could find was view_perspective.

What about view_rotation?

Looking at the implementation of view3d.viewnumpad in view3d_edit.c, it's just switch-ing over FRONT, BACK, etc. enumerations and setting the view matrix accordingly. The only way I found is through deducing the orientation from view matrix in Python, in the following barebones example using either view_matrix:
import math

def get_view_orientation_from_matrix(view_matrix):
    r = lambda x: round(x, 2)
    view_rot = view_matrix.to_euler()

    orientation_dict = {(0.0, 0.0, 0.0) : 'TOP',
                        (r(math.pi), 0.0, 0.0) : 'BOTTOM',
                        (r(-math.pi/2), 0.0, 0.0) : 'FRONT',
                        (r(math.pi/2), 0.0, r(-math.pi)) : 'BACK',
                        (r(-math.pi/2), r(math.pi/2), 0.0) : 'LEFT',
                        (r(-math.pi/2), r(-math.pi/2), 0.0) : 'RIGHT'}

    return orientation_dict.get(tuple(map(r, view_rot)), 'UNDEFINED')

... or view_rotation as @WChargin suggested, seeing that it's normalized as stated in API docs:
def get_view_orientation_from_quaternion(view_quat):
    r = lambda x: round(x, 3)
    view_rot = view_quat.to_euler()

    orientation_dict = {(0.0, 0.0, 0.0) : 'TOP',
                        (r(math.pi), 0.0, 0.0) : 'BOTTOM',
                        (r(math.pi/2), 0.0, 0.0) : 'FRONT',
                        (r(math.pi/2), 0.0, r(math.pi)) : 'BACK',
                        (r(math.pi/2), 0.0, r(-math.pi/2)) : 'LEFT',
                        (r(math.pi/2), 0.0, r(math.pi/2)) : 'RIGHT'}

    return orientation_dict.get(tuple(map(r, view_rot)), 'UNDEFINED')

It currently ignores perspective/orthogonal and camera view, but that can be easily deduced from the region's other variables.

Where are you getting the pi/2 from? Those vectors aren't even normalized (e.g., 2pi^2/4 is not 1). You probably mean sqrt(2) for the ones with two nonzero components and 1 for the ones with just one...

Especially considering the #define M_SQRT1_2   0.70710678118654752440 in conjunction with axis_set_view(C, v3d, ar, 0.0, 0.0, -M_SQRT1_2, -M_SQRT1_2, viewnum, nextperspo, align_active, smooth_viewtx); (for example).

I get these constants the stupid way: executing each view shortcuts, and see the resulting matrix :D On second thought, maybe I should've used view_rotation.to_euler() as you suggested.

Based on Adhi's solution, here's a complete operator to print all view3d perspectives like shown in the left-upper corner:
import bpy
import math

def main(context):
    view_orientations = []

    for area in context.screen.areas:
        if area.type == 'VIEW_3D':
            r3d = area.spaces.active.region_3d # fine for right-upper quadview view
            view_matrix = r3d.view_matrix

            view_orientation = get_view_orientation_from_matrix(view_matrix).capitalize()
            view_orientation += " " + r3d.view_perspective.capitalize()
            if area.spaces.active.local_view is not None:
                view_orientation += " (Local)"

            view_orientations.append(view_orientation)

    return view_orientations

def get_view_orientation_from_matrix(view_matrix):
    r = lambda x: round(x, 2)
    view_rot = view_matrix.to_euler()

    orientation_dict = {(0.0, 0.0, 0.0) : 'TOP',
                        (r(math.pi), 0.0, 0.0) : 'BOTTOM',
                        (r(-math.pi/2), 0.0, 0.0) : 'FRONT',
                        (r(math.pi/2), 0.0, r(-math.pi)) : 'BACK',
                        (r(-math.pi/2), r(math.pi/2), 0.0) : 'LEFT',
                        (r(-math.pi/2), r(-math.pi/2), 0.0) : 'RIGHT'}

    return orientation_dict.get(tuple(map(r, view_rot)), 'USER')

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    def execute(self, context):
        print("\n".join(main(context)))
        return {'FINISHED'}

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

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

if __name__ == "__main__":
    register()

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

Note: does only take the right-upper view in quadview mode into account.

It doesn't look like there's a clean way to do it.
Here's an excerpt of the painting code for the 3D viewport:
// view3d_draw.c:803
// in method: view3d_get_name
switch (rv3d->view) {
    case RV3D_VIEW_FRONT:
        if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Front Ortho");
        else name = IFACE_("Front Persp");
        break;
    case RV3D_VIEW_BACK:
        if (rv3d->persp == RV3D_ORTHO) name = IFACE_("Back Ortho");
        else name = IFACE_("Back Persp");
        break;
    // etc ...
}
return name;

As you can see, it's simply checking these manually and looking them up (the IFACE_ is for localization). The string is never stored in a value anywhere.
You could perform a similar check in Python using the view_rotation property. See this answer for a starting point.


text:
What is the difference between module and script execution methods in the Game Engine?
There are two options when using a sensor to run a python script (which also makes me wonder why the python option is a Controller and not a Actuator, but I guess that's a separate question).

As far as I can tell, Module runs a function in certain file (specified file.function). Script runs an entire file.
What are the practical differences between the two (assuming they are functionally the same)? What are some example cases where you would want to use one over the other?

The wiki page seems to be down currently, so forgive me if the answer is written right at the top..

These docs explain:

Script Mode
In Script mode, the controller is linked to a script, the whole script
will be executed before the logic moves on. Everything in the script
will happen at the same frame, if the same value or attribute are
changed more than once, only the latest will be visible in the game
because of this. If for example the position of an object is changed
first to (100.0,100.0,100.0) but later in the same script changed to
(0.0,0.0,0.0), then only the (0.0,0.0,0.0) will be visible to the
player because the move to (100.0,100.0,100.0) happened on at the same
frame.
Module Mode
Since Blender 2.49 the Python module controller was added. Simply
choose Module instead of Script on your Python controller drop-down
menu. Then you define a function on that module and call that function
from the controller. Instead of writing “myScript.py” on the script
edit box, you’ll write “myModule.myFunc” on the module edit box. This
function will run every time the controller is called. But other
functions and variables outside of myFunc’s scope will only run once.
This is good for optimizing your code when you want to initiate
variables only once then use them later.
The Python module controller supports any number of attributes, this
means packages are supported automatically. As well as
“myModule.myFunc” you can do “myPackage.myModule.myFunc”, nested
packages work too, as does method calls on class instances like:
“myPackage.myModule.myInstance.myMethod”. The python controller is
passed to the python function as an argument for functions that take
one arg.

Regrettably the 2.6x docs miss this info.


text:
Plugin Licences
I'd like to write a plug-in to accomplish something for my job, and I'm trying to figure out if the licensing options are such that I can convince management to let me do it.
My company would want to be able to distribute the plug-in to collaborators, while preventing its further distribution. There are two things I'm considering:

Potential clients getting a free copy (I'm not too concerned about this)
Our competitors getting a copy and using our own software elbow us out of potential clients - this, I'd like to prevent

The "Can I sell plug-ins for Blender" section of the FAQ notes that selling plugins is OK, provided they're GPL'd. This seems to me like a "one time sale" situation. In other words, why would a second client ever buy the plug-in, if they could just get it for free from the first?
Is there any way to license a plugin such that we can feel comfortable letting our collaborators use it, while at same time as preventing the opportunity for competitors to use it against us?

Blender's use of GPLv3+ is not unique or special, there is a lot of information online on GPL use, I think we can't realistically give good legal advice here. See: http://meta.blender.stackexchange.com/questions/422/are-licensing-questions-off-topic/423#423


text:
How can I detect even terrain in geometry nodes?
I'm trying to scatter an object on terrain using geometry nodes. The only problem is I want to only scatter if the surrounding terrain is even. I'm not talking about the angle of the normal; I want the surrounding area to be relatively flat. I've tried to use the blur node to detect, but nothing has worked so far.
Here is a photo the terrain, if that helps.

The goal is that, given a vertex, it can somehow find how flat the surrounding area is.

Some mockup or illustration would be helpfull to better understand ... btw how is the terrain generated? Especially mentioned flat part of the mesh?

Sure I'll add some more info, in a minute, but its generated based on a few procedural textures as a heightmap. The goal is that given a vertex, it can somehow find how flat the surrounding area is.

Can you mark (paint) the areas you count as flat? I'm guessing you dont want to use normal angle since it will scatter objects on top of hills ... probbably you can use just the elevation? Or there will be flat areas in higher elevations?

The reason I don't want to only use the normal is that a point can have a normal facing up, but still not be on even terrain. I want to check if the height is nearby is around the same height as the point. For example, I might want to scatter a tree with a thick stump. If it happened to scatter next to a hill, it would clip in.

If you want to keep some distance from uneven terrain, you can use the Shortest Edge paths node, as it can give you the shortest path through edges to vertices defined as an end vertex. This method performs better in a geometry with high resolution and with faces that don't differ much in size
First you need to define what is uneven geometry, I just check if the dot product between the normal and the vector $(0, 0, 1)$, or just the $Z$ component of the normal, is less than $0.95$:

Then you use that selection as end vertex of the Shortest Edge paths node and the edge length as the edge cost, using the total cost (distance travelling through edges) to select which faces will have points distributed:

Node tree:

Update:
With the node tree above, no points are distributed when there's no uneven terrain. To solve that, if you have a single mesh island, check if there's any uneven terrain using the Attribute Statistic node:

Or, if you have multiple mesh islands, check if each has any uneven terrain:

I love this answer, just tried it and it works very well. I didn't know about shortest edge paths. Is that some kind of pathfinding? Thank you very much

@JackJamison The node's algorithm is the Dijkstra's algorithm, as stated by its documentation.

I am trying it out and it works pretty well, but when there are no positions that are too steep the selection is blank. I've tried to fix it with an or equal to zero, but it didn't work. Any ideas?

@JackJamison see edit.

It works great, thank you

Simple terrain sample ...

You can try to get selection from Edge Angle node ...

Thanks for the response, but my terrain doesn't have any exactly flat areas. The goal is that it can detect roughly flat areas to scatter on

See edit ... Probably some search for selection based on angle between two faces like the "Edge Angle" node ... but it means if there will be a side of the hill with straight wall  with faces in low angle it would be taken into account, so I'm not sure if there is something that can cover it ... that is why I asked you if just low elevation can be used.

I would do it like this: first use a Capture Attribute node set to Vector and Face to get the normals of the faces.
Plug the Attribute output into a Vector Math node set to Dot Product, as the second vector you use 0/0/1, that is the pointing upwards in Z direction which would be perfectly horizontal.
Now the dot product returns 1, when both vectors point in the same direction (in this case upwards) and lower values when they differ from each other. So now with a Math node set to Less Than you can set a threshold how much deviation from the perfectly flat you will accept. Values less than the threshold will result in a Boolean value of 1, which you plug into a Delete Geometry node. This helps you see which areas now remain as flat.
Now some of the remaining mesh islands might be flat, but too small and you do not want to distribute points there. So you take Face Area node and a Mesh Island node's Island Index output and plug them into an Accumulate Field node set to Face. Then plug the Total output into another Less Than node and the result in another Delete Geometry node, to delete mesh islands that are smaller than the threshold you've set in the Less Than.
The remaining mesh you can now plug into a Distribute Points on Faces node. The resulting points you combine with the original landscape mesh through a Join Geometry node and that's it. You can later decide how flat it should be or how large the islands.
By the way, the face area threshold cannot really distinguish if an area is large enough in length and width, so a very long thin strip of flat terrain will be possible, too.

Hey, this looks good. I'm going to try it out in a little bit and let you know. Thank you


text:
How do I animate a right-angle triangle inside a circle (hypotenuse of the triangle is the radius of the circle)
As I move the radius of the circle I need to show the triangle moving showing the right angle moving (on the x-axis).
Basically the three points of the triangle are: the centre of the circle (A), a point in the circumference (B) and one on the x-axis (C) - so that line drawn from B to the x-axis is always perpendicular to the x-axis and remains perpendicular as you move point (B) (or angle CAB from 0 - 180 degrees).
Here a drawing of what I have in mind.

Hello, I guess you mean "hypotenuse of the triangle is the diameter of the circle" right?

Sorry no. The hypotenuse is the radius. So basically the 3 points of the triangle are: the centre of the circle (A), a point in the circumference (B) and one on the x-axis (C) - so that line drawn from B to the x-axis is always perpendicular to the x-axis and remains perpendicular as you move point (B) from 0 - 90 degrees. Hope this helps

Oh, I see. Sorry, then my answer is wrong or not applicable to your case. However, I find rather difficult to figure what you have in mind. Would you please add a sketch to your question? In fact, if you assign the hypotenuse of a right-angle triangle (i.e. both its length and position) then you can form a right-angle triangle only if the other vertex lies on the circumference that your hypotenuse is the diameter of.

@NicolaSap I think (and I could be wrong) that (s)he's saying that the C point isn't on the edge of the circle.  So A is in the middle, B is an arbitrary point on the circle, and C is the point on the X axis that has the same X coordinate as B.  N Dib, can you verify this?

Thanks both of you. The diagram that has been added makes it more clear.

Duane Dibbey's answer is good and solves your problem, however - for completeness - I'm posting another one that will leave you more freedom to move the hypotenuse around instead of having it span linearly from 0 to 360.

Create a triangle starting from a plane.

Shift+A>Mesh>Plane. Enter edit mode (Tab). Remove one of the 4 vertices (RMB then X>Vertices), move the others into positions 0,0, 1,0, 1,1 (RMB then G, holding Ctrl for fixed increments), select all (A) and make a face (F).
Then you can exit edit mode (Tab) and scale it down by 1/sqrt(2) (S 0.7071) to make the hypotenuse 1 unit long.
Hook the two moving vertices to two new empties.

Enter edit mode (Tab), select one vertex (RMB) then hook it: Ctrl+H>Hook to new object. Repeat for the other vertex. This will create two new empties in the scene.
Create a central empty and parent the top-right empty to it.

Exit edit mode (Tab). Make sure that your 3d cursor is still in the center (otherwise do Shift+S>Cursor to center), and add a new empty (Shift+A>Empty>Plain Axes).
Select the top-right empty (RMB) ant then the center empty (Shift+RMB). Set parent with Ctrl+P.
Constrain the X-location of the bottom-right empty to the top-right empty.

Select the bottom-right empty (RMB), go to the Constraints panel and add a new Object Constraint of type Copy Location. Link it to the top-right empty with the eye-dropper tool, and deselect Y and Z.
Done! You can now rotate the center empty and the triangle will change accordingly.

In the object properties of the empties you can change their display type and size, if you think they are too big and cluttering.

The problem with normals can be solved by ticking "Double sided" in the Object Data panel. The outlines are rather difficult to make well: the wireframe modifier is not great for 2D shapes and behaves oddly for small angles. One can create a complex mesh made of three non linked rectangles (one per edge) and then hooking the short edge of each to the three empties, but this would be a rather complicate answer to the original question.

Super - you are a genious...