3DS Max Unravelled

ambient occlusion in 3d standard primitive shapes


One of the key methods to achieving great results in CGI is ambient occlusion (AO), it adds extra depth to a render and takes a nice image that one step further. There are a few different ways to go about adding AO to your scenes but which is the right way to do it? The quick answer is that there is no 'right' solution for every project, as with most things it is a case of finding out which one will work best in the circumstances. So with that in mind I thought I would write a bit about the methods I think are the best and when, in my opinion, you should use them.

Just before we go over these different methods though we should probably touch on what AO actually is. Essentially Ambient Occlusion is a crude global illumination solution which works out how much shading geometry should receive based on how 'occluded' (or blocked) it is by other geometry. I have often heard AO described as a 'nook and cranny' shader and it helps to think of it as such; basically wherever surfaces meet you will get some shading, if a surface doesn't have anything around it then it will be pure white.

Basic method:

3DS Max can generate an AO effect using any renderer but the one I prefer (and have by far the most experience with) is Mental Ray. The basic method of adding AO to a scene with Mental Ray is simple:

1: Create a mental ray material

2: Plug the 'Ambient/Reflective Occlusion' shader into the surface slot

3: In the settings for the 'Ambient/Reflective Occlusion' shader find the 'Max distance' option. This is critically important as it determines how far surfaces will 'look' for occlusion - the smaller the value the smaller your shadows will be, the larger the value the larger they will be. This setting will be different depending on your scene and what you think looks right but as a general rule-of-thumb I go with 5-10mm for close-up prod-viz shots, 90-100mm for arch-viz scenes and, depending on the camera distance, higher for cityscapes etc.

4: Next find the samples setting. This controls the amount of noise in your shadows, so if your AO looks a bit splotchy you put a higher value in. 16 samples are fine for test renders but for production renders you will need to up it to 64

5: Finally I always change the falloff setting to 0.75 but that's just a personal preference, you can leave it set to 1 if you like.

Once your AO shader is setup you need to apply it to your scene. The simplest way to do this is to use the 'material override' option which is under the 'processing' tab of the render setup window. Just drag your mental ray material to the material slot in the material override section and drop an instance in there; this will now automatically apply your AO material to everything in the scene, easy! You can apply the material by selecting everything in the scene and applying the mat to all, but it is usually better to do it with the material override as you get to keep all of your current material settings and can just switch the AO mat off when you're done.

One other thing to remember is that if you are applying this to a scene you have already textured and lit (which is usually the case) then you will need to switch off/delete all the lights, turn off MR exposure control, remove any environment maps, set the environment to white and turn off final gather - the ambient occlusion calculation doesn't require ANY lighting, it is using the geometry only to work out how much shading should be in your scene so having any of the above on will just screw it up.

Bells and whistles:

So we have covered how to do a 'pure' AO render with the method outlined above but there are some problems with that, yes it does give you great 'connecting shadows' but since everything is black and white there is no colour bleed from the materials, also since the previous AO option has no lighting solution (and is purely ambient) there are no indirect light bounces...how do we solve this?

Well firstly all of our scene materials need to be MR A&D mats - these can be quite daunting at first but once you get into using them and setting up your scenes with physically correct settings you will see how versatile they are. In each material you will need to scroll down the options to the 'special effects' group and in here you will find an 'ambient occlusion' setting, once this is turned on it will apply ambient occlusion to the material.

The settings are similar to the other AO option in that you have a 'samples' option to control quality and the 'max distance' setting; however, you then have a check box to 'use colour from other materials (exact AO)', this is the option that gives us shadows with bounced light so, as a general rule, I have this checked. The only other thing to check is that the 'shadow colour' is set to 'global ambient light colour' - this makes sure that the shadows generated will use the global settings from the 'Environment and Effects' tab rather than a custom setting per material.

