May 20, 2018

How to make stylized "The Witness" trees in Blender

0 comments
I've spent some time studying how to make trees for games. Trees are important because they often take up a large part of the screen so you need to be friends with them. As usual there are many different art styles you can chose from, but the trees I wanted to make were the trees from the game The Witness. They look like this:


Their trees have an art style called stylized, so they are obviously not 100 percent realistic looking. While The Witness developers have written three blog posts about the trees in their game, none of them described how the trees were made, so I had to guess. One article I found on how to make similar-looking trees is this one: Airborn - Trees. It argues stylized trees can be created by using a blob with a tree shape and then add random quads with a leaf texture to the surface of the blob:


This was the first tree I made in Blender: The mighty elm tree:


First I added an "Ico Sphere" blob and then I added a "Plane" which I unwrapped. To add the leaves I added a particle system to the blob. If you don't know how to randomly spread out a mesh on another mesh with a particle system, you can look at this tutorial: Blender Beginner Tutorial - Part 7: Particles.

But you can't currently export the leaves to a game engine like Unity because they are not their own object. To make them their own object, you can follow this process:
  1. Select the blob and press Shift + Ctrl + A. The leaves are now their own objects
  2. But the leaves still share the original mesh, so it may be difficult to combine them into one object. To solve this problem you select all leaves and press U and select "Object & Data & Material + Tex"
  3. To join them into one mesh you just select one leaf and then the other leaves and press Ctrl + J

To make it all more tree like you need to modify the normals to make them more spherical. This will make the leaves face outwards and upwards from the center of the tree - to emulate the effect that light has on the growth of the tree. You do this by enabling "auto smooth" in the tab next to "modifiers." And then in the "modifiers" tab you add a modifier to the leaves called "Normal Edit" and select the blob as "Target object used to affect normals." The leaves with the blob should now look like this:


And if you export it all to Unity, the result will look like this:


The leaf texture is just random leaves painted with a transparent background:


You can see that the elm is kinda round. To get a less round tree shape you can instead of adding random leaf-planes to the faces of the blob (a setting in the particle system), you can add them to the volume of the blob and then not display the blob at all in the game. You can also add more blobs to get other tree shapes, but the process for each individual blob is still the same.

The process to make the spruce tree is similar. The difference is that you add the branches (which is now a mesh and not just a plane) not to a blob, but to the to the spruce trunk with a particle system. To make the shape more spruce like, you need to use the "Vertex Groups" settings in the particle system by changing the density (no branches at the bottom) and the length (shorter branches on the top). The vertex weight is a value between 0 and 1 and 1 means the longest branch.


You might argue this method of making trees is inefficient. How long will it take to make an entire forest of trees? The answer comes from the game Firewatch. They said in a GDC talk that they only used 14 tree models to build a forest with 4600 trees.



April 24, 2018

The plein air challenge - or how to not make a game in 48 hours

0 comments
Ludum Dare, which is a competition where you make a game in 48 hours, was on this weekend. I'm usually participating in this competition but this time I couldn't find a good idea. Instead I decided to do the plein air challenge where you do a landscape painting. But I'm not really into physical painting so luckily there's a digital version of the challenge where you find a landscape by using MapCrunch and make a digital painting of the landscape. After looking at a few photos I found this photo:


These fishes are very colorful so I thought it was good practice to learn a technique called texture painting. The idea behind this technique is to simplify the texture and not try to make it as realistic as possible. A game that's using texture painting is the newly released Sea of Thieves. One of the developers of the game gave a GDC talk where he explained how they did it: they simplified and this can best be explained by showing one of the slides from the talk:


I also watched a GDC talk by a developer from the game The Witness, which has a similar style. So I made the models in Blender and then I used Blender's built-in paint tool to paint the fish textures. The first fish I made was the Yellowtail Surgeonfish, and it ended up like this:


The other fish in the reference photo is called King Angelfish, and it ended up like this:


