# Exporting cycles rendered models to be used in opengl

The cube in top left corner is the default cube with change in view port color. I added checker texture to it using nodes and got it rendered using cycles render. When I exported them to be used via opengl API, the cube in top left corner,i.e. without texture, gets displayed.For any model, the only effect I observed is the change in viewport color in the model, which gets displayed via opengl. Is there a way to use rendered model or models with texture and other details added to it? P.S I have Open Asset Import Library to load scene and GLSL for implementing shader source.

• Do you want to bake the light and materials to a texture you can use with OpenGL? There are multiple tutorials on Cycles baking, including this one by Blender Guru. Have a look, it might help you. – maddin45 Nov 28 '14 at 9:39
• Seems you need baking. blender.org/manual/render/workflows/bake.html Carsten – Carsten Wartmann Nov 28 '14 at 9:40
• Even after baking the textures, it's likely that the exporter will not recognize the textures since exporters tend to be written to work with the Blender Render(Internal) material system. To export, you pretty much have to make a copy of the .blend and delete every material from Cycles then re-add materials using Blender Render for the exporter to function conrrectly. Simply disabling the Cycles nodes may not be enough since the exporter may detect them and then fail the way the SketchFab uploader does. – MarcClintDion Nov 28 '14 at 11:17
• I used the cycles baking and got a textured mesh in Material Viewport Shading, yet I cant get it to load completely,i.e. with texture, when I export it as collada file, .ply or .obj type files. To be precise I need it for game development but cant seem export model along with textures. – user3124361 Nov 28 '14 at 14:56

The main problem is that baking with Cycles is still fairly new, less than one year at the time of writing. Blender's various exporters were designed before this and they are built upon the older Blender Render(Internal) Material system. Here is a print-screen of the main Blender Render Material System. Although BI has nodes as well, I'm not so sure they will work well with exporting either.

So let's go back to Cycles for a moment. Here is a setup that has a texture which was baked using Cycles bake. The baked texture is chosen by a node as seen in the node editor but the current problem is that this node will not be recognized by the various exporters as being a texture that should be exported along with the model.

Here is an example of one difficulty that can make upgrading the various exporters to work with Cycles a bit complicated. There are three textures in the following node setup. One bake-to texture, one texture for the diffuse color input and one normal map.

Now it could be decided that the texture which is not attached to anything should be the texture to be exported as the main color texture, however, Cycles nodes allow for more than one node group as shown in the following image. The setup shown would make consistent and reliable exporting very difficult but it makes the Cycles material system very flexible. These two ideas conflict. It's not at all clear for this situation which baked texture(s) should be exported.

So for now what you can do is switch to Blender Render and deactivate the Nodes as shown in the following image.

Now click the tabbed icon for textures that is to the right of the Material tab icon and add a texture slot. Next, assign the baked texture to this slot. (Now you should be able to export without too many problems.)*

*as I mentioned in the comment earlier, leaving the Cycles nodes intact but deactivated can still cause the exporter problems. For simple scenes it doesn't always happen but with a complex scene that has 100 models and hundreds of textures all linked into the Cycles nodes system, things can get hairy for the exporter.

The textures may be detected but the exporter may not know what they mean and it could fail because of this.
The SketchFab exporter was doing this to me this past spring. It's probably better to save the .blend and create a duplicate of it and then just delete all the Cycles materials and build them up again using Blender Render(Internal) from the start.

It's a nuisance but until someone with coding skill finds the time to deal with it, this is what we are stuck with. (unless someone knows something I don't and they would like to share.) :)

• thx, I think this explains the same btw, I am too new on this anyway, so I am reading both :) – Aquarius Power Jan 6 '16 at 5:26

Since other renderers (except maybe Strata 3D) don't have a Cycles renderer or equivalent, it won't make sense to export that way because the other software cannot interpret Cycles proprietary data such as Nodes. The file would have to be exported as only the model itself and the UV map, and specular attributes applied in the receiving software.