Friday, February 27, 2015

Cycles "Voxels"

Im sure all of you have played Minecraft before and wanted to try something like it in blender... Well I figured out a way while messing with the last post about Lego :D!!! Here is the blend

Here is a basic example of how to do this. I will try to explain what is going on.

Ok so I am using a Voronoi which is a 3D texture to mix between a diffuse and a transparent. The reason this works is because im using from dupli on the texture coordinates node which applies the material of your object even when its duplicated with dupliverts or particle systems.

Also for this to even work you need to set the transparent bounces to a huge number (I used 150). The only problem with this method is it is VERY VERY slow and its almost impossible to fully converge other than that its pretty awesome :D

Here is the particle system settings 

Sunday, February 15, 2015

Lego Fluid Sim

So im sure you have heard everyone is doing lego fluid simulations after that post on blender nation... Well I had a go at it :D

(Warning there is a ton of lossless images it may take a min to load)

Saturday, February 14, 2015

So.. My internet was off and I decided play around with the blackbody node. IT IS AMAZING!
Here is what I came up with in the hour my internet was off.

Warning these images are lossless and quite big it may take a minute to load. Also if you click any of the renders are the top you will leave this blog post. I recommend clicking it with the scroll wheel aka middle click it will open the images in a new tab.

Now I am going to show you how to do the lava part which will look much better if it isn't on a cube ;)

Here is the node layout without the crazy mapping nodes

So you will first need to know what the black body node does. Basically it works off of heat the Cycles node uses kelvin. Here is a graph that explains it with the minimum amount of nodes you can have to use it

the multiply node is to boost the levels from the noise texture to 4000 so they are orange in the blackbody node.

Notice the image isnt black and white aka 1 - 0 its more of a blend between 2 greys.

Black and white should work better and have more accurate color levels based on your input temperature (The multiply node) but would have a sharper falloff.

Here you can see the out put from the color ramps mostly for masking.

This one converts the noise to a black and white image (Not grey to grey like shown above)

This one defines the area that emits light (The white parts)

Here is a more advanced version of the nodes which just makes the lava swirl when its animated

Here is the blend if you want to play with it. It is CC0 so you can do what you want with it.

The first few mapping nodes in the advanced image are almost impossible for me to explain here. There is a 1 hour video dedicated to explaining it on the BlenderFoundations YouTube channel it is a must watch if you love to make procedural things in cycles.

Here are the nodes from the mushroom that weren't supposed to be seen by anyone else lol

Here are some videos including that one on I was talking about on the BlenderFoundation page

Wednesday, February 11, 2015

Adding binary numbers (using logic)

As you see Derek has already made two posts about blender, so i thought i should also do something to brighten (or darken) your day. I will do more technical topics on this blog, so if you dont like tech and math you should skip my stuff.

I'd like to start with an explanation on how to add binary numbers. With this i dont mean just add pure numbers in your head, but i want to show you how the computer does it. Knowledge of binary numbers greatly helps understanding this post.

Binary numbers only have two numerals, 0 and 1. Here a picture to compare our normal decimal system with the binary system:

