|
Mich, Newbie
Posted: 17 June 2011 02:18 PM Total Posts: 4
Hello guys !
I’m working currently on a project migration from blender/Unity to blender/Away3d (Broomstick). I realized many tests in order to evaluate capabilities for this engine but unfortunately, nothing specific works. What is the problem ? Why any exports from my blender haven’t been parsed correctly ?
About, the obj format, I haven’t textures who are rendered, with the mtl file. Beyond, concerning the avatars animations, the MD5 export, collada don’t work.
Unless I don’t know how to do but seriously, I haven’t ideas.
Someone could help me please ?
Thx a lot.
PS.: For the most adventurous guys, u can see sources at : http://www.sendspace.com/file/5pyldj
|
John Wilson, Member
Posted: 20 June 2011 11:58 AM Total Posts: 62
[ # 1 ]
Hi,
I rarely have problems when exporting from Blender using the “Collada 1.4.0 plugin for Blender Version 0.3.162”. Make sure you have Triangles, Bake Matrices, Only Current Scene, Use Relative Paths and Use UV Image Mats options selected when you export.
I would recommend loading the resulting .dae file into preFab (it’s available free at http://www.closier.nl/prefab/). If it loads in preFab it should be fine in Away3D Broomstick if you export to AWD 1 or OBJ format.
|
theMightyAtom, Sr. Member
Posted: 20 June 2011 03:54 PM Total Posts: 669
[ # 2 ]
The posted obj file won’t open in 3D Studio MAX, I get a “Polygon index error”
I managed to get it to load in Broomstick, by exporting to FBX, then saving from Max to Obj. The texture paths were messed up though.
|
theMightyAtom, Sr. Member
Posted: 20 June 2011 03:59 PM Total Posts: 669
[ # 3 ]
|
Mich, Newbie
Posted: 21 June 2011 09:49 AM Total Posts: 4
[ # 4 ]
Oh it seem good, I see better
Thx.
|
Lauri, Newbie
Posted: 21 June 2011 10:43 PM Total Posts: 7
[ # 5 ]
Hi everyone,
I’m just playing with Broomstick. I got my blender scene imported to away3d using preFab (uv maps etc working perfectly). But I could not find how to assign light, one point light, to imported object. Lights are working perfectly for away3d primitives (cubes etc) with bitmap materials…
...
Loader3D.enableParser(AWD1Parser);
_loader = new Loader3D();
_loader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete);
_loader.scale(1);
_loader.load(new URLRequest(‘ukko/Ukko.awd’));
...
Any help is appreciated.
Cheers,
- Lauri
|
Lauri, Newbie
Posted: 21 June 2011 10:44 PM Total Posts: 7
[ # 6 ]
|
Lauri, Newbie
Posted: 22 June 2011 08:00 AM Total Posts: 7
[ # 7 ]
Hmmmm… Lights come with the AWD? Maybe I just export a class from preFab.
Edit: Nope… Lights don’t come with AWD (ofc). And class does not work because it’s for away3d 3.6.
I got it working by exporting wavefront obj from blender 2.57b and then changing objects to groups, i.e., replace all lines starting with “o” to “g” in myexport.obj. Otherwise it would some import the first object.
And for some reason I had to use full path for material files in mtl file.
Loader3D.enableParser(OBJParser); _loader = new Loader3D(); _loader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete); _loader.load(new URLRequest('ukko.obj'));
...
private function onResourceComplete(event : LoaderEvent) : void { var mesh : Mesh; var sMesh : SubMesh; for (var i : int = 0; i < _loader.numChildren; ++i) { mesh = Mesh(_loader.getChildAt(i)); mesh.geometry.scale(100); // by default you get small model from blender _text.text = _text.text + " " + mesh.name; // debug for each (sMesh in mesh.subMeshes) { _text.text = _text.text + " " + sMesh.numTriangles; // debug }
var material:BitmapMaterial = BitmapMaterial(mesh.material); material.ambient = 0.15; material.specular = 0.15; material.lights = [_dlight]; mesh.material = material; } _view.scene.addChild(_loader); }
|
Mr Margaret Scratcher, Sr. Member
Posted: 28 June 2011 02:04 AM Total Posts: 344
[ # 8 ]
Still having trouble getting this to work - I’ve changed the LoaderOBJTest example to load from an external file, and can get it to work with the head.obj, but not with a dae loaded into prefab and then exported as a .obj… Any guidelines on what to check for?
The .dae I’m using has several meshes, could that be the problem?
The dae is here:
http://www.videoemporiumdelivery.co.uk/projects/emporium.rar
|
Mr Margaret Scratcher, Sr. Member
Posted: 28 June 2011 02:26 PM Total Posts: 344
[ # 9 ]
Just had a quick experiment, made a cube in blender, and expoerted that succesfully. I could change the base colour of this cube, and the colour of the cude in the swf changes acccordingly. I then tried to apply an image as a texture to the cube, but although this image is copied into the folder, and the .mtl seems to refernece it, the cube is still shown in just its base colour…
package { import away3d.containers.View3D; import away3d.debug.AwayStats; import away3d.entities.Mesh; import away3d.events.LoaderEvent; import away3d.lights.PointLight; import away3d.loaders.Loader3D; import away3d.loaders.misc.AssetLoaderContext; import away3d.loaders.parsers.OBJParser; import away3d.materials.BitmapMaterial; import away3d.materials.methods.BasicDiffuseMethod; import away3d.materials.methods.BasicSpecularMethod; import away3d.materials.methods.FresnelSpecularMethod; import away3d.materials.methods.SubsurfaceScatteringDiffuseMethod; import flash.display.Sprite; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.events.KeyboardEvent; import flash.net.URLRequest;
[SWF(width="1280", height="720", frameRate="60", backgroundColor="0x000000")] public class OBJLoader extends Sprite { private var _view : View3D; private var _loader : Loader3D;
private var _light : PointLight;
//[Embed(source = "/../embeds/head/head.obj", mimeType = "application/octet-stream")] //[Embed(source = "/../embeds/emporium/emporium/emporium.obj", mimeType = "application/octet-stream")] private var OBJData : Class;
private var _camController : HoverDragController; private var _count : Number = 0; private var _subsurfaceMethod : SubsurfaceScatteringDiffuseMethod; private var _diffuseMethod : BasicDiffuseMethod; private var _material : BitmapMaterial; private var _fresnelMethod : FresnelSpecularMethod; private var _specularMethod : BasicSpecularMethod;
public function OBJLoader() { _view = new View3D(); _view.antiAlias = 4; this.addChild(_view); //Signature.y = stage.stageHeight - Signature.height;
_light = new PointLight(); _light.x = 15000; _light.z = 15000; _light.color = 0xffddbb; _view.scene.addChild(_light); _camController = new HoverDragController(_view.camera, stage); addChild(new AwayStats(_view)); initMesh();
addEventListener(Event.ENTER_FRAME, onEnterFrame); stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; stage.addEventListener(Event.RESIZE, onStageResize); }
private function onStageResize(event : Event) : void { _view.width = stage.stageWidth; _view.height = stage.stageHeight;
}
private function initMesh() : void { Loader3D.enableParser(OBJParser); _loader = new Loader3D(); _loader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, onResourceComplete); //loader.load(new URLRequest("emporium/emporium.obj")); //loader.load(new URLRequest("videmp/videmp.obj")); //loader.load(new URLRequest ("head2/head2/head2.obj")); //loader.load(new URLRequest("house/52_Scene_Scene.obj")); //loader.load(new URLRequest("house/house2.obj")); //loader.load(new URLRequest ("VW/Samba.obj")); _loader.load(new URLRequest ("cube/cube.obj")); _view.scene.addChild(_loader);
}
private function onResourceComplete(event : LoaderEvent) : void { var mesh : Mesh; for (var i : int = 0; i < _loader.numChildren; ++i) { mesh = Mesh(_loader.getChildAt(i)); mesh.geometry.scale(100); mesh.y = -70 //mesh.material = _material } }
private function onEnterFrame(ev : Event) : void { _count += .003; // _container.rotationY += .3;
_light.x = Math.sin(_count) * 150000; _light.y = 1000; _light.z = Math.cos(_count) * 150000;
_view.render(); } } }
|
Lauri, Newbie
Posted: 28 June 2011 03:42 PM Total Posts: 7
[ # 10 ]
I couldn’t access the rar… Did you try with absolute path in the .mtl file instead of relative path?
|
|
Lauri, Newbie
Posted: 28 June 2011 05:09 PM Total Posts: 7
[ # 12 ]
Yes, you have to do it manually. I tried your rar and it seems to work… I guess it’s a tiny bug.
In myobj.obj change:
myobj.mtl
to
/path/to/myobj.mtl.
(or in windows: c:\path\to\myobj.mtl or something).
And in .mtl all images/mymat.jpg to /path/to/images/mymat.jpg.
|
Mr Margaret Scratcher, Sr. Member
Posted: 28 June 2011 07:43 PM Total Posts: 344
[ # 13 ]
Still not having any joy, I’ve set the absolute path in the .obj file, and then for all of the jpgs in the mtl file.
I still had no joy, which I thought might have been to do with some of the folders having spaces in their names, so I changed all of those in order to get rid of that problem. Now it still does not work, and I get the error:
[Fault] exception, information=Error: Error #2032: Stream Error. URL: emporium/C:\Users\Dellend\Desktop\Design_stuff\Away3D\away3d_GIT\away3d-examples-broomstick\bin\emporium\emporium.mtl
which suggests that the paths are taken as relative, which I read recently is one of the changes - I’m using a version pulled literally in the last couple of days..
I’ve now changed it back to just emporium.mtl, and now it’s throwing up a similar error for the path to the textures, so I’m going to change them back and see what happens…
|
Mr Margaret Scratcher, Sr. Member
Posted: 28 June 2011 07:55 PM Total Posts: 344
[ # 14 ]
AHA SUCCESS!...
....Kind of…
I now have my scene visible, but all the meshes are using the same texture…
Hmmm….
|
Mr Margaret Scratcher, Sr. Member
Posted: 28 June 2011 08:10 PM Total Posts: 344
[ # 15 ]
NAILED IT! - Needed to make sure that ‘Material Groups’ was selected in the export window.
Now working beautifully!
(But only locally, for some reason, uploaded, I get the ‘Alternative content’ screen… Hmmm…..)
|