# Tag Info

## Hot answers tagged mathematics

49

Blender is the tool and bpy is the API. If you want to render geometry you can use bpy to deal with any meaningful input. Blender has been used effectively to display data for scientific publications for many years. I'll add a non-exhaustive list below. But if you are expecting ready made functions to plot a 3D scatter plot with scales and cube grid, with ...

40

Let's start with some definitions: Vector: A list of values that are all contained under the same "roof" so to speak. For instance, the location of an object in 3D space is a vector of 3 values (the $X$, $Y$ and $Z$ location of that object). All Vectors in blender are by definition lists of 3 values, since that's the most common and useful type in a 3D ...

38

Here is a list of the mathematical equivalents of each operation. Add: Out = Value1 + Value2. Subtract: Out = Value1 - Value2. Multiply: Out = Value1 * Value2. Divide: Out = Value1 / Value2. Sine: Out = Sin(Value1).† Cosine: Out = Cos(Value1).† Tangent: Out = Tan(Value1).† Arcsin: Out = Sin⁻¹(Value1).† Arccosine: Out = Cos⁻¹(Value1).† Arctangent: Out = Tan⁻¹...

36

The Add 3D Function Surface addon allows you to do exactly this. You can download this addon here. It also comes included in the built-in Extra Objects addon. Once you have the addon installed, when you go to add a new mesh, you will have two additional options: 'Z function surface' and 'XYZ function surface'. If you select either of these, you will then be ...

32

The dot product of two vectors measures two things: how much are they "in the same direction" ? how large are they? Skipping the precise definition, we're usually interested in these properties: Vectors with the "same-ish" direction will have a positive product, a null one if they're orthogonal, and negative if they are in opposite directions If you ...

30

The dot product is a way of multiplying two vectors that produces a scalar (i.e. real number) value. Geometric Definition The dot product of vectors $\vec{V}$ and $\vec{U}$ can be thought of as multiplying $\vert\vert \vec{V}\vert\vert$ (the magnitude of $\vec{V}$) by the component of $\vec{U}$ that is parallel to $\vec{V}$. Notice how the vector $\vec{U}$...

23

You can use Vector maths and Maths nodes to calculate the 'altitude' above the planet and from there the atmospheric density and use this to control the density of the Volumetric Scatter. To achieve this, add a mesh around your planet to act as a domain for the scattering. The domain's centre should correspond with the centre of the spherical 'planet'. ...

22