Here you see how our numbers are made up. Can you calculate what the binary number is? (spoiler: its 181). At this point i assume that you know how to add binary numbers (its the same as with decimal numbers. not that different). As we want to add binary numbers using logic, we treat 0 as 'false' and 1 as 'true'.
Now you may wonder how that is going to help us. Well there is such a thing called 'Boolean algebra' ( Its about how to work with the boolean values 'true' and 'false.
Now this formula stuff looks a bit complicated and is not that much fun, but there is something called logic gates. With these you can display complicated logical circuits. But before displaying stuff we need to know what to do.
We want to add binary numbers. As we only have 1 and 0 we can create some rules for what should happen when we add two of those bits.
Lets write it down in sentences, as a formula isn't going to make things easier. We have the input values X and Y and the output S (for Sum):
"If both X and Y is 0, S will be 0. If either X or Y is 1, S will be 1."
So far so good, but what happens if we add 1 and 1? We get the binary number 10, but we only have one output. Lets think about how we add numbers.
We use a carriage if the addition of two number results in a value that cant be displayed by one digit and add this carriage to the left. So to accomodate this, we add another input Cin and another output Cout. We now have to adjust our rules. As we have 3 inputs now we get a few more combinations:
"If X,Y and Cin are 0, S will be 0 and Cout will be 0"
"If either X,Y or Cin is 1, S will be 1 and Cout will be 0"
"If 2 of X,Y or Cin are 1, S will be 0 and Cout will be 1"
"If X,Y and Cin are 1, S will be 1 and Cout will be 1"
Now we have the theory, so lets start using some gates:

Lets start with the carriage output. Cout is 1 if X and Y are 1. This can be done using a AND gate. Its output will only be 1 if all of its inputs are 1. In this picture X is 0 and Y is 1, so as predicted by our rules, Cout is 0.
Now we need something to accomodate our other rules. Something that is only 1 if only one of its inputs is 1. Some people mightve guessed it: a XOR. A XOR is only 1 if exactly one of its inputs is 1.

As you see its output is 1 while only one of its inputs is 1. now we should combine these two:

I labeled the inputs and the outputs here. You see that when we add 1 with 0 we get 1 and no carriage. Which is what we wanted. What we have here is called a 'half adder' ( im giving you the german page here, because the english one has a super strange notation for the gates and you wouldnt understand my blogpost then). 'Half' because it does only half of what we need. We are missing something to process Cin. Well lets just use another half adder then.

Now we are processing our Cin too, but we have 3 outputs. Now lets remember our rules. If 2 or 3 of our inputs are 1, Cout must be 1. We dont have that many combinations here, so when we test them,
we will see that for each those combinations, at least one of the Couts is 1. So we need a gate that is 1 as soon as 1 or more of its inputs are 1. This would be an OR gate. Lets add this to both our Couts:

Now we have a so called 'full adder' which does everything we wanted. Now we can add 2 bits, but we wanted to add whole binary numbers. To do this we only have to chain our full adders:

Here you see a 4 bit adder (sorry its a mess. I dont have a proper algorithm to place the lines in my program. it just places them like this). X is 10 and Y is 11. When we add these we get 21, which does not fit in 4 bit so we get 5 as result for S. As you see i labeled the last Cout as 'Overflow'. It will always be 1 if the resulting number of the addition is too big to fit in 4 bits. 

And there we have it. Binary additions using pure logic.

This is only kinda how a computer does additions. The computer uses signed numbers using the 2s complement. So a overflow is detected a bit differently.

If you came this far your brain is probably melted. This may be because im bad at explaining stuff in english (which is not my mother language). So if you think you are missing some information to understand the topic, leave a comment and tell me what i forgot to explain!

New Cycles Pointiness Attribute

So Sergey has been working on a new attribute for the geometry node called Pointiness. It can be used for many things like dirt maps simple AO and making random glowy parts on your mesh.

You can test this out by downloading some builds from the BuildBot.

Here are some images showing what I made with it.

Suzanne getting a make over

Snow on a mountain

And something glowy :D

Monday, February 9, 2015

So to start off the blog ill make a post about the light portals in cycles being developed by lukasstockner97 Be sure to check for builds HERE

So TLDR what it pretty much
 does is it turns the environment lighting in to an area light which is much much more efficiently sampled in Cycles. Cycles is a monte carlo forward pathtracer which is very stupid in the way it does things so you have to help guide it along.... A lot.
Here is a little tutorial on how to use it (For now it will change in the future) 

First you need an interior scene with light coming from outside (World light not any light from outside) or else this feature is pretty much pointless.

Second you need to add an area lamp where the hole in the object is.
Third make sure portal is turned on. This will make the area light no longer function as an area light so all the settings you see there are useless except for the size.

In the end you should have something like this. That black box around the light is to prevent the world light from going in the cracks(Im guessing) which would cause a crazy amount of fireflies. Dont worry this is automatically done no magic is required :D

Here is an image without light portals. 34 second render time

Here is an image with light portals. 33 second render time

Here is a link to the original Blenderartists thread