Gold material - LuxRender Wiki
Luxrender GPL Physically Based Renderer

Gold material

Personal tools

From LuxRender Wiki

Jump to: navigation, search

Contents

Gold Material

Gold final 2.jpg

The goal of this tutorial is to make a gold material, which can be seen on old jewellery exhibiting some worn look. It should not be the typically clean shiny gold look you get with modern jewellery.

One remark before I start: Its important when developing a material, that you use a model for preview which resembles the final object. Just using a simple sphere or a plane will most certainly lead to longer development cycles. The lighting shouldn't be too simple too. Just using a single point or mesh light will not suffice for the most materials, that exhibit some sort of reflection.

My sample scene for this breakdown uses a very simple broad bracelet and I use 3 mesh lights to light the scene.

Selecting the base material

The immediate idea is of course to use luxrender's metal material with the built-in gold setting. If we use it we get the following image

Metal gold.png

Besides setting the roughness, there are no parameters to fine tune the actual color texture. The metal material gives too light a result for our intended purpose. The roughness is quite ok though.

This leaves us with the next basic material type - shiny metal. This material has two channels: reflection and specularity, both fully configurable with textures. Lets assign a quick yellow color for both channels, set the roughness to 25 and see what we get.

Shiny yellow reflection.png

Now that's not really what we are aiming for. Its too shiny (as the material's name already suggests). What we have here is in effect a compound material. Reflection as well as specularity is a reflection of light, where specularity has the additional benefit of a roughness parameter. Lets see a close-up of the above render

Shiny yellow reflection detail.png

Using both reflection and specularity results in a rough material which seems to be coated with some shiny substance. The reflection channel is always perfectly smooth, so as long as we use it, we will always end up with a smooth shiny surface. The solution is to turn off the reflection by setting it to 0. With the roughness value we should have all the control we need to describe the material.

See below for the same shiny metal material with reflection turned off and using different roughness settings.

Shiny yellow specular series.jpg

To be honest, I cannot image a situation, where I could make use of the compound nature the shiny metal is delivering, because in the end it will collide with the material setup I have in mind, but who knows what time will bring ...

Defining the basic color

Now that the reflection issue is solved we have to concentrate on the basic color for our gold. This sounds trivial but I will spend quite some time on this topic.

The simple approach is of course to directly assign a color to the specular channel. For this project I won't use this approach, but will rather concentrate on the gaussian texture. So its good to look at what this gaussian really is.

A gaussian offers the following controls

Gaussian.jpg

You have a wavelength slider, which is conveniently placed under a spectrum image, so you won't have to guess which color belongs to a wavelength. The whole visible spectrum is available.

This texture produces a wavelength distribution in a gaussian bell curve, the maximum being the selected wavelength. The width parameter sets the standard deviation of the bell curve, thus actually telling luxrender how many wavelengths left and right from the maximum are to be used. This now sounds very theoretical, so the best is to actually visualize it

Simple gaussian.jpg

This series was rendered with a gaussian texture set to a wavelength of 586 nm, which is an orange hue. With a width setting of 20 the orange hue is quite visible. The broader the width the more yellowish, then slightly green and at the end almost white the reflected color gets. The broader the width, the more frequencies from the visible spectrum gets reflected. With a width of 150 we have already a very high percentage of the visible spectrum covered, hence the almost white color.

Width 35 and 55 are more interesting. From our main wavelength to the right, only red hues are available, but to the left there is yellow and green in the immediate neighbourhood. Broadening the width from 20 to higher values will add more different hues from the left then it does from the right. Yellow and green in this case, therefore we see the shift from the orange to the yellow/green.

I like to use the gaussian texture, as I think it gives a richer appearance to the final render ( but that is maybe my conception only :) )

What the gaussian texture lacks in comparison the the constant color, is a control for the saturation of the color. You have the energy slider, but this only acts as gain and not as saturation control. To get this, we have to build it by our own and thanks to lux, this isn't all too difficult.

We use the mixing feature for textures. I setup a mixing like this

Gaussian mix.png

With this we are mixing a constant white color with the gaussian and using the amount parameter to blend these two textures. Lets have a look at a series of renders for different values for the mixing amount.

Gaussian mix series.jpg

This produces quite acceptable results, especially the render with the amount of 0.85 looks promising for our gold material.

As a side note: the mix amount for textures works just the other way round as it does for mixing materials. A value of 1 in the mix amount will use 100% of texture 2 when mixing textures, but will use 100% of material 1 when mixing materials. This may be resolved in future releases (maybe even 0,6 final), but for the time being this can cause some headache.

For the basic gold color I settled on a wavelength of 586 and a mixing amount of 0.86 giving the following starting point

Gold start.png

Adding some bumps

This gold material is (besides its specularity roughness) perfectly smooth, and with this perfectly recognizable as being cg. We need some bump mapping to counter the perfect look and give it a more hand crafted look.

A word of caution before we begin: What I observed in my projects so far is, that the real look of a material - when it comes to subtle bump mapping - is only fully visible at quite high samples/px rates. The render above was intentionally rendered up to 2000 samples/px to show its too perfect surface. The noise introduced with lower sample ratios tend to suggest some noisy bump mapping which in the end is not there. So to get the bump mapping right, you have to render it to high samples/px ratios to be sure its ok.

A popular approach to achieve something like a hammered look is to use a voronoi texture. So lets start with it

Bump voronoi.png

