|
Wucka, Newbie
Posted: 31 May 2012 01:59 PM Total Posts: 23
Hi all,
I am working on a project and everything is working perfectly, the only problem that I am coming across is that the models look lesser in quality because they have flat shading when I bring them over from blender. Blender has the option to smooth shade the objects, and I have seen a few posts here about doing the same thing.
One of these options was to use Weld.apply(objectContainer3D).This option has not worked for me yet, and it is a bit taxing on the project itself since I am running a very complex model on the iOS system, so run time is effected too heavily.
The material method classes have caught my attention, and my question is if I was right in assuming the weld is the only way to achieve this smooth shading for a mesh or full model, or if there is an alternate way of doing this.
Any help is appreciated,
Thanks,
Wucka
|
Fabrice Closier, Administrator
Posted: 31 May 2012 02:48 PM Total Posts: 1265
[ # 1 ]
You could try to load your mesh in Prefab, weld it, eventually merge it and export as AS3. Faster inits, lower KB and less ram for free .
|
Wucka, Newbie
Posted: 31 May 2012 03:42 PM Total Posts: 23
[ # 2 ]
Thanks for the answer.
On my way to trying this, I found that in prefab 2.0 I am getting the result that I want. The model is smooth and clean, but when I export from prefab and import in the awd, it becomes flat or rigid again and shows the faces.
I exported out the prefab as a ase file so I could dig in and see how it parsed and applied the materials to see if I could gain some insight into what is going wrong on my end with my project.
At the moment I am doing this
public function createMaterialFromClass(cls:Class):TextureMaterial
{
var bitmapData:BitmapData = new cls().bitmapData as BitmapData;
var bitmapTexture:BitmapTexture = new BitmapTexture(bitmapData);
var heartMaterial:TextureMaterial = new TextureMaterial(bitmapTexture);
return heartMaterial;
}
to process my materials that I have embedded, and then while I am looping through the objectContainer3D I am doing this in order to apply the materials to the meshes.
if(name.toLowerCase().indexOf(“id”) > -1)
{
ArteryMaterial.mipmap = true;
TextureMaterial(ArteryMaterial).smooth = true;
TextureMaterial(ArteryMaterial).repeat = true;
TextureMaterial(ArteryMaterial).alpha = 1;
TextureMaterial(ArteryMaterial).alphaBlending = false;
mesh.material = ArteryMaterial;
mesh.material.lightPicker = lightPicker;
}
I added in the mipmap, smooth, repeat and alpha settings to try and mimic what I saw in prefab but to no avail. I am more then likely overlooking something simple, but maybe the answer to my problem is in there.
At this point the model comes in smooth to prefab so welding it will not do much I assume at this time.
Any insight on what I can do to apply the materials in order to get the same smooth quality through code will be much appreciated.
Thanks,
Wucka
|
Fabrice Closier, Administrator
Posted: 31 May 2012 03:58 PM Total Posts: 1265
[ # 3 ]
wait, have you try set up all materials in Prefab and export as as3?
All required after is to simply init the class (look at example in project file how it’s done: new MyExport())
All your definitions are respected from Prefab to AS3. basically all you try to do is already done for you! So unless there is a bug, all you see in Prefab should be same once you compile (excepted for lights/lightPickers, which I plan to add an optional export into the project file) For these you simply need to add them into the class by hand.
|
Wucka, Newbie
Posted: 31 May 2012 05:12 PM Total Posts: 23
[ # 4 ]
I just did what you said and set up the full model with materials in prefab and exported as3. It worked great and I was able to, with some tweaking in Flash Builder, get it running in the browser with the same smooth effect.
I am now trying to figure out why I can get smooth models from an as3 export but when I export awd and bring it into my first project, I am not able to achieve smoothness like that.
I have browsed through the ASBase and myClass.as to try and gain some kind of perspective on why one is smooth and the other is not, unless it has something to do with awd vs the asd data files that are used in the as3 prefab export.
Thanks again very much,
Wucka
EDIT**
Upon further review of the as3 export files, I was able to eliminate a bulk of the code that I am not using. Essentially everything in ASBASE.as that has to do with materials I commented out except for getMaterialID, generateMaterial, and buildTextureMaterial. I am still able to get a smooth model.
The only difference that I see between my awd project and the as3 project are how the meshes themselves are being parsed. The as3 is using the ASDReader, which I am assuming is just there to interpret the binary file type that asd is.
Anyways, I have altered my awd project to reflect that of the exported as3 to try and match the results of a smooth model and nothing yet. Still going to look through the code but any advice on where to be looking or what I can change that will achieve this would be very much appreciated.
Thanks again,
Wucka
|
Fabrice Closier, Administrator
Posted: 31 May 2012 09:34 PM Total Posts: 1265
[ # 5 ]
“full model with materials in prefab and exported as3. It worked great…”
‘Glad it worked.
“I was able to eliminate a bulk of the code”
I do have more variations of the as3 exports in the pipeline.
More simple, especially handy if you build one project built on multiple as3 exports. But prio #1 was to allow export that can work without any changes.
I’ll porbably add these once users will be already familiar with what is already lots of options.
Note that you can set the export of asbase to generic or not (less dead code if you do use only limited settings). You can also export 1 mesh at a time to asd, and replicate the contructor as in the full as classes.
“why one is smooth and the other is not”
Awd2 exports the same data and do respect the geometry as asd files.
“but any advice on where to be looking”
Thats what i try to do, but your code is on your screen
I’ve just reach the state with Prefab where I can start add new stuffs and try improve others…
So please if you have wishes, requests, question—> use the feedback option.
or do post into Prefab’s forum on this site.
|
Wucka, Newbie
Posted: 05 June 2012 02:11 PM Total Posts: 23
[ # 6 ]
You have been a great help Fabrice. It took some time over the weekend working with older awd files from prefab 1 and the new asd prefab 2. After some comparisons I believe I have it all figured out with your help. I was able to get the baseline code structure for loading in the asd files for my project, and with that I had MUCH faster load time on multiple platforms.
Prefab 2 is great, and the updates with it are wonderful, one of the biggest was the fact that in prefab 1 my obj files used to come in mirrored, which does not happen in prefab 2 which relieves some headaches on my end.
Thanks again for all your help, can’t wait to see what you guys come up with for animation export because I am loving the “guys” and tweening I can do within prefab.
Thanks,
Wucka
|
Fabrice Closier, Administrator
Posted: 05 June 2012 07:21 PM Total Posts: 1265
[ # 7 ]
“I was able to get the baseline code structure”
You can indeed adapt the exports very quickly into your project. But I feel we need more flexibility. The extra export options that I’ll add later on, should allow you to export only the pieces you need. Will do it once most users will be familiar with the actual logic.
“I had MUCH faster load time on multiple platforms.”
You were warned!
“I am loving the “guys” and tweening I can do within prefab.”
Very happy to hear that!
How cool would it be to define much complexer animations or have physics guys?? Next update will bring you the tadaa: “dataGuy”, a way to define levels for games or simply store smart in content data. With ghosts for full easy preview/edits in editor for transform and auto replacement once exported as a level file… if you make games, it will probably interest you.
As they are in very early stage and since I have only done just a few pages of Prefab 2 manual, not covering them at all. Let me ask you if you have discovered the difference between regular TweenGuys and chained ones when you have a few properties set?
If not, try play a bit with them, add new guys to same mesh… You’ll probably enjoy looking at the kind of crazy complex animations that you get as a result and what you could do with them. At least I was!
Another tip: you can remove them only by rightmouse clicking the selected mesh /remove guys. Obviously I will add a little menu to let you pick the one you want to remove. For now, it simply removes them all. And finally, once Prefab format will be up&running; as I want it to, it will be easy to store them for further editing…
|
Wucka, Newbie
Posted: 13 June 2012 01:40 PM Total Posts: 23
[ # 8 ]
Hi Fabrice,
Thanks for all the hard work on prefab 2.0. I have been playing with the guys features and things as you had stated in a previous post. I was wondering 2 things:
First, I know you are working hard on the guys feature, I was just wondering a time frame for release of that feature to start getting animations done in prefab.
The other would be, will the guys be exported as their own .as file. I am trying to set up a framework for how I will implement the prefab exports once those guys are ready. If they are going to be individual .as files then I will be able to create separate .as files with the tween library out there to mimic the framework prefab will use.
Thanks,
Wucka
|
Fabrice Closier, Administrator
Posted: 13 June 2012 02:01 PM Total Posts: 1265
[ # 9 ]
busy as we speak on export skeleton animations to awd2..
stage 1(atm): is to be able to load an animation in a given format and export in another. Works now from loading md2 and exporting it to as3. Of course we want be able export collada to awd2 or as3 etc..
stage 2: once the above works, start implement editors, for instance you have this Ogre.md2, but you do not use the 10 other animations. so you want be able to edit the data.
stage 3: have vertex, uv, skeleton, path animators generators&editors;
Regarding the “guys”... it is there already, look the as export, it has the “export” guys. Tho, it is exported only if you export the project as. Indeed a “guys” export only would be handy… +1 on the todo
|