Final result One method is to create a volumetric cylinder and distort it by rotating it around the origin by an amount that varies based on the distance from the origin. First, create a volumetric cylinder. This is achieved by calculating the distance from the origin in just two of the three dimensions (it's effectively a circle projected along the ...

20

Have used the equations found here http://www.econym.demon.co.uk/isotut/real.htm#heart1 The first can be crunched into XYZ surface. Notice the use of fabs(...) in the A helper function. The abs(...) method is not in the list of allowable methods and creates an error. Here is some code for the second. Which required a mapping from spherical coordinates. ...

17

I don't think there's currently a way to add surfaces, but if you are okay with using meshes, you can use the Extra objects addon (it's not enabled by default). To enable the addon, open the User Preferences, by pressing Ctrl + Alt + U; then, switch to the Add-ons, search for "extra" and enable the one that reads "Add Mesh: Extra Objects", by checking the ...

16

Sine Wave Producing a sine wave is easy as Sine is one of the math functions in the Blender Internal Converter --> Math node. However, a normal sine is no good as a direct factor for a mix node, since a sine wave produces values between -1 and 1, and the node expects a value between 0-1. To produce sine-like oscillating values between 0 and 1 I used the ...

15

Quaternion has the advantage that it gives better interpolation between keyframes for arbitrary rotations, compared to euler or axis-angle, this is often used for character animation and why its default for armatures. It also avoids the gimbal lock problem. You make a good point that the f-curves are hard to control. Typically you wont manipulate each axis ...

14

At some point the geometry will get converted into discrete coordinates - it's something we have to accept. Perhaps a method as simple as generating a profile 'edge' mesh from 20 points on a curve ( blender has curve interpolation functions in python mathutils.geometry to get neat segments) and then use the Screw modifier to Lathe them around

14

tl;dr: Always use GGX, set your roughness map to Non-color Data and square it with a math node before plugging it into the Glossy BSDF. Different microfacet distributions will have differently shaped specular highlights. Beckmann and Ashikhmin-Shirley are both similar to a Blinn-Phong specular highlight that you might find in a game engine or Blender ...

14

Here is how I would do it Wrap your expression inside a LaTeX document \documentclass{standalone} \usepackage{lmodern} %or whatever you like \usepackage[intlimits]{amsmath} \usepackage{amsthm, amssymb, amsfonts} %Useful stuff \begin{document} $<your expression>$ \end{document} Pipe that to pdflatex, or save it to expression.tex If you used a pipe:...

14

The RGB values in Blender use a linear color model while the Hex values use gamma corrected non-linear color model. To convert between these two, you would have to manually do the gamma calculations using the transfer function of your color profile, wich is set in the Color Management section of your Scene – set to sRGB by default. The excact conversion is ...

14

Fract returns the fractional part of a floating-point value, as described by @Merlin, but its treatment of negative fractional parts is not actually the same as Blender's implementaion of Modulo. If you want to see what a mathematical chunk of your shader tree is doing, it can be quite handy to make it generate a graph. Fract: This plane is 8x8 units, with ...

13

Oh gosh, I spent ages with it. On the pictures you posted it looks particularly nice because of lines are actually spirals. If they were straight it won't look nice. On your picture pole doesn't have quads and also has a lot of adjacent edges. So if you don't want this, maybe you can just stop (I would stop earlier) and connect the rest of the points using a ...

12

Computing a real mathematical set given implicitly by function(s) f1(x,y,z,...)=0, f2(x,y,z,...)=0, ... is really hard. Here's how I do what you want: The implicit function theorem tell us that, off a set of measure 0, an analytic set can be locally parameterized by a number of parameters equal to the dimension of the set. Your heart is a two-dimensional ...

12

I think one issue with your original solution was due to lack of 'absolute' on your tests on the Normal - it's allowing for > 0.5 but not for `< -0.5'. Also, 'mixing' the individual channels before combining could be causing a problem. Try a material similar to the following : This can produce the following effect : EDIT - Here's another alternative ...

11

We can take Sharp off the list right away as the entry in the manual states: Distribution: Microfacet distribution to use. Sharp results in perfectly sharp reflections like a mirror, while Beckmann, GGX and Ashikhmin-Shirley can use the Roughness input for blurry reflections. You may find this article to be a big help in visualizing the differences ...

11

To supplement PGmath's answer: It is worth noting that the math is calculated a bit differently than you might think. It has to do with limitations of storing and representing floating point numbers (reals) in a computer (in binary format). For the same reasons you cannot represent 1/3 in decimal exactly (it is 0.333...) you cannot represent exactly (for ...

11

There is an addon shipped by default with Blender called Add Mesh: Extra Objects capable of doing this. It is disabled by default and can be activated from the User Preferences dialog. Start by opening File > User Preferences > Addons then search for Extra and activate the Add Mesh: Extra Objects addon. Then in the 3D View press Shift+A > Add > Mesh > Math ...

11

Original answer (edit addressing the question clarification below) If you look at how the Catmull-Clark subdivision algorithm does it, you can see it creates a five-pointed star: Before: After: When you surround it with quad geometry, it still works the same: Before: After: With Catmull-Clark smoothing: If we look at this, we can see that this redirects ...

11

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 ...

10

Since asking this question, I've made a small (single script) plotting utility. This could be made into an add-on however I find it useful as-is. Usage: Paste this script into a text-block named blend_plot.py and press "Run Script". Running the script will create a blend_plot_func.py text-block containing an initial plotting template (if you don't have ...

10

It's impossible to tell what's going wrong in your particular case as there just isn't enough information in your question - you've only partially shown the 'internal' node tree (many of the nodes are hidden, meaning it's impossible to verify that they aren't marked as 'Clamped' and left assuming that, say, 'Root' is raising to the power of 0.5) and you don'...

9

2.8x import bpy from mathutils import Vector cam = bpy.data.objects['Camera'] up = cam.matrix_world.to_quaternion() @ Vector((0.0, 1.0, 0.0)) cam_direction = cam.matrix_world.to_quaternion() @ Vector((0.0, 0.0, -1.0)) 2.7x import bpy from mathutils import Vector cam = bpy.data.objects['Camera'] up = cam.matrix_world.to_quaternion() * Vector((0.0, 1.0, 0....

9

This script will generate a 2D Mandelbrot set in Blender using OSL. #include <stdosl.h> shader node_fractal( float CenterX = 0.0, float CenterY = 0.0, point Vector = P, float Zoom = 1.0, int MaxIterations = 50, color Foreground = color(1.0), color Background = color(0.0), output float ...

9

here's a grid OSL shader I wrote a while back. /* Grid Lines : Author Dealga McArdle, 2013 : modified from Sine Stripes by Thomas Dinges example shaders: http://www.openshading.com/osl/example-shaders/ */ #include "stdosl.h" shader GridShaderUV( // input and output parameters vector Vector = P, color GridColor = color(0.8), ...

Only top voted, non community-wiki answers of a minimum length are eligible