Kakes' 3D Blog

Maya Particles: Creating a flower field with particles

Posted by: Kakes on: January 8, 2012

Particle Flowers

Particle Flowers

Above is a flower field I created with flowers in the background made of particles. Particle sprites always face the camera, meaning they will face you regardless of camera movement or camera swap.

To create particles, set your menu to Dynamics mode, and select Particles -> Particle Tool [].

In the Particles tool settings, enter the new particle name and set the number of particles you want to create per click. Setting the Particle Number to 50 means that each time you click, 50 particles will be created (hence a bunch of 50 flowers) per click, but you can’t control the location of each particle.

Since I wanted all flowers to touch the ground, I kept it to one and clicked 50 times more, exactly where I wanted the flowers. Making the ground orbject live made it easy to align the particle to the ground.

Initially, these particles are just dots on the screen.

Click on the particle object and open up the Attributes Editor. Under Render Attributes, change the Particle Render Type to Sprites and check Depth Sort.

This changes particles from dots to planes that face the camera.

If you click on Current Render Type button, you can scale the sprites.

By attaching a flower pink and purple materials, the particles rendered out as flat flower planes that always face the camera. Even though they’re in the far background, I didn’t like the fact that they looked obviously flat. They also had fuzzy white edges around the texture alphas.

So I decided to make them spheres instead of sprites by changing the Particle Render Type to Spheres.

You can see the difference below – the pink flowers look like they have geometry :)

Tags: , ,

Kakes’ 3D Blog 2011 in review

Posted by: Kakes on: January 1, 2012

To kick off the new year, WordPress stats helper monkeys have been busy putting together a personalized report detailing how this blog did in 2011!

 

Crunchy numbers

The concert hall at the Syndey Opera House holds 2,700 people. This blog was viewed about 41,000 times in 2011. If it were a concert at Sydney Opera House, it would take about 15 sold-out performances for that many people to see it.

In 2011, there were 17 new posts, growing the total archive of this blog to 50 posts. There were 100 pictures uploaded, taking up a total of 5mb. That’s about 2 pictures per week.

The busiest day of the year was July 8th with 240 views. The most popular post that day was Importing Maya Animation into Flash with Papervision 3D.

How did they find you?

Some visitors came searching, mostly for peach maya, flan, how to make a tree in maya, siheyuan, and how to model a tree in maya.

 

Where did they come from?

Most visitors came from The United States. The United Kingdom & India were not far behind.

 

Who were they?

The most commented on post in 2011 was Importing Maya 2012 models to Papervison3D

These were your 5 most active commenters:

  1.   stefanhgn 1 comment
  2.   Tigerfeet 1 comment Follow
  3.   ThankGod Fortune Abbey 1 comment
  4.   Bill 1 comment
  5.   PolyFace 1 comment

Attractions in 2011

These are the posts that got the most views in 2011.

  1.  Importing Maya Animation into Flash with Papervision 3D 3 comments January 2011
  2.  Modeling a Tree in Maya 7 comments February 2010
  3.  Light Fog with Maya Mental Ray using Parti Volume 2 comments October 2010
  4.  Low Poly Character: Modeling a Geisha in Maya 5 comments April 2010
  5.  Adding sound to the animation timeline in Maya 10 comments May 2010

Some of the most popular posts were written before 2011. Kakes’ writing has staying power!

Rubicon 3D Irrigation Animation

Posted by: Kakes on: December 8, 2011

A 3D animation I made for Rubicon Water earlier this year (above) is now translated into Spanish and Chinese! Links below.

Chinese:

Spanish:

Tags: , ,

Creating and Blending Layered Textures in Maya

Posted by: Kakes on: November 7, 2011

Floating Island work in progress

Below is a floating island I modeled. I wanted to tile the grass and rock textures, but have them blend into each other, rather than have a clear cut line between the two textures.

First, I laid out the UVs so they are contained within the first quadrant with no overlapping UVs. Just like I would to make one texture map for the whole island.

In Photoshop, I created one layer per material (in this case 3: one for grass; one for rock; and one for dirt.) I blacked out the layers, then painted white over the areas I want the materials on.

Since there are only 3, I decided to put each layer on a channel layer like below.

So the white area on the Red Channel will be tiled grass, the white area on the Green Channel will be tiled rock, and the white area on the Blue Channel will be tiled dirt. The edges are blurred so the final textures will blend into each other.

