Tuesday, November 20, 2007

Showing-off with the new B2 Domelight

As some of you may already know, we've just released a new Brazil 2 pro build with several new beta features (check the attachments at the bottom of that post). We've already started getting some interesting test imagery -- I thought it would be cool to share :)

"Render test by Cuneyt Ozdas -- Domelight with Brazil 2 Advanced material, SSS texture and area highlights. The scene is lit by the "Walk of Fame" HDRI from http://www.hdrlabs.com/gallery/panoga... The same HDRI is used as an environmental reflection and can be seen in the chrome sphere. Rendertime: ~4 min/frame on a 2Ghz Core2 Duo notebook (T7200 processor) 2GB RAM Max9. Pure QMC solution, no irradiance/render-cache, and no additional lights in the scene."

The youtube video got pretty compressed, so here is a 800x600 divx 6 version. (1.5 MB)

... And an image by Nathan Fariss:

This one uses HDRI from the Domelight with GI, the new analytic bump mapping, the new bi-directional sub-surface scattering (sweet!), caustics, dispersion.... Nathan is threatening to add more features to it -- if he does, I'll update the image :)

Also -- google alerts sent me a link to a new Brazil V1 video tutorial today, called, "Easy Occlusion with Brazil R/S." A couple things to note on this: 1) You can do the same thing with colored lighting if you use the Chroma Shadow pass, and 2) his technique will not work if you're using over-bright/hdr lighting (the blacks in the shadows end up being clamped-1.0-intensity-light when inverted). For doing the lighting passes when you want to use over-bright/hdr lighting, use the white plaster pass.

Sunday, November 18, 2007

Anisotropic Highlights


Anisotropic reflections occur when small groves in a surface cause the reflection to be stretched in a particular direction. So how do we create them in 3d? Well first, anisotropic reflections in cg can be split up into two categories.

  • An Anisotropic Highlight. A highlight is just a faked reflection of a point light source. Most 3d apps have a way to do anisotropic highlights, and that's what this tutorial is about.
  • An Anisotropic Reflection takes an actual reflection of your scene or an environment map and stretches it based on an anisotropy direction. This will be discussed at a later date.
Take this real world example of a christmas ornament that's made up of fine synthetic hairs that all travel in one direction.

Figure 1
Figure 1

Here's the direction of the grooves.

Figure 2
Figure 2

Here's another anisotropic highlight on a sphere...

Figure 3
Figure 3

This is caused by grooves like this...

Figure 4
Figure 4

Here's some Anisotropic highlights on a plane. A horizontal highlight like this...

Figure 5
Figure 5

is caused by vertical grooves...

Figure 6
Figure 6

A vertical highlight like this...

Figure 7
Figure 7

is caused by horizontal grooves...

Figure 8
Figure 8

Here's the example of a CD or the bottom of a pot...

Figure 9
Figure 9

Here's the direction of the grooves that causes the pot picture above.

Figure 10
Figure 10

As you can see, the grooves always go in the perpendicular direction to where the highlight is stretched.

3dsmax's Brazil Advanced Material Rendered in Brazil 1.0 or 2.0

Brazil has an anisotropic highlight as part of the Brazil Advanced's Blinn Highlight Shader. It's similar to the standard max anisotropic highlight, but with a few differences.

Here's the anisotropic highlight with default settings...

Notice it's quite similar to Figure 3 above.

The orientation is defined in object space, so it defaults to the grooves traveling along the x axis of the object, which of course produces a highlight that goes straight up and down (again, the direction of the highlight is always perpendicular to the direction of the grooves). Changing the angle parameter from 0 to 90 will change the direction of your non-existent bumps, and hence change the look of the highlight to something similar to Figure 1.

Here's the interface to the shader

To achieve the pot example above, you need to provide the shader with a more complex direction. That's where the angle map slot comes in handy, which bases the angle of the anisotropy off of a black and white map.

In the angle map slot, place a gradient ramp and set it up like this...

