Using Blender 2.43 Render Baking with Anime Studio Pro

Have you come up with a good Moho trick? Need help solving an animation problem? Come on in.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

User avatar
Rhoel
Posts: 844
Joined: Fri Feb 25, 2005 8:09 am
Location: Phnom Penh, Cambodia
Contact:

Using Blender 2.43 Render Baking with Anime Studio Pro

Post by Rhoel » Tue Mar 06, 2007 11:52 pm

Blender is a very good free open source 3D application. You can download it from http://www.blender.org/download/get-blender/

For the first time user, it's not as friendly as some other 3D packages but still an outstanding bit of kit.

Blender 2.43 was released this month and has a new feature of interest to Anime Studio users - it now includes render baking. Basically it means the lighting in a scene is mapped onto a 3D object: This map can be imported along with the model into another application to create realistic 3D objects.

The following is a step by step guide to creating a Blender texture map then import into AS. It is not a Blender modeling tutorial as such, but designed allow anyone new to Blender to make a 3d object for AS. It includes other critical functions such as creating lights and secondary views. The tutorial is long and I hope every step painfully detailed.

You don't have to understand all the terms or processes. Just go with the flow and you should do it first time. If you already know the interface, you can jump to part 2.

Go grab a coffee and take your time.

Rhoel

----------------------------------------------------------------------------------------------
How to Bake a texture map in Blender and import into Anime Studio Pro
----------------------------------------------------------------------------------------------

Part 1: Let's make an object and light it.

When you start Blender, it opens with a cube object. Since it's there, this tutorial will use the standard cube.

A cube is the same on all sides, so let's flatten it make it easier to see which bit we are working on.

The standard window is the top view: In case you have switched to another view, let's go back to the top view: Press NP7 (number pad key 7). You should see this.

Image

I have labeled the key items. Any object which has a magenta outline is selected. You can RMB (Right Mouse Button) click on an object to select it.

For this exercise, you we will need to see the cube in 3D. To do this, either hold down the CMB (Centre Mouse Button or wheel) or use Alt + LMB (Left Mouse Button) to move the window around. It can be tricky at first but get it into this position; If you loose the window, don't panic - just NP7 the window back to top view and try again.

Image

We need to flatten the box. We need to see it better first:
RMB select the cube, then hit the TAB key. This takes you into the edit mode. You will see the cube is now changed, as have the buttons along the bottom of the screen.

If you have a mouse with a wheel, scroll the mouse wheel to enlarge the cube so you can see all the corners easily.

Image




Time to flatten the box:
Hit the S key - S stretches an object. We want to flatten the cube in one axis only. On the lower left of the window, you will see a xyz axis indicator. We want to flatten on the Z axis, so hit the Z key. You will see a white line running vertically through the box. Flatten till it looks like this.

Image




