JCPalmer Posted June 27, 2014 Share Posted June 27, 2014 I did just like your enhancement request for shape key animation, but this is not that (Nice to have something to play with though). I look at the export script and it is looking for fcurves in amination_data.action. That's interpolation right? Quote Link to comment Share on other sites More sharing options...
gryff Posted June 27, 2014 Share Posted June 27, 2014 ....shape key animation, but this is not that Jeff, I'm not quite sure I understand that. The animation is done with a shape key. - but just one. Cloth Animation2 I look at F-curves as how the interpolation is done. In this new blend file, the same cloth animation, but more animation editor windows open: 1.The Action Editor - allows you to edit/create animations for whole objects and rigged objects. Currently empty as the animation does not involve moving objects.2. The F-curve editor - allows you to define how the interpolation takes place. On right of that window you will see a box with the type of interpolation - currently set to Bezier. You can also tweak individual points ot groups of points, by scaling or moving them and by adjusting the handles.3. The Shape Key Animation Editor - you can create animations with one or more Shape keys - objects don't move - but the vertices that make up the mesh do.4 The Default Time line. Finally over on the far right you will see a Shape Key box with "Draped" highlighted. Below that is a slider (currently at zero) drag it and watch the cloth change. If you want to look at an example with multiple shape keys, I can dig out the head I used in my Unity Lipsync demo. cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 27, 2014 Share Posted June 27, 2014 gryff,Just to be clear, shape keys would be an enhancement. I am interested in it and trying to find out where in the python API the data for it is. The animations & other things I requested are currently supported features of the existing production exporter(possibly undocumented). The tablecloth examples are a good start for me, as I know there is data for me to find & I do not have to make anything, thanks. What I had in mind for the base-case model was to add stuff to it so many export features could be exercised. They might make a silly model, but the overall purpose of the model is deadly serious. Maybe something like add a plane to act as ground and receive shadows. Make sure the light is directional (sun) type, since it is the only kind of light that casts shadows in Babylon. Do not worry about clicking the custom properties to cast/receive shadows or creating a shadow map for the light. The new exporter has its own. I'll turn them on once I get the model. For other stuff just go wild like add fog, a multi-colored cube that rotates like a disco ball. Make the camera pan back and forth. This animation is directly either on the camera or mesh thru the structure animation_data (table cloth has nothing in animation_data). The script for camera is:You only have to understand this enough to know how to get it into the model. if camara.animation_data and camara.animation_data.action: TowerOfBabel.log('animation begun of camera: ' + self.name) self.animations = [] for fcurve in camara.animation_data.action.fcurves: if fcurve.data_path == "location" and locAnim == False: self.animations.append(VectorAnimation(camara, "location", "position", 1)) locAnim = True #Set Animations self.autoAnimate = True self.autoAnimateFrom = 0 self.autoAnimateTo = bpy.context.scene.frame_end - bpy.context.scene.frame_start + 1 self.autoAnimateLoop = TrueThe code for mesh is (object is the mesh): if object.animation_data and object.animation_data.action: TowerOfBabel.log('animation begun of mesh: ' + self.name, 2) self.animations = [] for fcurve in object.animation_data.action.fcurves: if fcurve.data_path == "rotation_euler" and rotAnim == False: self.animations.append(VectorAnimation(object, "rotation_euler", "rotation", -1)) rotAnim = True elif fcurve.data_path == "location" and locAnim == False: self.animations.append(VectorAnimation(object, "location", "position", 1)) locAnim = True elif fcurve.data_path == "scale" and scaAnim == False: self.animations.append(VectorAnimation(object, "scale", "scaling", 1)) locAnim = True #Set Animations self.autoAnimate = True self.autoAnimateFrom = 0 self.autoAnimateTo = bpy.context.scene.frame_end - bpy.context.scene.frame_start + 1 self.autoAnimateLoop = TrueHere I would go for the the disco cube, rotation_euler. Might look pretty funny for that man to go strolling thru the fog with that above his head. Jeff Quote Link to comment Share on other sites More sharing options...
gryff Posted June 28, 2014 Share Posted June 28, 2014 Just to be clear, shape keys would be an enhancement. Understand that - but was not sure exactly what the dividing line was. I will try to build a test file for you though I think "fog" is going to be a problem. Blender has a number of ways of doing fog , smoke, fire etc. but they are usually for situations where you produce still renders or animations - not a 3d setup. Example "Mist" is produced in a render by adding an alpha factor to objects as they get further away from the camera in a render. Will try to make a test file for you after my guest leave next week. cheers, gryff Quote Link to comment Share on other sites More sharing options...
Wingnut Posted June 28, 2014 Author Share Posted June 28, 2014 Hi guys. JC... at http://www.blender.org/support/ ... in the 'demo files & FAQ' section, there is a link to the 'regression suite' which is supposedly a large package of Blender test files. Might be worth a look. If you want to avoid all the BS, its link is http://download.blender.org/demo/test/test260.tgz . Thanks again for your cool work on exporting. I love hearing you talk about it, and feeling your enthusiasm. I hope hope hope you make Tower of Babel free for us (maybe with a donations link). What a great contribution it will be. You'll not only be a hero for Babylon users... but for ALL people who export from Blender. And you seem to teach REAL WELL, too, so comment that puppy to the gills, and it won't need any documentation. I would be more than glad to voluntarily help with ongoing support where ever I can. As best I can tell, you have essentially created a 2-way exporter. One choice... make a .babylon file, and the other choice, make a Babylon ready-to-use scene. I love that idea. JCPalmer 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted June 29, 2014 Share Posted June 29, 2014 Jeff, one issue that might crop up when sharing .blend files is whichg version of Blender was used to create them. Example, files created in Blender 2.63+ when opened in Blender 2.61 and earlier will show up without faces - just a wireframe. Another example, if I create a .blend file in Blender 2.71, when I open it in Blender 2.69 I get a warning message telling me that "data maybe lost" as it was created in a later version of Blender. So, it might be a good idea if I use the same version as you to create test files (which I will start in a couple of days). cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 30, 2014 Share Posted June 30, 2014 gryff:Good to know, about the versions. On Ubuntu (my dev system), I am using 2.69, because I was in a hurry after nuking my Window 7 a couple of weeks back, and this is the version piped in from this Ubuntu software packager thingy. On OSX, I use 2.7a. Go with 2.69, as this model is intended to be put in GIT for regression testing of future modifications. Most software will open an older version of a file that is uses, and possibly update them. Wingnut:Thanks for the source for some more .blend files to try. I plan on justing putting Towel of Babel in GIT, just like the original exporter. Not in any hurry though. There is a fully working exporter in production. I am starting to play with Shape Keys, which is a higher priority. There is also a problem with dealing with the way Babylon implemented Instances. My plan is to fully support my commercial needs first. After that, it is in my interest that not it HAVE TO BE supported by me. As far as documentation, It is sort of the same program, massively reorganized into smaller python OO classes. The original was created right at the beginning of this project, and it shows it. It was just one monolithic class, with everything done in a single pass. Almost every new project has one these. You need to pump data in from an external source, then you have to quickly focus on using it. You just get this program to work, not put it in an easy state to maintain. Towel of Babel has python classes for World, Mesh, SubMesh, Node, Camera, Light, Texture, Material, Mult-material, bone, skeleton, & animation/Vector animation subclass. Each of these classes has a constructor, which does the first pass of pulling out all the things that are needed and doing any processing needed to make them Babylon ready. Each class also has both a to_scene_file() & to_java_script() methods to write the babylon friendly data to its respective output. This level of modularity makes it vastly more maintainable than before. Jeff Wingnut 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted July 1, 2014 Share Posted July 1, 2014 Go with 2.69 That is the version I will use cheers, gryff Quote Link to comment Share on other sites More sharing options...
Abhay Posted August 25, 2014 Share Posted August 25, 2014 hello ! I have exported a scene from blender it's working fine in web .But i want to change its texture and color dynamically . e.g. Suppose i have a bag object i have exported it from blender its name is test.babylon it has a texture name base.jpg.But i have have 3 another textures . i have create a dropdownlist in my html page. So i want to if i have selected red/black/purple from dropdownlist bag texture should be change .Please do help me out . Thanks in advance . Quote Link to comment Share on other sites More sharing options...
Temechon Posted August 26, 2014 Share Posted August 26, 2014 Hi Abhay, I'm just linking to your own thread for future readers : http://www.html5gamedevs.com/topic/8773-change-texture-dynamically/Cheers, Quote Link to comment Share on other sites More sharing options...
qqdarren Posted June 15, 2015 Share Posted June 15, 2015 Bringing back to life an old thread here! It seems like the answer to this is to use submeshes and a multi-material? Temechon's code is pasted in below. But I'm struggling to understand the SubMesh() parameters: it feels like they are magical numbers just plucked out of thin air. How do I know the numbers to use for each of the 6 faces of the box? Also, on one of tries, I got the texture on just one face, but it was upside down. I wondered if giving the numbers in a different order can fix that, or if I have to rotate the whole box? BTW, I have a two-sided plane, working, but I don't like that when I rotate around it that it has no depth, which is why I want to create a box instead:var myImage = new BABYLON.StandardMaterial(null, scene);myImage.diffuseTexture = new BABYLON.Texture("textures/img1.png", scene);myImage.backFaceCulling = false;myPlane = new BABYLON.Mesh.CreatePlane(null, 2.0, scene, true);myPlane.material = myImage;(The textures I put on each side might be dynamic textures, which is why doing this in Blender is not a solution.) Temechon's code from earlier in this thread:var wall3DMaterial = new BABYLON.MultiMaterial("wall3DMaterial", scene);wall3DMaterial.subMaterials.push(wall3DInnerMaterial);wall3DMaterial.subMaterials.push(wall3DOuterMaterial);wall3DMaterial.subMaterials.push(wall3DSideMaterial);wall.subMeshes = [];var verticesCount = wall.getTotalVertices();// Material at index 1 : wall3DOuterMaterialnew BABYLON.SubMesh(1, 0, verticesCount, 0, 3, wall);new BABYLON.SubMesh(1, 0, verticesCount, 3, 3, wall);// material at index 0 : wall3DInnerMaterialnew BABYLON.SubMesh(0, 0, verticesCount, 6, 3, wall);new BABYLON.SubMesh(0, 0, verticesCount, 9, 3, wall);//Material at index 2 : wall3DSideMaterialnew BABYLON.SubMesh(2, 0, verticesCount, 12, 24, wall); Quote Link to comment Share on other sites More sharing options...
qqdarren Posted June 15, 2015 Share Posted June 15, 2015 Trial and error found the 6 faces, but I cannot solve the problem that "Front" is upside down, and "Back" isn't. BTW, there seems no difference between doing "0,6" vs. two commands, "0,3" and then "3,3", as Temechon did. (?)myBox.subMeshes.push(new BABYLON.SubMesh(0, 0, verticesCount, 0, 6, myBox)); //FrontmyBox.subMeshes.push(new BABYLON.SubMesh(0, 0, verticesCount, 6, 6, myBox)); //BackmyBox.subMeshes.push(new BABYLON.SubMesh(1, 0, verticesCount, 12, 6, myBox)); //RightmyBox.subMeshes.push(new BABYLON.SubMesh(1, 0, verticesCount, 18, 6, myBox)); //LeftmyBox.subMeshes.push(new BABYLON.SubMesh(1, 0, verticesCount, 24, 6, myBox)); //TopmyBox.subMeshes.push(new BABYLON.SubMesh(1, 0, verticesCount, 30, 6, myBox)); //Bottom Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 16, 2015 Share Posted June 16, 2015 These are the constructor args for submesh:constructor(public materialIndex: number, public verticesStart: number, public verticesCount: number, public indexStart, public indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox: boolean = true)you are setting the verticesStart to always be 0, with also the same count. That seems wrong. Quote Link to comment Share on other sites More sharing options...
qqdarren Posted June 16, 2015 Share Posted June 16, 2015 JCPalmer: every example I've seen does it that way (though that does suggest those two parameters are redundant, doesn't it):http://makina-corpus.com/blog/metier/2014/how-to-use-multimaterials-with-a-tiled-ground-in-babylonjshttp://blogs.msdn.com/b/eternalcoding/archive/2013/07/10/babylon-js-using-multi-materials.aspx Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 18, 2015 Share Posted June 18, 2015 They are not redundant. From my work refactoring the Blender python export script, I know it builds different values for them. I can see where each section had the same vertex count. The examples are building even sized sections. The verticesStart really should not be the same. Think that you can get away with it, since the only internal use of these is in refreshBoundingInfo(). These are public members though, so external parts of the framework can reference them. 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.