Back in Maya, a new LayeredTexture node was created by clicking on its button on the sidebar of the Hypershade window. The lge_island_texture node is the lambert material on the island mesh.

I clicked on the new LayeredTexture1 node to open up its Attributes Editor. Then clicked on the area under the Layered Texture Attributes section twice to add 2 more textures. I picked 3 colours for the 3 materials, and changed their Blend Modes to Over. These colours will be replaced by textures later.

A new Lambert material called RBG_isle was created. The RBG map I created above was attached to its colour node. Then I deleted the material node.

The RBG file node was middle-mouse-dragged onto the LayeredTexture node. Other was selected when the menu popped up when dropped onto the LayeredTexture node. This pops open the Connection Editor.

I clicked on outColorR on the left column, then clicked on inputs[0].alpha on the right column.

Likewise, ourColorG was connected to inputs[1].alpha, and outColorG to inputs[2].alpha.

Finally, I middle-mouse-dragged the LayeredTexture node onto the material on the island mesh, and selected Color. The ‘final’ network looked like this.

You can see this working in the preview panel if you have the High Quality Render switched on.

Now to replace the colours with textures, I clicked on the Colour button in the Layered Texture Attributes Editor to attach the texture files just like I would for any material.

This was done for all three textures and the network looked like below.

A quick render showed that it worked well :)

In the place2DTexture node, Repeat U and Repeat V could be can to increase the number of tiles.

To connect blended bump maps, normal maps and displacement maps, another LayeredTexture node needs to be created. The process is the same as above, but instead of hooking it up to the Colour attribute of the material, you hook it up to the relevant slot (in this case, a normal map for the rock was connected to the Bump slot).

The final render using a layered texture with tiled textures, another layered texture for normal maps, and another for displacement map is below.

Quick Realistic Grass in Maya

Posted by: Kakes on: November 5, 2011

When you just use a grass texture, it doesn’t look very realistic because the render looks flat like below.

So here’s a quick way to make grass have some volume, without using fur or paint effects but, by using a displacement map.

Open up the Hypershade window and right-click on your grass texture and select Graph Network.

Middle-mouse-drag the Displacement node to the Work Area. Middle-mouse-drag that node on top of the grass material node and select displacement.

If you refresh the Work Area by right-clicking on the grass texture and selecing Graph Network, it should look like below. Click on the displacement node.

Click on the button next to Dsiplacement in the Displacement Attributes tab.

In the Create Render Node window, choose 2D Textures -> Fractal.

Render the scene, and your grass will look more realistic with the added volume.

Using lights in Papervision3D to create objects having a Phong Shading on flat coloured materials are easy enough, but what about when you want dynamic highlights on jpg/png materials that you load in?

After making a light like below…

var light:PointLight3D = new PointLight3D(false, false); //(showlight, flipped)
light.x = 0;
light.y = 0;
light.z = -500;
default_scene.addChild(light);

You can use the phong shader to your loaded material file (in this case, embedded material file as we’re continuing on from my previous post).

var bitmap1:Bitmap = new matBlueBall() as Bitmap;
var bitmapMaterial1:BitmapMaterial = new BitmapMaterial(bitmap1.bitmapData, true);
var shader:PhongShader = new PhongShader(light,0xffffff,0x333333,200);
var shadedMaterial:ShadedMaterial = new ShadedMaterial(bitmapMaterial1,shader);
_model_balls_blue.materials.addMaterial(shadedMaterial, "blue_ball");

The phong shaded material om the spheres looked like this in Flash – it looks very dark because there’s only one point light.

For greater control over “ambient” lighting, you can use an environment map instead.


Embed an environment map to your class. In this exmaple, the envionment map looked like the image on the left – the light grey for the environment (ambient) and the white spot for the specular highlight.

