Ambient Occlusion issue: "No objects or images found to bake to"

Hello all, I have a little issue with baking ambient occlusion in Blender Internal.
I have done this successfully on simple objects but sometimes it fails on more complicated ones.
“No objects or images found to bake to”

I suspect it is related to the objects I am using, which have been imported from Maya as obj files. They are reasonably high res handbags. Each is made up of multiple objects, some high, some low density meshes.

I need to fix this, so what could be causing it?

have you added a blank image to your UV coords in the UV editor?

Hi Modron, I created a new blank image with default settings.
I tried saving the image and re-opening the image.

The imported obj files have UVs already set up to match texture bump maps, so I don’t want to alter the UVs.
Perhaps the default UVs are in some way not recognised as being a valid unwrap. However I am not sure how to unwrap these objects again and still retain the original UV layout.

Any thoughts?

Have you assigned this new image as a texture on texture panel? Probably not yet… If you open this image in UV editor and switch to edit mode, does UV editor gets blank? Does it have another image as soon as you switch edit mode? If so change to what you have created. Select all mesh - it should be visible as some unwrap on this image. If it is - bake.

Hi Eppo, I had tried that but it hadn’t helped.

However, things have changed since I tried this yesterday. Today I am getting successful bakes on some files, but I did restart the PC. I assume something caused a glitch, but I am testing one of the more complicated files.

I have found that this file had two identical sides, which must have been mirrored originally as the UVs are in the exact same position. Those parts had been separate objects and I had joined them together.
I assume that the AO baking does not work with overlapping UVs, even if they are identical. I separated the component parts and the AO baked on one side but not the other, so I flipped the UVs on the side that did not work (S X -1). This seems to have worked.

The following is all the things I double checked:

  • New blank texture file created in Blender for baking AO.
  • This new file is saved as a jpeg externally.
  • Default World settings with Ambient Occlusion ticked, with Gather on approximate.
  • Material on object has a texture with the blank AO jpeg assigned to it, with UV mapping and the correct UV map (I have two UV maps on the objects) that you want to bake to.
  • Most importantly, I checked for identical overlapping UVs. Separated the objects and flipped the UVs of the mirrored side.

So which factors are likely to be show stoppers for baking AO? I assume the last one is, but do the others matter?

BTW I did mean to post this on the texturing thread not the modelling thread. I hadn’t noticed that I clicked on the wrong one.

There is nothing preventing to bake AO on overlapping (mirrored islands, ofc) UVs. http://www.pasteall.org/blend/31278
You might consider using pngs instead - jpgs have compression errors but that is not the cause of your problem, sure.
Btw, it used to be texture amount limit you could have for object. Tbh, i don’t know if that is changed, it might be now. How many textures you have on?

Edit: this doesn’t sound like ‘solved’, is it?

You are right, although what I did appeared to solve the issue in one case, my assumption was that it was the the solution.
Whether it is png or jpeg is irrelevant though. I am only using jpegs to reduce file size to use on the web.

However if baking AO on overlapping UVs does not normally prevent baking, then the issue is likely more to do with the files I am using.

The workflow I am using is as follows:

  • Import obj file into blender, which contains many separate objects that are part of a product
  • Delete materials that came over from Maya/Arnold from the objects
  • Apply a default material I have prepared to the objects, making it unique and renaming for each object
  • In textures, relink the bump map files to corresponding objects
  • Create an additional new UV map and move the UVs up, down, left and right, into adjacent ‘tiles’
  • Join objects together into one object, open new UV map to check all UVs have moved to adjacent tiles if necessary, so there are no overlaps
  • Scale the UVs x 0.3 so all nine ‘tiles’ fit on one UV tile
  • Bake one AO map that the new combined object can use
  • Bake one Normal map from all of the bump maps (yes I create an extra large 4k blank file to compensate for the scale, to avoid losing resolution)
  • Select certain component parts of the mesh and separate them into predefined objects (not all the individual objects that it was originally)
  • Now I have a handful of selectable objects, all using one material, with one AO map and one Normal map (instead of over a dozen objects all with their own materials and bump maps)

I think the best thing to do is alter my workflow to include a stage before the imported objects are joined together.
This stage would be to do a test AO bake on each component, to make sure it bakes properly.

My assumption is that the file imported from Maya contains UV information that is in some way incompatible, until I manually edit it.

I just did a fair amount of testing. Both with importing the obj with default settings (which separates the imported object into multiple objects based on the file’s original settings) and changing the default import settings so that it doesn’t split it into different objects.