Not so bad, but still too regular. To counter this I use the blender distorted noise texture and distort the voronoi texture with an improved perlin, adjust the bump amount and get the next render

Bump distorted.png

Next I give the bump a specific direction and end up with this setup and result

Bump distorted stretched c.jpg

Again a word of caution: I am using here a non uniform transformation to have the texture stretched along the x-axis. Now the x-axis in discussion is the global x-axis. If you copy the object, rotate it and assign the same material to it, you will get the stretching in the same global x-axis, making the object look weird. As long as there is no object coordinate system for the texture transformations, all these transformations have to be done very carefully and sometimes cannot be done at all. Needless to say, that this disqualifies its use in animations ...

The material looks better now, not so smooth, but lets have a closer look

Bump distorted stretched closeup.png

Again, although having a bump map, we have too clean a look. Real world noise, dirt and bumps tend to have a fractal character. The closer you look, you will always see similar patterns. Here is where you have to decide how this material is going to be displayed. Is it low res or seen from far away, you will get away with the setup we have right now. But rendering at higher resolutions where the material takes some area of the render will demand for more work on the bump mapping.

I take a simple approach and aim at adding some small scale noise. But before actually adding the it, we design it as single noise to better see its appearance.

I found the blender musgrave texture to be quite flexible in creating noise, which isn't too even in itself. Lets start with the noise texture itself.

Bump small noise setup.jpg

The important controls (besides the musgrave ones) are the contrast and and tex1/tex2 sliders. The contrast lets you control the amplitude for your bump map while the tex1/tex2 sliders define the limits in which your bump values will vary. You could also set the amplitude with the tex1/tex2 but I prefer it this way, especially as these parameters are quite useful when combining textures.

Now that the single noise bump is defined, lets combine it with the previously developed voronoi texture. The simplest approach for this is to mix these two textures. Doing so we get the following.

Bump combined setup.jpg

The two textures are now mixed with a ratio of 1:1, the small noise still too big. What bugs me though is that the small noise is uniformly distributed over the voronoi texture.

Its probably more plausible, if the most elevated portions of the voronoi texture are more smooth than the lower regions. The higher ridges should have more contact with the environment and exhibit a more polished look.

To accomplish this, I restructure the texture mixing in a way, where I use the voronoi texture as amount to mix the small noise texture with a constant bump value. See here

Bump modulated setup.jpg

The effect is now more or less what I intended, but lets have a look at the texture setup to analyse why this is so.

The voronoi texture acts now as modulator (amount value) between two textures. The extreme values for this texture control the amount of each of the two textures. The range is set to [0..1] but the contrast is lowered, so the maximum value won't reach 1, which translates to texture 1 (the small noise) not being used as pure texture.

The musgrave texture has a very low contrast (bump amplitude) and the range is set to [0.18..0.23]. Texture 2 is a constant value of 0.3. With this setup the maximum amplitude will be from 0.18 to 0.3.

When the value for the voronoi texture (the modulator) reaches a value of 0.0, only a constant of 0.3 will be the result of the mix i.e. no noise is mixed in. This are the elevations of the voronoi texture. Going gradually to higher values will mix more amount from the noise texture to the result, thus adding noise and lowering the average bump value.

This means, to control the overall amplitude of the resulting texture you have to adjust the levels of the two textures.

Now lets have a look at the whole object

Bump modulated.png

Color revisited

I will use the created bump texture as base for a slight color variation. The idea is again, that the lower areas (especially the small holes) are less shiny than the elevated ones.

To do this, I will use the same technique as with the bump map, but now I will use the complete bump texture as amount texture for mixing the basic gold material with a darker one.

First lets find a good variation of the basic gold material to act as darker less shiny one.

Color mix checker setup.png

I use a checker texture to emphasize the different materials. Now we setup a more elaborate texture for the basic gold material. Instead of using the simple checker texture we use a variation of the bump map texture.

This render uses no bump mapping to clearly see the effect of the color variation.

Color mix texture setup.jpg

You can see here, that the size and composition of the texture is the same as the bump texture, but has other values regarding its contrast and limit values.

The important values to have full control over the balance of dark/light areas and their distribution are the last 3 constant values (now at 0.4, 0.2 and 0.0 resp ). Its not immediately obvious, that this is the case, and its now starting to get very hard to see the structure of the material setup.

A graphical representation would be a real blessing, but alas, for the time being we have to work very concentrated. It also helps to actually print out the setting and make notes and groupings on the paper and emphasize the important parameters.

Now lets add the bump map again and have a look at the result.

Color mix texture bump.jpg

That should do for the basic material, but I have still another bit planned for the gold material - some additional dirt independent of any bumps.

Adding dirt

For this I set up the following dirt texture

Dirt texture.jpg

This a mix texture of 2 musgrave textures scaled and rotated and the mixing is controlled by just another musgrave texture. Maybe overkill, but I like it :)

Now I setup a mix material with the actual gold material in slot 1 and a very simple gold material in slot 2. The simple material is basically the material we started from, a shinymetal with a gaussian assigned to the specular channel, but the specularity is now lower and the roughness is set to 2.0.

Dirt 03.jpg

Now just by varying the specularity of the dirt material and the bump map on the first material we can create a wide variety of gold materials.

Gold matrix.jpg

Well, thats it for a start.

The important point is to keep yourself organized. This is getting really tedious with increasing complexity of the material, so know your building blocks, know how they contribute to the final result and keep notes about them, for otherwise you will have a hard time deciphering the material setup after only 2 weeks.