Previously a production blog for my final year project ( you can still find the old posts of WIP images) YOu have stumbled across a collection of knick knacks and tutorials for 3D CG...

Showing posts with label environment. Show all posts
Showing posts with label environment. Show all posts

Sunday, March 28, 2010

Hello, my name is Daniel Vijoi and I have been working in the gaming industry for 7 years. My current job is Lead Texture Artist at AMC Studio, a Romanian game development company based in Bucharest. During this time I worked on many projects like TestDrive Unlimited (Atari), Mercenaries 2, Saboteur (Pandemic Studios/EA), Pure (Blackrock Studios/DISNEY), Rise of Nations & Rise of Legends (BigHuge Games/THQ) and other exciting titles yet to be announced. I decided to write this tutorial as I noticed a certain lack of interest for game related environmental texturing in the 3d community. This tutorial is targeted at medium level users and will present the process of texturing a photorealistic building that has already been modeled. I will focus on the texturing process in particular, even though the modeling and UVs are also important for the final look of the building.



For this tutorial, I used the 3Dtotal Texture DVD, a large library of diverse textures that we here at AMC Studio use regularly. At the end you will find a list of all the specific 3D Total textures I have used for each texture I have created. Some of the images included in this tutorial also mention which textures were used.



Usually, it is preferable that one artist does the entire process of modeling and texturing as usually, these processes are interlinked so optimizing the geometry will make changes to the texturing and vice-versa. This is why I will also mention some of the means by which the geometry and UV have to be optimized to keep the textures needed to a minimum while also adding extra details and personality to the asset.



The majority of game assets start their life as a concept art and some reference images that will help to better define the character of the building. For this tutorial I used the following concept art and reference photos. The subject of the concept is a desert building inspired by the settlements on Tatooine and the typical real-life Tunisian buildings. I included some extra Sci-Fi details to make it more interesting. The desert environment will influence the chromatic variation of the textures as well as their detail as far as weather influence on materials goes. Being a multi-purposed building, details vary: there is a generator in the tower and the back side of the building can be used as a market stall to sell different things.

With the help of the above pictures, I modeled the low polygon geometry. The model has 2500 polygons, well under the 2700 polygon budget set initially. This will allow me to add further cuts in the geometry to optimize texture usage later on in the process. Here’s a screenshot of the building geometry from two different angles:

Here you can see the same geometry with the UVs unwrapped. The checker texture was added to make sure all the UV shells are proportional and that there are no areas with deformed UVs.

Before texturing, a quick drawn texture layout would be in order. This can be done either in Photoshop or on paper. This makes the texturing a lot easier if the layout part is sorted out beforehand. Because this process is rather quick, I usually sketch a couple of versions before I decide which is the best one to use. First of all, the entire geometry has to be measured properly so that the UV layout is as compact as possible with as little unused space as possible. Large areas on the geometry will take up more space on the UVs than small areas. In this case, I chose the keep the texture resolution at 128 pixels/meter. This will allow me to keep all the UVs in proportion with each other and also figure out how much space will every detail on the building take on the texture. Having all the parts at the same resolution will ensure that no area of the building will appear to be blurrier than the other.

Because this is a photorealistic building, the textures have to be chosen carefully, so that they do not contain any artifacts due to compression. The artist has to closely follow the color provided in the concept art or, as is the case here, the reference photos if the concept art is not colored. This particular building is part of a desert environment, so the tone of the textures has to match the desert climate.



When choosing the base textures, the most important things to follow are the material details, as the colors can always be modified later. Another good idea would be to choose textures that have a lot of color variation, as this color variation will add a lot of personality to the building.



Here’s how the wall texture for the basic shape of the building was made. The top image is the original texture while the lower one is the result after tweaking the colors with Color Adjustment and a bit of Unsharp Mask.

The next image shows how I added different color tones and a layer of paint to the existing wall. The easiest way is to select the necessary details with Color Range and add them to our PSD. I use this method a lot.

Next up I used a mask (top frame) to add some details from a texture (middle frame) to our map. The result can be seen in the lower frame. The blending mode for that layer will be Normal. This will ensure that the newly created layer will not modify the original texture’s color.

