Sign in to follow this  

blender cycles baking

Recommended Posts

I just completed a project using this technique and it works very well. In fact, I'd say that after working with Babylon a little, the ideal workflow is to avoid using Babylon's lights and shadows completely, and do all of your lighting in Blender and then use a single hemi light in Babylon.


My workflow is as follows (using the Blender renderer):


  1. Make sure all textures are unwrapped. They don't really need to have carefully cut seams, but of course that's always better.
  2. Open the texture in Photoshop. 
  3. Back in Blender, go to the object, tab into edit mode, choose the UV editor, then bake the shadows.
  4. Save the shadow image as .png.
  5. In photoshop, copy the shadow map over the original texture, using multiply. Adjust the opacity and add a slight gaussian blur if desired.
  6. Save out the new texture and apply in Babylon.

When I get some time, I'll write up a tutorial on this. It's really not that hard to do.

Share this post

Link to post
Share on other sites

I think what burbonvagin is talking about is the ability to bake textures from the cycles render engine. This feature arrived with Blender 2.71


You have always been able to bake textures, including shadow maps, with the traditional blender render engine.


Being able to use the cycles render engine means you will be able to make full use of the Node Editor in Blender to create materials then bake them textures. There is, I believe, a collection of shaders available that can be used with the cycles render engine and the new baking ability will allow these to be baked out.


cheers, gryff :)

Share this post

Link to post
Share on other sites

Hey Alex, 


Where should I click to run your demo ? I don't see any canvas in my browser...


Oops, sorry guys. The client asked to take it down momentarily. It'll be back online Friday. Sorry for the confusion!

Share this post

Link to post
Share on other sites

Ok, site is back up.


If you take a look at the scene, there is a single hemi light set as follows:


 this.scene.lights = [];var hemisphericLight = new BABYLON.HemisphericLight("hemiLight", new BABYLON.Vector3(0, 1, 0), this.scene);hemisphericLight.diffuse = new BABYLON.Color3(0.65, 0.65, 0.65); hemisphericLight.specular = new BABYLON.Color3(0.5, 0.5, 0.3);  hemisphericLight.groundColor = new BABYLON.Color3(0.2, 0.2, 0.2); hemisphericLight.intensity = 2.15;

So all of the lights and shadows are baked into the textures. On the floor, we have the basic floor material which is sort of concrete, and then on top of that I layered the output from the Blender shadow baking. It's important to not have overlapping UVs for this to work. So the floor has to be one single texture, with all UVs in their own texture coordinates. You can do this by unwrapping by hand, or even doing a UV project for textures that are just solid colors. That's how I baked the shadows on the tool boxes. For the walls, we baked in shadows from the 30 or so lights in the ceiling, and then softened those in Photoshop, leaving the ones cast from the toolbox as harder edged.


The car shadow is actually just a plane parented to the car, with a png outline of the car from the top down, made transparent and with edges softened. Then when the car moves the shadow moves with it. I don't think it's as cool as a real cast shadow but it's effective enough to sell the illusion.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.