dhiru Posted August 1, 2017 Share Posted August 1, 2017 Hi, I am trying to follow along the Donut tutorial made by blender guru on youtube; so far I have a donut (torus) with some plane on it. When I try to use the Babylon js exporter following is the error I get :- Please advice. Exporter version: 4.6.1, Blender version: 2.78 (sub 0) ========= Conversion from Blender to Babylon.js ========= Scene settings used: selected layers only: false flat shading entire scene: false inline textures: false texture directory: C:\tmp\BlenderFiles\Donut\ Python World class constructor completed processing begun of mesh: Torus.001 processing begun of baked material: Torus.001 Cycles baking texture, type: DIFFUSE_COLOR, mapped using: BakingUV ========= An error was encountered ========= File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_export_babylon.py", line 330, in execute mesh = Mesh(object, scene, nextStartFace, forcedParent, nameID, self) File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_export_babylon.py", line 787, in __init__ bakedMat = BakedMaterial(exporter, object, recipe) File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_export_babylon.py", line 2135, in __init__ self.bake('diffuseTexture', 'DIFFUSE_COLOR', 'TEXTURE', image, mesh, uvName, exporter, recipe) File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_export_babylon.py", line 2167, in bake self.bakeCycles(cycles_type, image, uvName, recipe.nodeTrees) File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_export_babylon.py", line 2215, in bakeCycles bpy.ops.object.bake(type = bake_type, use_clear = True, margin = 5, use_selected_to_active = False) File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\modules\bpy\ops.py", line 189, in __call__ ret = op_call(self.idname_py(), None, kw) ERROR: Converting py args to operator properties: enum "DIFFUSE_COLOR" not found in ('COMBINED', 'AO', 'SHADOW', 'NORMAL', 'UV', 'EMIT', 'ENVIRONMENT', 'DIFFUSE', 'GLOSSY', 'TRANSMISSION', 'SUBSURFACE') ========= end of processing ========= elapsed time: 0 min, 0.0737 secs Quote Link to comment Share on other sites More sharing options...
gryff Posted August 1, 2017 Share Posted August 1, 2017 @dhiru: - David Price (aka Blender Guru) likes to use the Cycles Render Engine (CRE) to create materials for his meshes. The Blender Babylon Exporter(BBE) does not directly support the CRE (it has a lot of complex shaders) but attempts to bake out a texture. 2 hours ago, dhiru said: Cycles baking texture, type: DIFFUSE_COLOR, mapped using: BakingUV ========= An error was encountered ========= When I use the CRE to create materials, I bake out a texture from the CRE myself before exporting to a.babylon file. I then convert the materials back to Blender Render materials and now use the textures that I baked. 4 rocks The 4 textured rocks in that example were done by applying 4 different cycles materials to the UV unwrapped low poly rock in the centre (including a normal map) then baking each to a texture. The baked textures were then applied to Blender Render materials and the rocks exported. Might be tedious if you have a lot of meshes to do. Maybe @JCPalmer : can provide more info as to what the error actually is. cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 2, 2017 Share Posted August 2, 2017 4.6.1, or the single file version, has a problem that it cannot export anything using Cycles after Blender version 2.76, I think. They made a change to the names of texture types in 2.77 for Cycles in the API. The 5.4, or zip file version, has an enforced minimum version of Blender of 2.76, so there is checking to use names both ways. The only reason 4.6.1 has not been deleted is it will not work with very old versions of Blender. I have no intention of ever modifying it. This is not the only thing that is fixed in 5.4, but not 4.6.1. Switch to 5.4. You must use preferences to install it. No need to unzip it. Even so, the Cycles baking is a convenience that can sometimes have problems. If that occurs, you would need to bake it outside of the export process. FYI, for export purposes, Cycles is inferior. If you had multiple meshes with the same Cycle material, it could not be shared in BJS. A separate texture would be generated for each. Very simple materials which could be expressed in the internal renderer, should not be done in Cycles. Quote Link to comment Share on other sites More sharing options...
gryff Posted August 2, 2017 Share Posted August 2, 2017 @dhiru : a quick look at a the Blender Guru "Beginner" YouTube tutorials published in 2016 - as far as I can tell, he does not UVunrap the donut, the cup or the icing. Not sure how that will work when the exporter tries to do the baking for you. @JCPalmer : amazing that we keep running into people still using v 4.6.1. cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 2, 2017 Share Posted August 2, 2017 I think it is because they see 4.6.1 is a .py file & 5.4 is a .zip file. The readme by @V!nc3r is improved. Think the directions to install might be better right in the readme. There are directions without a picture after multiple clicks into the documentation site, but here would be better . Too lazy myself to do. As long as people post their log file, I can pick it out right from the first line. Quote Link to comment Share on other sites More sharing options...
dhiru Posted August 2, 2017 Author Share Posted August 2, 2017 Many thanks! -- I got rid of the error but now when I try my babylon-export in blender, it just hangs (I tried it multiple times). I have attached my blender file for reference (its a simple donut with multiple modifiers to reduce the glossiness. Pl. advise donut3.blend Quote Link to comment Share on other sites More sharing options...
dhiru Posted August 2, 2017 Author Share Posted August 2, 2017 Also, I tried to not use cycles render at all, and changed to blender render; but it still hangs when trying to export; Not sure if that means anything. Quote Link to comment Share on other sites More sharing options...
dhiru Posted August 2, 2017 Author Share Posted August 2, 2017 Looking at the responses carefully; I suppose the reason blender-babylon exporter hangs on this file is because I should have UV unwrapped each of the assets then "baked" each to a texture -- at the moment I am completely clueless how I would do that. Could you please point me to any literature that might explain it. Apologies for my naivety donut3.blend Quote Link to comment Share on other sites More sharing options...
gryff Posted August 2, 2017 Share Posted August 2, 2017 @dhiru : well I took a look at your file - some oddities 1. There are three objects, one with no material (the plane), one with a cycles material (the icing) and one with a blender render material (the donut) 2. As you point out there are modifiers on two of the objects which you might want to apply before trying to export or reduce the value of "view" subdivisions of the subsurf modifier to 1 The first time I tried to export the file it actually exported a .babylon file but crashed Blender So give them all a cycles material and either apply modifiers or reduce subdivisions. See what happens. cheers, gryff Quote Link to comment Share on other sites More sharing options...
gryff Posted August 2, 2017 Share Posted August 2, 2017 @dhiru : something like the image below is what you are looking for? cheers, gryff Quote Link to comment Share on other sites More sharing options...
dhiru Posted August 3, 2017 Author Share Posted August 3, 2017 Many thanks for the tips! -- live-saver!; I apologize for the hand-holding but when I added the material to my plane and also changed everything to Cycles Render; (along with applying subsurf) .. it still hangs for me; perhaps I have to wait for more than 5 mins to get the file rendered ? Could not have gotten this far! -- thanks. donut3.blend Quote Link to comment Share on other sites More sharing options...
gryff Posted August 3, 2017 Share Posted August 3, 2017 @dhiru : did you reduce the "view" divisions in the subsurf modifier before applying it ? Should not take 5 minutes cheers, gryff Quote Link to comment Share on other sites More sharing options...
gryff Posted August 3, 2017 Share Posted August 3, 2017 @dhiru : I see the latest file you posted still has 11K + vertices for the donut and icing. I just tested my export - less than 20 secs on an original Intel I5 machine running XP I will put together a couple of .blend files that you can play with. Hopefully post them later today - evening my time. cheers, gryff Quote Link to comment Share on other sites More sharing options...
gryff Posted August 4, 2017 Share Posted August 4, 2017 @dhiru : Ok I have uploaded 2 blend files in a zip file. donuts.zip The two blend files are my_donut1.blend and my_donut2.blend. I will explain the difference below. 1. my_donut1.blend a.) This is a cycles version - each part, table, donut, icing has a cycles node set up with an addition of an Image Texture node that is not directly connected to the other nodes. If you look at that node carefully it names a texture which if you look at the textures listed in the UVEditor window is just a black texture. b.) Each of the three objects has had the modifiers applied then it has been UV-unwrapped. I set the "view" subdivisions to 1 before applying it c.) I have given the scene a Sun Lamp - you can add more and move them around You can use this setup to bake out the textures by highlighting that Image Texture node (so it has a yellow line around it) then going to the Render Tab in the Properties Panel, finding the Bake sub tab and clicking the Bake button with the setting below set to "Combined" Each texture will bake in the UV window - now save them somewhere where you can easily find them. 2. my_donut2.blend a.) The same geometry as above but I have now deleted all the materials, changed from cycles to the Blender Render Engine and created three new materials. b.) Each one of these new materials has the appropriate baked texture that was save above added to it. Now export away. And here is an example of what you should see in a web browser with an Arc Rotate Camera A Donut cheers, gryff Quote Link to comment Share on other sites More sharing options...
dhiru Posted August 4, 2017 Author Share Posted August 4, 2017 Many thanks for this!; I will study them and work on them now. Thanks a lot! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.