But the reference photo also include some reef rocks, which I thought would take a lot of time to make. But then I recalled a GDC talk by one of the developers of the game Firewatch, which is by the way also using painted textures. She said that you can make a few assets, like a few rocks, and then you can use them several times in the same scene. If you place them differently no-one will notice that they are the same rocks. So I decided to make one rock and then use only that rock. It ended up like this:


To make the texture for the rock I decided to test a technique called gradient mapping. It's easy to get a black-and-white image by baking the ambient occlusion to the rock texture. To color it you can use a gradient with the color range you want the rock to have, and you will automatically get a basic colored rock by using gradient mapping. Then you can paint the details you want the rock to have.

With two fishes and a rock, I put the scene together in Unity, and the final scene ended up like this:



February 17, 2018

How to create your own billion dollar cryptocurrency

0 comments
Everyone can create their own cryptocurrency - but not everyone can create their own cryptocurrency that's also worth billions of dollars, like bitcoin, which has a market value of USD 180 billion. A cryptocurrency closely related to bitcoin is bitcoin cash with a market value of USD 25 billion.

While researching the difference between bitcoin and bitcoin cash I discovered that one of the guys behind bitcoin cash is Rick Falkvinge. I'm Swedish, so I recognized him because a few years ago he created a political party called Piratpartiet (The Pirate Party), which used to be a big part of the Swedish political scene but has since then disappeared. What has he been doing since then?

It turned out that Rick Falkvinge has been buying bitcoin and then he created bitcoin cash because he disagreed with the developers of bitcoin. The main difference between his views and the views of bitcoin is that a cryptocurrency should be more decentralized. If you research bitcoin and bitcoin cash you realize that there's a small war going on between the believers in each cryptocurrency, so I'm not going to argue which one is the best because only time can answer that question.

