Showing posts with label Materials. Show all posts
Showing posts with label Materials. Show all posts

Friday, August 23, 2013

Video Update for August 2013

August is almost over, time for a video update:


Friday, November 25, 2011

Material World

I often get questions about the texturing in the screenshots and videos I have posted so far. There is nothing really new in what I do, still it may help to discuss it.

The material system I devised shares the same core philosophy as the voxel system. It is all based on my hope that if you put enough layers into something it will eventually look good. I know this is an awfully technocratic approach to art and design, it is just the way I found to compensate my lacking skills. I also hope this system is flexible enough for true artists when the time comes.

The volumetric world definition is a set of layers. Each new layer adds or subtracts to the layers before. If you look at a cliff formation, there is one base layer for the main volume of the cliff, then other layers on top of it, each one adding a different type of rock.

Each volumetric layer has a different material assigned to it. The material system defines the look of each layer, and very important, how transitions between different materials are rendered.

Let's look first at how material boundaries work.

Once voxels are converted into a triangle mesh, each triangle ends up having a material assigned to it. A change of material happens because the predominant voxel layer changes too. Very often the material boundaries align perfectly with sharp features in the geometry.

This is what you want in some cases. Imagine where the foundation of a building goes under the rock. You don't want the rock and the wall materials to blend, it would look weird. In other cases you do want different materials to blend. For instance where snow ends and bare rock starts. A clean line would not be right.

This behavior had to be controlled by a material setting. The engine then looks at all the triangles contributing to each vertex and compiles a list of materials for the vertex. Material boundaries form based on these blend settings.

At some point I was alpha-blending materials at the boundaries and baking the resulting image into a texture. I would later use this texture for rendering. This alpha-blending turned to be a problem when I moved all material rendering to realtime shaders. As you will see next, each material is a also collection of layers. Rendering a single material means all these layers must be evaluated and blended together. Now, imagine a point where three different materials overlap: I would need to evaluate all the layers for all materials there. It was often worse than that, in some spots I could find up to seven or eight different materials.

I knew rendering a single set of layers was fast enough, so what I did was pick one of the materials and render just that one. Materials already have an alpha value. Picking the one with the highest alpha does the trick. This still creates sharp transition lines, but they can be fixed by offsetting the alpha by a noise function. The transitions become more natural that way.

The following screenshot shows several transition areas as produced by the shader:

Image


Then there is the other half of the material system: how each material is defined. As I mentioned before, it is just a set of layers. Each layer has defines several properties that control how it looks and how and where it is applied. Here are some of them:
  • Diffuse map: A texture with the color information for the layer
  • Normal map: A texture that describes additional orientation changes in the surface of the layer
  • Start and Bottom angles: These angles determine where the texture appears based on the orientation of the geometry. They are based on the world's up vector. This is what you would use to put moss on the top of rocks for instance
  • Mask noise: A noise definition that determines the intensity of the layer at any point in world space.
I have some other properties, but the ones listed above do most of the work.

I leave you with a screenshot of Buddha, where you can see the angle properties used to place some grass in the horizontal areas. It does not make sense in this case, this is just so you can see it in action:

Image




Sunday, June 26, 2011

June Snow

It was a long weekend in Quebec. The snow is long gone, but it rained a lot. I got some time to improve the placement of snow textures in the virtual world.

As I have it, snow appears in a scene for one of two reasons: there is some volume accumulated on the ground, or a layer of snow covers other features like rocks.

When it accumulates it becomes a feature of its own. It usually forms waves and dunes. I found it can be recreated as a 3D volume layer using some form of multi-fractal ridged noise. To this volume I apply a snow texture.

When it appears on other features like rocks and boulders, I model it as a set of additional texture layers for the rock or boulder material. This means that every material needs to know how it will look when covered by snow. I will post about the material system in the future. As you will see, adding snow takes little effort.

Here are some screenshots showing the latest results I've got:

Image

Image

Image

The three screenshots were taken out of the same mountains.

I found not so hard to re-create areas that were completely covered by snow. The tricky part was the transition zones, where snow gradually disappears and the ground starts to show again. The last screenshot shows a transition area. I still need to work on them.