Author Archives: Administrator

Skies and Backgrounds 2

The other simple plugin now in the Laboratory is the Sky Gradient.  The default settings for the Realistic Sky don’t look like any sky I’ve ever seen except perhaps through sunglasses and tinted windows.  This wide angle camera shows the transition from the sky overhead to the horizon.

Default Sky Settings

The Sky Color Control can easily be adjusted of course but the gradient from the zenith down to the horizon doesn’t look right for a clear day even with the Haze turned right down.  What I had been using was a Bi Gradient to add more blue into the mix but lately it struck me that the transition was still not right and the sky should be bolder bluer lower down.  A formula could be used but it would be pretty cumbersome compared to a plugin with colour chips and a slider made off a template.  By taking the Zentith as 1 and the Horizon as 0 then putting the background value to a power of function (or exponent) the response is 1 when linear and the same as the Bi Gradient.  Values less than 1 will push the bolder blue Zenith colour down toward the horizon and values greater than 1 will push the paler Horizon colour up into the sky.  I found that values of 0.5-0.75 were best but I need to make more observations when the weather is perfectly clear.  Any points below the horizon return as black.

Sky Gradient


Skies and Backgrounds 1

I’ve uploaded 2 plugins to the Laboratory; an old one I’d forgotten to upload, the Rotation Map, and a simple new one the Sky Gradient.  The Rotation Map had a bug in it anyway which I only found now with more thorough testing.

Firstly the Rotation Map was made specifically for help with creating night skies.  Finding a good  full 360º star map and a view of the Milky Way this could be projected onto the inside of a giant sphere but it wouldn’t interact well with the Realistic Sky.  Note that any colour in the Background is added to the Realistic Sky when it is rendered.

The rotation controls allow for adjustments to how the sky map appears.  With a few tricks it’s possible to properly animate the path of the stars in the night sky.  A sky map will need to be altered so that the Celestial Poles are aligned with the X-axis.  You’ll need to find the North Star in the image and the Southern Celestial Pole.  Finding the stars in that image was harder for me than in the real night sky.  If the original sky map is rotated around X it will be around whatever is in the middle of the image.

I’ve made the selection of Axis to be consistent with the Realistic Sky in Carrara where North is -X and East is +Y.

Corrections in 2D on the image can’t be made because the top and bottom have distorted and stretched out the stars so that these look fine when they are wrapped around a sphere but not once they are moved.  So the method is to put a Sphere primitive into the scene with it’s centre at the origin and apply the sky map image to its Color channel.  Rotate the sphere until the North Star lines up with the -X axis in the Right side view and the Southern Celestial Pole lines up with the +X axis in the Left side view.

It can help to make a copy of the image and then mark the Celestial poles with a cross in the 2D editor and use that first.  Set the scene Ambient to 100% with no other lights and do a spot render and little adjustments to get as close as possible in the orthogonal views.

Now put a Spherical Camera into the scene and set its position to Left then move it to the origin.  Render the image with the same resolution as the largest original dimension and with square proportions.  The spherical render will now take the undistorted stars and make a new distorted 2D spherical projection with different stars at the top and bottom and with the Milky Way wrapped around the map at an angle rather than in the middle.  Importantly the Southern Celestial Pole will be in the middle of the edge of the image on the left hand side.

Using the Rotation Map plugin as the Scene Background the new adjusted version of the sky map can be loaded.  When the 3D Rotation value for X is animated though 0-360º the stars will make a full revolution around to represent the passing of one day.  The X axis can also be adjusted for the correct time of night and year – this map was about right for an evening in April at 0º so with a 90º rotation is has the Southern Cross in the right place for January.

The 3D Rotation in the Y axis can be adjusted for the latitude of where the scene is supposed to be taking place.  At the Equator this will be zero and for the Southern Hemisphere, in say Sydney, this will be +33º   So for London this would be about 51º North and so use 309º according to the way the map is setup.

I’ll be improving this plugin by adding in freely set spin values for each of the axes for use with animations and full ±360º sliders.  Amateur Carrara Astronomers in the Northern Hemisphere please give feedback…

Rename Scene Command

