www.jpct.net

jPCT - a 3d engine for Java => Projects => Topic started by: neo187 on October 21, 2011, 01:27:47 pm

Title: jBrush - A World and Animation Editor and a Serializer tool
Post by: neo187 on October 21, 2011, 01:27:47 pm
UPDATED ON 12/02/2012 - Version 0.3

Hello all,

This is a JPCT software I have created as part of a student project. It started as an exercise on the use of JPCT and it developed into this fairly complex toolkit that I used to create most part of an Android game (https://play.google.com/store/apps/details?id=com.voicegame) currently available on the Android Market. I developed it a way that it could hopefully be of use to other JPCT users in their projects. While a number of versions were released, correcting a number of bugs reported, the software may still contain bugs (for which reports are appreciated!).

jBrush is a World and Animation editor. It allows you to import 3DS, OBJ and MD2 models, do the usual scale, rotate and translate operations. It has a 3DSMax-like interface where you can navigate the camera through the environment, rotate it around an object, position it front, side or on top of the scene.

World Editor:
In jBrush you can assign textures, most of the Object3D properties (name, collision, transparency, culling, emissive color, bumpMap, parent/child). You can also set up point lights, ambient light. The tool lets you export the scene as an instruction file which can be imported with two to three lines of code inside your JPCT/AE project with the aid of the library that comes with it. The library creates Object3Ds for all the models in the scene and it lets you fetch any of the them by the name given in the editor so that they can be used for further game actions.

Animation Editor:
jBrush is also a keyframe animation viewer and editor. It allows you to playback MD2 animations and to create your own animations out of 3DS keyframe meshes for a model (e.g. the 3-4 main stances of a walk-cycle) and set name and speed to the sequence created.
When linked to your project the library will take care of all the animation routines so that for any Object3D you can start or stop an animation with just one line of code. You can play animations continuously or play them once, at the same speed set up in the editor.

Serializer Tool:
Finally jBrush works as an interface to JPCT's Serializer facility, so it lets you export any supported model in serialized format (.ser) for more efficient processing on the Android.

An example use of this tool for instance is to create a scene with the environment models, create keyframe animations for an enemy, place the enemies inside the map and export the entire scene. The library will let you import the scene and fetch all models whose name contain a given parameter (e.g. "enemy") and with one line of code you can play their "moving" animations and execute further game code on them.

ADDITIONAL FEATURES FOR Version 0.25:

ADDITIONAL FEATURES FOR Version 0.26:
ADDITIONAL FEATURES FOR Version 0.28:

ADDITIONAL FEATURES FOR Version 0.3:

Download the software:

jBrush (v0.3) (http://dl.dropbox.com/u/34036122/jBrush%20v0.3.zip)


Video previews/tutorials on how to use the library:

World Editor preview and project setup (http://www.youtube.com/watch?v=wb-BJPOz9UE)

Animation Editor preview and lib usage (http://www.youtube.com/watch?v=yCjsPvN0D3E)

NEW:

Triggers and GUI editor preview and lib usage (http://www.youtube.com/watch?v=sPtNPfJMLRU)

(http://dl.dropbox.com/u/49345508/Screen1.jpg)

Place 3DS, OBJ and MD2 models in the scene. Edit their texture and properties.

(http://dl.dropbox.com/u/49345508/screen2.jpg)

Set up point lights and ambient light.

(http://dl.dropbox.com/u/49345508/screen3.jpg)

View MD2 animations or create animation sequences from 3DS keyframe meshes.

(http://dl.dropbox.com/u/49345508/Screen4.jpg)

Place collision volumes (triggers) in the scene and create GUIs and Heads Up Display icons.


Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: EgonOlsen on October 21, 2011, 10:52:20 pm
Nice one! I really like the tutorial videos...well done. I have two remarks...it looks like as if you are using the software renderer in legacy mode (which is default, but maybe shouldn't be any longer...). This means that the lighting calculations are totally different from what you get on Android/OpenGL. Just add a

Code: [Select]
buffer.enableRenderer(IRenderer.RENDERER_SOFTWARE);

after creating the FrameBuffer and you'll get one in OpenGL-look-alike-mode.

The second thing is, that your method naming in the library differs from the standard Java conventions in some parts, where methods start with a lower case letter. Personally, i find this confusing.

Other than that, great work. I will add it to the projects page if you don't mind...!?
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: neo187 on October 22, 2011, 09:19:31 pm
it looks like as if you are using the software renderer in legacy mode (which is default, but maybe shouldn't be any longer...). This means that the lighting calculations are totally different from what you get on Android/OpenGL. Just add a

Code: [Select]
buffer.enableRenderer(IRenderer.RENDERER_SOFTWARE);

after creating the FrameBuffer and you'll get one in OpenGL-look-alike-mode.

The second thing is, that your method naming in the library differs from the standard Java conventions in some parts, where methods start with a lower case letter. Personally, i find this confusing.

Thanks for the feedback. I amended the buffer bit and re-uploaded, I can actually tell the difference! Yeah the capitalised methods must be confusing, I must have had Unity in mind when I wrote them as Unity has Animation.Play and Animation.PlayOnce methods.... changing those will require modifying the video tutorials, which I will do as soon as I have time...

Quote
Other than that, great work. I will add it to the projects page if you don't mind...!?
Of course! I'd love it if you put it in the 3rd party download section, along with Devkit and those other apps.... I put a lot of extra work in making sure this could be useful to other users in the community other than just for my game.

I am currently working on expanding it with a GUI editor and in-game library for displaying and receiving events from them. I'll also try and implement a "trigger" placement facility like the one Unity has, whereby you can place wireframe boxes in the map which are invisible in game but trigger events when collided with (like opening doors or elevators). I could actually use your input on that Egon, how would you go about the wireframe rendering of meshes in the editor? I am sure I have seen it in some sample code...and what do you think would be the best way of having them as invisible trigger objects in the scene?

Thank you.
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: EgonOlsen on October 27, 2011, 08:24:10 pm
I've added it to the projects page as well as to the download page. I'm not linking to the dropbox version but to a local copy instead. Let me know when i should update it with a newer version.

About the wireframe rendering: It's not easy to mix the normal scene with wireframe rendered objects. You could do this by rendering two worlds or by rendering different objects in different mode in two passes...but that doesn't solve the problem that the wireframe object doesn't care for the zbuffer, i.e. they will either be painted over everything of everything will be painted over them (depending on draw order). The best solution might be to fake it by using a transparent object with the wireframe baked into the texture.

About how to do the triggers...i'm not sure. Maybe just a SimpleVector with a dimension and some method that checks if something is within this bound?
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: EgonOlsen on October 27, 2011, 08:25:41 pm
BTW: I've noticed two things while taking the screen shots for the projects page. The mouse navigation somehow feels wrong to me. At times, it moves in a different direction than i thought that it actually should. And you should increase Config.maxPolysVisible. The current limit is too low for more complex objects.
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: neo187 on October 29, 2011, 09:12:51 pm
Thanks for the feature! Really appreciate it  ;)

Have set maxPolys to 250000, have seen that in a few examples in the forum, that seems plenty....

And yeah, i realised there was a small bug in the mouse/camera mapping...have added a fix for it though the camera still lags a bit in changing direction if you quickly change the mouse movement direction while dragging it.... have sent you a PM with the incriminated code snippet, maybe you have a better solution for that....

Have re-uploaded the package.

Will update this thread when the new features are ready!
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: EgonOlsen on October 29, 2011, 10:42:04 pm
I don't see a change in behaviour...is it still the same link? I'm not sure if we are talking about the same thing...what i mean is, that if you drag into one direction and then change direction, the scene continues to move into the former direction. You have to release the button and then drag again to actually change direction. The version that i've downloaded right now this shows this behaviour. What i would expect is a behaviour like in this example: http://www.jpct.net/forum2/index.php/topic,977.msg6207.html#msg6207 (http://www.jpct.net/forum2/index.php/topic,977.msg6207.html#msg6207)
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: neo187 on December 19, 2011, 12:22:08 am
A new version of jBrush has just been uploaded. New features in v0.2:

-Create and place trigger volumes (with library functions to listen for trigger collisions)
-Create and edit GUI and Heads Up Display icons (with library function to modify them in-game)

Video:
 Trigger and GUIs editor preview and lib usage (http://www.youtube.com/watch?v=sPtNPfJMLRU).

-Preview and play MD2 animations in the editor (with library functions to play MD2 animations with one line of code)

The editor now lets you serialize and export both an MD2 animated model and an animation created in the editor out of 3DS keyframe meshes. The latter option is particularly good for Android, as an MD2 model uploads geometry data for every single frame of the animation, which can result in running out of memory with complex meshes. 3DS animations from jBrush only export the main keyframes (e.g. the 3-4 stances of a walk cycle), all in serialized form, and calculate the ones in between at runtime (via JPCT), resulting in a lot less memory usage.


The download link is in the original post!
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: EgonOlsen on December 19, 2011, 07:50:34 pm
Cool. I've updated the download in the download section.
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: AGP on December 27, 2011, 07:18:34 am
Awesome job, man. May I suggest integration with Raft's bones for Ogre files? That would be great.

And a couple more suggestions: you should be able to bitwise or Check Others with Check Self. And Set Object Properties could have a button for setCulling (I was testing jBrush with a caped model, which is why I came upon this one). Thanks for the great job.
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: neo187 on December 28, 2011, 08:46:21 pm
Awesome job, man. May I suggest integration with Raft's bones for Ogre files? That would be great.

And a couple more suggestions: you should be able to bitwise or Check Others with Check Self. And Set Object Properties could have a button for setCulling (I was testing jBrush with a caped model, which is why I came upon this one). Thanks for the great job.

Thank you very much. I should be able to fix the collision setting and add an option for Culling in the next release soon.

Being able to preview skeletal animations with Raft's Bones would be a nifty feature, maybe be able to mix animations by assigning different sequences to different groups of bones.... but it'd be quite a bit of work, for which I don't really have the time at present, but maybe later on!

Thanks again for the feedback.

EDIT:
Have just uploaded v0.27with an option to set the object's culling and to bitwise Check Others and Check Self.
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: zammbi on March 13, 2012, 12:23:38 am
Found moving the camera a little annoying, but good serializer tool.

Question how do I load the mtl file for a obj model?
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: robert on April 09, 2012, 02:17:14 pm
Please, allow the use of degrees in rotation, otherwise we have to use a calculator.

P.D: Nice program  :)

Thank you.
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: neo187 on April 10, 2012, 10:58:43 pm
Thanks all for the feedback.

Zambbi, the .mtl file is by default assumed to be of the same name as the .obj one and to be located in the same directory! Could you elaborate on how you think the camera could work better than it does? What exactly did you find unsatisfactory?

Robert, the rotation dialogue is simply feeding your input values into the JPCT's Object3D.rotate... function, which, as per JavaDoc:

Quote
Rotates the object's rotation matrix around the y-axis by the given angle w (radian, clockwise for positive values). This rotation is then applied to the object when it's rendered the next time.

Is this not what you need?
Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: robert on April 11, 2012, 12:54:38 pm
Thanks all for the feedback.

Zambbi, the .mtl file is by default assumed to be of the same name as the .obj one and to be located in the same directory! Could you elaborate on how you think the camera could work better than it does? What exactly did you find unsatisfactory?

Robert, the rotation dialogue is simply feeding your input values into the JPCT's Object3D.rotate... function, which, as per JavaDoc:

Quote
Rotates the object's rotation matrix around the y-axis by the given angle w (radian, clockwise for positive values). This rotation is then applied to the object when it's rendered the next time.

Is this not what you need?

Hello there,

Yeah, I know jpct uses radians, it's just that for humans is much easier to work with degrees. Well, at least for me, because I'm used to using degress in Blender. You could simply put a radio widget to select degrees or radians in a quick way and do the conversion from degrees to radians in the former case.

Thanks.
Title: Bones
Post by: robert on April 13, 2012, 12:06:55 pm
Hi there neo187,

Another great addition would be the ability to load bones serialized files so we can also create scenes with those. I don't think it's much work, but if you need help i'll be here  :)

Title: Re: jBrush - A World and Animation Editor/Library and Serializer tool
Post by: neo187 on April 13, 2012, 01:35:56 pm
Hi Robert

Thanks for the suggestions. I should be able to add a degree input to the rotation dialogue for the next version, which will hopefully come out soon (I'm particularly busy at present)...

Another user suggested integration with Bones, I haven't used Bones a lot, if you have an idea of what would need to be linked to the project, which of its functions exactly you'd like to have plugged in the editor and what in the Bones library does them, you can PM me and I'll try look into it!

Alternatively, you know that you can open up the scene text files generated by the Editor and see coordinates and sizes of all the objects in the scene? There's a file in the distributable that helps you figure out where the data is in the file... You can use that information to have a rough idea of where to place your Bones objects in code...
Title: Re: jBrush - A World and Animation Editor and a Serializer tool
Post by: Thomas. on April 13, 2012, 10:20:42 pm
Download link don't working...
Title: Re: jBrush - A World and Animation Editor and a Serializer tool
Post by: wtsang02 on June 29, 2012, 06:04:29 am
I get noob question.. how do I start the program.? I use win 7 with jdk 1.6 , eclipse. I double clicked the"jBrush Editor.jar" and it returned a " canot find main class error" Thanks for advice.
Title: Re: jBrush - A World and Animation Editor and a Serializer tool
Post by: parikshit on September 13, 2012, 11:34:58 am
Hi,

I am new ti JCPT, I have downloaded  sample in jcpt-ae,  its working fine. But now i have created a new scene in jBrush. Could you please tell me how to add this to my program.

Thanks