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.


Messages - EgonOlsen

Pages: 1 ... 801 802 [803] 804 805 ... 822
12031
Support / help please
« on: June 21, 2004, 11:15:36 pm »
This is how it looks now:



What i did is this: I opened and resaved the model in DeepExploration (a very powerfull 3D converter tool) and the colors were correct from there on (they were as wrong as your render shows before). I don't know why this has happened. It's either a flaw in jPCT's 3DS-loader (but one that doesn't occur on any other model i know of) or a flaw in the software you used to make this model (i doubt that, but you never know).
Anyway, i modified some parts of your code that suffered from a copy-and-paste disease... :wink:
You applied a rotation to every part of "vroom" right after loading. That's not a good idea, because it means that you rotate every part around its own rotation pivot...and that will screw up the model finally. I replaced this by rotating the mainObj only.
Second, you don't have to add mainObj to the world, because it's a dummy object.
Third, i removed the light sources and set ambient to max to show you, that the colors are really fine now.
Fourth...some other stuff i can't remember...
The sources can be found here: http://www.jpct.net/stuff/vroom

Anyway, please tell me which program you used to create the model, so i can track down this problem better...

12032
Support / Animation
« on: June 21, 2004, 05:37:44 pm »
You have to call animate() in your rendering loop, not when initialising things. If you, for example, add 5 keyframes to an animation, animate(0) will display the first frame, animate(1) the last and animate(0.55) an inbetween state of the 3rd and 4th frame.
So in your renderloop, you have to do something like animate(t); t+=0.1f; for each frame (or time based...whatever). However, there are two more things to consider in your code:
You are doing a rotateMesh() on the animateMe-object. Later on, you are using this rotated mesh as the first keyframe. That won't work, i.e. it will look silly. Are you sure that you need to do the rotation? Or is that just a copy-and-paste-error from the example code? If you do, rotate the object instead, not the mesh.
Second, you have to chose the appropriate clamping mode for your animation. The default clamping mode is only suitable if the last frame of an animation is close to the first frame. i.e. the animation loops.

Hope this helps.

12033
Support / help please
« on: June 21, 2004, 05:28:27 pm »
jPCT uses the diffuse color of a material to color the polygons using this material. If this works fine for you but is still not what you want, then jPCT may not be suitable for you. If that is what you want but it's not working properly, i would be very interested in such a model to see for myself.

12034
Support / help please
« on: June 20, 2004, 01:38:18 pm »
jPCT is (per definition) a texture-only engine. For 3DS, there is the option to let jPCT create uni-colored textures for materials but that's basically all that is supported. I'm not sure what you mean by "too ugly"...what are you missing or what looks wrong? Maybe adding some colors or something would help...?

12035
Support / Displaying Objs Problem
« on: June 17, 2004, 05:39:32 pm »
Looks fine to me so far...your problem must be located somewhere else. You are obviously not calling build() on the ferito, so you have to have a call to World.buildAllObjects() later in your code. Otherwise, your feritos are not "builded" correctly. If that's the case, just add a ferito.build() right before adding the ferito to the world.
Second, if the feritos move, remove the enableLazyTransformations() call. That's for static objects only and may cause problems on all others.
And last but not least: Are you sure that the first object in the array returned by the loader is your ferito? If a 3DS-file contains other stuff too, this can be anything...

Edit: For debugging purposes, try something like this to see whichs objects actually belong to your world and where they are:

Code: [Select]

for (Enumeration objs=theWorld.getObjects(); objs.hasMoreElements();) {
Object3D obj=(Object3D) objs.nextElement();
System.out.println(obj.getName());
System.out.println(obj.getTransformedCenter());
System.out.println("---------------------");
}

12036
Support / Animation
« on: June 17, 2004, 12:14:29 am »
Btw: What is (a) ferito? Babelfish translates it with "hurt"...are you writing a pain simulator... :wink: ??

12037
Support / Animation
« on: June 17, 2004, 12:10:22 am »
You are basically right. I really don't know if it's possible to store all your keyframes in one 3DS-file in a working way, but that's just my lack of experience with 3DS...so i suppose that it is possible. In that case, just load the file, get the Object3Ds from it, call build() on all of them and add their Meshes using Object3D.getMesh().cloneMesh() to the animation. But that requires the meshes to be equal in vertex order. I'm not sure if 3DS guarantees this... :?:
However, after adding your meshes somehow, you have to call animate() on the object to animate (use the first object from the 3DS-file as the base object for your animation for example).
I'm not sure, if this was clear enough. Creating animations on your own (i.e. without using the MD2-format) can be a bit tricky. But it's quite easy once you got the basics though.