Most of the details can be added in this manner by using masks or Color Range to isolate desirable details from one texture and add them to our own. The final color can always be modified using Replace Color if needed.



One very important thing to take into consideration is the texture resolution. The artist must always be careful when scaling the source textures to both keep the natural scale of the details while at the same time ensuring that particular details will not be sharper or blurrier than the rest of the texture.



Another thing to consider is the management of the PSD files. This will help obtain the maximum texture quality but also decrease execution time when working on a tight schedule. All layers should be named and organized in groups to make sure all the details are easy to find in case they are needed. I try to keep the layers on Normal as much as possible to make sure I keep as much detail from the original texture while avoiding color deviation and artifacts caused by using other blending modes like Hard Light or Overlay. If these blending modes are necessary, it is very important to keep the resulting texture as photorealistic as possible. Softlight seems to be a blending mode suitable for accentuating highlights, shadows, bevels, etc.



Here is one example that follows the above mentioned:

This next picture shows the final wall texture with a bit of saturation added to it:

The two Photoshop guidelines mark the lines that define how the texture is tiled. I needed to make the texture tileable on these lines as the wall is 5.5 meters tall but I only had 4 meter worth of texture to work with. The result is that I had to cut the geometry at 3 meter height and tile the image at that height to increase the usable surface area. This technique is very useful when texturing a high building but you also need to have dripping details at the top and dirt like details at and bottom of the texture. So basically, the middle part (between the guidelines) can be tiled to cover as much space on the geometry as needed while keeping the top and bottom unique.



Here is the same texture applied to the geometry:

This texture not only does it tile with itself but with another texture used for the back of the building. This second texture has been created by using this one as a base and adding some masked details to make it unique.

Here are some further tiled texture examples, this time from assets that are not related to this one:

The same method has been applied when doing the tower wall seen above. To make the tile harder to spot, I reduced the detail of the texture by making the bricks look more alike in color and intensity. Using some masks from the previous texture, I have saved some time when adding dirt at the base of the tower and dripping details at the top. Afterwards, I have used Color Range to select some painted areas from the base wall texture and add them on top of the tower wall texture for added variation. It is often a good idea to use common or similar details for all the textures of the same asset to add unity to the texture and make them fit together better.



After adding these details, I copied a row of stones from the top part of the tileable area and blended it in with the lower part. This will make the texture blend in seamlessly. Usually, making the textures tileable should be kept for last to save time. Also note that the texture tiles vertically to span the height of the tower but also tiles horizontally to make it easier to map it on the circumference of it.

The above image contains a step by step description of the way the roof texture was created. First I added contrast and color to the texture by duplicating the layer and setting the blending mode to Multiply. I then used Color Range to select some of the red paint and increase its intensity. Finally, I added some rust, paint chips and metallic details to make the texture stand out.



Next up is how I extracted the dripping details form a concrete texture to be used for the roof as well as other elements of the building.

Now, to move on to some of the details; first, the entrance door. It is important to remember keeping the PSD files organized and with as few layers and special blending modes as possible to avoid making the final texture look too cluttered.



One layer for each detail type should be enough: rust, chipped paint, scratches, dirt, text, etc. A good idea would be to keep volumetric details as separate layers to make them easier to convert to a normal map later on.

The following image shows how the wood texture was created. When details with clearly defined vertical or horizontal lines are concerned, the first thing to do is make sure they are lined up properly. This will make the tiling process easier.

Optimizing the workflow means that it would be a good idea to keep some textures or elements of the textures in a "library" organized by category: dirt, stains, rust, etc. This will make them easier to find when needed. At the same time, the most interesting elements of the already created textures can be used either for the same asset or for other assets to save up time if necessary.



One last detailed area I’d like to point out is the pipes. Here is the creation process detailed:

To summarize, only a few Photoshop tools are used when creating texture, tools like Color Range, Replace Color or Healing Brush. It is important to keep the number of layers to a minimum and use as blending modes as little as possible. Always keep the resolution consistent throughout the textures. Don’t forget to keep volumetric details as separate layers to make it easier to create the normal map and specular map later. All the time saved from keeping the workflow as organized as possible will give you more time to fine tune the texture or add details to areas that you might have neglected.