NOTE: If you are working on a large scene with lots of materials in it is quite important to get your AO settings right in the first instance, clicking through hundreds of mats to tweak settings can make you lose the will to live! There is a very useful script available on Joe Gunn's website called 'Material Tweaker' which lets you specify material sets (which work in the same way as selection sets) and then make global changes to them. It works with Standard, MR A&D and V-Ray mats and whilst you can only make general changes to them the MR A&D set does allow you to switch AO on or off and adjust the radius (the script uses different terminology to the actual materials, basically AO radius = max distance). You can't adjust things like sampling quality unfortunately but in that case I would leave it at 16, do some renders to see where there are problems with noise and then adjust specific mats accordingly.

Once all your materials are setup in your scene you will get a very subtle ambient occlusion effect which, because it is part of a true final gather calculation, has indirect bounced light and colour bleeding in the shadows. But as technically accurate as this calculation is I tend to find that the end results look a bit washed out and weedy, yes the indirect bounces and colour bleeding look beautiful BUT they also take some of the shadow impact and edge definition out which, to my eyes, makes it look wrong...so what do we do?

Mix and match:

What I tend to do on almost every project (but not all of course - this is another thing where artistic license comes into the equation and you work out from project to project when it is relevant or not) is use both AO methods so that you have beautiful shadows with indirect bounces AND nice connecting shadows with well-defined edges.

