« Posts tagged Maya

Fruit Bowl Render

black and white fruit bowl

In our lighting and rendering class we are going through the basics of mental ray lighting with linear work flow. I’ve done a bit of this on my own as you might know if you keep up with this blog. I’m learning a lot about the different tools you have in Mental Ray to control shadows and blurry reflections. Our first assignment is to light and render a fruit bowl that as supplied to us. I’ve just started this assignment and I only have the orange texture started, but I have finished lighting the scene. We aren’t allowed to use any indirect lighting systems like Final Gather or Global Illumination. Any bounced light has to be simulated. I’m going to add coloured point lights to simulate bounced light after I have my textures setup.

Most of these lights are casting ray traced shadows with a light radius of 5, 40 shadow rays, and 2 bounces per ray. There is a bit of light linking going on so I can illuminate the bowl and drop cloth separately. For this coming Monday we have to have at least one of the fruits textures started. I have chosen to start with the orange. I generally like the texture, but I have to make a new bump map that puts all those little circular bumps across the surface. The current bump isn’t dense or varied enough.

(http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/09/lightrough1 NULL.jpg)
As always, if you have any questions about the settings or any of the file setup just post em here or email me.

Unreal Unit Meshes – “UBlocks”

Unreal Block Meshes

After digging into the 2DPlatformerStarterKit (http://udn NULL.epicgames NULL.com/Three/DevelopmentKitGemsPlatformerStarterKit NULL.html) I began thinking about how I should go about creating my 2D test level. This level would be a staging ground for all sorts of pre-production tests. Things like lightning, particle systems, and mesh design would all be roughed out here. I always find if hard to visualize what sizes my meshes should be while working in Maya.  I was thinking that a quick way to rough out the size of a level and it’s meshes would be to use pre sized blocks like LEGO (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/08/legos NULL.jpg).

I’ve made several different sizes of cube type meshes that area all using the same parent material. Each square on the grid texture represents 64 units in the Unreal engine. If your Maya grid isn’t setup  to work with the UDK change your grid settings to match these values…

Maya to UDK Grid Settings – Length and Width:2000 Grid Lines Every:64 Subdivisions:8

(http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/08/ublocksweb NULL.jpg)

UBlocks in default UDK Scene

The material network is pretty self explanatory, but I’ll go over it quick. There is a texture coordinate node that is being multiplied my a custom parameter node. This lets you control the parameter node’s value separately in all instances of this material. The “U” and “V” coordinates in the “Texture Coordinate” node are represented in the texture by red and green. Multiplying this node’s output will multiply each color channel in the texture. Increasing the value of red and green will tile the material. The new multiplied red and green values are then plugged into the grid texture’s UV input.

Shader network for UBlock parent material (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/08/ublocks_mat NULL.jpg)

Shader network for UBlock parent material

Download UBlocks (http://www NULL.terrymatthes NULL.com/public/UBlocks NULL.zip) – I don’t mind if you redistribute the meshes with your projects, but please link this post or include the original ZIP file in your download.

UDK Platform Starter Kit Scene Scale

Unreal Development Kit Scale Chart

I was checking out the Unreal Developer Network (http://udn NULL.epicgames NULL.com) last night and found out they’ve released what is essentially a template for a 2D platformer (http://udn NULL.epicgames NULL.com/Three/DevelopmentKitGemsPlatformerStarterKit NULL.html). My brain just about exploded when I saw this. I’ve been trying to code my own bare bones 2D platform game class for quite some time, but most of my skills are geared towards art. I did however purchase the Introduction to Unreal Script (http://www NULL.eat3d NULL.com/unrealscript) from Eat3D.com (http://www NULL.eat3d NULL.com/). It helped me setup a proper development environment for the UDK, but I found the technical depth quite shallow. I guess that shouldn’t surprise me given that it’s an introduction :\

At any rate the documentation for the kit is pretty decent and if you have a basic understanding of level design you should be able to jump right in and start building your own levels and swapping characters. Before I went to work today I took some measurements of an in game shot to get an idea of the mesh sizes I’ll need to create in Maya. If you’ve never created anything for the Unreal Development Kit in Autodesk Maya then the first thing you will want to do is adjust your scene scale. Here is a YouTube video (http://www NULL.youtube NULL.com/user/jonathanvillaverde#p/u/18/v62ZJhryFP4) from Jonathan Villaverde’s channel (http://www NULL.youtube NULL.com/user/jonathanvillaverde) to help you get that done.

Default 2D Scale Measurements for UDK 2D Platformer Kit (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/08/ScalePlatform2D NULL.jpg)

Default 2D Scale Measurements for UDK 2D Platformer Kit

Flower Stem Rig

flower bent by dynamic hair deformation

I had problems. I talked to people. I now have less problems. This is generally how I like my troubleshooting to go. The last problem I had with my project was getting the animation deformers at the top of the flower to follow the stem when I bent it. In newer versions of Maya (2011+) there is a constraint type “point on poly”. This worked quite well. I grouped the flower head along with all its deformers and then parented that group to the top center vertex of the stem’s poly cylinder. One problem down, about a dozen more to go. I don’t mind running into walls, not being able to climb them is a different story :P

grouped Deformers following vertex modified geometry (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/07/stembend NULL.jpg)

My next challenge was getting the stem to grow and take the flower head with it. There was a few different ways I could have approached this. While figuring this problem out I had to keep in mind that the stem might be bending and curving while growing. At first I thought I could just increase the scale of the stem, but as the stem got bigger and the bend modifier curve grew larger the mesh started to lose shape because it’s resolution was too low. A quick Google search came up with a video (http://vimeo NULL.com/7420996) on how to rig a vine by Jordan Blit. In this video Jordan hooks up a simple connection between the vine’s “Y scale” and a “poly split ring” node’s “divisions” attribute. This seems to be a terrific way to grow the stem and maintain its shape no matter the length. There are a few other things Jordan sets up to make this error-proof and you should definitely check it out. I should mention that your construction history must be kept intact for this to work. If you clear your history the connection to the “poly split ring” node will be broken. When finished I added a constant variable via Mathematic Nodes Mental Ray (http://www NULL.creativecrash NULL.com/maya/downloads/scripts-plugins/rendering/other-renderers/c/mathematic-nodes-mentalray-support---2) plugin that multiplies the divisions by 2. This gives us a higher resolution mesh. Terrific :D Our stem now grows and deforms to our bend modifier, plus we’ve given ourselves a “hook” to grab via our math constant to increase our mesh resolution. Now I need to set up our stem so it can be affected by dynamic forces.

flower stem's "y scale" relationship with the poly split ring" node (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/07/stemscale NULL.jpg)

A friend and fellow 3D student mentioned rigging the stem up with a skeleton and using IK handles. He pointed me to this video (http://vimeo NULL.com/6044700) by Alex Villabon. In this video Alex gives a grass mesh a simple joint chain and then uses a Maya hair to deform the skeleton, which indirectly animates the mesh. I liked this method, but I didn’t want to use any joints in my flower rig. Keeping the rig “light” was important given the possible amount of flowers in my scene. Instead of controlling the stem indirectly with a joint chain I decided to make the hair directly control the stem by making the hair a “wire deformer’. A wire deformer is a curve which shapes the geometry it’s parented to. You can alter your curve and watch the geometry conform to its shape. This works out well because the hair is inherently affected by dynamics and it will control the shape of our stem. Now that the stem is set up correctly I have to start on the animation for the flower head. It has to transition from a bud into a fully bloomed flower.

flower bent by dynamic hair deformation (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/07/flowerhair NULL.jpg)

At this point I still don’t know whether I want to use blend shapes or modifiers to animate the bud opening. I’m thinking blend shapes might be overkill as the bud is really just a sphere with 5 sections that peel back to let the flowers petals grow out. What do you guys think? In case anyone is interested I have started a thread (http://forums NULL.cgsociety NULL.org/showthread NULL.php?f=88&t=989384) regarding this project over at CG Society (http://www NULL.cgsociety NULL.org/).

Here are links to the videos and plug-ins I mentioned throughout the post.

Alex Villabon
Animate Joints With Maya Hair (http://vimeo NULL.com/6044700)

Jordan Blit
Growing Vine Rig (http://vimeo NULL.com/7420996)

Creative Crash
Mathematic Nodes Mental Ray (http://www NULL.creativecrash NULL.com/maya/downloads/scripts-plugins/rendering/other-renderers/c/mathematic-nodes-mentalray-support---2)

Flower Update

Flower with bend modifier applied

So everything was going as expected. All was well in the land of flowers and Maya… well almost. I’ve run into a snag when it comes to bending the flower. My non-linear bend modifier controlling the stem don’t seem to be moving the rest of the modifiers associated with the petals and filaments. Only the geometry of the petals and filaments is moved. I have tried all sorts of different parenting and grouping methods. Nothing seems to make the modifiers move. I think that when moving objects with modifiers Maya doesn’t register the geometry moving in the same was as if you translated it. Since the translate is not updated the parenting structures seem to be of no use. The modifiers just say in place. Quite frustrating if you ask me.

I’m looking into parenting the modifiers to a vertex or face. I quickly came across this plugin: DJ Rivet (http://www NULL.djx NULL.com NULL.au/blog/2006/11/11/djrivetmel/). DJ Rivet creates a hair follicle and parents the follicle to a geometry face. It then parents your object to the hair follicle. This plugin looks to be exactly what I need, but I am having 2 problems with it. One; it doesn’t want to install properly for me. When I got to load the plugin it doesn’t show up in Maya 2011. I have placed it in the bin/plugins directory where all the other plugins are, but it doesn’t show up in the plugin list in Maya. Two; it has been said by a few people that this tool doesn’t parent well to geometry that is being deformed :(

I might have to write a custom script for this. I’ve never done that before and it’s actually a little daunting. I figure I can track the position of a face on the stem by averaging the world position of the 4 verts surrounding that face. I can then grab that faces normal orientation and use it to set the rotation of the grouped deformers. As long as the face referenced is one from the top cap of the stem cylinder I’m thinking this should work. Consequently if anyone knows a far easier way, or a script that’s already been developed please let me know. To better visualize the problem here are three pictures showing the static flower, the bend flower and the deformers themselves.

Flower unbent (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/06/flower_static NULL.jpg)

 

Flower deformers (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/06/flower_deformer NULL.jpg)

 

Flower with bend modifier applied (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/06/flower_bend NULL.jpg)

 

I think now is a good time to take a break from the rigging side of things and concentrate on the materials. I always like to switch gears when I become frustrated with a project. This way I can keep making progress without deterring myself from continuing on. For now I think I will just model a branch and manually place the flowers along it. When that is done I will get back to setting up the modifiers properly.

As always any comments, critiques or recipes for the best summer cocktails are appreciated :D

Maya opticalFX Sprite Textures

Sprite Texture Thumb Image
Introduction
Prerequisites

Appreciation for all things shiny.

Magic effects in video games are sweet, but do you know what’s even sweeter? Knowing how they work so you can make your own. That’s what we’re going to do here. We are going to learn how to make awesome looking sprites in Maya so we can bring them into the Unreal Development Kit for our own special effects. First we’ll take a look at what sprites are, followed by how to render optical effects using a spot light in Maya. Next Photoshop will be used to touch up and save out our images for import into the Unreal Development Kit. Follow me and we’ll “get our learn on”.

Sprites are single polygon planes who’s surfaces are mapped with an image. For visual effects these sprites are usually programmed so they always face the active camera. This means however you look at a sprite in 3D space it will Sprite Based Tree (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_tree NULL.jpg)always be facing directly towards you no matter where it’s positioned. Sprites give an accurate enough representation for a variety of visual effects. Things like snow, muzzle flashes, and small pieces of flying debris look the same no matter what angle you view them from. Even visual effects such as lightning are so quick that you wouldn’t even notice that the effect isn’t truly “3D”. If this is the case then why would we bother giving these effects any extra dimensionality?

Sprites are also simple to render. If all your sprites are single polygon planes you can afford to have a lot of them on-screen at the same time. Throw enough of them together and you can get some pretty realistic looking effects for a lot cheaper then pre-rendered graphics. The picture to our left shows a tree who’s leaves are made of a few larger sprites. No matter which way the camera looks at the tree the leaves appear to be full of volume.

Maya

Point Light Optical Effects

The optical sprite we are creating will be based off a point light. Once created the point light will be manipulated via the “Optical Effects” node to give our light different properties. To do this access the “Create” menu at the top of the screen. Navigate to Lights>Point Light and select it. You should now have a point light at the origin of your axis. The optical effect we are after is not visible by default on our point light. We have to turn it on in the Attribute Editor (ctrl+a). Select the point light and access the Attribute Editor. Under the “pointLightShape1” tab we are going to expand the “Light Effects” section. In this section the last option is “Light Glow”. Turn this on by clicking the checker board button on the right of the text field. If you’ve done this correctly you will see a circle around your light and the Attribute Editor will have jumped to the properties for the “opticalFX1” node you just created. Our point light is now set up to cast some great looking optical effects.

Render Camera Setup

opticalFX Render Setup (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_scene NULL.jpg)Go back to the “Create” menu and navigate to Cameras>Camera and select it. You should now have a new camera also sitting the axis origin. Select your new camera and Move (“w” key) it away from the origin. Now that we’ve finished placing our new camera we will go ahead and look through it. Select the new camera and in your view port menu navigate to Panels>Look Through Selected Camera. You should now be looking straight at the point light we created. The last thing we want to do to our camera is make the “Resolution Gate” viewable. This will let us see the bounds of our render. To do this we will use our view port menu and select View>Camera Settings>Resolution Gate.

By default your resolution is probably not square. We need to make it square so we can use the images we create in the Unreal Development Kit. To change this let’s go ahead and navigate to the “Render Settings” through Window>Rendering Editors>Render Settings. Change your settings to match these options (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_renderSettings NULL.png). With that setup we are now ready to start rendering out some optical effects.

Rendering Optical Effects

The optical effects we are using render out very fast. This will enable us to view near real-time previews while changing the visual settings. To view our render we are going to open up the “Render View”. This can be accessed through the main Maya menu: Window>Rendering Editors>Render View. In the Render View menu select IPR>IPR Render>camera1. This will setup interactive rendering on the camera we created earlier. The last step to setting up IPR is to marquee drag over the entire renderable area. When you do this the edges will become red. Any changes you make to the opticalFX node will now be instantly seen.

Important Note: Maya’s opticalFx are only viewable in “Maya Software” render mode.  Make sure this is selected as your render mode in the Render View window

opticalFx Node Properties

If at anytime you loose focus of the opticalFX node you can access it by clicking on your point light, bringing up the Attribute Editor, and navigating the tabs at the top to find “opticalFX”. Right now you want to have your Render View open as well as your Attribute Editor with the opticalFX node tab viewable. The following section is a visual comparison of the basic opticalFX  properties we will be dealing with in this lesson. There is a lot more you can do with this node than the sections listed below, but this is a beginner lesson so I want to keep things simple for now. Try experimenting on your own after to see what some of the other settings can do.

Optical FX Attributes

opticalFX Radial Frequency Comparison (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_Radial NULL.jpg)

opticalFX Star Points Comparison (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_StarRadius NULL.jpg)

Glow Attributes

opticalFX Glow Intensity Comparison (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_GlowIntensity NULL.jpg)
opticalFX Glow Spread Comparison (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_GlowIntensity NULL.jpg)
opticalFX GlowNoise Comparison (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_GlowNoise NULL.jpg)
opticalFX Glow Radial Noise Comparison (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_GlowIntensity NULL.jpg)
opticalFX Glow Star Level Comparison (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_GlowIntensity NULL.jpg)

To save a render in the Render View you need to use the File>Save Image option. don’t get caught up colouring your optical effect as we will be stripping the colour from within Photoshop. When you are making your effects don’t forget that we can’t have parts of the star breaking the edge of our render. The images are going to be put on flat square sheets in the Unreal Development Kit. If the sprite images extend past the edge of the render they will give away our effect showing its 2D nature. When you have saved three renders that you are happy with move on it the next section.

Photoshop

Saving Sprites For The  Unreal Development Kit

First let’s go ahead and create a New File (ctrl+n) if you haven’t already. Make sure it’s a square 512px file just like the images we rendered out of Maya. We want these to match up as we’ll be exporting this file for use in the Unreal Development Kit. Open (ctrl+o) all three of the sprite files you rendered out and change each of them to grey scale. We can do this by dropping the saturation of each file down to zero. While the layer in each file is selected access Hue/Saturation (ctrl+u). Now drag the “Saturation” slider all the way down to the left and this should drain the colour from your image. Before we jump into the next step I want to take a moment to explain what “Channels” are and how we can use them to our advantage.

Channels

Channels Setup (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_channels NULL.jpg)Each digital image is made of 3 different colours. You probably know what they are if you think hard… red, green, and blue. Photoshop stores this information in “Channel” layers. You can access these through the Channel tab in your layers window or through the “Window” menu. Each of these channels stores 8 bits of information. That means the value for each pixel in a channel is stored as a number from 0-255. As the value gets higher the pixel’s channel value becomes stronger.

In the “Layers” tab all these values are added up for each pixel and you get the full colour view you see as the image. A pixel with a value of 255 in each category would be represented as a compiled colour of pure white. A pixel with channels values of R(255) G(0) B(255) would compile as purple. So what does this have to do with what we’re doing? We’re just saving out pictures for sprites, right? Yes, that’s correct, but we’re saving black and white versions of our sprites, as we will be manipulating the colour from within the Unreal Development Kit in our next lesson. This means that the actual compiled colour of our texture doesn’t matter. This is going to let us store 4 different sprites in one file! Yes that’s right I said “four”. We can add an “alpha” channel to our Photoshop file and get one extra channel.

So now that we know all about what channels are and how we can use them let’s start putting our sprites in our new file’s channels. Go ahead and Copy (ctrl +c) one of the desaturated sprite images from your open files. Navigate (ctrl+tab) to your “new document” and access the channels information. In your new document all the channel information should be blank as you haven’t pasted anything in the layers section. Paste (ctrl+v) the sprite you just copied in a channel. The process is the same for all your other channels. Go ahead and copy the other two sprites you saved into the remaining red, green or blue channels. Remember: our final texture image isn’t important here.

Circular Gradient (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_gradient NULL.jpg)The alpha channel in our texture will not have a sprite. We are instead going to insert a circular gradient that will help us control the look of our sprites from within the Material Editor. Select your Gradient Tool (“g” key) and make sure your foreground colour is black and your background colour is white. Also be sure that the “radial gradient” option is selected atop Photoshop. Navigate to your channels tab and press the “Create new channel” button. This will give you an alpha channel to drag out our gradient in. Select this channel and from the middle drag out to the edge and let go to create your circular gradient. When you have finished save your Photoshop document as a Targa file under the “Save As” section of the “File” menu. When presented with your options for the Targa format select “32 bit”. This will save the file with the extra alpha channel. Remember that each channel is 8 bits so a 24 bit Targa holds 3 channels and a 32 bit will hold 4.

Conclusion

Don’t those sprites we made look awesome? Maya’s optical effects node can get you a lot of different looks so have fun an experiment to see what you can come up with. Try mixing multiple sprite images together within Photoshop and using their combined values in a single channel. Now that we know how to make magic sprite shapes and have saved them out in an efficient format we can take them into the Unreal Development Kit. In our next lesson we’ll use our sprite texture as a base for controlling the look of our sprites through a material network.

Here are the three sprites I will be using in the next lesson about our material controller. Just for fun I thought I would add some colour to them in Maya :)

My Sprite Textures (http://www NULL.terrymatthes NULL.com/wp-content/uploads/2011/01/p_101_spriteTex_mine NULL.jpg)
.

Further Reading

Sprite Material Controller
Make a Particle Explosion Effect by Mike McClelland
Sprite Rendering Fundamentals The Gnomon Workshop
Pixie Dust Using Sprites The Gnomon Workshop

Program Shortcuts Used

Maya
Move (“w” key)
Attribute Editor (ctrl+a)
Photoshop
New File (ctrl+n)
Open File (ctrl+o)
Hue/Saturation (ctrl+u)
Navigate Documents (ctrl+tab)
Paste (ctrl+v)
Copy (ctrl+c)