This scene command can be used in a number of ways to rename the current selection in the scene hierarchy.

With a number of duplicates, for example Spheres, these can be renamed and given an index.  This will obviously be useful to save time if you have a large number of duplicates in the scene and want to rename them.  Use the Change All option to rename the entire selection. 







Untick the Add Index option to only change the names.  When the Auto Index option is ticked the index number will be the one given by Carrara to each object as it is inserted into the scene.

If the objects to rename are mixed in with other objects in the selection fill in the specific name to search for and be sure to uncheck the Change All option.



Terrain Intersection

While working on some larger scenes with Terrain objects and Clouds I made a few observations and conclusions.  On a woody hilltop the individual trees can still be made out up to at least 4 miles away, particularly along the ridges.  When making a scene in Carrara we can use the Surface Replicator to easily fill a Terrain object with plants, rocks, etc.  One limitation is that the replicator will only allow for 100,000 maximum objects.  When using real world scaled objects that means we can only use a 2 square mile Terrain object to fill out with a dense forest of mature plants and probably only a 1 square mile or less object for really dense growth and a full canopy.  Carrara can handle a large number of terrain objects filled with replicated trees and render them in good time with low quality GI Sky Light.

Then I saw there were going to be problems when using the replicator with some more complex scenes.  When we have a road over the terrain, a clearing or town, or want to put in a lake or river and bank we might be able to use a Terrain Layer or paint onto a texture map to solve these distribution issues but that there are real problems when Terrain objects overlap.  I always prefer to have a separate Terrain object for a landscape feature, use a Zero Edge Filter and emerge from the Infinite Plane or a larger base and especially to build a mountain range.  If Surface Replicators were used on those overlapping Terrains full of trees then tree tops are going to poke up out of the ground, intersect each other and make a mess.  I couldn’t think of any other solution for that and to help with the other issues above than with a new simple plugin.

The Terrain Intersection Shader can be used with the Surface Replica Shader Distribution to return black or white by itself or to Multiply against a more complex distribution Shader.  Give each Terrain object a list of other overlapping terrains and the plugin will check which is higher and give that the white value.  It can also be used to save time where there are other objects like a tower or town or to make a clearing without needing to paint a texture map for the terrain – especially if you change your mind and want to move things around.

I’ve had trouble in the past with Terrain objects and the Carrara SDK.  Which ever way I try the Rendering Quality Mesh can’t be used, only the Preview Quality Mesh is returned.  The Surface Replicator is able to use it so there must be a way but I’ve never got an answer.  The Terrain Primitive is not included in the SDK.  However since this new plugin is not optimized that isn’t a big issue.  The Preview Quality can be turned up a bit to get a better result but the Preview Quality will give a quicker distribution without me needing to write the extra code.

You can find this plugin in my Laboratory.  Mac version for Carrara 8 will be available soon or on request.

Puffy Clouds

Carrara’s own Volumetric Clouds render quickly and look great but they can only produce results for a limited range of realistic clouds.  Undeveloped flat based Cumulus and broken up Fractus clouds can be made with the Cumulus 1 and Cumulus 2 shapes.


The Big Cumulus shape is a bit more lumpy.  None of the existing cloud shapes can be used to make a really puffy Cumulus cloud with distinct rounded outlines on top.  Another limitation of the existing cloud types is that only the noise animates.

Carrara Big Cumulus

Using extreme values the secret of the cloud shape is revealed.bigcumulusblobs

It turns out that new cloud shape plugins can be made with the Carrara SDK.  So I set out to test and create my own new cloud shapes.  The idea was to make something that worked much like the existing shapes but to give them a bit more ‘purpose’ when they animate.  In real clouds the puffs appear to rise, grow, tumble and churn.  I would look for a way to get something in between a simulation and what looks real to find that purpose.  One of the challenges was to formulate cloud shapes so that they did not need to run a simulation and my solution was to follow random but cyclic paths and to evolve the cloud over time.  I favoured this approach rather than using a fountain or a particle effect.


With the added complexity my Cloud shape is much slower to render, especially when the first ray hit occurs and Carrara builds its lighting cache.  The amount of detail to generate smaller and smaller puffs can be controlled for a faster render, along with the normal volumetric cloud accuracy settings.  My Cloud has many extra parameters and I have placed up to 9 clouds in the one volume arranged into banks.


