Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - zed

#1
Support / Re: TextureManager.flush()
July 17, 2008, 05:19:36 PM
Well, looking forward to 1.17 then. Fortunately I have figured out a work-around for my problem, so I guess I won't have to wait for it.

Here's another texture-related question though: I'm loading a textured 3ds model at startup, which I want to change the textures on at runtime. I'm not adding any textures to the texture manager before loading the model, so jPCT applies a dummy texture. So far so good. Now I provide a way to interactively change the texture on that model...and it just doesn't work. To my surprise I found out that everything works just fine, when I add one of the possible textures to the texture manager before loading the model. If I do so, all the other textures, that are loaded later on work fine. I've compared pretty much every state of my application when doing it in one or the other way...everything seems to match perfectly. I'm kinda stuck here...

Edit: Not less surprising than the problem described above, is its solution. My textures had a resolution of 512x512, so I scaled them down to 256x256 and everything worked fine. I really did not expect that to be the problem...but what do I know ;)
#2
Support / Re: TextureManager.flush()
July 17, 2008, 10:48:05 AM
Alright...I already thought it would be something of the kind  ;)

Anyway, here's the deal: I only want to keep a limited number of objects in my world. All of the other objects that I use are clones of this little set of 'base-models'. They are created at runtime and I want to remove them as soon as I don't need them anymore (which happens quite soon after creation). These temporary objects are potentially all textured differently, so I also want to get rid of the textures as soon as I kick out the objects. The problem here is, that I didn't find any way to remove single textures from the texture manager, so I tried flushing all textures out, which was obviously not the best idea...

I'm using Software Rendering by the way.
#3
Support / TextureManager.flush()
July 16, 2008, 06:19:58 PM
Why is it, that I get a NullPointerException when rendering and having flushed the texture manager beforehand. I even add new textures to the texture manager after calling TextureManager.flush(), but when I call world.renderScene(...) I get a NullPointerException which originates at "com.threed.jpct.Object3D.render(Unknown Source)". Things work fine, when I don't flush the texture manager...unfortunately I would soon run out of memory when not being able to flush the useless textures out.

Did I get something wrong with TextureManager.flush() ?
#4
Support / Re: Mixed up vertex indices
July 02, 2008, 12:14:27 AM
Nope, I don't create any triangle strips either... The funny thing is, that the models are properly displayed and only the vertex indices are mixed up. I've also tried different ways of exporting and converting by now. Without success unfortunately. I get exactly the same results everytime.

Seems like I'm kinda stuck here...
#5
Support / Re: Mixed up vertex indices
July 01, 2008, 06:08:52 PM
Alright, here we go. These are the vertex counts for one of the 3 objects in the file.

- Number of vertices retrieved via Wings3D: 62

- Object3D.getMesh().getVertexCount(): 360

- Object3D.getMesh().getUniqueVertexCount(): 62 - before building, 70 - after building

Switching vertex optimization on or off doesn't affect these values.
#6
Support / Re: Mixed up vertex indices
July 01, 2008, 03:07:01 PM
I've done it before loading the model, yes.

I assume that the vertex numbers should stay the same. I had to go quite a long way round to get a 3ds model, since I don't have 3DS MAX installed. So I modeled the whole thing in Maya, exported it to FBX, imported the FBX to Wings3D and exported it again as 3ds. The vertex numbers stayed the same throughout the whole process. I also get the same vertex numbers when inspecting the 3ds file with Wings3D. Only when importing to jPCT they get mixed up somehow...

The thing is, I need to be able to mark special spots on an object, so that I can attach other objects to these spots later on. I figured the best way to do so, was to specify vertices as reference points, which is why I obviously run into troubles when the vertex indices change. Any other suggestions how to solve this issue?
#7
Support / Re: Mixed up vertex indices
July 01, 2008, 02:41:09 PM
I've already tried that. Doesn't have any effect.

This is not normal behaviour, is it?
#8
Support / Mixed up vertex indices
July 01, 2008, 01:28:43 PM
Hi!

Is there any way I can make jPCT preserve the vertex indices as I load a file? I've created a 3ds file containing 3 models and I need to do some transformations on them that depend on special vertices in the models. My problem is that the models are displayed correctly, but the vertex indices don't match my 3ds file. So e.g. when I want to access vertex #57 in model #3 I don't get the expected vertex. I'm using a GenericVertexController for accessing the vertices by the way.

I'd appreciate any help. Thanks!

zed
#9
OK, I wasn't aware of the fact that I could replace the object's texture and keep it correctly mapped just by calling setTexture(), so sorry to bother you with such trivia.

But since you came up with the problem of replacing textures on objects using multiple textures at once, I'm wondering how you would do so. PolygonManager provides a means to get information about every polygons texturing. This would mean I'd have to iterate through all the polygons of an object, putting them in groups of "same texture" and afterwards changing every single polygon's texture accordingly. Would this be the right way to do it, or are there any other, cleverer strategies?
#10
Support / Same 3ds object with different textures
May 19, 2008, 07:10:27 PM
Hey! A question concerning texturing:

I'm loading a textured 3ds model and it's respective textures. So far everything works fine and the model is displayed correctly. Now I'm running into problems, since I want to use the same model again in the scene, but with a different texture attached to it. Is there any way I can alter the names of the textures referenced by the 3ds model, so I can add another texture to the TextureManager without replacing my old one.

Appreciate any help!

zed
#11
Hey guys. Sorry for not replying for a while, but I've been busy elsewhere. Thanks for your advice, it indeed was Config.maxPolysVisible that solved my problems.

@Kearnan: Are there any special reasons, why you prefer 3ds over obj? What tools do you use to convert them?

Greetz!

zed
#12
Support / Model import produces strange results
May 08, 2008, 06:31:05 PM
Hey there!

I'm new to jPCT and just trying to get into the basics. Therefore I just tried to adapt the Hello-World example, that comes with the API, so that it loads and shows an external model instead of the box, usually displayed. I got myself a high poly model of an elephant (which can be found here: http://graphics.im.ntu.edu.tw/~robin/courses/cg03/model/) and imported it using the following code:

char c=File.separatorChar;
Object3D [] buffer = Loader.loadOBJ("models" + c + "elepham.obj", null, 0.05f);
elephant = buffer[0];

elephant.calcNormals();
elephant.rotateX((float)Math.PI);

world.addObject(elephant);


So far, so good. Everything compiles well and I can run the example, but the output is totally weird, as you might see in the image. What's wrong here? Is it possible, that the normals get screwed up somewhere? I have to use Software-Rendering, could this be the reason? I'm really stuck here, so I appreciate every kind of advice! Thanks!

zed