If you research bitcoin cash, you will find a text written by Rick Falkvinge called Official Statement from the CEO of Bitcoin Cash. In it, he tells why a cryptocurrency should be developed like a swarm. A swarm? What is he talking about? Luckily, Rick Falkvinge has written a free book on the subject called Swarmwise: The tactical manual to changing the world. In it he tells the story of how he created Piratpartiet and why the political party disappeared and how you can create you own decentralized organization. These are the key concepts from the book:
  1. You need an idea that you know can work from a theoretically point-of-view. Be provocative. If you are not making somebody angry, you're probably not doing anything useful. 
  2. The idea has to generate enthusiasm on its own - no advertising campaign is needed. It should be enough to mention it to someone, but it needs to have a realistic, understandable goal that energize people to change the world for the better. It also need subgoals and you need to be able to measure the progress towards the goal and the subgoals.   
  3. People have short attention span, so you need to keep them interested by having a signup page or a forum where people can collaborate. This will make a structure so people can self-organize by doing tasks without first asking for permission, which is good because you can't control all parts of the swarm on your own. 
  4. As the swarm is organizing itself into different groups, you notice that each group gets a leader. Make sure to form a relationship with each leader. But remember that this leader is not a boss and can't thus give orders. What they should do is to communicate what should happen and start doing it and the people interested will follow automatically. If someone sees something they don't like, they should contribute with something they like, and not complain about what they don't like. You should celebrate if someone takes a risk but failed, and not criticize, because it will prevent people from trying new things.   
  5. To kickoff the swarm, all members should do some task, such as collecting signatures. This task has to be realistic and has to be a step closer to the goal. It will also get people to know each other. 
  6. The swarm will copy the behaviors of the leader, and yes the swarm needs a leader to inspire each other to greatness. The only way to have the swarm behave well is to behave well yourself by leading by example. To be able to lead by example you need to take care of yourself by sleeping and exercising. You also need to be honest, if the swarm is encountering trouble, be honest about it and suggest a solution to the problem.   
  7. As the swarm grows, you have to make sure that no self-organized group gets more than 150 people. If so, you need to create subgroups. The core group should consist of no-more than seven people, which is the optimal group size or the group will become too inefficient.
  8. Members of the swarm will translate your goal to their own goal. For example, the idea behind bitcoin is to create a decentralized currency, but some believe in bitcoin because they don't trust banks and others believe in bitcoin because a bitcoin transaction is less easier to track than a regular currency. This will make it easier to market the goal because the friends of the members of the swarm will listen more to their own friends than to you and your personal goal. 
  9. You need to make sure that the swarm is visible in the real world and not just online. For example, when you walk around you see shops that have put up stickers that they accept bitcoin. 
  10. Conflicts within the swarm will happen as the swarm develops. But you need to be aware that a small amount of conflict is a step of progress and it's a phase all groups have to go through before they become efficient. Also mistakes will happen, but even big companies make mistakes, and mistakes should be expected because you need these crazy ideas that often end up as mistakes as long as you learn from them. You should reward good behavior, such as initiatives or helping others, with attention and ignore bad behavior.  Also remember to have fun because people enjoy having fun and will join your swarm to have more fun.
  11. You need help of your swarm to recruit new people to the swarm. Members of the swarm have to talk with people they know. To make it easier you need a weekly newsletter to let people know what's going on. Make sure it's written so someone who's new to the swarm understand everything in it. When measuring new people you should not measure Twitter follower or Facebook likes, but people themselves. Many people on Twitter are not really interested in you, but in promoting themselves by following you.  
  12. You need to be able to activate the swarm when needed. The addition of 25 people from your swarm to a discussion on the Internet will convince someone who's just reading the discussion that your swarm's goal is something to follow. If you control the perception of who's the winning team, you become the winning team. It's important to note that the swarm should discuss the goal and not promote it - people don't need to see more ads. Neither should you forget the long-tail: even the smallest blogger is important and reward all people for their interest in your swarm and answer all comments, even if the comment is rude you need to be nice and polite.  
  13. Use old media like newspapers to your advantage. Make it as easy as possible for journalists to write articles by providing detailed press releases and photos. The long-term goal is that when journalists are writing an article about your goal, then they should write an article about you and not someone else. If the media starts to ridicule you then it's a good sign and a step forward from not being mentioned at all.
  14. Never take success for granted. When the swarm is successful, don't forget that success doesn't last. Just because you are popular today doesn't mean you have to be popular tomorrow. 

I think the ideas from the book are interesting and they are at least a starting point if you have your own currently worthless cryptocurrency. The ideas behind cryptocurrencies and decentralized organizations are new, so I guess we will see many more ideas on how to best grow such organizations.

February 12, 2018

Everyone wants to crash a Tesla

0 comments
This is just in! A big youtuber with 173 thousand subscribers has found my Tesla Simulator I made to learn Unity. The video has 55000 views and thousands of likes. He didn't call it a game - more of an experience which was funny, and he named it Tesla crashing simulator, which is what people seem to like about the game: destroy Teslas. But the Teslas in the game are indestructible so they will never stop. Anyway, check out the video and prepare to laugh.

February 11, 2018

The illusion of life - or why you should animate flour sacks

0 comments

