Kakes' 3D Blog

Fixing jagged edges rendered in Maya’s mental ray

Posted by: Kakes on: July 31, 2011


Architecture Visualisation

After creating a 3D house in Maya, I was disappointed to see mental ray not render the edges cleanly – the edges were jagged. This was clear especially around the windows and the top edges of the house:

To fix this, the sample settings in the Render Settings were changed. In the Quailty tab, the Sampling Mode was set to Fixed Sampling, and the Max Samples was increased to 3.

When re-rendered, the edges weren’t as jaggy:

3D Short ‘SunDay’ screened at MIAF 2011

Posted by: Kakes on: June 23, 2011


SunDay @ MIAF 2011

SunDay was screened at the Australian Centre of the Moving Image as part of the Melbourne International Animation Festival’s Best of the Next Australian showcase last Sunday!

Tickets sold out half an hour before the screening so some of my friends who came to watch couldn’t get in, but it was great to see last year’s work play on the big screen and see other aussie student films.

A bit embarassing now as we can do better now, but here’s the film:

Tags: , ,

3D Character Liah now at AIE Melbourne

Posted by: Kakes on: March 24, 2011


Liah on Blue Studio door at AIE Melbourne

After becoming a winner of AIE‘s Character Competition 2010, my cute teenage witch Liah was printed over 2 metres tall and pasted on their Blue Studio door!

She was my first high poly character I ever made (and second character ever), so I’m pretty proud :)

You can check out more pics of Liah and how I made her.

Tags: ,

Kakes’ Papervision3D Site

Posted by: Kakes on: February 15, 2011


Kakes' Papervision3D Site

So I’ve been uploading a few posts about Papervision3D. Now I’ve finally whipped up a website!

Jump to 3d.keikokamata.com and drag your mouse to rotate the scenes around. Five scenes in total for now.

I started to use the Collada parser rather than the DAE one. It seemed to load much faster, and I could track the progress of materials loading by creating a mateiral list and sending it to the Collada class.

Fixing skew and z-sort in Papervision3D

Posted by: Kakes on: February 5, 2011


Azusa in Papervison3D

Above is Azusa in Pv3d. She is made up of a very thin cube with her front render on the front face of the cube, and her back render on the back face of the cube.

Since I first had each plane made of two triangles, when I rotated the plane in Flash, the texture would distort and get bunched up. I could see the texture warping as I rotated her.

It turns out that this was because Papervision3D uses affine texture mapping. This means it distorts materials in 2D to add a perspective illusion. When there are only two triangles, it’s very easy to spot the skewing. So the solution was to subdivide the plane so it has more triangles.

I still didn’t like the bottom cube getting distorted. When I traced the camera properties, the zoom = 40, focus = 8.66, and fov = 60.

I wanted a less deep, more compressed view. So I set the values to zoom = 60, focus = 55 to make it look better. (The lower the focus, the more distorted and deep the view.)

As a side note, Flash supports GIF, JPG and PNG. The maximum texture size capable for Flash Player 9 is 2880x2880px. So use 2048x2048px max so that “mip” mapping (which smoothes the texture when zoomed) is supported.

Now, I hate it how Papervision3D has issues with deciding which triangle to render in front of another. In this case, the base cube somtimes gets rendered in front of the geisha’s pedestal, and other times the pedestral renders in front of the geisha plane.

The quick fix is to import org.papervision3d.render.QuadrantRenderEngine and add renderer = new QuadrantRenderEngine(); to the init() method.

The problem is that its performance is horrible. But the whole scene doesn’t need to be rendered with the quadrant renderer. The problem is just on the pedestal.

By setting testQuad property of the other meshes to false, Pv3D uses the default basic renderer. So the following code was added in the load complete hander.

_model.getChildByName(“base”,true).testQuad = false;
_model.getChildByName(“azusa”,true).testQuad = false;

Now z-sorting was going well without affecting performance much.

Baking shadows to textures in Maya

Posted by: Kakes on: February 1, 2011


3D Hourglass with baked textures