I went back and forth trying various settings that we have discussed. The overlapping or complicated UVs seem to increase the risk of failure, but overall the baking seems a little unstable (although conditionally unstable).

Revised AO baking Material checklist:

  • New blank texture file created in Blender for baking AO.
  • This new file is saved as a jpeg or png externally.
  • Reload this file, as it may disappear when trying to bake, causing an error.
  • Material on object has a texture set to image.

Lastly, this will not prevent the baking if not done, however it may help prevent the blank AO image disappearing (I am not certain):
In the Material texture image section, assign the blank AO jpeg to it. with UV mapping and the correct UV map (I have two UV maps on the objects) that you want to bake to.

Additional AO baking OBJECT checklist:

  • Object is in Edit mode.
  • Select all faces.
  • In the UV window, select all faces.

Now, I have found that not all of the OBJECT checklist is necessary all of the time, but with a complicated object containing mirrored UVs, all the steps should be followed.

I have also found that bakes often fail first time and you should just reload the blank AO file, or select it from the list, and hit bake again for simple bakes to work.

I have tested within the same file, on different objects and proved the following:

  • On a simple object (one island) you can have all the material checklist done, but still be in Object mode (I had previously been in edit mode but not selected any of the UVs), and the bake will work.
  • On a more complicated object, with multiple islands, the bake will fail in object mode. It will work in Edit mode without selecting any of the UVs.
  • For an object containing overlapping mirrored UVs, it is necessary to have the faces selected in the UV window for the bake to work.

Since this seems to cover everything, the question is now: Is this conditional stability in baking a bug that should be reported to Blender devs?

Does anyone have thoughts on this? Should this checklist be altered, added to, clarified in any way?

Eppo, I forgot to mention specifically, I deleted all the materials and created a new one, with a new texture for the AO map.
Although the default material I set up for use has a texture layer for:

  • AO
  • Normals
  • Matcap colour
  • Matcap lighting (yes I am trying to separate this intentionally)

I don’t think that this is going to effect the baking in any way.

BTW you said “overlapping (mirrored islands, ofc) UVs”. What does “ofc” mean?

Ha, of course (ofc), silly me. I was thinking you were just referring to another overlapping UV situation. LOL.

Anyway, I am thinking this whole issue comes down to the way Maya and Blender handle mesh generation. The checklist probably will not apply to any objects created within Blender, but as I am importing an obj that was generated from Maya it brings with it some hidden flaws.

I am on Windows 7 and I am using Blender 2.70. I had already downloaded 2.71 but forgot to install it. I will do that now anyway.

I will check out those scripts, thanks. Greg Zaal does some great work.

Do you mean a Blender file to share as an example? For testing etc?

Yes, blend file, that is a requirement for error report too.
I don’t think there cold be import flaws - obj is simple enough format but you never know… If you had Meshlab, that can check if there is something unusual or some errors in obj file and it gives better error descriptions imho.

I do have Meshlab, but not used it much. However I am not saying there is something wrong with the obj. I am saying Maya and Blender may have fundamentally different methods of creating a mesh and applying UVs. It may not be apparent to the user, but shows up with errors like this. In the code the vertices may be ordered, or the UVs applied, differently.

Or I could be completely wrong… ;D

I’ll work these files then provide a test file.

Have you verified that the object to bake to is in a layer that is set as renderable in the Render Layers?

That is another limitation of bake textures, don’t ask me why.

paolo

Yes I did check the render layers first. I checked everything I could think of. The exact same settings work with an object created within Blender, so I am putting it down to the imported data.
Since I set myself a check list I haven’t had any failed bakes, so it is just a case of working smart, to avoid the frustration of trying to work out where the issue may be.

If anyone has random bake fails, follow my check list.

I am still working on these files, on a deadline. Next week I’ll take a few parts, stick them in a test file and share.

While I’m not sure this is still the case (haven’t baked anything in BI for ages), BI used to use this ancient thing where each face could have a different texture assigned. Have you tried opening your UV editor, selecting all the faces and then selecting your target texture image?

I am not sure what you mean. Are you referring to something different to what I am doing? Sounds the same.

I am baking AO and found the most reliable way to get it to work is to select all the faces in edit mode and making sure the image is loaded (not just relying on creating a new image). If you see the earlier post regarding my checklist and the conditional failure, you can see that it does not always appear to be necessary to even be in edit mode or have faces selected, but with these imported objects is certainly makes the process more reliable.

What you say sounds like the process I have found to work already, unless you are meaning something different.

Piotr, I just looked at your Meltdown bake tools addon. Does it do anything specific that you really wanted to achieve? Or is it just a collection of the most useful settings in one place?