Baking reflected environments to texture

Hello all. I am quite new to Blender rendering (my knowledge is limited to Cycles preview renders using simple materials) and I would like to replicate a handy rendering and baking trick I previously achieved in Max. The idea is to bake environment maps onto a model in order to simulate complex materials, something that proves to be very useful when dealing with game engines with limited rendering.

Here is an example. Here I am using two environment maps, one representing gold and another representing gun metal. (in my setup I am using environments maps stored in cylindrical format, but I would be fine with using a matcaps/lit sphere format since converting between the two in Photoshop is trivial). The reflections are applied to the model, and can then be baked to texture. If I am not mistaken the baker uses the current viewport camera as a point of reference for the environment baking. As an icing on the cake I am also blending in an AO pass, but that of course is not a requirement since it can be done later directly on the texture.



Now my understanding is that Cycles baking can do all this, but my attempts have not been successful probably because I am not using the right kind of projection or missing some setting. What is the proper way to achieve such a bake ?

Thank you for you help !

For a similar effect, you shouldn’t use baking… (I don’t even know why baking has the ‘Glossy’ option, since it doesn’t represent anything usefull)

Whenever you need reflections in your materials, you need to suply info from the surroundings. An enviroment texture is the best option here, and you need to have different enviroment textures, depending the surroundings of your objects (different places, different textures).

Place a camera in the center of your object, hide the object, and set your camera to ‘Panoramic’. Render the enviroment, and use that image as you normally would.

:wink:

So, you want to know how to bake an equirectangular cube map in Blender?

So, you want to know how to bake an equirectangular cube map in Blender or you don’t know how to use one in Blender?

Hi -

Secrop : I am looking for a way to replicate the useful technique described in the breakdown image. In this example I am using an equirectangular (= cylindrical globe mapping) image ; another very popular way of storing such faked material information is “litspheres” or “matcaps”. The whole point is for the image to provide all the information from the surroundings, as well as to simulate stylized material properties. In other words : in this case the Blender scene would have no ambient light, no other objects influencing the render, and no light sources. The environment image is then baked to the UVs of the model. This is extremely useful for game art with low tech specifications, and saves a lot of time usually spent painting in these highlights manually.

Helluvamesh : I would say both. So far my knowledge is limited to loading HDR maps as environments for cycles, as done here :

http://i.imgur.com/cBR3AYF.png

From there I indeed want to know how to bake the reflections provided by the environment map onto the model UVs/texture. I can see two ways of achieving the result : either by sampling it as if it was a spherical environment (fixed reflection), or, as reflected onto the object based on the camera angle (which was the case in my example). Both can be very useful, but at the moment I do not know how to setup the scene to achieve either. Thanks !

Just clear camera location and rotation, select camera and set it to to Orthographic in the camera properties.
Create the image map assign the UV’s add image texture node to the object material Do not connect it, bake environment.

Here’s something quick after looking up some forum posts.
Feel free to ask any details left out of image (if there are any and if this helps):
http://www.pasteall.org/pic/show.php?id=103233

That seems like an odd way to handle the reflections. The environmental texture should be mapped using the Reflection coordinates, and it should use the environmental texture node rather than the standard image node, exactly as if you were adding an environmental texture to the World. Also, if he has the environmental texture, there is no reason to bake the environment.

Rambo : that does sound relevant, however I am looking for more clear explanations since I am new to this.
Eppo : this does look extremely promising ! I’ll try it asap.
Austin : I see what you mean. On the subject of baking the material texture and the environment separately : indeed that does seem redundant in the context of my example ; however I can see it as a nice added bonus which might turn out to be useful in some cases.

I’ll try all this and will report back with my results.

Irrelevant

deleted…

Ever happened to delete Camera shortly before baking?

You right , camera seems to be irrelevant when you bake the environment. I guess I thought is the same when you render the scene in panoramic 360 you have to clear camera location.
There you go learned something new.

I am happy to report that this is working as intended ! I am using an emissive shader, and indeed relying on a camera to finely tune the main direction of the matcap. Thank you for mentioning that I was supposed to select the image node that I want to bake to, as this wouldn’t have occurred to me otherwise.

It was also nice to see that such a matcap setup can be displayed in the realtime viewport too - very useful stuff as well.
Thanks again !