When you import meshes into realtime 3D engines, you’d probably want to bake some shadows so less calculation needs to be done. In this instance, I wanted to import 3D meshes into Flash using Papervision 3D.

Before I get into baking shadows, I just noticed that Papervision3D doesn’t recognise UVs that are outside the first quadrant in Maya’s UV editor.

As an exampe, when the UV map for the grass sphere looks like this,

…in Flash, the texture appears skewed like this.

Once I scaled the UV so that it fits in the first quadrant and tiled the grass texture file, it looked fine.

Now, back to the shadow problem. What you see in Flash looks flat because there are no shadows. The solution is to bake the lights and shadows onto the texture maps in Maya.

Once you have some lights in your Maya scene and are happy with the shadows, open up Window => Rendering => Hypershade. Select one of the texture files and the objects that are using that texture file. In this case, the grass sphere and the grass texture node were selected.

Then in the Hypershade window, go to Edit => Convert to File Texture []. Here, tick Bake shading group lighting and Bake shadows and choose your file format and resolution.

Hit Convert and Maya will export the new texture file to your project folder. It’s a good idea to combine meshes where possible so you don’t end up with many texture files. Just make sure the UVs of combined meshes don’t overlap because that will mess with the baked shadows.

If you export the meshes now to Flash, you might get something like this.

This is because Maya has re-assigned your objects with surface shaders that Papervision3d can’t interpret. You need to go back into Maya and re-assign materials to the meshes again, this time using the texture files Maya exported out.

Compare it with the screenshot before I baked the shadows.

Importing Maya Animation into Flash with Papervision 3D

Posted by: Kakes on: January 31, 2011


May walking in Flash

The low poly mesh for May worked pretty well even around her elbows and knees. The joints for the elbows and knees were placed very close to the outline of the mesh so she deforms better. And now I wanted to see if joint animation can be imported into Flash.

I first tested something very simple. I keyed a few frames to make her shake her head, selected her mesh and exported her as a collada file. Joint keyframes exported fine by ticking Animation and Joints and skin in the export option. But anything from the graph editor did not appear in Flash – it appeared like step animation.

Okay, that made sense. So I keyed every frame in Maya to get the tweens by going to the Graph Editor and selecting Curves => Bake Channel []. Sample by option was set to 1.

Next, I wanted to test whether IK works. The quick answer was “No”. But it “worked” when I converted IK keys to joint keys manually by keyframing the joints that are affected by the IK. There had to be a better way to do it, and sure enough, I found that you can do that with a click of a mouse:

Select the COM joint and go to Edit => Keys => Bake Simulation Options []. Tick the Below box and hit Apply. IK handles can now be deleted and all joint animation is baked on every frame. Yay!

However, when I exported the baked animation, I got the following error:

INFO: animations #27 of 27
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at org.papervision3d.core.animation.channel::AbstractChannel3D/updateToTime()
at org.papervision3d.core.animation.channel::MatrixChannel3D/updateToTime()
at org.papervision3d.objects.parsers::DAE/buildAnimationChannels()
at org.papervision3d.objects.parsers::DAE/onParseAnimationsComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()

I googled for help and I found a couple of posts that could fix the problem. One was to open the Collada file and find an <Animation> tag that didn’t have an id attribute and add one. They all had ids. Another fix was to convert all <polylist> tags to <triangles>. All had <triangles> already.

I was convinced that it was the Collada export that was the problem so I had a look at my export settings. What fixed the #1009 error was ticking Apply Transformations in the OpenCollada Export Settings.

So here is a screenshot of the OpenCollada export settings that worked fine with joint animations in Flash. Click the thumbnail for the full export settings window.

In words, make sure you have Bake transforms, Triangulate, Animations, Joints and skin, Polygon meshes ticked. I also tick Relative paths and Copy textures so I can just use relative paths for the Collada file and texture files when I upload them.

To upload your animation to your webpage, you need to upload the swf file, the dae file, and the texture file. Here’s the test animation online.

Maya 3D model in Flash Papervision3D