The book The Illusion of Life tells the story of the beginnings of Disney Studios and the development of their animation process. What exactly made Disney's style unique? It is one of the books you have to read if you are interested in animation - not just animated drawings, but also if you are into 3d game animations. Here are some key points from the book:
  • Animation is not just timing, or just a well-drawn character, it is the sum of all factors named. What you as an animator are interested in is conveying a certain feeling you happen to have at that particular time. The response of the viewer is an emotional one, because art speaks to the heart. Our tools of communication are the symbols that everyone understands because they go back before mankind began talking. 
  • The animator is the actor in animated films. But animation is harder than acting. In animation we start with a blank piece of paper. Out of nowhere we have to come up with characters that are real, that live, that interrelate. We have to work up the chemistry between them, find ways to create the counterpart of charisma, have the characters move in a believable manner, and do it all with mere pencil drawings. 
  • Start the film with something the audience know and like. This can either be an idea of a character, as long as it is familiar and appealing. It can be a situation everyone has experienced, an emotionally reaction universally shared. But there must be something that is known and understood if the film is to achieve audience involvement. The mystery radio programs are good at this, using voices and sound effects that reach out to you. The broadcasts are projected through symbols into your imagination, and you make the situation real. It is not just what you hear, it is what the sounds make you believe and feel. It's not the actor's emotions you are sensing anymore - they are your emotions.  
  • For a character to be real, it must have a personality, and, preferably, and interesting one. The audience should identify with the story situation, and the best way is through a character who is like someone they have known. There should also be a change in the initial action that will enable the animator to show more than one side of this personality, like from concentration to rage.
  • Key animation principles:
    • Don't confuse them. Keep it simple.
    • Too much action spoils the acting.
    • Mushy action makes a mushy statement.
    • Say something. Be brave.
    • Why would anyone want to look at that?
  • Walt Disney himself was actually not a good animator. Animation was developed far more by the animators themselves than by Walt. But this advancement would never have occurred without Walt. Without Walt's drive, it is doubtful that any of the animators would have tried so hard or learned what to do.  
  • The best way to know if your animation is good is to test it on a real audience. 
  • Attitude can be achieved with the simplest of shapes. A flour sack is often used to illustrate this (the shape will change but the volume will always be the same). This idea is used by animators today as well as you can see if you click on this link:

  • The fundamental principles of animation are:
    • Squash and stretch. What you are animating should change shape, as in the flour bag example.
    • Anticipation. Before what you are animating is doing something, it should be shown what you are animating is about to do.
    • Staging. The audience should clearly see what you are animating.
    • Straight ahead action or pose to pose. This is about how you plan the animation. In the first case you make it up as you go, and in the second case you first create key poses and then fill in the animation between the poses. 
    • Follow through and overlapping action. This is about the end of the animation. The idea here is that things after a movement don't come to a stop all at once, some parts of the character may stop later. And you also have to make sure it merges with the next animation. 
    • Slow in and slow out. The focus should be on the key parts of the animation, so a character should move slowly into the key position, and then move slowly away from the key position, and then fast between the key positions. Too much of this will produce a mechanical feeling, so you have to analyze the actions more carefully if that happens.  
    • Arcs. The movement of living creatures will follow arcs and not straight lines.  
    • Secondary action. The main idea of the animation can be amplified by adding a second animation, such as wiping away a tear. 
    • Timing. Each inbetween frame between the same extreme key frames gives a new meaning to the action. No frames inbetween can mean that the character has been hit by a large force, while more frames can mean the character is sneaking. 
    • Exaggeration. Realism is not the goal because it's sometimes difficult to understand if a character that is "realistically" sad is sad. But if you exaggerate and make a sad character sadder, the audience will easier understand that the character is sad. One animator at Disney made an animation so exaggerated that he thought he would get fire, but Walt loved it. 
    • Solid drawing. You should learn to draw as well as possible before starting to animate. The better you can draw, the easier it is to animate. 
    • Appeal. The audience should obviously enjoy what you are animating. 
  • Norm Ferguson, one of the animators and who gave Pluto his character, had no formal art training, which was good because he was not following anatomy and drawing rules. One of the other animators said "He doesn't know that you can't raise the eyebrows above the head circle, so he goes ahead and does it and it gives a great effect."
  • Always analyze and observe. One of the animators could simply not stop observing how the real world worked. This is one of the reasons Leonardo da Vinci became a good painter - he always brought a notebook with him and he could even invite people to his house to easier observe them. 
  • As said before, realism is not the goal. Great fiction is art and invention, not duplicated reality: 
    • Things should happen faster than in real life.
    • You want to make things more interesting and more unusual. 
    • The actors should be more rehearsed than everyday people, opening a door should be as simple as possible.
    • The actors thought process should be quicker and their uninteresting progression from one situation to another must be skipped. 
  • Every animator has ups and down. To find inspiration again you can look at magazines and at drawings by animators whose techniques is different from yours. Every animator is also making mistakes. "Everybody knows that! I shouldn't make a mistake like that. It's just because you always forget something! I ought make a sign and stick it up in front of me on the desk so I never make that mistake again."
  • People love to see thinking characters. You should do this by changing the expression of the character.  
  • If you want to make great animations you should observe and study and make your characters different and unique - instead of cloning a similar character over and over again. No two scenes should ever be alike and no two characters should ever do something the same way. Frequently, some animator will animate not something he has observed, but something he has memorized that some other animator has done. 
  • When animating you should avoid writing what you will animate, you should draw what you will animate by making a storyboard. 
  • Extreme action is best illustrated by minimizing background elements, and other things that would draw attention away from the action. 
  • One quick look is all the audience gets - keep it simple, direct, like a poster; it must sell an idea.
  • If you are stuck, you can act out the seen yourself or have someone do it for you. Disney animators had assistants who acted out scenes, so they could see how the scene looked and determine the best angle for drawing it.
  • It takes 1.5 years to learn the basic fundamentals of animation and another 5 to 6 years to be at all skillful. 
  • Every animation is a new animation. Someone outside the studio once stated that it was easy for Disney to make a film now that they had done so many. Their reply was: "On every picture, you're in a learning process. It's not so much an application of professional knowledge as constantly learning. It is always new, or it had better be. On each film, you start from scratch, make the mistakes, pick yourself up time and time again, yet never give up. You must keep your belief in the picture and your faith in yourself. For a picture to end up good, it must be treated like it was the very first one you ever made."
  • It's important that the background is the background. There should be nothing behind the animated figures that distracts in any way. Too much detail, busy shapes, eye-catching forms are all confusing; too much color, too much dark and light pattern, colors that conflict with the figures are all disturbing. 
  • At the end of a cartoon movie, it's common to see how the camera zooms out and pulls up, showing more and more of the sky. The reason the camera is pulling up is because it was difficult to animate how the character became smaller and smaller, so they had to remove the character and instead show the sky.
  • To make you animation feel alive you have to add sound. Sometimes you have to add sound to something that doesn't make a sound. Disney had to test several alternatives before they found the sound of a spider web shimmering with dew and the sound of a magnet. 
  • When using photos and video as reference, you can't always copy what you see. A work of art is never a copy. For it to have meaning to people of many generations and cultures, it must have the personal statement of an artist. Michelangelo's famous statue of David would be a strange looking character if you met him walking down the street. According to this source, David's:
    • Upper-body and head are bigger on purpose, to account from viewing his statue from afar and from below.
    • Right hand is bigger than the left, probably to draw attention to the stone as a symbol of his courage and physical power.
    • Eyes are not looking in the same direction.
  • When learning to draw anything, it's important that the artist go to the source. If Disney artists were going to animate a fox, they would try to get a real fox to study - photographs and videos are not enough. They could even use animals that had been found dead, although not all were interested in study the animal after a few days as the body had started to decompose. Nothing matches the learning that comes from feeling an animal's bones and muscles and joints, to discover how they are put together and how far they can move in any direction. You also have to study what attitudes and actions are unique to the fox. What makes this animal a fox?
  • Some animations are difficult to draw, such as the antlers belonging to a deer. What the animators at Disney did was to either film it and then trace it on the paper, or build an antler model, and trace it by having the antlers behind a piece of glass.
  • Avoid dialogue. Instead you should use an expression, action, sound effect, or music. The audience wants to see what is going to happen and the dialogue should only fortify and sharpen the story and personalities. It is not enough if the character is saying it's angry - you also have to show it so the audience if also feeling that the character is angry.