The above image shows the final version of the first map, with all the tiling areas. I set my target at using two 1024x1024 textures and one 512x256 alpha texture. Even with the budget restrictions, this should never be an impediment in adding as much details as possible. Adding more details on the tileable textures is always better than adding less when trying to minimize visible tiling areas.

This is the second diffuse texture, with the tiling areas also marked out.

Normal Map


The next major step to be taken is creating the normal map. First thing to do is create a height map from the diffuse map we already created. This is by no means realized by just de-saturating the color texture and running a filter, there is more to it than that. A close study of the volumes defined by the color texture is necessary. We start by isolating large volumes like door frames, window frames and large grills. Finer details like wood fiber, rust or chipped paint, which do not have a lot of volume associated to them, should be kept separately so that they do not compete with the large details when converting the height map to normal map. Doing so will result in a final texture that is unnatural and cartoony.



Here’s how the height map looks, basically it is a grayscale map that define the depth of each detail. Contrast is very important as it is the element that will add depth to the resulting normal map

This is how the resulting normal map looks after using the nVidia Normal Map Filter on the previously created height map. You can also use Crazybump or Xnormal for the same purpose. This normal map can be further enhanced in Photoshop before being used. If some details need to be more pronounced, they can be duplicated on the normal map and the resulting layer can be set to Overlay. This will increase the depth of that area.

The same method has been used for the second texture. Here is the height map and the normal map for that texture in one image.

For some areas I have also added normal map details that were not taken from the diffuse map. Here are a few such details that have been added to the previous normal maps with Overlay to add variation to them.

Finally, the specular map:



The specular map’s basic role is to dictate how much light is reflected off a surface. Materials like wood, brick or concrete will have lower specular values while glass, metals and other metals have higher values. As with the normal map, the specular map requires careful examination of the surfaces involved, to guarantee proper results. Some 3d engines might use a grayscale specular map, some a colored one.



In the images below, the bright areas represent the windows with some dark areas for the parts that are dirty. The metal surfaces have brighter values with dark areas for rust and brighter areas for shiny details. The darkest values are for the bricks, concrete and wood. Of course, if the wood is painted, its specular value will be higher, same goes for wet or polished bricks. Another rule would be that older surfaces tend to reflect less light than new surfaces as they are affected by dirt, dust and/or rust, all of which have very low specular values.



In general, the specular map will have more contrast than the diffuse color it has been generated from.



Here is how the specular maps look in this case:

Here is a compilation of screenshots from Maya, using the High Quality Renderer. This is the closest you can get to the ingame image while still using Maya. Similar details can be obtained when using other software packages too.

Before wrapping things up, this is a list of all the 3D Total textures used in this tutorial:



Parts01 texture

- brick15 (02 - aged & stressed)

- brick18 (02 - aged & stressed)

- ceiling_01 (07 - sci-fi textures)

- door_12 (07 - sci-fi textures)

- hull_05 (07 - sci-fi textures)

- metal09 (02 - aged & stressed)

- paint03 (02 - aged & stressed)

- paving03 (01 - general)

- red10 (03 - bases & layers)

- wall10 (02 - aged & stressed)

- wall13 (02 - aged & stressed)

- wall14 (02 - aged & stressed)

-wood_03 (02 - aged & stressed)



Parts02 texture

- african15 (09 - ancient tribes & civilizations)

- brown_01 (03 - bases 7 layers)

- misc09 (02 - aged & stressed)

- normal06 (03 - bases 7 layers)

- paint01 (02 - aged & stressed)

- plaster06 (02 - aged & stressed)

- plaster08 (02 - aged & stressed)

- tile02light07 (05 - dirt & graffiti)

- tile02medium10 (05 - dirt & graffiti)

- tile04heavy01 (05 - dirt & graffiti)

- wall05 (02 - aged & stressed)

- wall18 (02 - aged & stressed)

- window01t (07 - sci-fi textures)



As a conclusion, I leave you with a render of the final asset. I hope you enjoyed this tutorial and hopefully this will help you better understand some of the challenges of texturing for next-gen games.

Thursday, January 7, 2010

HDRI

HDRI - Maya / Mental Ray




By: Steven J. Tubbrit


What is HDRI?