public class KakesPapervision3DTest extends PaperBase
{
[Embed(source="mat/env.jpg")] private var EnvImage:Class;
private var envMap:Bitmap = new EnvImage();
[Embed(source="dae/blue_ball.dae", mimeType = "application/octet-stream")]
private var daeBlueBall:Class;
[Embed(source="mat/blue_ball.jpg")]
private var matBlueBall:Class;
...

…and replace PhontShader with EnvMapShader…

private function initMaterials():void
{
var bitmap1:Bitmap = new matBlueBall() as Bitmap;
var bitmapMaterial1:BitmapMaterial = new BitmapMaterial(bitmap1.bitmapData, true);
var shader = new EnvMapShader(light, envMap.bitmapData, envMap.bitmapData, 0x333333);
var shadedMaterial:ShadedMaterial = new ShadedMaterial(bitmapMaterial1,shader);
_model_balls_blue.materials.addMaterial(shadedMaterial, "blue_ball");
...

The specular highlight still follows the light as you rotate the scene, but now there’s enough “ambient light” that lights the spheres nicely.

Embedding Collada and texture files to Papervision3D

Posted by: Kakes on: September 11, 2011

One bad thing about not embedding collada and texture files in your swf file is that it can take quite a while for flash to load in external files, even if they’re pretty small.

To embed collada and material files, declare them as a class.
The paths are relative to your flash src file, rather than the deployed swf file.

public class KakesPapervision3DTest extends PaperBase
{
[Embed(source="dae/blue_ball.dae", mimeType = "application/octet-stream")]
private var daeBlueBall:Class;
[Embed(source="mat/blue_ball.jpg")]
private var matBlueBall:Class;
...

Create your DAE as ByteArray where you initialise your models…

private function init3dModels():void
{
var byteArray1:ByteArray = new daeBlueBall() as ByteArray;
_model_balls_blue = new DAE();
_model_balls_blue.load(byteArray1);
_model_balls_blue.moveDown(150);
_model_balls_blue.scale = 100 ;
_model_balls_blue.rotationY = 180;
default_scene.addChild(_model_balls_blue);
...

Use BitmapMaterial instead of BitmapFileMaterial…

private function initMaterials():void
{
var bitmap1:Bitmap = new matBlueBall() as Bitmap;
var bitmapMaterial1:BitmapMaterial = new BitmapMaterial(bitmap1.bitmapData, true);
_model_balls_blue.materials.addMaterial(bitmapMaterial1, "blue_ball");
_model_balls_blue.materials.addMaterial(bitmapMaterial1, "blue_white");

Before embedding external files, my scene was taking several seconds to load, even though they were not even 1mb including all the texture files. After embedding dae and jpg/png files, the load time was instant.

Baking lights and shadows in Maya using Mental Ray Renderer

Posted by: Kakes on: September 9, 2011

I’ve written how to bake lights and shadows onto texture files using the Maya Software renderer before, but this post is for the more exciting Mental Ray renderer. (Yes, smooth shading, final gather, normal maps!)

Here’s a simple scene set up with a few spheres and lights.

This is the mental ray render that I want to mimic by baking the lights and shadows on the texture files.

Select one or more objects that have no overlapping UVs. In Polygons mode, Go to Color –> Batch Bake (mental ray) []. If it’s greyed out, go to Display Render Settings Window and change the Render Using: combo box to Mental Ray.

In the Batch Bake options, check the Use bake set override to use more options. Select Color mode: Light and Color, check bake to one map, and set the image file type and dimensions to what you want. If you check Keep original shading network, Maya won’t replace your texture files within Maya with the newly created image which is handy. I recommend checking Orthogonal reflection (explanation at the end). Make sure you’ve selected the right camera too.

Hit Convert and wait for a while as Maya calculates and exports the new texture file.

On the left is the original texture file and on the right is what Maya exported. It needs a bit of touch up, but it’s a great start for use with Papervision3D or other 3d engines.

Now, with orthogonal reflection, the baked lighting doesn’t look exactly the same as the render. Without orthogonal reflection checked, the pv3d scene looks very much the same as the render like below.

However, the texture file that Maya spits out without orthogonal reflection selected won’t work well if the pv3d scene is rotated.

Importing Maya 2012 models to Papervison3D

Posted by: Kakes on: September 4, 2011

Maya 2012 has a Collada exporter that enables you to export .dae files. But unfortunately it can’t be read by the Papervision3D Collada/Dae class as the tags don’t match up.

I found that the best way to fix this problem is to use Autodesk’s standalone FBX 2011 Converter; Instead of Maya –> DAE, we need to export from Maya –> FBX –> DAE.

1) Download and install Autodesk FBX 2011 Converter (http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775920).

2) In Maya, select the objects you want to exort and select File –> Export Selection []. Select FBX export as the export file type and hit Export Selection.

3) Open up Autodesk FBX 2011 Converter UI. Drag and drop the .fbx file you just exported to the Source Files window. On the right side of the UI, change the destination format to DAE Collada and hit Convert.

And huzzah, Papervision can import the 3D model created in Maya 2012 :D

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:

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 195 other followers