I want to have one model that can be customised with different parts eg. Different arm models or different head models. I want them to all be different models (one for the head, body, one for each arm and one for each leg) and then have them all pieced together and rendered to look like one complete model. How could I implement this into my project using lwjgl and OpenGL?
There are a few ways that I could think of that would work, some of them touching on the concept of Skeletal Animation.
First, you could use your modeling software (for example, blender) and add all of the components into the scene individually, then just read in the whole scene into your game.
Another way of going about this would be to try to give each component the role of a bone, then use a skeleton structure to link all the bones together. The only problem with this is that you're going to have to create your own variables for the skinning formula.
Lastly, you could load them all into a scene in your modeling software, link them with joints, then export that into your game. This would be my choice since it would give you all the information you need to perform the skinning formula, which will give you the ability to animate the components of your structure.
Related
i am new to java 3d. i have encountered a situation like , i want to load ready made developed 3d model of any object [as an example shoe] developed in 3d modeling software like 3d studio max or Maya in my java program , update its texture or color properties etc. then render it and then display the updated model to the end user.
so i am asking all the 3d experts how should i proceed ahead to accomplish my goal ?
which input should i load into my program ?
how can i update the loaded model , render it and display the updated model to the end user ?
in simple story , i want to give my users ability to modify 3d model by their interactions as such ,
they provided 3d model of shoe for example in default colors and textures & some fields like sole color , if they choose color red then the loaded 3d model's sole is colored red (i.e. updated) and then displayed to end user with red color rubber sole shoe instead of default color shoe.
please, advice me to accomplish my goal.
Ok so first of all, complex objects are usually created using some 3D editing software like Blender or Art of Illusion. These programs can output the object into several different file formats, the most common being the .obj file format:
http://en.wikipedia.org/wiki/Wavefront_.obj_file
Another common format is .3ds, which in my experience is a lot more work than it's worth. They do make a .3ds file loader for Java3D, the page can be found here:
http://www.starfireresearch.com/services/java3d/inspector3ds.html
My advice for you is to just use the .obj file format, it is a lot easier to use. You can also just make your own parser for it which is not as hard as it sounds. This way you know exactly how your object is being loaded into the environment. Java does come with it's own parser, instructions on how to use it are here:
http://www.vrupl.evl.uic.edu/LabAccidents/java3d/lesson08/indexa.html
I have had a lot of trouble with files exported with Blender while using this file format unfortunately, they may have fixed the problem by now but I'm not sure. When I used to do a lot more 3D stuff I just used Art of Illusion, even know Blender is a lot more powerful. Blender can be run on a Mac but is a lot smoother on windows with the proper setup. Good luck! If you need some example code let me know and I would be more than happy to post some for you.
Art of Illusion:
http://www.artofillusion.org
http://www.artofillusion.org/documentation#
Blender:
http://www.blender.org
http://www.blender.org/education-help/tutorials/
Im not sure how you want the user to be able to change the object. If you want them to be able to change the color, or the type of shoe or whatnot that is not a huge deal. If you want the user to be able to change the lace length or something where you are changing the actual object's structure, that requires an in depth knowledge of 3D structure. If you want to change a color, just change the material. If you want to be able to change the type of shoe, just load a different shoe object. I hope this was helpful for you.
In the comments, you also talk about texture mapping, which in my experience is a lot easier to do in Blender than it is to do in Art of Illusion. I would probably use blender to accomplish this:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Textures/Mapping/UV
John
I assume you just want the user to select a different texture/color, right?
Then have a look at the Java3D tutorials out there, e.g. this one: http://www.java3d.org/tutorial.html
I further guess your shoe is actually a 2-part model, i.e. just the sole should get another color while the rest might get a different texture, right?
In that case, you'd need 2 models/shapes, each with its own appearance. Then, for example, alter the soles appearance as you like, e.g. by assigning a different material or changing the material's color.
I have been writing some basic code for an application I am designing. I have learned the basics and gotten some simple database connection working with RPC calls etc. What I need to do now and am completely lost (as I am traditionally a c# developer with windows forms).
In c# if I wanted a new form I would just create it, and then call the show method.
How does one create multiple pages in GWT, and switch between them?
Thanks in advance,
Chris
The simplest way would be to
Make a new java class (GwtHome.java, GwtHelp.java etc)
Extend these classes by using the Composite class
Make the equivalent of a Master Page and add it to the rootPanel as a class with the appropriate headers, menu, footer and Content Placeholder (Could be any of the AbsolutePanel, VerticalPanel, HorizontalPanel objects provided by the GWT Framework)
By clicking on the menu clear the Placeholder and add the appropriate object of GwtHome, GwtHelp etc.
After getting aquanted with the above procedure, you might want to break up the code in many files using a design pattern as suggested by Andrei.
Simply clear the root panel (RootPanel.get().clear()) and add the widget for your new "page", the same way you added your first one.
If you're using LayoutPanels, do RootLayoutPanel.get().clear() instead.
Look at Activities and Places design pattern: https://developers.google.com/web-toolkit/doc/latest/DevGuideMvpActivitiesAndPlaces
I highly recommend it for a multipage GWT app. It explains pretty well how you create different "views", that are driven by their "activities", and tied to specific "places" (pages) that users can navigate.
Typically you use a LayoutPanel as your "page" container that occupies the entire available browser window. You split this LayoutPanel into 2-3 layers (zones), like top menu, side menu, main area. Each area contains one widget, usually a ScrollPanel, FlowPanel, or HtmlPanel. Then you use different widgets or HTML inside each of these widgets to display whatever you need. You may also create your own composite widgets that you can reuse in different pages.
I have a JTree that I'm filling with skills for a Game Database programme that I'm writing.
There are several categories, and subcategories (actual skills), and then levels skill below that (sometimes). Currently I'm emulating this with one skill class, some options inside, and a few enums, plus a method to check that if the skill is a category (called isCategory). Two other things to note:
Different types of skill behave differently.Some are bought once, other several times, some have options to pick from etc
Different categories contain different skill. For instance The Weapon Skills category has different types of weapons, but the Armour Skills are in a different section.
I've seen a very good example of attaching a ComboBox via a cell renderer to each node in the tree. Here is the example I found.
I understand the above code, but I can't see how to would attach the combo box to a node, and not to the tree? I've read 'How to use Trees', and I've run, and looked at the code for a few of the demos for tree. I can make basic trees, but I find the tutorials a bit obtuse and lacking in enough detail to figure out for myself how to proceed. I've found another example of only rendering leaf nodes as checkboxes, which is much more complex.
Obviously I'd like to combine the two, being able to have different categories able to have different skills and different skills have different levels of proficiency. However the only way I can think of doing so it to have different JComboBoxModels for the different types but I don't know how to do this, and I can't find out how. I've tried to edit the checkbox example to use ComboBoxes, but for the life of me I can't figure it out.
Could someone give me a hint as to what approach to take on this, as I'm new to Java and strugglingto figure out what to do?
You should implement TreeCellRenderer as well as TreeCellEditor. Both should return JComboBox with different model. Which model to choose you should decide in the getTreeCellEditorComponent/getTreeCellRenderingComponent depending on value parameter (the tree node in fact).
Would this be a good place to start?
Conceptually, yes. Both JTable and JTree use the flyweight pattern to render and edit cells/nodes.
This example cites a basic TreeCellRenderer.
This example illustrates a simple TreeCellEditor using the default renderer.
This example shows an Outline view that incorporates features of both JTable and JTree.
After having used Swing for the past 3 years for School and such, I decided to give JavaFX a try and play around with it. With the new Scene Builder and NetBeans 7.2, it's been a blast so far.
The next step I'd like to do is convert a small project of mine into JavaFX. One of the issue however is that project uses a MVC Architecture. Basically I have a JFrame with a Toolbar, a JMenuBar, plus an empty JPanel.
The JPanel is used to display a View which is a JPanel built the using GUI Builder of NetBeans. This allows me to navigate to different view and each view is an independent component.
My question is as followed: Is there any ways to display a Scene inside a Scene? Or achieve similar result as a JPanel inside a JPanel, or a User Control inside a User Control (for the .Net folks)
Basically, I'd like to display another scene in the Gray area of the picture.
I had the same reaction when I came in: you want a Node (which feels wrong on a first glance). The Node is basically the root component that can contain itself (much like a JPanel) and though you can change out scenes on your stage if you're looking for the "root component" it will extend Node for the MVC basics.
http://docs.oracle.com/javafx/2/api/javafx/scene/Node.html
I'm sure you could get fancy and swap out scenes on your stage (which is totally viable) but from my Swing background the Node behaved more naturally. Caviat: I find I write a bit more framework and abstractions to make it work for me (wrapped classes with Groups etc...) but it definitely does the trick.
I hope to find a better way, for my "Module" based project I initially used Scenes, but found it completely restricting. The Nodes allow for much more dynamic content.
Best of luck.
edit: reading the doc after answering I really should say "Parent" but the direct subclasses of Node are all useful as containers)
I am developing a small desktop application in Netbeans. The application is complete and working fine. A small description of application is as follow:
The application is basically an object manager, where user add new object, remove old objects and connect object with each other. What i did is that i simply add 3 panel and change its type to titled border. One for Add object one for remove and one for connect.
Status:
Every thing is working fine as expected.
What Left:
In order to make UI more appealing i added a new panel at the end and called it "Object Viewer". I am planing to visualize the steps which user performs e.g
If user add an object then i that pannel i will daraw a little
circle and fill it with green color
Similarly if user remove some object then again i will draw another
cricle and fill that with red
And when user connects two object then i will draw two circle and
connect them with a dotted line
This is my first java application, i only want to know how do i acheive this task. Some links or experience are highly appreciated
As for custom painting in swing, have a look here: http://download.oracle.com/javase/tutorial/uiswing/painting/
However, I'd suggest using a graph visualization library like JUNG etc. Using this you'd basically only have to define your object graph.
You can either do that manually with Java 2D, which I don't recommend, or, since you are using Netbeans (and I assume the Netbeans Platform, but this is not required), I would strongly suggest looking at the Netbeans Visual Library. It can do exactly what you want.
As Nico Huysamen said you can do that with Java 2D. But because it's your first Java application I strongly recommend to do it manually with this lybrary in order to understand how higer level lybraries work.