So have the gradient go from black to white. Set it to Spiral. Also, note that the Output Amount is set to 360. This is because, in Brazil the Angle is from 0 degrees to 360, so you need to set the gradient ramp to go from a value of 0 to 360, which is achieved by multiplying the black to white gradient by a value of 360. So the color black remains 0, and the color white, which is usually 1, is now 360.

Make a cylidner, and apply a UVWMapping modifier on your object, and set it to planar from the top.

And we get the correct highlight...

To learn more about Anisotropic highlights and reflections, please visit http://www.neilblevins.com.

Wednesday, October 10, 2007

Tutorial: Rendering Caustics in Brazil r/s

Let's start by answering the question, "what are caustics?" According to wikipedia, "a caustic is [an] envelope of light rays reflected or refracted by a curved surface or object, or the projection of that envelope of rays on another surface." This results in the concentration of light into patterns of light and shadow that's projected onto another surface. Caustics are very common in the environment around us and can be used for both artistic effect and to increase the level of realism in 3d renderings.

photos: Jimmy Earl, Heiner Otterstedt

Brazil r/s will automatically and accurately render caustic generated by both reflective (mirror) and refractive (glass, water, etc.) sufaces.

This exercise will cover the various settings that enable and control rendering of caustics in Brazil r/s.


Start by downloading and rendering the example scene (3ds Max 8, and Brazil r/s 2.0).

The scene contains a ground plane, one direct light, a camera, a cylinder (to add some reflections) and a glass teapot that we will use as a caustic generator.

The scene's material setup is as follows:

  1. teapot = Brazil2 glass material with default settings.
  2. ground plane = Brazil2 advanced material with diffuse set to white and a small specular highlight.
  3. cylinder = Brazil2 advanced material with diffuse set to white, highlight shader set to "none" and fully self illuminated (luminosity: 255/255/255) with Kl set to 2.0 (this setting makes the reflected cylinder more visible).

The scene is illuminated by a direct spotlight and a small amount of direct sky light (color: 23/36/50). Most of our caustics will be generated from the spotlight.

The quality and shape of your caustics depends largely on the geometry used to generate the caustics. More complex geometry creates more complex caustics, reflecting and refracting your light rays in a greater variety of directions.

The rendered scene is shown below with notes what we want to do. The rotated camera view is there to make the image a little more dramatic and to get the caustics aligned into a diagonal.

Note: Make sure that Genrate Caustics is checked on in Brazil2 Glass material options.


  1. Enable Caustics
    1. turn on photons in light rollout -- keep the default settings.
    2. Switch the lights shadow generator to "Brazil2 Ray shadows" to make the shadow transparent as they travel through the glass object.

    3. Check "Enable" in "Brazil Photon Map Settings" rollout, and turn Caustics on (marked with red dot).

    4. Render.
      Caustics are there and look good already, but the transparent shadows look wrong.
  2. Fixup the shadows by changing the shadow mode to "Rectangular Area":
    1. In the spotlight's Brazil 2 Ray Shadows rollout, change the shadow mode to the "Rectangle Area"
    2. Give the shadow some size by setting the scale of the shadow's Area Light Scale to 10 by 10
    3. Adjusting the max error to 5% will give us a nice balance between performance and quality in this scene.

  3. Tweak the caustics settings
    1. Set the "Photons in Estimate" to 50
    2. Set the "Max Search Radius" to 1000
    3. Adjust the "Energy Tweaks" "Multiplier" to .55

      The larger Max Search Radius will blends sparse areas of the caustic photons together better, and the smaller number of Photons in Estimate will cause the photon gather to stop searching for more photons around the sampling points much sooner ("Smaller Effective Radius"). By lowering the energy Multiplier, we are preventing the amount of over-bright photons in the of caustics.
  4. Increase the image sampling and render
    1. Set the Image Sampling to 1 by 2.
    2. Render


Now we have our glass teapot with believable shadows and caustics. You can download and render this final scene here.