Posted by: Kakes on: January 28, 2011


Low poly May in Flash

I thought I’d have a go at using Papervision3D to import my 3D character into Flash. They say that the total triangle count for Flash should be under 3000, which meant that I needed to create a low polygon 3D model – lower than Azusa. Since I may want to add more objects to the scene later, I thought I’d make a character below 500 triangles.

So here’s my new character, May, in wireframe mode. This was the first time I made such a low poly character, so hopefully the mesh around her joints are good enough to deform okay when I try to animate her later.

Now, I downloaded Open Collada for Maya as May needed to be exported as a .dae file. Once installed, I loaded COLLADAMaya.mll inWindow => Settings/Preferences => Plug-in Manager and exported her as a .dae file using the new OpenCOLLADA exporter. One default setting I changed in File => Export Selection Options was, I ticked Copy textures so her texture file gets copied over to where I export her mesh.

Speaking of texture file, this time I wanted to make her texture map with only Photoshop tools. That is, just brushes, blend modes, and filters rather than using some photos to help with the look. Here’s her texture map.

For the Flash part, I downloaded Saqoosha’s FLARToolkit. I didn’t really need the augmented reality feature just yet, but I might like to add it later.

There’s a lot of tutorials out there now about how to import collada files to flash so I won’t be writing it here. (Just a note to myself though, when you name classes and files, make sure you do it in 6 places. In the AS file, make the class name and function name the same as well as the file name. In the FLA file, put the class name into Properties tab => Publish => Class and File => Publish Settings => Formats => Flash (.swf) and file name.)

Click here to view the SWF file.

One thing that was odd was that her right leg had its normals reversed in Flash. When I checked it in Maya it was fine. I thought I’d try reversing the normals in Maya so that it looks incorrect in Maya, and what do you know, it appeared fine in Flash.

Duplicating with SDK: Making Flipping Pages in Maya

Posted by: Kakes on: January 15, 2011


Scene from SunDay - Animation by Keiko Kamata & Arunima Patke

In the short animation SunDay, Rikka flips through the Lever Solver book. To rig up the book, I used set driven keys as below. (How to set up SDK can be read in my post Adding Set Driven Keys to animate a hand in Maya.)

Where 0 is the minimum value of the SDK and 10 is the maximum value, below was set to be the joints’ value 0 position.

At value 3, the joints were set as below.

This was value 5…

value 7…

value 9…

and value 10.

Now, I wanted Rikka to be able to flip through pages twice. So I wanted to duplicate the page mesh, page jonts, and the SDKs associated to them so I don’t have to rig up the new page. To do so, you go to Edit => Duplicate Special [] and tick Duplicate input graph.

I translated the new page down a little and there was a book that could be flipped twice. To be able to flip through more pages, keep duplicating the page with the input graph ticked.

Rendering wireframe in Maya

Posted by: Kakes on: January 2, 2011


Above is a male character I modeled and textured based on a photo. Now I wanted to render him out as a wireframe. There are a few ways you can do this in Maya, but I found this to be the simplest method.

First, create a lambert material and go to its shader group tab. Expand the mental ray menu and tick Enable Contour Rendering. While you’re here, you can change the colour of the wireframe lines and also its thickness.

Now either apply the new lambert material to everything in your scene, or create a new render layer and override all materials with the new lambert material.

Open up the Render Settings window and set the Render Using to mental ray. In the Features tab, expand the Contours menu and tick both Enable Contour Rendering and Hide Source check boxes. Change the Flood Colour to what ever colour you want the faces to be when rendered, and increase the Over-Sample to 3. Lastly, expand the Draw by Property Difference menu and tick Around all poly faces.

Hit the render button and the wireframe of your objects will be rendered. Hiding all lights make rendering extra fast.

Kakes’ Portfolio Website

Kakes' Portfolio Website

Kakes' Portfolio Website

Kake’s Tweet

Topics

Author

wordpress visitor counter
Follow

Get every new post delivered to your Inbox.

Join 209 other followers