Moon Posted May 26, 2014 Share Posted May 26, 2014 Hello,First of all thank you for this wonderful FrameWork, it's just amazing. I discovered it less than one month ago. This is my first post, and here is my problem: I use the latest version of FireFox and the lastest stable version of BABYLON.JS I have a blender scene, which I want to load, but what happens is that either it gives me some errors like "TypeError: vbo is null" and "Unable to compile effect: default" .... or it shows the ground and the box I created with BBJS along with a "map of the town scene that I wanted to load but not the actual buildings... And here is the part of my code that handles the loading:var moteur = new BABYLON.Engine(jeu, true);// var scene = new BABYLON.Scene(moteur); BABYLON.SceneLoader.Load("", "Ville.babylon", moteur, function (scene) { scene.executeWhenReady(function () { scene.collisionsEnabled = true; scene.gravity = new BABYLON.Vector3(0, -9.81, 0); var joueur = new BABYLON.FreeCamera("Joueur", new BABYLON.Vector3(25, 2, 24), scene); joueur.applyGravity = true; joueur.checkCollisions = true; joueur.speed = 0.3; joueur.attachControl(jeu);Is there something that I misunderstood or should know about loading Blender scenes ?I tested loading a scene containing a simple building (i.e. Just one cube scaled three times vertically, without any texture or material and it worked just fine). Quote Link to comment Share on other sites More sharing options...
Moon Posted May 26, 2014 Author Share Posted May 26, 2014 I have attached a screenshot to this post for more clarity. Thank you in advance.Blender Town Plan.bmp Quote Link to comment Share on other sites More sharing options...
Kilombo Posted May 26, 2014 Share Posted May 26, 2014 Hello there and welcome aboard. Can you please post more code (what's happening in the render loop?).Btw, you have the "var scene" commented out, it won't work for sure that way. In a first look everything seems ok. Can you jsfiddle? Quote Link to comment Share on other sites More sharing options...
Moon Posted May 26, 2014 Author Share Posted May 26, 2014 Hi, thank you.Before I go further, I wanted to ask: is there a limit on the number of vertices... the imported scene can have ? I think I have read it somewhere... And by the way, at http://blogs.msdn.com/b/eternalcoding/archive/2013/06/28/babylon-js-how-to-load-a-babylon-file-produced-with-blender.aspx they didn't instanciate the scene before the loading request.Also, as you can see in the screenshot, the scene does appear (with ground and skybox) but without the imported part from Blender. But sometimes nothing appears and just throws errors... Quote Link to comment Share on other sites More sharing options...
Dad72 Posted May 26, 2014 Share Posted May 26, 2014 Yes, something like 65536 Quote Link to comment Share on other sites More sharing options...
Moon Posted May 26, 2014 Author Share Posted May 26, 2014 It's probably that which causes me problems, because my scene is a monstruous one with hundreds of buildings and tens of cars (the cars are probably the worst part). I will edit it and see how it goes. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 26, 2014 Share Posted May 26, 2014 The limit is per mesh. A mesh cannot have more than 65536 vertices because else you need more than a 16bit index to address itThere is no limit when it comes to the limit of meshes per scene Quote Link to comment Share on other sites More sharing options...
Moon Posted May 27, 2014 Author Share Posted May 27, 2014 Ah okay, thanks for the info. Anyway, I have edited the scene during the night and reduced the number of cars and buildings.I tried to load it again but most of the time, the browser didn't render anything and just throwed errors (will past the various errors at the bottom), and sometimes it rendered the BBJS ground and skybox only to crash 2 seconds later. Then I had some chance and it rendered for a little longer (1 minute or so) and I have gladly seen that it managed to load the cars but not the buildings Here are the errors I have got:-------------"Unable to compile effect: default" babylon.js:1"Defines: #define UV1" babylon.js:1"Optional defines: " babylon.js:1------------"Unable to compile effect: default" babylon.js:1"Defines: #define REFLECTION#define LIGHT0#define POINTDIRLIGHT0#define UV1" babylon.js:1"Optional defines: " babylon.js:1------------Error: WebGL: drawElements: must have element array buffer binding babylon.js:1TypeError: vbo is null babylon.js:1"Unable to compile effect: default" babylon.js:1"Defines: #define REFLECTION#define LIGHT0#define POINTDIRLIGHT0#define UV1" babylon.js:1"Optional defines: " babylon.js:1TypeError: vbo is null babylon.js:1 Quote Link to comment Share on other sites More sharing options...
Moon Posted May 27, 2014 Author Share Posted May 27, 2014 And here is a screenshot of the loaded cars, note that only the cars have been loaded and they didn't show textures...loaded cars without textures.bmp Quote Link to comment Share on other sites More sharing options...
Moon Posted May 28, 2014 Author Share Posted May 28, 2014 Can someone here provide me with .blend and .babylon files (nothing fancy, a box with an image texture will do) along with the used texture, that is working for you, so that I can try to locate the problem, if it's with my code, computer, browser or Blender... That would be highly appreciated. Thank you. Quote Link to comment Share on other sites More sharing options...
gryff Posted May 28, 2014 Share Posted May 28, 2014 Can someone here provide me with .blend and .babylon files (nothing fancy, a box with an image texture will do) along with the used texture, that is working for you, so that I can try to locate the problem, if it's with my code, computer, browser or Blender... Here is a zip file containing a babylon file for a textured cube, the texture and a simple html file to load the babylon file. I have also included the cube.blend file so you can check it out. If the car meshes are being seen with no textures - check out the material and texture set up in the .blend file. If you don't set up the textures properly in Blender they wil not show in your scene. cheers, gryff cube_babylon.zip Moon 1 Quote Link to comment Share on other sites More sharing options...
Moon Posted May 28, 2014 Author Share Posted May 28, 2014 Thank you so much.I have downloaded it and will check this out as soon as I get up, it's 5:05 a.m. here and I need some sleep. ^^ Quote Link to comment Share on other sites More sharing options...
Moon Posted May 28, 2014 Author Share Posted May 28, 2014 Your Babylon file works and the one I exported from your Blend file works as well, so this means that the problem is within my Blender file. Can you give me some advice as to how to proceed to have this working ?In my scene, the buildings have been UV Unwraped and then a material having an image texture has been applied to the faces... Quote Link to comment Share on other sites More sharing options...
gryff Posted May 28, 2014 Share Posted May 28, 2014 Can you upload a couple of blender files somewhere so I can download them and take a look ? Hard to say what your problem is without looking at them. cheers, gryff Quote Link to comment Share on other sites More sharing options...
Moon Posted May 28, 2014 Author Share Posted May 28, 2014 I could finally reproduce the textured cube you provided me. So now, I'm completely sure that the problem was/is within my original scene. Thank you very much. Now that I have understood the right procedure, I will try to fix my scene. If you are still interrested, I can share it with you and you will give it a look to help me fix it. Quote Link to comment Share on other sites More sharing options...
Moon Posted May 28, 2014 Author Share Posted May 28, 2014 I realized a very important thing here... I HAVE TO USE the Blender Render and NOT the Cycles Render.Maybe you can add/mention it in the artcile talking about Blender, @DeltaKoch. Because, while my scene looks just amazing in Cycles, it's plain white with Blender Render. Quote Link to comment Share on other sites More sharing options...
gryff Posted May 28, 2014 Share Posted May 28, 2014 If you are still interrested, I can share it with you and you will give it a look to help me fix it. Sure. I'm willing to help. will need to look at some .blend files though. I HAVE TO USE the Blender Render and NOT the Cycles Render. Does that solve/explain your issues? cheers, gryff Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 28, 2014 Share Posted May 28, 2014 Absolutely we only support Blender Render. I definitely need to update the doc with this information. Quote Link to comment Share on other sites More sharing options...
Moon Posted May 30, 2014 Author Share Posted May 30, 2014 Does that solve/explain your issues? Yes, that was the main reason, I switched to Blender Internal but after some tests, I still had the precedant errors... so I'm re-doing the scene from scratch in Blender Internal and it's much faster and lighter. Also I wanted to ask, which lights settings would you advise me to have a good rendering ? I ask this because I noted that the imported scene is affected only by its lights from Blender and not the one in BabylonJs. Thanks again for the cube file. It really helped me understand the origin of the problem. Quote Link to comment Share on other sites More sharing options...
gryff Posted May 30, 2014 Share Posted May 30, 2014 I ask this because I noted that the imported scene is affected only by its lights from Blender and not the one in BabylonJs. Moon: when I first started using BJS I was a little diasppointed with the lighting - but that has changed with the more recent versions as the range of the Omni and Spotlight. can now be controlled. Normally, when I am creating stuff in Blender I usually add a camera (FreeCamera) and a Hemi light (basic flat cloudy day lighting)- just so I can visualize a scene without having to add anything. to the script. You can add your lights in the script no need to add them in Blender as well as change the camera type. The only light I have experimented with is the Omni llight - setting range/intensity. Seems to work well. Also, if you want to you can open the .babylon file (I use Notepad++) and change the values of various parameters - cameras and lights are usually right at the top of the file - I used that to tweak the range and intensity when I was testing the Omni light. It really is a matter of trying various lighting layouts until you get the effect you want. Ohh, and I believe there is a limit of 4 lights that can illuminate a single mesh. cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 30, 2014 Share Posted May 30, 2014 The limit is per mesh. A mesh cannot have more than 65536 vertices because else you need more than a 16bit index to address itThere is no limit when it comes to the limit of meshes per sceneTechnically I do not see that there is a limit, since the python script breaks large blender meshes into multiple babylon meshes with ones after the first forced parented to the first. Noticed side effects of parenting as opposed to s single babylon mesh though. First is if you move, position, parent mesh in code after all the kids do not move as well. Also not sure if problems will result from a multi-mesh with armature. Quote Link to comment Share on other sites More sharing options...
Moon Posted May 31, 2014 Author Share Posted May 31, 2014 C'est reparti pour un tour ! I finished re-doing the scene and guess what... the errors reappared again and it wouldn't render anything. To give you some details about what I did, here it is: I modeled some basic buildings and then went to the first layer where I generated a town on a subdivided plane (grid) with a particles system where the buildings rise from the vertices of the grid. It gave me the following errors:"Unable to compile effect: default" babylon.js:1"Defines: #define LIGHT0#define HEMILIGHT0#define UV1" babylon.js:1"Optional defines: " babylon.js:1"Unable to compile effect: default" babylon.js:1"Defines: #define DIFFUSE#define LIGHT0#define HEMILIGHT0#define UV1" babylon.js:1"Optional defines: " babylon.js:1So I thaught the light was the problem, so I simply deleted it to test it out, then I got the following errors:"Unable to compile effect: default" babylon.js:1"Defines: #define UV1" babylon.js:1"Optional defines: " babylon.js:1"Unable to compile effect: default" babylon.js:1"Defines: #define DIFFUSE#define UV1" babylon.js:1"Optional defines: " babylon.js:1Then I tried with the last saved file before I make up the grid and it worked twice out of three (the first and the third time). If you want to give it a try, here is the babylon file (the grid version) attached, just change its extension from .txt back to .babylonVille2.txt Quote Link to comment Share on other sites More sharing options...
gryff Posted May 31, 2014 Share Posted May 31, 2014 Can you post the blend file and any associated textures (zip it) Moon so I can take a look? cheers, gryff Quote Link to comment Share on other sites More sharing options...
Moon Posted May 31, 2014 Author Share Posted May 31, 2014 Of course, here they are, the textures have been zipped together, and for the blend file you jus need to change its extension back to .blend As a side note, for some of those buildings, I UV Mapped them but I didn't yet assign them their material.ressources.zipimmeuble7.txt Quote Link to comment Share on other sites More sharing options...
gryff Posted May 31, 2014 Share Posted May 31, 2014 TY Moon - will get back to you tomorrow - it is 3.00am here - I need sleep cheers, gryff 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.