If you know about rendering in passes then this will seem very basic, but what I do is setup my scene first with MR A&D materials (with occlusion switched on) and photometric lighting then render out the first pass. I then open another version of that scene and save it as an 'AO' version, setup my Mental Ray material with the ambient/reflective occlusion shader and plug it into the 'material override' section, delete all the lights, set the background to white, turn off FG and turn off exposure control. It may seem strange to do this in a separate file but I find it easier to keep things organised this way, I don't like having to switch everything off and on all the time in the main file, keeping them separate means I don't forget to turn things back on again or accidentally delete some lights. There are other reasons why having your AO version as a separate file is a good idea but we'll go over those in the next section. Once this is all setup and you have your renders it's time to stick them together so we switch to the compositing software. I use Photoshop for stills and After Effects for animation (although if I'm rendering Exr files I will always use After Effects as it deals with them better than Photoshop) but you can use whatever compositing software you're comfortable with, the concept is the same no matter what you use:

1: In Photoshop open up your 2 files, the first pass and the occlusion pass

2: Copy the occlusion pass and paste it onto a new layer over the first pass

3: Change the layer setting for the occlusion pass to 'multiply' and adjust the opacity to suit your taste

4: Done! If you switch off the occlusion layer's visibility you can see how much of an affect it has on the final image, it really adds definition and gives your shadows a great sense of depth.

The fiddly bits:

There are a couple of instances where the methodology used above doesn't really work, these are also when having a separate file for the AO starts to makes a lot of sense so let's briefly go over them:

1: Custom AO radii

The basic method of adding a global ambient occlusion shader to your entire scene is great for getting quick results but, as discussed earlier, depending on their size/detail objects sometimes need to have different 'max distance' values - a scene where every single object has the same setting just doesn't look quite right. So the answer is to ditch the 'material override' option and apply custom AO settings to your objects. You don't need to set them up individually of course, you can go with a few AO mats that have different distance values - one for fine detail and small objects, one for medium and one for large. Setting your AO up this way is more time consuming but it does give better results.

2: Reflective AO

In the 'ambient/reflective occlusion' shader there is a check box titled 'reflective', this can be very useful in enhancing the realism of your AO solution when it comes to highly reflective objects. Obviously a surface should not have a completely uniform amount of reflection, specularity maps help with this but the reflection occlusion shader can be used as well to get better results. Instead of sampling directly out from the surface normal as with standard AO, when you check the 'reflective' box the shader works in a different way and takes samples from the reflection direction of the surface normal. This calculation then focuses on areas that should have very little or no reflection, such as in tight corners etc, and will give you a map to use in compositing which reduces the reflection in these areas.

3: AO with masks

There are some instances where you have objects with transparency; the leaves on a tree model for example where you have a basic plane and the leaf shape is cut out with an alpha channel. Now obviously if you setup your AO pass as described above the alpha channel will be lost and your AO pass will render the full planes rather than the leaf shape, to get around this we need to, again, abandon the 'material override' method and go for a more custom setup. All you need to do is apply your basic AO to everything in the scene then, for the leaves (or whatever else it may be) do the following:

1: Create a blend material

2: Plug the AO material into slot 1

3: Create a standard material with opacity, specular level and glossiness set to 0

4: Take the alpha channel used in the original material and plug it into the mask channel of the blend material

That's it, you should now get an AO render which has your transparency masks included.

4: AO with round corners

One of the neat features of the MR A&D materials is the 'round corners' option, this lets you create an edge fillet effect without actually generating any extra geometry. It is useful for simple things like walls or the edges of a book...basically it can work quite well with any straight edge (although for most things I still prefer to actually model fillets into them). If you do have any of these in your scene then you will obviously need them to be in your occlusion pass as well, if you don't you will have some strange looking edges that are both rounded and straight at the same time! Again we will need to ditch the 'material override' option and apply AO to the scene selectively. Once you have applied the standard AO shader to everything that doesn't have the edge effect on do the following:

1: Create an MR A&D material with the colour set as pure white

2: Turn the reflectivity down to 0

3: In the special effects tab turn 'round corners' on and set fillet radius as desired

4: Plug the 'ambient/reflective occlusion' map into the 'additional colour map' channel

That should now give you an AO render with round corners where required.

Conclusion:

I hope this post proves to be useful to people, I started writing it thinking that I would just do a basic summary of the AO methods I personally use but, as I wrote, it got more and more detailed. Even so the methods outlined above are by no means exhaustive and the 'fiddly' options I have listed, which will undoubtedly give you better results, are ones I don't use that often - if anything I tend to find myself just doing the quick AO + MR A&D AO option as it gives good results with a minimum of fuss. The other options are good to know though for when you need to go that little bit further.



Chris Trill is an experienced 3D artist & Graphic Designer. In 2010 he started his own agency, Design Corps, offering Design, 3D Visualisation, Animation and Stereoscopic video services.

3D CAD model of a house


Advanced CAD provides design options unlike any other platform. It offers historically unparalleled capabilities for precision design, combined with modeling and extremely cost effective planning methodologies. Most importantly, it also works well with design and construction market technology. Top level 3D like Tekla, for example, includes a full range of the latest up to the minute design, drafting and planning capabilities.

Advanced 3D CAD principles

3D CAD is the most accurate, versatile design methodology in history. The basic box of a simple CAD design frame is also irrefutably the most accurate and most efficient planning tool ever created. The most complex designs are now comparatively easy, simply because of better software capabilities.

To give some idea of the computing power of this software: If the CAD-designed Dubai Tower was designed on the other design software of its time, it could still have been in the planning stages, years after it was actually built. The generation of CAD that designed that building is now obsolete, which explains what's meant by "advanced" 3D software. Advanced CAD takes these principles much further.

Expanding your range of design options

Advanced CAD is a great tool for the all-important "sketching and brainstorming" process, where designs are conceived and put through their paces as active working concepts. At this critical stage of design, designers must be able to work with their concepts in detail, and get a complete picture of all design issues.

For designers, this stage can be very difficult, and they need the tools to work with their designs effectively and efficiently. This is where Advanced 3D CAD outclasses all other types of software. Only Advanced 3D covers all aspects of the design stage comprehensively.

Precision work- How advanced CAD handles the tough jobs

It's not commonly known by laypeople what "precision" engineering really means. This can be the toughest, most demanding, and ferociously number crunching of all types of design and planning. It involves meticulous work, often related as much to scientific, engineering and architectural principles as much as any design or other considerations. Before CAD, this work could take months. Whole drafting teams could be involved in single design elements.

Advanced 3D modelling has made it a lot easier. The murderous number crunching is done automatically, and most importantly, flexibly. The software can generate a very detailed, comprehensive model of any precision job, literally to any degree of accuracy.

Advanced 3D CAD and specification requirements

The use of three dimensional space is a huge advantage for drafters in all aspects of specifications. The specification figures in 3D design software and 3D modeling software literally have to add up, to create a design.

The very high levels of accuracy naturally created by 3D designs ensure reliable specifications. Every specification is correlated, meaning many basic specification errors can't even be made. It's an invaluable asset to planners, ensuring quality control from the first two lines of a design.



Pacific Computing is the exclusive distributor in Aust and NZ of Tekla Structures 3D modelling construction software for structural detailing and drafting. For more information and to view our range of products, visit Construction Software.

3D programming for an online game


3D computer graphics as seen on FaceYourArt.com

A 3D rendering with raytracing and ambient occlusion using Blender and Yafray

3D computer graphics are works of graphic art created with the aid of digital computers and 3D software. The term may also refer to the process of creating such graphics, or the field of study of 3D computer graphic techniques and related technology.

3D computer graphics are different from 2D computer graphics in that a three-dimensional representation of geometric data is stored in the computer for the purposes of performing calculations and rendering 2D images. Such images may be for later display or for real-time viewing.

3D modeling is the process of preparing geometric data for 3D computer graphics, and is akin to sculpting or photography, whereas the art of 2D graphics is analogous to painting. Despite these differences, 3D computer graphics rely on many of the same algorithms as 2D computer graphics.

In computer graphics software, the distinction between 2D and 3D is occasionally blurred; 2D applications may use 3D techniques to achieve effects such as lighting, and primarily 3D may use 2D techniques.

Contents

1 Technology

2 Creation of 3D computer graphics 2.1 Modeling

3 Process 3.1 Scene layout setup

3.2 Tessellation and meshes

3.3 Rendering

3.4 Renderers 3.4.1 Projection

4 Reflection and shading models

5 3D graphics APIs

6 See also

//

[edit] Technology

OpenGL and Direct3D are two popular APIs for generation of real-time imagery. Real-time means that image generation occurs in 'real time', or 'on the fly', and may be highly user-interactive. Many modern graphics cards provide some degree of hardware acceleration based on these APIs, frequently enabling display of complex 3D graphics in real-time.

[edit] Creation of 3D computer graphics as seen on FaceYourArt.com

3D model of a suspension bridge spanning an unusually placid body of water

Architectural rendering compositing of modeling and lighting finalized by rendering process

The process of creating 3D computer graphics can be sequentially divided into three basic phases:

Content creation (3D modeling, texturing, animation)

Scene layout setup

Rendering

[edit] Modeling

The modeling stage could be described as shaping individual objects that are later used in the scene. There exist a number of modeling techniques, including, but not limited to the following:

constructive solid geometry

NURBS modeling

polygonal modeling

subdivision surfaces

implicit surfaces

Modeling processes may also include editing object surface or material properties (e.g., color, luminosity, diffuse and specular shading components — more commonly called roughness and shininess, reflection characteristics, transparency or opacity, or index of refraction), adding textures, bump-maps and other features.

Modeling may also include various activities related to preparing a 3D model for animation (although in a complex character model this will become a stage of its own, known as rigging). Objects may be fitted with a skeleton, a central framework of an object with the capability of affecting the shape or movements of that object. This aids in the process of animation, in that the movement of the skeleton will automatically affect the corresponding portions of the model. See also Forward kinematic animation and Inverse kinematic animation. At the rigging stage, the model can also be given specific controls to make animation easier and more intuitive, such as facial expression controls and mouth shapes (phonemes) for lipsyncing.

Modeling can be performed by means of a dedicated program (e.g., Lightwave Modeler, Rhinoceros 3D, Moray), an application component (Shaper, Lofter in 3D Studio) or some scene description language (as in POV-Ray). In some cases, there is no strict distinction between these phases; in such cases modelling is just part of the scene creation process (this is the case, for example, with Caligari trueSpace and Realsoft 3D).

Particle system are a mass of 3d coordinates which have either points, polygons, splats or sprites assign to them. They act as a volume to represent a shape.

[edit] Process

A 3D scene of 8 red glass balls

[edit] Scene layout setup

Scene setup involves arranging virtual objects, lights, cameras and other entities on a scene which will later be used to produce a still image or an animation. If used for animation, this phase usually makes use of a technique called "keyframing", which facilitates creation of complicated movement in the scene. With the aid of keyframing, instead of having to fix an object's position, rotation, or scaling for each frame in an animation, one needs only to set up some key frames between which states in every frame are interpolated.

Lighting is an important aspect of scene setup. As is the case in real-world scene arrangement, lighting is a significant contributing factor to the resulting aesthetic and visual quality of the finished work. As such, it can be a difficult art to master. Lighting effects can contribute greatly to the mood and emotional response effected by a scene, a fact which is well-known to photographers and theatrical lighting technicians.

[edit] Tessellation and meshes as seen on [http://www.FaceYourArt.com]

The process of transforming representations of objects, such as the middle point coordinate of a sphere and a point on its circumference into a polygon representation of a sphere, is called tessellation. This step is used in polygon-based rendering, where objects are broken down from abstract representations ("primitives") such as spheres, cones etc, to so-called meshes, which are nets of interconnected triangles.

Meshes of triangles (instead of e.g. squares) are popular as they have proven to be easy to render using scanline rendering.

Polygon representations are not used in all rendering techniques, and in these cases the tessellation step is not included in the transition from abstract representation to rendered scene.

[edit] Rendering as seen on [http://www.FaceYourArt.com]

Rendering is the final process of creating the actual 2D image or animation from the prepared scene. This can be compared to taking a photo or filming the scene after the setup is finished in real life.

Rendering for interactive media, such as games and simulations, is calculated and displayed in real time, at rates of approximately 20 to 120 frames per second. Animations for non-interactive media, such as feature films and video, are rendered much more slowly. Non-real time rendering enables the leveraging of limited processing power in order to obtain higher image quality. Rendering times for individual frames may vary from a few seconds to several days for complex scenes. Rendered frames are stored on a hard disk then can be transferred to other media such as motion picture film or optical disk. These frames are then displayed sequentially at high frame rates, typically 24, 25, or 30 frames per second, to achieve the illusion of movement.

Several different, and often specialized, rendering methods have been developed. These range from the distinctly non-realistic wireframe rendering through polygon-based rendering, to more advanced techniques such as: scanline rendering, ray tracing, or radiosity. In general, different methods are better suited for either photo-realistic rendering, or real-time rendering.

In real-time rendering, the goal is to show as much information as possible as the eye can process in a 30th of a second (or one frame, in the case of 30 frame-per-second animation). The goal here is primarily speed and not photo-realism. In fact, here exploitations are made in the way the eye 'perceives' the world, and thus the final image presented is not necessarily that of the real-world, but one which the eye can closely associate to. This is the basic method employed in games, interactive worlds, VRML. The rapid increase in computer processing power has allowed a progressively higher degree of realism even for real-time rendering, including techniques such as HDR rendering. Real-time rendering is often polygonal and aided by the computer's GPU.

An example of a ray-traced image that typically takes seconds or minutes to render. The photo-realism is apparent.

When the goal is photo-realism, techniques are employed such as ray tracing or radiosity. Rendering often takes of the order of seconds or sometimes even days (for a single image/frame). This is the basic method employed in digital media and artistic works, etc.

Rendering software may simulate such visual effects as lens flares, depth of field or motion blur. These are attempts to simulate visual phenomena resulting from the optical characteristics of cameras and of the human eye. These effects can lend an element of realism to a scene, even if the effect is merely a simulated artifact of a camera.

Techniques have been developed for the purpose of simulating other naturally-occurring effects, such as the interaction of light with various forms of matter. Examples of such techniques include particle systems (which can simulate rain, smoke, or fire), volumetric sampling (to simulate fog, dust and other spatial atmospheric effects), caustics (to simulate light focusing by uneven light-refracting surfaces, such as the light ripples seen on the bottom of a swimming pool), and subsurface scattering (to simulate light reflecting inside the volumes of solid objects such as human skin).

The rendering process is computationally expensive, given the complex variety of physical processes being simulated. Computer processing power has increased rapidly over the years, allowing for a progressively higher degree of realistic rendering. Film studios that produce computer-generated animations typically make use of a render farm to generate images in a timely manner. However, falling hardware costs mean that it is entirely possible to create small amounts of 3D animation on a home computer system.

The output of the renderer is often used as only one small part of a completed motion-picture scene. Many layers of material may be rendered separately and integrated into the final shot using compositing software.

[edit] Renderers as seen on [http://www.FaceYourArt.com]

Often renderers are included in 3D software packages, but there are some rendering systems that are used as plugins to popular 3D applications. These rendering systems include:

AccuRender for SketchUp

Brazil r/s

Bunkspeed

Final-Render

Maxwell

mental ray

POV-Ray

Realsoft 3D

Pixar RenderMan

V-Ray

YafRay

Indigo Renderer

[edit] Projection

Perspective Projection

Since the human eye sees three dimensions, the mathematical model represented inside the computer must be transformed back so that the human eye can correlate the image to a realistic one. But the fact that the display device - namely a monitor - can display only two dimensions means that this mathematical model must be transferred to a two-dimensional image. Often this is done using projection; mostly using perspective projection. The basic idea behind the perspective projection, which unsurprisingly is the way the human eye works, is that objects that are further away are smaller in relation to those that are closer to the eye. Thus, to collapse the third dimension onto a screen, a corresponding operation is carried out to remove it - in this case, a division operation.

Orthographic projection is used mainly in CAD or CAM applications where scientific modelling requires precise measurements and preservation of the third dimension.

[edit] Reflection and shading models as seen on [http://www.FaceYourArt.com]

Modern 3D computer graphics rely heavily on a simplified reflection model called Phong reflection model (not to be confused with Phong shading).

In refraction of light, an important concept is the refractive index. In most 3D programming implementations, the term for this value is "index of refraction," usually abbreviated "IOR."

Popular reflection rendering techniques in 3D computer graphics include:

Flat shading: A technique that shades each polygon of an object based on the polygon's "normal" and the position and intensity of a light source.

Gouraud shading: Invented by H. Gouraud in 1971, a fast and resource-conscious vertex shading technique used to simulate smoothly shaded surfaces.

Texture mapping: A technique for simulating a large amount of surface detail by mapping images (textures) onto polygons.

Phong shading: Invented by Bui Tuong Phong, used to simulate specular highlights and smooth shaded surfaces.

Bump mapping: Invented by Jim Blinn, a normal-perturbation technique used to simulate wrinkled surfaces.

Cel shading: A technique used to imitate the look of hand-drawn animation.

[edit] 3D graphics APIs

3D graphics have become so popular, particularly in computer games, that specialized APIs (application programming interfaces) have been created to ease the processes in all stages of computer graphics generation. These APIs have also proved vital to computer graphics hardware manufacturers, as they provide a way for programmers to access the hardware in an abstract way, while still taking advantage of the special hardware of this-or-that graphics card.

These APIs for 3D computer graphics are particularly popular:

OpenGL and the OpenGL Shading Language

OpenGL ES 3D API for embedded devices

Direct3D (a subset of DirectX)

RenderMan

RenderWare

Glide API

TruDimension LC Glasses and 3D monitor API

There are also higher-level 3D scene-graph APIs which provide additional functionality on top of the lower-level rendering API. Such libraries under active development include:

QSDK

Quesa

Java 3D

Gsi3d

JSR 184 (M3G)

Vega Prime by MultiGen-Paradigm

NVidia Scene Graph

OpenSceneGraph

OpenSG

OGRE

JMonkey Engine

Irrlicht Engine

Hoops3D

UGS DirectModel (aka JT)

;;