Caustics in Brazil r/s render very quickly, so they are a feature that's actually quite fun to play and experiment with. Try different settings from those above and note how the changes affect the rendering. In addition to that, try getting creative and experimenting with some of the following:

  1. Glossy reflections on the teapot glass material.
  2. Allow Absorption in the glass material.
  3. Try caustics with Dispersion.
  4. Play with area shadow settings.
  5. Experiment with the "Affect Surface" settings in the light.
  6. Try different Photon Map Settings.
  7. And in the end, why not a little of post-production?

The techniques mentioned above were all used in the creation of the following picture:

Tutorial Contributed by Pavel Romsy

Friday, September 28, 2007

Friday Diversons: (lame excuse version)

My apologies for the lack of posts lately -- been very busy w/ work and life (we're preparing the release candidate, and... finally.. a website for Brazil materials :) ).

As for what's coming next on the blog: I've got 2 tutorials that have been contributed, which just need some editing and reformatting, as well as the interior tutorial mentioned previously, and more chapters for the field guide outline. I've also gotten some requests for some comparisons between Brazil 1 and 2, so I'm thinking about some good ways to show that.

Here's a couple images from the two contributed tuts:

Friday, September 14, 2007

Friday Diversions: Toonage

I really love the toon renderer in Brazil r/s -- Invariably, whenever I'm just messing around with Brazil r/s, I find my work drifting into experiments with NPR and toon renderings.

I'm a long time fan of cartoons of all kinds and love the different styles that have developed with different cartoons/comics/illustration/etc. Our original cartoon shader development was done for a game called "Looney Tunes Racing." Here's a couple of screencaps of characters from the in-game cinematics:

The type of toon shading required for this job was pretty minimal, with very little use of what we call, "multi-level paint" and very simple, non-weighted line-work. Loony Tunes did do more complex styles too, but the bread and butter of the work produced was kept simple and designed to be done quickly and to be outsourced as much as possible.

By continuing development of the Ink & Paint shader (which now ships in 3ds max) into what is now "Brazil Toon", we have continued to add more and more features and controls in an attempt to mimic the types of things that we were discovering in the design of various cartoons. Eventually, it kind of turned into a game to take a real cartoon and see how close we could get to the original style. So for today's diversion, I'll share some of those:

This image shows an anime background plate with a 3d character (courtesy of Rune Spaans) rendered over top. Note the day-for-night lighting, the decoupled shadowed/lit colors on the character's skin and the matching of the style of the line-work as well as the various colors of the line-work. Total setup time on this character was about 5 minutes.

Here again is Rune's character rendered over top of an anime background plate. This time the character has 3 level paint falloff, highlights on the skin, and gradients in the some of the ink-work.
Here Dagan Potter does explodingdog's Red Robot with solid, simple colors, and a stylized, hand drawn look to the inking.

In this, I wanted to play around with something like Frank Miller's Sin City graphic novels: White shadows in black environments, shocking use of colors, very bold and stylistic linework.

Here's an architectural watercolor effect achived with a combination of in-render effects using blurbeta plugins, Gooch shaded Brazil Toon, and some post work for the paper texture. The model is by Aris Vidalis .
Gooch shading and transparent Brazil Toon rendered side by side with a line-work only version of a technical illustration (background passthrough mode). The shading and rendering on this image was done by Robert Boothman. This image demonstrates the ink control that can be used to achieve highly stylized looks. These objects are rendering in background passthrough mode so that the background paper image shows through.

Model by Daniel Martinez Lara. The image uses Multilevel Paint in combination with volumetrics, complex lighting/shadowing, and post render effects on a large format frame (original render is 2k). This image shows off some more advantages of working with a hybrid in-render/shader approach - you can easity combine 2d and 3d elements, speeding workflow and gaining complex environmental interactions with minimal effort.

P.S. also check out the images on the Blur Studio/Spongebob Squarepants Artist Spotlight

Thursday, September 13, 2007

Tutorial: Control Reflections

This simple tutorial will show you one of the ways to control what is reflected in your scene. Download the file field-guide_reflection_tut.zip. Open the max file. We see a simple building and some kind of public art teapot sculpture. Render the camera view.

The windows are a Brazil 2 Chrome material and we can see they are reflecting the ground plane and a white environment. (Check out the Infinite Ground Plane tutorial for info on how to set up the ground.)

Let’s put a photo of some clouds in the background. Press 8 to bring up the Environment and Effects dialog. Load sky.png into the Environment Map slot. Open the Material Editor and drag the environment map into an empty slot.

Choose Instance on the dialog box that pops up when you release the mouse. Change the Mapping Coordinates to Cylindrical Environment.

Render again and you get this:

Now let’s change the background but keep the clouds reflected in the windows. Open the Environment dialog again. From the Material Editor, drag the blue gradient onto the Environment Map button and choose Instance. Render again.

The clouds aren’t in the windows anymore but we’ll fix that now. Select the Chrome material in the Material Editor and go to the Chrome Parameters rollout.

Click the checkbox next to Env to activate Environment mapping. Drag the clouds bitmap into the Environment map button. Now the chrome material will reflect the cloud graphic. Render again.

Lookin’ good! But what if you don’t want to see the giant red teapot reflected in the windows? Select the teapot, right-click in the viewport and click on Object Properties.

Uncheck Visible to Reflection/Refraction, click OK and render again.

This is just one of several ways to control what is reflected in your materials. The Environment map controls that we used in this tutorial aren't limited to the Chrome material. The Brazil 2 Advanced material and Glass material also have these controls.

Tutorial Submitted by: Pongoloid!

Thursday, September 6, 2007

Tutorial: Neon Tubing with Object Lights


Come up with a setup for doing Neon Tubing -- complete with the proper look of the neon object itself, and it's illumination.


We're all pretty familiar with what neon lights look like -- self-illuminated tubes of glowing color. Different colors and different effects are created with different types of gases and tubing.

A quick look at a google image search for "neon" provides some good examples and gives us an idea of the variety of looks that neon can have.

The colors are bright but generally pretty flat in terms of how they falloff at the edges of the tube, but in some cases you see an interesting gradient that's a lighter color in the center of the tube and a more saturated tone at the edges.

Here's some examples:

photos: Chris Higgins, Pslawinski & Wikipedia


Overall look/feel: We'll go for an urban, neon bar-sign type of look. The environment will be dark to show off the neon.

Surface: Not much detail except for the example on the far right which definitely has a glass look to it. We'll do a couple examples without the glass look (just straight bright objects), and then we'll do one with the neon-in-glass.

Camera: Nothing fancy about the camera. Standard lens, night shot.

Initial thoughts/plans: I'll just use a simple self illuminated renderable spline of a SplutterFish logo against a brick wall. For the lighting I may or may not use a dim key-light, but I will definitely use ambient occlusion (skylight) to get a nighttime look, and we will be using GI to allow the renderable spline to generate illumination. For the basic neon tubing a Utility material will probably be perfect, giving me simple colors and control of the illumination. As we try different looks, we will be using our trusty Falloff map for the coloring and we'll end up using Brazil 2 glass to construct a neon-in-glass look.


As usual, the following is a step-by-step of what I came up with to achieve this. Do a quick render test between steps to see how things are progressing. Also, go "off-script" and do some experimentation of your own -- try different settings and different materials and see what kind of results you get. The files for this tutorial can be downloaded here (3ds Max 5).

  1. Setup
    1. File|Open... field-guide_neon_start.max
    2. Open the render dialog - assign Brazil 2 -- turn off the material editor lock, and turn off the "Rendered Frame Window" near the bottom of the Common Parameters Rollout.
    3. Render/test to see what we're starting with:

  2. Adjust the Render Settings for the Look we want to use
    1. In the render dialog, Renderer Tab, Luma Server rollout, turn on skylight
    2. Turn on GI
    3. Set GI bounces to 2
    4. Render -- too bright, so...
    5. Select and modify the omni Light: set it's multiplier to .25
    6. In the Luma Server, adjust the skylight for a nighttime look [38 38 58]
    7. In the Sampling Settings rollout, turn up the anti-aliasing sampler to 1 by 2
    8. Render -- a bit slow, so lets...
    9. Turn on the rendercache and render again -- much faster, but now it's antialiased.
  3. Build the first "Neon" material: a flat shape, cyan color
    1. In the Material Editor, replace the "neon fish" standard material with a Brazil2 Utility Material
    2. Set the Utility Material color to neon-cyan [95 250 255]
    3. render. looks good, but not casting enough light, so...
    4. In the Utility Material's Global Illumination rollout, adjust the GI send level to 2
      there's our first neon -- would work well at a distance and renders pretty quickly
  4. Build the second "Neon" material: dark orange with a lighter orange central glow
    1. Add a falloff map to the Brazil 2 Utility Material's color slot
    2. In the Falloff map, change the front color to light orange [255 148 5]
    3. Change the side color to a darker orange [252 74 46]
    4. Adjust the falloff curve to accentuate the brightness in the center
    5. Render. I feel the light being cast by the neon should be brighter, so...
    6. Adjust the Brazil 2 Utility Material's GI send value up to 2.5
    7. render.
      That's a pretty nice looking neon that will work in a lot of different situations without needing a lot of adjustment. By simply changing the two colors in the falloff map, you can create a wide variety of believable neon colors. For example, a color called, "raspberry" is very eye catching and popular -- to create that, just change the falloff colors to pastel-magenta and powder-blue ([255 148 232], [148 148 232])
  5. Build the third "Neon" material: Neon-in-glass -- orange glow inside refractive glass
    1. Put the orange neon Brazil 2 Utility Material into a Blend Material (keep the old as sub...)
    2. Replace the Standard Material in the Blend's "Material 2" slot with a Brazil 2 Glass Material
    3. Put a falloff in the Blend's "Mask Amount"
    4. Edit the falloff curve so that the glow only happens in the center of the sample sphere, but you get a lot of orange spill into the mix with the glass
    5. render. looks good, but the neon looks like it's too dim, so....
    6. Go back up and edit the original Brazil 2 Utility Material in the Blend's "Material 1" slot -- adjust the color map amount to be 200 (we want to blow out the intensity of the glow on this one)
    7. render. Not bad, but I like the warm red glow that we're seeing the the reference photo, so to create that...
    8. Edit the GI send filter color to make give it a red cast [255 33 0]
    9. render.
      This is a really nice looking neon that works very close up and has many of the characteristics we're looking for from the reference photo (reflections, refractions, and a red shift to the illumination it creates).
5:30 screencap video. This follows the steps described above but has no audio. It is also scaled down quite a bit, but I think the main ideas come across.


In this case, my biggest complaint is probably with the geometry. The object itself doesn't sell well as "being neon," because neon is typically not bent in only two dimensions. Look at real neon and how the glass artist has to bend the tubes into the third dimension in order to give the illusion of sharp corners. If you find yourself needing to do photoreal neon, it might be a good idea to actually talk to a neon/glass artist to learn how they'd approach the problem.

Another problem with the geometry is that the extrusion of the object folds in on itself which creates some artifacts in the neon-in-glass example.

Also, the trick I used to do the neon-in-glass actually paints the glowing gas onto the surface of the tube, and relies on the fact that we generally look at the sides of the neon tubes, not down their lengths. The glow in this example doesn't actually exist in the center of the volume of the glass. Some may be compelled to go for a glowing volumetric inside of constructed hollow glass tube, but i think the processing costs and the amount of man-hours spent actually constructing and setting up the scene that way wouldn't be worth the benefits except in very specific cases.

The approach used here is just one of many ideas, but I like the flexibility and control that the b2 utility mtl gives.


Again, this is just one approach. There are different techniques for achieving the same goals, and some maybe better than what I've shown here. Try rendering this with and without the rendercache to get an idea of how much the cache is helping with the R&D process. Try to achieve similar effects using different materials and other advanced rendering features.

As stated before, "There are no rules for this stuff, so experiment, have fun, and keep the goals in mind."

Share what you come up with and we'd be glad to add your techniques to this example.