The acronym HDRI stands for High Dynamic Range Image, essentially, HDR Images are images that have a dynamic range far greater than the 0-255 range that we are currently used to using in our traditional computer based images, this means that images using the 0-255 range cannot display the dynamic range accurately (The contrast ratio between darkest and brightest regions).


An HDR Image has an important property in that their pixel values are proportional to the amount of light in the world corresponding to that pixel, unlike most regular images whose pixel values are nonlinearly encoded, HDR pixels use floating point numbers, which are capable of representing light quantities of one to a million and beyond. As mentioned earlier, Low Dynamic Range Images usually represent pixels using only eight bits per channel, with the pixel values ranging as integers from between 0 and 255 respectively.


Because of the greater range capable of within HDR Images, these types of images are able to store accurate lighting values, and by using these images in conjunction with Global Illumination, Final Gathering, etc, you can produce extremely realistic and warm looking images than that which could be created with a low dynamic range. For more information on HDR Images, see the following website : http://www.debevec.org


Maya / Mental Ray HDRI Tutorial




Ok, If you've read on using Final Gathering with Maya / Mental Ray, you'll already have an idea of some of the concepts behind using Mental Ray within Maya and how to effectively set up a scene. In this tutorial, we'll be utilising the scene from, which you can download from here (Maya 4.5 only) : Scene File (Zip File - 39kb), once you've downloaded the zip file, extract the contents, we're going to be adding some extra's to this scene during the tutorial. Now before we continue, I'd recommend first downloading a nice HDR Image, there's a good collection which can be found at this site : http://www.debevec.org/Probes/, for the purpose of this tutorial, let's go for a nice warm looking image, download the Grace_Probe.hdr, as shown below.





Ok, now that we have our HDR Image, it's time to load up the scene. You should now have something similar to diagram below within Maya if you've downloaded the scene.






Now if you do a quick render, you'll probably see something like this.





The quality is a little blotchy, but that's not a problem right now, we can 'up' the final gather rays in the final render.


We are now going to add an extra object to the scene, a half dome, select Create > Polygon Primitives > Sphere, a sphere should appear within your scene, select the sphere and increase the radius to 10, so that it encompasses the scene, now, in the front view, select the polygons just below the half way mark, but not at the half way mark and delete these faces.





You will now be left with a dome shape or half sphere, now the important part,
select the sphere, and then go to Edit Polygons > Normals > Reverse. The reasoning behind doning this is so that when we map our image onto the dome, the normals are pointing in the right direction for illumination to be correctly calculated. Create a Lambert Shader, and assign it to the dome, now open it's Attribute Editor, and click on the box in Lambert tab next to Ambient Colour, in the 2D Textures section, select File and then find the .HDR Map we downloaded earlier, if you cannot view it inside Maya, select Best Guess(*.*). In the Files Of Type section in the open dialog box. Once you've done this, do the same as before, only this time add it to the Colour channel of the Lambert node.


Now select your dome shape, and go to Edit Polygons > Texture > Planar Mapping, go to the options box, set it to Y axis and then ok, with the object still selected, open the UV Editor, leave it open, in the front view, select the following UV points





Now, scale and then deselect the UV's in their rows, until you get something similar to this in your UV Layout.





Select ALL Uv's now and then scale them so that they fit exactly into the 0 to 1 UV Space (the grey square in the diagram above), what we've essentially done is made sure that our UV layout is utilising the whole of the HDR map correctly, by relaxing the area's where the map would've been stretched. Now the beauty of HDRI is mostly found in the lovely reflections it's produces as well as it's lighting, in this case, we will now convert the plane the red ball sits on from a Lambert to a Blinn, this is easily accomplished, select the plane, open it's Attribute Editor and in the Lambert tab, change the type to Blinn, now with added new specular attributes, set them up as follows (similar to the red ball's attributes).





I haven't mentioned this yet, but it's worth taking note now that Maya will not actually display the HDR map, Mental Ray recognises the map, but Maya doesn't hence it not displaying. Ok, we're about ready now to do a test render, but first we must make a few small changes to our scene, you'll remember from the final gathering tutorial that the Min and Max samples are based on the scene size, well this has changed since we added our dome, so recalculate for the scene, I come out with 20 units, so that's 2 for Max and 0.2 for Min, so open the Mental Ray Render Globals and in the FG section, make the necessary changes. Change the final gather rays to 500, just for viewing purposes too. Now delete the white plane object from the scene that is currently illuminating it, as we want to just concentrate on the HDRI effect. And perform a test render.





