Wednesday 20 September 2017

C Programming for Beginners: Operators

This is part 4 of my series on C programming for beginners. (See also part 3)

In your programs you will often want to assign values to variables and, later on, test those values. For example, you might write a program in which you test the age of an employee in order to calculate his or her bonus. Here I use the ‘greater than’ operator > to test of the value of the age variable is greater than 45:

if (age > 45) {
bonus = 1000;

Operators are special symbols that are used to do specific operations such as the addition and multiplication of numbers. One of the most important operators is the assignment operator, =, which assigns the value on its right to a variable on its left. Note that the type of data assigned must be compatible with the type of the variable. This is an assignment of an integer (10) to an int variable named myintvariable:

int myintvariable;
myintvariable = 10;


Beware. While one equals sign = is used to assign a value, two equals signs == are used to test a condition.

= this is the assignment operator.
e.g. x = 1;

== this is the equality operator.
e.g. if (x == 1) 


C can perform tests using the if statement. The test itself must be contained within parentheses and it should be capable of evaluating to true or false. If true, the statement following the test executes. Optionally, an else clause may follow the if clause and this will execute if the test evaluates to false. Here is an example:

if (age > 45) {
bonus = 1000;
} else {
bonus = 500;

You may use other operators to perform other tests. For example, this code tests if the value of age is less than or equal 70. If it is, then the conditional evaluates to true and "You are one of our youngest employees!"  is displayed. Otherwise the condition evaluates to false and nothing is displayed:

if (age <= 70){
printf("You are one of our youngest employees!\n");

Notice that the <= operator means ‘less than or equal to’. It performs a different test than the < operator which means ‘less than’. These are the most common comparison operators that you will use in tests:

== // equals
!= // not equals
> // greater than
< // less than
<= // less than or equal to
>= // greater than or equal to


Some assignment operators in C perform a calculation prior to assigning the result to a variable. This table shows some examples of common ‘compound assignment operators’ along with the non-compound equivalent.

operator                    example                       equivalent to
+= a += b a = a + b
-= a -= b a = a - b
*= a *= b a = a * b
/= a /= b a = a / b

It is up to you which syntax you prefer to use in your own code. Many C and C++ programmers prefer the terser form as in: a += b. But the same effect is achieved using the slightly longer form as in: a = a + b.

I’ll explain prefix and postfix operators in the next article. And if you want to learn C in more depth, why not sign up to my online video course – C Programming for beginners. See here:

Monday 4 September 2017

iClone 7 Review

iClone 7 $199
iClone 7 Pro Bundle (includes 3DXchange7 Pro and Character Creator 2) $299

iClone 7 is a 3D animation package. It lets you create and render scenes populated with animated figures. It provides realtime animation, so that you can view your animation as you create it rather than being forced to wait until it is rendered. It can be used either for creating animations from scratch or it can exchange data with other packages including game development software such as Unity or general-purposes modelling and animation software such as Maya, 3ds Max and Blender. It can also be used for creating still images and for designing figures and animations to be used in games created using packages such as Unity 3D or Unreal (though you may need additional tools and licenses to use some exporting options).

iClone 7 is a 3D animation package. Here I am editing a supplied cartoon-like figure. I’ve added two props (a hat and dark glasses) and applied a predefined pose.

This is how Reallusion describes the product: “Integrated with the latest real-time technologies, iClone7 simplifies the world of 3D Animation in a user-friendly production environment that blends character creation, animation, scene design and cinematic storytelling. The GPU powered renderer gives unparalleled production speed and artistic visual quality. The iClone Animation Pipeline seamlessly connects industry-standard 3D tools and game-engines for interactive applications, film and virtual production.”

Let’s see how you get started. First, let’s suppose you want to animate a character. You can use a pre-designed figure by selectin one from the Content panel and dropping it right into the main edition area. Here you can tailor the figure as required by morphing and shaping it. You can do that using dialog boxes to set parameters to change the width of the mouth, the length of the hair, the figure’s height, muscularity and so on. Then you can go on to add clothes from a supplied library and use a timeline editor to modify and animate the figure’s movement and facial expressions.

You can also create entire scenes by arranging objects – chairs, doors, stairways and so on - and you can use the software to make adjustments to the lighting, including subtle effects from multiple-light sources and reflections from surfaces. For advanced video-makers, there is even the ability to use simulations of real-world cameras to ‘film’ the action using settings based on specific real-world camera models. The video below provides a short overview of some of the most significant new features in this release.

Where to start?

This is undoubtedly a powerful product. But, if you are new to iClone (as I am), how easy is it to learn to use? Well, in my experience, it is by no means easy as it could be. The user interface looks really slick but it is also very, very complicated. There is a menu system across the top - File, Edit, Create, Modify etc. – and each menu item shows a drop-down menu with many items having further levels of pop-out menus. Below this is a toolbar of icons covering features ranging from scaling and rotating to enabling global illumination and setting constraints. Then there are multi-page docked panels at the sides (Template, Animation, Stage, Modify and more) which are furher complicated by sub-selecting side-tabs (Content, Scene, Visual), nested pages (Template, Custom) which contain collapsible outlines of items (Characters, GI, Morph and so forth) used to browse folders of items shown in yet another nested pane. The arrangement of views can be altered by selecting various workspaces from a menu (Standard, Visual Effects, Animation etc.) and in some of these workspaces an animation Timeline appears down at the bottom of the screen.

But where exactly do I start? Several cups of coffee later, a browse through the online Help and a visit to the web site to watch some video tutorials and I am still not entirely sure… To give them their due, I have to say that Reallusion has a lot of online lessons and having watched a few I quickly discovered that I use iClone to create scenes, modify figures, add props, do facial animation and much more besides. But I didn’t find a simple “This is how to create your first iClone 7 project” lesson.  Or “Your first ten minutes with iClone”. The online Help isn’t that helpful either. It starts with a detailed section on the user interface ‘Knowing The Environment’ which laboriously documents all the menus and panels before going on to explain optimal rendering settings and the various software capabilities – 3D character generation, Character Animation, Facial Animation and so on. Yes, this is no doubt a great reference. But even so, as a beginner – where do I start?

The user interface is quite crowded, with panels, pages, buttons, icons, menus and folders all needing to be navigated. The editing is fast and good quality, though. Here I am posing one of the supplied figures.

OK, so over the years I’ve used numerous graphics and animation packages – everything from general-purpose packages such as Cinema 4D and Blender to specialist packages such as Vue (for landscape design) and Poser (for character animation) so with a bit of playing about I was eventually able to work out how to create geometrical objects, add and modify characters and do some basic animation. Assuming you have previous experience, you too should probably be able to work out how to create and animate simple objects fairly quickly just by trial and error. But if you are completely new to 3D design and animation, iClone doesn’t go out of its way to help you get going.

Let’s assume that you stick with it long enough to get over the initial hurdles. The good news is that adding and animating objects is actually quite a fast and straightforward business once you know how. You can even animate cameras to, for example, follow an object or change its focal length to ‘zoom in’. You can make most of these changes by selecting specific ‘modes’ by clicking icons to scale, move or rotate objects but some things, such as camera focal length, need to be selected in one of the docked panels. Each change is automatically added as a marker or ‘keyframe’ on the timeline and the motion between keyframes is automatically calculated by the software.

More, more, more…

Things start to get a bit more interesting when you use some of the supplied content. There are ready-to-use figures that can be dropped into the edit view ready for you to animate. To save time, you can even drop on some predefined poses and animations – for example, there is a ‘leaning against a wall’ pose and a ‘walking down a catwalk’ animation. When these are added, the figure immediately adopts the pose or follows the predefined animation. It’s worth noting, by the way, that (assuming your computer has the appropriate memory and graphic requirements – see below) the quality of the in-editor preview is extraordinarily good. The facial animation is slick too. The skin and muscles really do seem to respond pretty convincingly when a character moves its eyes, smiles or speaks.

Here I’ve re-posed my figure just by dropping onto it one of the predefined poses. This will need some manual adjustments (his fingers seem to be going through his boots).

Here I’m fixing the hand position using a feature called ‘Edit motion layer’ that lets me move virtual bones to repose the figure. You can also animate figures with predefined animations.

When you’ve finished designing and animating you can render your video in a variety of formats and resolutions up to a theoretical 3840 x 2160 – but in fact when I tried to produce video at that resolution on my Windows 7 PC it warned me that 1920 x 1088 is the maximum possible on Windows 7 or 8.

Overall, this is a remarkably capable package that lets you create and edit scenes, figures and animations and shows an impressively high resolution and fast preview of animations right inside the editing area. If you are already an experienced animator you will probably be able to ‘guess your way’ around the user interface to find the essential resources, properties, tools and timelines reasonably quickly. If you are not so experienced, however, the learning curve is likely to be steep. In spite of a fairly detailed manual and a good range of tutorial videos, this software really would benefit from one or more ‘quick start’ guides to get the new user up and running quickly.

Bear in mind too that while it comes with a number of ready to use figures, props and scenes, these may not supply everything you need, depending of course on the type of project you are working on. Reallussion has many additional add-in packages that can fill the gaps. These include libraries of additional characters, monsters, talking heads, video effects and 3d assets. There are also plug-in tools for thing such as motion capture, Chroma key (green screen) and enhanced rendering. In fact, I suspect that the market for add-ins and additional content explain the relatively low price of the base software. True, you can do a great deal without paying for any of the added extras, but many of the optional add-ins are so darn’ useful that most serious iClone user will probably want to buy some of them at some point.

Overall then, this is a good, low-cost animation package that could be both useful and fun for the serious amateur animator, graphic artist or video-maker. It does take some effort to learn but once you are over the initial hurdles, it really is quite impressive. If you plan to use it professionally, however, for example to create characters for 3D games you may need to buy some additional tools and content which could push up the price quite a bit.

iClone 7 Recommended System Requirements

  • Intel i5 dual core CPU or higher
  • 8GB RAM or higher recommended
  • 10GB free hard disk space or higher recommended
  • Display Resolution: 1920 x 1080 or higher
  • Graphics Card: NVidia Geforce GTX 600 Series/ AMD Radeon HD 7000 Series or higher
  • Video Memory: 2GB RAM or higher recommended
  • Video card compatible with Pixel Shader 3.0 recommended for optimized visual performance