Time to save your work: Blender uses Ctrl + W key combination and not the Ctrl + S as most programs. Save the file to whatever directory you want - please keep all the elements of this tutorial together (don't worry about the reason).

Next stage: We need to add some colour and lights to see all the sides of the box. Use the Tab button to get back to Object Mode. Hit NP7 to go to the top view. We need to change the colour of the box. Make sure the box is selected and the lower window looks like this. Hit F8 to get to the materials window and click the two buttons to get back to this set-up.

Image

You will see I have highlighted a grey box marked COL: This is the object colour. LMB the grey colourbox and a small window opens - select a pale yellow or similar. Do not use a strong colour as this will hide the lighting.





We need to add more lights and change their colours:
RMB click on the light. The light should have the magenta outline.

Let's duplicate the light. Hit Shift + D, then move the mouse ... a new light will be created.

Image




To change the light colour, LMB the light colour box and select a deep red colour.

Make another new light. Shift + D this red light and drag it to the front left. Change the light colour to a deep blue.

Time to switch to the front view - hit NP1 (Number Pad 1). You see all the lights are at the same height. - Lower the light to the ground plane. To move it, hit G to grab it then drag to a lower height. Duplicate this light, move it to front right, make it green and place it below the ground plane. Ctrl + W to save your work.

To save us jumping from top to front views, we can have several screens open at the same time. Let's create a split screen:
Move the mouse pointer up to the edge of the top window - the cursor changes to an up and down arrow: press RMB. A menu pops up - select split screen. You should now have two screens. Put the mouse over the right window and press NP1. You should see top view on the left and front view on the right. NP7 the left screen if it has anything other than the Top view.

Image




Lets render the scene so we see what we have. Rendering is easy, just hit F12. With luck you should have this.

Image

If you haven't then go back and repeat till you have. You can move the lights (or any object) by RMB to select, then hitting G (the grab button). Move things around until you are happy.

We are now ready to make the UV map.






Part 2: Making a UV Map:
In the left window, select the box again (RMB)
Go to the Edit window. (TAB)
zoom and 3D the window (using the center wheel, SHIFT or Ctrl will move the window NS, EW), and get it like this.

Image




On the right window, you will see I have red circled a new button. Change this to UV/Image editor. The window will now be just a black box - that is fine.

Let's make the first seam of the map.
Click A then Z to make the window like this.

Image




The box now has magenta "dots" on each corner - there are called vertices's. We are going to select the lower back two: this the B key twice - you get a cute little circle (the mouse wheel makes it larger or smaller). When they are selected, they turn yellow. Click on both vertice so you have this.

Image




RMB click to get rid of the vertice select tool.
hit Ctrl + E, and select Make Seam option.
Hit key A. to de-select the vertices.
(A toggles between select and deselect).

You should have this.

Image




If your box looks like that, congratulations, you have your first seam.

Repeat the select vertices, Ctrl +E, Make seam, A cycle until you have this pattern.

Image

Please save your work.






Time to prepare the image which will store the lighting information.

On the bottom of the right window, you will see an "image" button. Click it and a pop-up menu appears ... select new. This opens a new dialogue box. Enter 1024 for both width and height options. Hit okay.

We are now ready to unwrap the UV map.

Go back to the left window and hit TAB. The window changes to UV face select.

Hit A. The box will highlight in a delicate shade of pink and the right window will change colour.

With the mouse in the left window, hit U (to Unwrap). A menu appears, select unwrap.

You should see this.

Image





Time to render the lighting to the new image:

Hit Ctrl + alt + B.
This brings up a new menu - select Full Render.

You should get this.

Image

NOTE: If you get an error message saying no images found to bake to, don't panic , I sometimes get this message too ... just do the image/new/okay again - this might be a bug or me being out of step - whatever, it re-links everything together:

Hit ctrl + alt + B and it should render fine.






If the image window renders the lighting, you are nearly done:
Save the image!
In the right window select the image/save as. Please save the image in the same directory as before.

Final stage: Output the cube as a file Anime Studio understands.
make sure the cube is selected. Then go File/Export/Wavefront OBJ/... save the object to the working directory, call it blender_UVbox. Use the standard settings and hit okay.

Save your blender project and quit.

Congratulations, you have successfully make your first UV mapped obj file. Let's look at it in SA>










Open Anime Studio Pro:

To import a 3D object in Anime Studio, you use File/import/OBJ 3d model ...
navigate to your working directory where you stored the blender tutorial, and select the blender_UVbox.obj file.

The file will be imported but you get this - a screen full of box side.

Image




Don't panic - AS has a 3D script to handle this automatically.

Use Scripts/3d/autoscale to bring the object into view.
This will scale down the object - you probably will be looking at the side of the box.
Use the Rotate Layer X and Rotate Layer Y buttons to rotate the box - you should get this

Image




You can also use the 3D world view button to play with the object.

And that, as they say in animation circles, is all folks.



Rhoel
2007-03-07

---------------------------------------------------------------------------------------------

If all this looks daunting, it's not - I have just detailed every little step with a newbie in mind ... there is nothing more infuriating than one missing step at all regular users know but Joe Newbie doesn't.

Have fun with it - the potential of this tool is awesome.

Rhoel
User avatar
Gnaws
Posts: 347
Joined: Tue Nov 07, 2006 9:31 pm
Location: Las Vegas
Contact:

Post by Gnaws » Wed Mar 07, 2007 4:34 pm

Sweet, sweet, sweeeeeeeeeeeet!!

So Rhoel, are you pretty well versed in Blender? Can you import OBJs?

Thanks for taking the time to put this together. Can't wait to try it out. And please post more examples when you have them.

:D
User avatar
2ner
Posts: 170
Joined: Wed Aug 04, 2004 1:14 pm

Post by 2ner » Wed Mar 07, 2007 4:47 pm

Thanks for the tut. I was looking forward to this. I have a little experience with blender and I followed all steps in your tut but I end up with a block in Moho 5.4 of a uniform green color. It looks like just the material color without the baking. I don't imagine Moho 5.4 is different from AS in this regard?
User avatar
Rhoel
Posts: 844
Joined: Fri Feb 25, 2005 8:09 am
Location: Phnom Penh, Cambodia
Contact:

Post by Rhoel » Wed Mar 07, 2007 5:52 pm

2ner wrote:Thanks for the tut. I was looking forward to this. I have a little experience with blender and I followed all steps in your tut but I end up with a block in Moho 5.4 of a uniform green color. It looks like just the material color without the baking. I don't imagine Moho 5.4 is different from AS in this regard?
The uniform green colour is the natural colour of the object without the map.

The problem could be two things:
The texture image is missing, or in the wrong format.
or
The image named in the .mtl file is different/in a different location.

First check:
Open the Texture map in photoshop/AC-DC and see if you have a T-shaped map with all the lights baked on: If it is okay, make sure its in the same location as the obj file and the .mtl file.

Next Check:
Open the .mtl file in notepad and have a look at it - make sure the named material image is in the same folder, the names agree etc.

That should cure the error.

Alternative Fix:
The other alternative is to repeat the Ctrl+alt+B stage. I use tga files to maps to, jpgs and PNG's should also work in AS. I don't know if any other file format works.

If you really get stuck, can you post your obj, .mtl and image files here (or zip the blender, obj, mtl, and image file or email it to me) ... I'll have a look at it, and see if I can crack it.

If I have missed a stage, or I need to detail the image export settings, I'll amend the tutorial to include the new settings.

I wouldn't be overly worried at this stage - it's frustrating I know but it took me several hours to crack this final stage.

The contents of my .mtl file looks like this
-------------------------------------------------
# Blender3D MTL File: moho_tut.blend
# Material Count: 1
newmtl Material_cube_map.tga.001
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.704000 0.712000 0.584000
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.000000
illum 2
map_Kd cube_map.tga
--------------------------------------------------

My obj filename is: Blender_UVbox.obj
My mtl filename is: Blender_UVbox.mtl
My image mao is : cube_map.tga

Hope this helps

Rhoel.
User avatar
Rhoel
Posts: 844
Joined: Fri Feb 25, 2005 8:09 am
Location: Phnom Penh, Cambodia
Contact:

Post by Rhoel » Wed Mar 07, 2007 5:59 pm

Gnaws wrote:So Rhoel, are you pretty well versed in Blender?
I wish! Still learning - my modelling is getting better but rigging is something I have yet to tackle.
Gnaws wrote:Can you import OBJs?
Oh yes. Been able to do that for a long time - having the render bake is new: Before I had to use a 3D paint tool to add colour etc.


BTW, specular high lights are missing in the render bake - Blender takes the view that highlights are camera related and therefore move in relation to the camera. Whilst true, for As without any cameras, the missing hi-lights are a problem.

I have yet to check the transparency rendering.

More later.

Rhoel
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete » Wed Mar 07, 2007 6:08 pm

Regarding to UV mapping (not specific for Blender):

It is possible to make an script in AS that change the .mtl file for a loaded 3D object (maybe using switch layers)?
It could be sooooo cool because you can simulate light movement inside AS animation just changing the .mtl file with a switch layer!!!
Ideal for backgrounds!!!

Regards
Genete
User avatar
2ner
Posts: 170
Joined: Wed Aug 04, 2004 1:14 pm

Post by 2ner » Wed Mar 07, 2007 6:09 pm

Thanks for the response Rhoel. My material file didn't have .tga at the end of the last instance of the image file name. Odd that in your's the first instance of the image file name has a .001 at the end of it and mine doesn't. Anyway, I added .tga to the second one and it works! This is going to be fun.
User avatar
jorgy
Posts: 779
Joined: Sun Sep 05, 2004 8:01 pm
Location: Colorado, USA

Post by jorgy » Wed Mar 07, 2007 6:44 pm

Thanks! I can't wait to try this out!
User avatar
Gnaws
Posts: 347
Joined: Tue Nov 07, 2006 9:31 pm
Location: Las Vegas
Contact:

Post by Gnaws » Wed Mar 07, 2007 7:38 pm

...rigging is something I have yet to tackle.
Doesn't Blender ship with some rigging tool called (uncomfortably) "Mancandy"? Seems like that would help the rigging process, no? That was another reason I wanted to try Blender.
Bones3D
Posts: 217
Joined: Tue Jun 13, 2006 3:19 pm
Contact:

Post by Bones3D » Thu Mar 08, 2007 9:09 pm

Rhoel, you never cease to amaze me! This is a fantastic, yet surprisingly simple application of Blender for use with Moho/AS!

I'm still in the early stages of learning Blender's feature set, but I haven't quite reached the level of using the UV mapping tools for texturing in it. I'm looking forward to playing around with this once I get to that point though.

In the meanwhile, I do want to let the other users here know that there is a brand new book out for Blender called Introducing Character Animation With Blender. The book is current up to v2.42 of the software and covers just about every aspect of the user interface and various tools within it. Well worth picking up if you are new to the software. A DVD is also included with the book and contains several example files, including the entire project files for the animated short, Elephant Dreams.

- Introducing Character Animation With Blender by Tony Mullen

Anyway, I look forward to seeing many more innovative ways to merge Blender with Moho/AS projects, such as Rhoel's example above. The potential uses for this sort of collaboration could be invaluable!
8==8 Bones 8==8
User avatar
Touched
Posts: 504
Joined: Mon Dec 11, 2006 7:33 am
Location: Sunny California
Contact:

Post by Touched » Thu Mar 08, 2007 10:29 pm

You could also just download all the material from that Elephants Dream DVD from the Elephants Dream site:
http://orange.blender.org/download
User avatar
Rhoel
Posts: 844
Joined: Fri Feb 25, 2005 8:09 am
Location: Phnom Penh, Cambodia
Contact:

Post by Rhoel » Fri Mar 09, 2007 7:18 am

Touched wrote:You could also just download all the material from that Elephants Dream DVD from the Elephants Dream site:
http://orange.blender.org/download
I agree with this though I'd suggest some and not all of the material. I have several of their scenes downloads and character models. It's very informative. You will need a fast processor to work on some of their scenes.

Many of their scenes were built film-set style ... many scenes can only be viewed from one angle - rooms have side and back walls but nothing behind camera.

It can be disheartening too - some of the animation helpers on the character models I simply have absolutely no idea how they were created, such as little gizmo's on the cheeks and face to make animating expressions easy. Worst, I can find no reference to it in the documentation.

Just have to experiment or use their forum to find out.

Rhoel.
User avatar
Rhoel
Posts: 844
Joined: Fri Feb 25, 2005 8:09 am
Location: Phnom Penh, Cambodia
Contact:

Post by Rhoel » Fri Mar 09, 2007 7:21 am

Bones3D wrote:Rhoel, you never cease to amaze me! This is a fantastic, yet surprisingly simple application of Blender for use with Moho/AS! ... The potential uses for this sort of collaboration could be invaluable!
I am currently experimenting with building a room set, just to see what the problems of walking a character around on the Z axis will be.

I think making a "When the wind blows" style film will be relatively easy with this approach.

Rhoel
User avatar
j0llyr0ger
Posts: 29
Joined: Sat Dec 17, 2005 12:43 am

Post by j0llyr0ger » Sat May 26, 2007 7:14 pm

Gnaws, Mancandy is a fully rigged character that is freely available online. It's not a tool built into blender. There are a growing number of fully rigged characters available for download and use in blender.

Rigging is much easier than it used to be with previous versions of blender, but it can still take much more work to rig a 3d character than a 2d one- though sometimes it can take more work to make a 2d character do something that would be easy for a 3d one.

I haven't been to this forum in a long time since animation is just one of my many interests- and I am interested in 2d and 3d animation.

Thanks for the simple tutorial on putting 3d objects from blender in AS.

For someone at home in blender like me, it seems it could be easier to do 2d character animation in AS and then use the rendered result as an animated texture pattern (with transparency) on a 2d mesh in blender to create the 2.5d effect since things like camera moves are MUCH easier and blender actually has real lighting built in (which could also affect the 2d character).

You could apply your character animation made in AS as a texture movie (with the background color set to transparent) to a single rectangular polygon in a 3d environment.
User avatar
Gnaws
Posts: 347
Joined: Tue Nov 07, 2006 9:31 pm
Location: Las Vegas
Contact:

Post by Gnaws » Mon May 28, 2007 12:09 am

j0llyr0ger wrote:Gnaws, Mancandy is a fully rigged character that is freely available online.
Thanks, j0llyr0ger. I Googled around for about 5 minutes and only found this. Is this the best one to try?
...sometimes it can take more work to make a 2d character do something that would be easy for a 3d one.
Amen, Brother

I pretty comfortable with 3D, and know my way around Lightwave pretty well as I use it at work. But the thing that appeals to me about Blender (besides being Open Source) is the AS supported texture baking Once I get my head around it (hopefully this Summer) I'd like to implement some 3D objects in a long form 2D animation I'm working on.
Post Reply