rogersgb, I have a small update to the computeNormals() function for 3DS in MaxLoader.java (originally this was in Loader3DS.java).

Since I've not used the "new" code as of yet I didn't feel comfortable commiting this via subversion so I would appreciate if you could try it out and update it yourself. The "new" code seems to match the "old" code except that the Vec3 is now Vec4, and "object.verts" is now "object.vertices"

Basically I ran a profiler on the joglutils project (old one) and I noticed that computeNormals() was a huge bottleneck and so I started looking at the code and realized that it has way too much nested looping that is causing the long computation times. Initially the code loops over the objects and then each face of the object and calculates the normal for each face. It then loops over the vertices of each object and for each vertex it loops over all of the faces and tries to find the face who has a vertex that matches the current vertex and then it uses the face normal to add to the vertex normal...and then it normalizes the normal. Well, the looping over each face for every vertex is horrible because the loop never terminates early because it has to loop through all of the faces to find if any has a matching vertex. Also, it calculates a 'shared' counter that is used to divide the normal summation for each vertex normal but this is pretty much useless because we normalize the vertex normal anyway so dividing it by some value does nothing....it just adds an unnecessary calculation.

I rewrote the code to the following: Loop through each object - initialize the normal vector in each object

Loop through each object - Loop through each face of the object - calculate face normal - add face normal to each of the 3 vertex normals of the face

Loop through each object - Loop through each vertex of the object - normalize the vertex normal

It may seem like there are three loops and this is worse but in fact this is much much faster and gives the correct results (or at least it seems to). And when I say it is much faster, on a model of 500,000 vertices the calculation was 30 times faster than before....I don't think the model size matters but I'm just giving you an example.

Here is the code that I believe works for the "new" code (MaxLoader.java)

// dividing by the negative of the magnitude to get the opposite // vector...not exactly sure why this is done to be honest but it works.object.normals[i].x /= -mag;object.normals[i].y /= -mag;object.normals[i].z /= -mag; } } }

Here is the code that works for the "old" code (Loader3DS.java) that I am currently using:

// dividing by the negative of the magnitude to get the opposite // vector...not exactly sure why this is done to be honest.object.normals[i].x /= -mag;object.normals[i].y /= -mag;object.normals[i].z /= -mag; } } }

By the way, I'm working on a small scale scenegraph that supports LOD. This should tremendously help out the model rendering.

-greg

cool...that's actually something I need to implement in my work and I've not even started so I can't wait to use what you come up with.

I'm currently trying to implement VBO rendering as an option though I'm not sure how much it will help me since I'm using GLJPanel() and the GL context is destroyed on resize/init() and so I lose the VBOs that are created. Right now the direct draw rendering is what I'm using until I come learn how to do context sharing, etc. Though the VBO rendering might help for the versions of the code that use the GLCanvas() so it might not be a total waste. I have VBOs drawing the faces thus far, but I need to figure out how to get the normals in there and then the textures.

cool...that's actually something I need to implement in my work and I've not even started so I can't wait to use what you come up with.

I'm currently trying to implement VBO rendering as an option though I'm not sure how much it will help me since I'm using GLJPanel() and the GL context is destroyed on resize/init() and so I lose the VBOs that are created. Right now the direct draw rendering is what I'm using until I come learn how to do context sharing, etc. Though the VBO rendering might help for the versions of the code that use the GLCanvas() so it might not be a total waste. I have VBOs drawing the faces thus far, but I need to figure out how to get the normals in there and then the textures.

I have the same problem with textures and display lists on a GLJPanel. I store them in hash tables when they are created. If they need re-initialized due to context destruction I just grab them back out of the hash table. That implementation works for a heavyweight canvas as well.

Currently I have it working for a GLCanvas and I need to add code that recreates the buffers following a re-init() in GLJPanel cases....once I get that figured out I'll post the update here or I might actually try to edit the subversion code itself.

EDIT: I downloaded the latest version of the joglutils loaders and so I'll try to make the changes directly and either I'll send you the modified files, create a patch and attach the files, or try to see if I can commit to subversion. I'll even add the computeNormals() code that I submitted before and I noticed that the test viewer doesn't have the best lighting setup because it washes out the models so I'll try to make it like the viewer I wrote (just gonna tweak the lighting parameters).

Hello. I made simple Scene Tree system that allows to relate nodes spacially and treat them as a tree. It's pretty basic but useful for attaching objects to each other. I also made OBJ format reader, although it is buggy right now, and does not support full OBJ format. It pretty much can parse the output of light wave's OBJ exporter and create a Node that can be used in the rest of my Scene tree.

Hello. I made simple Scene Tree system that allows to relate nodes spacially and treat them as a tree. It's pretty basic but useful for attaching objects to each other. I also made OBJ format reader, although it is buggy right now, and does not support full OBJ format. It pretty much can parse the output of light wave's OBJ exporter and create a Node that can be used in the rest of my Scene tree.

All of the scene stuff is located in *.basic package. everything else is for my old CS class. I will probably upload new source code soon to a different place.

I am definitely looking to checking out your guy's stuff though, thank you in advance!

If you get a chance, I would download the latest joglutils loader (not in the original branch but the new stuff) and try to add your OBJ loader and/or add to the one that has been started there. I've not looked at it myself yet so I don't know how much is complete but it might be of interest to you.

Would you guys be interested in a Frame Buffer Object class? It covers all the basic stuff like color and depth attachments, but it has some neat features like support for multiple color attachments (a nice feature for those doing GPGPU stuff), and you can designate either a texture or render buffer as the attachment type.

Would you guys be interested in a Frame Buffer Object class? It covers all the basic stuff like color and depth attachments, but it has some neat features like support for multiple color attachments (a nice feature for those doing GPGPU stuff), and you can designate either a texture or render buffer as the attachment type.

Yes, the project is alive. I personally have updates that I've planning on making but I've not had the free time to do them. In particular, I want to add updates in these areas of the 3DS Model Loader: - Include VBO loading/rendering option - Include Serialization of model files for faster reading/processing - Improve the example viewer code to have more functionality and better lighting

I don't have a timetable of the update because I need to first convert my code to the new structure that was created in the last update.

here is the main project site: https://joglutils.dev.java.net/ The files are available via SVN or you can download individual files from the Documents and Files section.

For some reason the dev sites are not accessible right now...figures the timing!

This all sounds very exciting! I'm hoping some day I'll be able to load a model with bone animations and be able call the animations from my code. As far as 3D programming goes, bones and shaders are the two things I haven't been able to wrap my brain around.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org