Murky Water Animation

To test the smooth transition from above to below the surface of the murky water this animation lowers the camera to sit on the water level and then lets the waves wash over it.  Once below the water the visibility has been increased to 30 ft to be able to see more.  In reality nothing would be seen more than a few feet in front of the camera at the surface and the light would rapidly be absorbed at any depth.



Not much effort went into modelling the carp or the animation.  To improve this it also needs some small scraps of stuff floating in the water and other small particles.  These should be given no gravity but will require some physics and collisions to suggest any current and movement of the fish if possible.

Murky Water

When you look into a body of dirty water objects fade into the murky depth.  As objects get deeper and deeper down they appear to become darker and take on the colour of the murk.  In this photograph the water is very murky from the clay, reducing the visibility to less than a foot depth.  The water, fallen branches, sticks and fish take on the dull colour of the clay.

Carp in the Lake

To create this effect inside Carrara we have Absorption and in-scattering in the Transparency shader channel.  Within the set Attenuation distance the transparency is gradually ‘turned off’ to return only a black colour from that depth – that is when the Absorption channel is a Value set to 100%.  Anything deeper in the water than the Attenuation distance returns black – thus adding nothing to the final shading result.   I’ve used a shader for the water following the old rule that color, transparency and reflection should have their total value add up to 100%.  The Fresnel effect will switch over between using more reflection at the shallow angle and more transparency when looking directly down.


This close up shows the same scene with the Absorption turned ON in the LEFT side and turned OFF on the RIGHT side.  Without the absorption the objects in the murk become clearly visible – including the shadows on the bottom of the lake.AbsorptionEffect

So next what if we want to put the camera under the water ?  We still get the ray-traced colour effect on the objects seen through the surface above the water but without using Distance Fog or changing the whole Scene Atmosphere it doesn’t look like we are under the murky water at all.MurkyUnderwaterNoEffect

If we change the Scene Atmosphere from the Realistic Sky to use Distance Fog then we’ll get something like the desired effect but in doing so loose the view of the sky and anything out of the water.  The effect of the underwater murk needs to stop at the surface of the water and interact with it for a better result.  Here is the same scene using Distance Fog but with a radius of 10ft rather than 1ft so we can still see what is going on.MurkyUnderwaterFogEffect

Problems will arise If we want to use the same scene in smooth animation.  We can key frame switch some of the effects but we can’t switch the between Distance Fog and Realistic Sky dynamically.  Layering effects, multi-layer rendering would offer some solutions with existing technology.

To achieve this and other effects I’ve been making the Murky Volume plugin.  This is a render of the same scene underwater using the plugin.  The effect is similar to the Distance Fog but it interacts with the surface.  Again the visibility has been extended to 10ft in order to see something.  Where the view is looking directly up through the water we can now see the sky and foliage clearly.MurkyUnderwaterPluginEffect


An old trick was to take a polygon hair prop with a higher transparency/alpha then make a duplicate, maybe scale it up a fraction, offset it bit and then you could get a thicker final mesh to render.  This gave me the idea to make a simple new plugin to Thicken out the results of the simulations.  It might also give a more realistic render and rely less upon painting in the layers of hair into the texture map.

For the Thicken beta version 0.1 I’ve allowed for a single additional layer with a surface offset, xyz displacement and a scaling factor.  I’ll probably be adding a second layer and second column of settings.  I don’t think I’ll add multiple layers because that will make for a very tricky UI.  I’ve also considered giving the layers their own shading domain but I’m not sure if that is safe yet – Carrara can cope with it when you add and remove them in the vertex modeller so it should be possible.

The Thicken plugin can of course be used to conveniently add a surface offset or indent a mesh by telling it to hide the original mesh.

I used it in the render of this cloth hair simulation.  There are only a few artefacts where the layers of hair went through each other, before the thickening was applied – you can see these on the left shoulder.  This next attempt at dynamic cloth hair used twice as many layers as the last one, with 5 down the side of the head and two more at the back.  The self collisions performed nearly perfectly but it took more than 12 hours to run when draping over the figure in a 5 second animation sequence.  I also improved the alpha map technique by using 2 pixel thick strokes to paint the tips of the hair.