The code for this task should look somehow like this (i typed this from the top of my head, so don't blame me if it doesn't work exactly like this):
Code: [Select]
Object3D[] animArray=Loader.load3DS(getDocumentBase(),"3ds/ferito_anim.3ds", 20f);
Object3D animateMe=animArray[0];
animateMe.build();
animateMe.setTexture(...);
...
Animation anim=new Animation(animArray.length);
anim.createSubSequence("plopp");
for (int i=0; i<animArray.length; i++) {
animArray[i].build();
anim.addKeyFrame(animArray[i].getMesh().cloneMesh());
}
animateMe.setAnimationSequence(anim);
...
animateMe.animate(xxx);

12038
Support / Displaying Objs Problem
« on: June 16, 2004, 05:29:34 pm »
I assume that theWorld is global? Moving the call to addObject() to the end of loadFerito() should do the trick. I can't see a reason why this should cause a nullpointer exception (IF theWorld is global). Creating a new world in the loadFerito()-method is bad, because that means that you create two instances of world and only use the second one for rendering...the result is (as mentioned) the same: You can only see the last object.
So:

1.) Make sure theWorld is global
2.) ferito doesn't have to be global IMO. Make it local inside loadFerito.
3.) Don't create more then one instance of World

BTW:

Code: [Select]

ferito=new Object3D(0);
ferito=feritoArray[0];


is unnecessary work in this case. Just do a ferito=feritoArray[0]. The Object3D(0) will be created and throw away right afterwards in your example. There's no point in doing this.

12039
Support / Camera position object3D position mismatching
« on: June 14, 2004, 06:20:04 pm »
There are some places in your code where things can go wrong. The first thing is: Are you actually calling build() on your loaded object somewhere? Are you adding it to the world? (Obviously you do, because you couldn't even see it otherwise..it's just that i can't spot that place in your code). Anyway, you are rotating the mesh. If you do this without calling build() before, your rotation pivot could be wrong. It will be placed at the origin, which may be correct but it doesn't have to. It depends on your model, so try to call build() before doing this or check if a rotation pivot at the origin is really what you want.
If it still doesn't work, try to figure out in which way your cam's position and the one of the object differ. Maybe that will help to see what's wrong here.

12040
Support / A texture error…
« on: June 11, 2004, 04:50:16 pm »
I think it's a problem with the order in which you are doing things. The 3DS-loader will look for materials (i.e. texture names) in the file and then, it tries to get a matching texture from the TextureManager. If there is none, a new one with this name will be created. If you try to add another texture with this name later in the code, you'll get this error. So you either have to move the loading of your textures to a position before you load the object(s) or you have to use the replaceTexture()-method in the texture manager to replace the white dummy texture with that name with the correct texture.

Hope this helps.

12041
Support / Loading generic texture in an Applet
« on: June 08, 2004, 10:10:46 pm »
That means that files is null, which means that dir.list() returns null, which means that your "textures"-directory doesn't exist. At least not there where you expect it to be. Try the complete path (i.e. "c:\blah\blubb\...\textures" or similar) and see if that works.

12042
Support / Loading generic texture in an Applet
« on: June 08, 2004, 04:44:11 pm »
The exception happens somewhere in your code. What exactly is in line 238?

12043
Support / Loading texture problem while using certificate
« on: June 04, 2004, 11:22:43 pm »
Well, getDocumentBase() returns an URL, which can simply be printed out. I doubt that this will reveal anything new, but i would like to know if getDocumentBase() really returns the same URL with and without the certificate. If it does and you say that the textures are loaded correctly, just not displayed, i suggest to double check your code. Maybe you are doing something when loading the file that causes this behaviour.

12044
Support / Loading texture problem while using certificate
« on: June 04, 2004, 07:07:59 pm »
Strange...do you get an error message? Maybe signing the applet affects the document base?? I'm just guessing here, but it could be helpfull to know where getDocumentBase() points to in both situations.
Is your applet in a jar file? If so, maybe putting the textures into that jar and loading them from there using an InputStream will work...

12045
News / Version 1.01 has been released!
« on: June 03, 2004, 07:33:57 pm »
Changes are documented here: http://www.jpct.net/changes.html

Have fun!

Pages: 1 ... 801 802 [803] 804 805 ... 822