Page 1 of 1

Help with textures

Posted: Tue Feb 26, 2008 6:06 pm
by zakkwylde
Hi everyone its my first post here. Gotta say Zeditor is fantastic! With Villes help here, i managed a simple 3D rotational display of an aircraft. However, when i loaded it as a 3DS mesh, it came with several different meshes, like wings, tail, body, etc. So i am going to texture each one individually...but i am unable to do it. can anyone help? I can load the texture into the program but thats about it. Furthermore the aircraft as a 3DS shape seems to be translucent...how do i give it a solid look?
Thanks!

Posted: Tue Feb 26, 2008 7:13 pm
by VilleK
If the 3ds seems translucent then this might be because of a problem with the 3ds-file import function. It seems that some 3ds-files have the triangles in reversed order which makes them have their normals inverted in ZGE. If you want I can take a look if you zip the 3ds-file and post here or email.

About texturing you need to create a Material for every texture. Then UseMaterial before every RenderMesh. However it may be difficult to position the texture correctly. Try experimenting with texturex/y/scale on the material.

Posted: Wed Feb 27, 2008 4:59 pm
by zakkwylde
Ok sure heres my 3DS file, do take a look. Now about texturing the individual meshes, for the content folder, i go to the model subfolder and onRender i put the Usematerial node? or is there another way to texture the parts?

Posted: Wed Feb 27, 2008 5:32 pm
by VilleK
Yes it was a problem with normals. Try downloading the 1.7.3 version and use the new "Invert normals" checkbox to import your model again!

About the textures: Create a Bitmap with a BitmapFromFile to import the textures. Then create a Material for every texture and connect with the bitmaps (set the Texture property on Material, you need to name your bitmaps first). Then insert a UseMaterial before each RenderMesh that should be textures. This is in the OnRender-list on your imported model. But as I said earlier it may not look very good because texture coordinates are not imported.

Posted: Fri Feb 29, 2008 3:23 pm
by zakkwylde
Yeah Ville, thanks for the update. It was a step upa lright but i theres still the slight prob of the wings. I attached 2 pics of the same aircraft, one with and without the inversion. If you see the no-invert, the wings are solid, but the body is translucent. In the other pic, u will see its reversed. The wings are now showing their insides and the body is solid. I tried to simplify things by making the wings just flat rectangular planes so they wont need much rendering and they became triangles instead. So how do we go around this small problem?

Posted: Fri Feb 29, 2008 8:51 pm
by Kjell
Hello,

You might want to double-check the normals of your model in the tool you've created it in. Make sure you've got double-sided face rendering turned off in your viewport and that all normals are pointing outwards.

Good luck~
Kjell

Posted: Sat Mar 01, 2008 7:25 am
by zakkwylde
Ok guys its quite difficult to solve it cuz i'm using Anim8or, i posted the qns to their forum and will wait out for the reply. wil post it here too in case someone gets d same prob. Meanwhile i will get on with the project, i have managed to make the aircraft roll and yaw and gave it a Y-axis turn if rolled. However, i simply cant make it move forward on the Z-axis if facing forward and subsequently move slower forward and sideways more if i've turned. So far i managed to get a X-axis movement but Z-axis velocity stays the same. Is there a command like G91model.velocity?

Posted: Sat Mar 01, 2008 2:19 pm
by Kjell
Hi,

I've googled for backface culling in Anim8tor, and it seems like there is a disable/enable backside switch in the options menu.

Each model in ZGE has it's own Velocity property ( vector ) that you can access through for example Model.Velocity.X. However ( and this is directed to VilleK ), I noticed that the Position of a model does not get updated by it's Velocity. Bug?

Regards,
Kjell

1st Edit: Whitened the incorrect remark

Posted: Sat Mar 01, 2008 2:53 pm
by VilleK
Hmm... I thought the "invert normals" would solve this.

A good thing to try is import your 3ds-file back into your 3d-modeling program (or another modeler). If it doesn't look ok then the problem is in Anim8or's 3ds-export.

A complication to the above suggestion is that ZGE does not import the normals from the model, instead it automatically calculates new normals depending on triangle direction. The reason for this behavior is to save space in the final executable.

Maybe each individual mesh inside a 3ds-file can have a independent setting for triangle direction. If an expert on the 3ds-file format happens to read this then please provide info on how to detect triangle order (clockwise or anti-clockwise) for each triangle in a mesh. This determines which direction normals point in.

Kjell: please elaborate on the problem with Velocity and Position, I'm not sure I understand what you mean, thanks.

Posted: Sat Mar 01, 2008 3:24 pm
by Kjell
Hi VilleK,

When reproducing the problem, I noticed I was actually mistaken about the Velocity issue. This was due to me being unaware of the Velocity property being multiplied with the DeltaTime by default. Probably should have read the Component reference more carefully :roll:

Concerning the 3ds format, I'm pretty sure it was counterclockwise.

Kind Regards,
Kjell

Enemy

Posted: Sun Mar 30, 2008 1:53 pm
by zakkwylde
hi guys am doing something like spawning enemies and making them come towards me exactly. does anyone have an ideas on the coding?
I know that 3 variables or 2 must be formed to store muy current X and Y position but how do i make the enemy move toward it and in the proper angle??help pls thanks!

Posted: Sun Mar 30, 2008 4:32 pm
by Kjell
Hi zakkwylde,

Are the enemies restricted to a 2D plane or can they move freely in 3D? In case it's 2D take a look at the example I've attached. If it's 3D you're after, let me know and I'll hook you up with a 3D version ;)

Kind Regards,
Kjell

Posted: Mon Mar 31, 2008 3:02 pm
by zakkwylde
most definitely 3D, thanks....I was thinking of spawning the enemy if the player collided with a object and thereafter the enemy keeps spawning on random places and comes to the player location. any ideas on how that works?

Posted: Mon Mar 31, 2008 7:34 pm
by Kjell
Hi zakkwylde,

Not quite sure what you are asking there ... in any case, here is the Enemy Follow example executed over all 3 axes. The player sphere can be controlled using the Arrow Keys again + A to ascent and Z to descent.

And we should have made a separate topic as this has nothing to do with Normals or Textures anymore :roll:

Good luck,
Kjell