Dynamic Hair with the Cloth Deformer

After a few drafts I’m getting encouraging results with dynamic hair.  This symmetrical hair was modelled lock by lock, each one layered over the other.  The roots of the hair fully conform.  From the side of the head down till below the ears is the falloff area then right down to the tips the hair is all dynamic.  It’s important to get the initial style right where the hair does conform because it will try to return to that shape during the simulation.


Improvements are needed in the number of layers of hair.  It needs another layer at the side of the head and one or more lower at the back of the head below the ears.  There should also be more variety in the locks – I duplicated and moved the same ones at the side of the head for each layer to save time.  The texture and transparency maps need more effort and care to paint with higher contrast in the strands and cleaner detail for the alpha on the tips.  I also made a scalp prop to fit underneath based on a copy of the figure’s head geometry.

I have shown animations before with dynamic cloth hair but these did not have self collisions or enough length to drape over the costume/figure.  This example used a large sphere on an angle to cover the whole head and the ears and a capsule for the neck.  The collisions over the costume required the modified code which can recorded and store simulations at a higher fps.


While working on this I found that the conforming falloff feature of my plugin wasn’t working quite how I wanted or expected.  It’s supposed to falloff gradually from fully conforming to fully dynamic with a painted map or zone or both – but there was not much ‘falloff’ apparent.  I made a slight change to the simulation code to improve this.  My idea is that if the falloff for a vertex is 50% then it will be pulled back half way from where the physics take it to the conforming position.  The conform rate value is now used as a speed limit instead.  The conforming force is still very strong but the falloff now produces a smoother transition.  Collisions overrule this so I will need to experiment a bit more.  I want this falloff because in cloth simulators that have an on/off pixel constrain selection this creates really obvious hard bends along that dynamic edge.  

I made another quite simple but important change to the plugin code and that was to add in a self-collision margin.  In my simulator each vertex of the cloth mesh is treated as a particle with a thickness.  Unless the user overides that thickness all of the vertex particles are thick enough so that they just touch each other.  That is one reason why a regular mesh is very important.  The new margin value allows for thinner vertices and now the cloth folds can get much closer.  The hair’s need to have self collisions become obvious because without this new change the dynamic locks would pass through and intersect with each other.  This has a big impact on the design and modelling the style because the hair must start the simulation without being tangled.

Layered Simulations

Hair Layered Over ClothingAnother problem with my simulator has become apparent when trying to run a layered simulation where one cloth items drapes over another.

My plugin is a deformer and not a physics solver.  The accurate simulations are run by getting Carrara to slowly advance the time sequencer.  The current tests I’ve been doing included attempts to combine dynamic hair with a dynamic costume – where the hair would drape as a second layer over the costume.  The simulation is normally saved at the scene’s frame rate, so when the higher fps was used on the hair the costume would not move in slow steps but jump to the next set of stored data only when at a time multiple of the scene frame rate.

A number of separate cloth mesh objects can go into the one simulation but hair and different layers and different types of cloth will need different properties.

To get this to work better I set both the dress and the long hair into record mode and then ran the simulation from one of them to get the high frame rate.  This caused an immediate crash and an impossible to find bug.  I had to give up trying to find how and where it was happening because no single specific part of the code was causing it.  I believe that there is no easy way to fix it and the code is not ‘thread safe’.  Therefore only one simulation should be set to record and run at any time.

The solution for the layered cloth is simple enough.  A new setting and change to the plugin is required so that the costume simulation can be run first and all of the frames are then saved.  If the simulation is set to run at 150fps with a scene rate of 25fps then all 150 snap-shots of the cloth will be saved per second for use in the next simulation that layers over it.  This does make for a much larger file size so some kind of management of the stored data to discard the extra frames could also be added.

The next release of the cloth plugin will have this high definition recording and playback feature.  I will also need to add a similar feature to the Jiggle plugin for it to work consistently with my cloth.  It might also help when combining cloth with the Carrara physics solver or strand based hair.  I have not tested that yet.