Ok, not bad, but not great, how can we improve the look? It's blotchy, but we can increase the samples later to fix that, in the meanwhile, decrease the plane's reflection value to just 0.3, it's also a little dark, so select the dome and within the Hypershade, graph the material.





Select the file node and open it's attributes, and within the Colour Balance section, click on the Colour Gain's 'colour' box.






Once you've done that, increase the V value in the H S V section to 2.






Now, let's try another render:





Now, looking a bit better than before, let's try a different HDR Map that will show off the scene a bit more, in this case, the HDRI map being used here is already quite bright, so I set the Colour Balance back a little - HSV Value V to 1.5.





Now, that's looking quite nice, the HDRI map has helped to achieve a fairly
good, very realistic looking scene due to the lighting range available. And in this final test, I've increased the size of the plane so that it overlaps the dome, just to fix the reflections a little, I've changed the plane to white and changed it back to a Lambert, and the ball has had it's reflection value upped a little bit more too, and I've increased my render time a bit more by upping the final gather rays (1500), and within the globe's attribute editor, I've changed the shape nodes render stats as follows






Note Switch off 'Primary Visibility' if you don't want the globe to appear in renders, but still affect the scene : -


And the final test render:





I'd agree, it's not the best quality in the world, and the render time is way too high, (above 10 minutes for the still above) so we now need to look at different ways to improve the final image and render time. One way is : - let's not rely on the final gather rays to correct the blotchiness within the final image, but instead, let's mess around with the Min and Max radius, I've set them to Max = 8, and Min = 0.8, and this is the result that produces.





This still rendered in roughly only 2 minutes, and is a vast improvement over the previous one's blotchines, now experimenting again, I set the Max value to 16 and increase the FG Rays to 2000.





As you can see it's improving, this one took just under 3 minutes to render, whereas it's not an exact science, and values can't be given as defaults for each and every scene, and most of the time the rules seem to be broken for each and every scene, as in the case of Min And Max values formula we came up with within the FG Tutorial, which does not seem to be the case in this scene, all I can end on is saying, experiment and experiment until you get the 'look' your after, I just hope that within this tutorial, you've been able to gain a little insight into working with HDR Images.






Final Test Render - FG Rays set to 3500, Max Radius set at 24, Min Radius set 2.4, 4 Minutes 45 Seconds rendered




LAST MINUTE ADDITION - VERY IMPORTANT




Ok, based on my previous FG Tutorial, there was a way of calculating the FG Min and Max samples using the scene size in Units and then taking 10% if that. However, that was for a flat scene, now again, this is probably not the way to do this, but I came up with another idea, when a scene has more depth, i.e. height and width, measure them both, as in, I get (using Maya's measure tools) 20.57 (rounded up) for my width, and for my height I get 11.57 (rounded up).

Now, use the formula Height * Width, and I get 237.9949, let's say, 240 , for arguments sake we've rounded it up. Now using the formula from the first scene, i.e. Max radius is 10 % of the scene in units, that would make the MAX Radius should be set at 24, and again the MIN Radius should be set at 10% of that, and so 2.4 is the value there, now look at the final render test I did, the final values I came up with before the scene actually started to looking presentable, wow, that's some co-incidence! Now, like I said, they may be nothing in it, but the results seem to speak for themselves. Remember though in the scene above, which was fairly square, the formula may change if the depth was the longer value in the scene.


If your wanting to view and edit HDR Image maps, I'd also recommend downloading HDRShop, available from: http://www.debevec.org/HDRShop


Thanks for reading and I hope you find this tutorial useful.

Wednesday, October 28, 2009

Butchery

Scene 1 Done!!!!! :D

Monday, October 12, 2009

Lighting Complete!


Final Lighting Test from maya with color correction in Photoshop, comped in the 2d fire with sparks and smoke (have yet to create the emitters for smoke and sparks :P)
An ambient Green eerie Light bouncing around the room which is primarily lit by a fierce fire pit. Think the Great Hall in Beowulf.