I've got a sphere on screen (using the primitive generation routine that came with the examples), the camera looking at it and all was well. Then I loaded a texture and added it to the sphere object, but the whole thing is upside down and to the left. Does this mean my object is upside down and facing to the left? Or that my camera isn't where I think it is? Or does my computer just hate my guts? :)
Edit: Bad code deleted.
Ok I've already found some errors in the above code. For example I had the wrong parameters for the X_ROTATION command. :) Still not fixed. I'm starting to think there is no exact science to this. The texture position seems to move when I change size of the object as well as size of the texture itself.
Edit: Actually I just realised it might have everything to do with the shape I'm using (disc). I'm guessing I need to use a program designed for altering/creating textures to fit certain shapes? What do they call them, texture mapper or something right?
Code now looks like:
SETSCREEN 600, 600, 0
// Limit our frame rate
LIMITFPS 60
// Load graphics
LOADSPRITE "BinaryLight3.png", 1
CreateSphere(1, 15, 48, RGB(255, 255, 255))
// main loop
WHILE TRUE
X_MAKE3D 20, 600, 45
X_CAMERA 0,0,40,0,0,0
// Add our texture
X_SETTEXTURE 1, -1
// Turn the sphere into a disc
X_SCALING 1,1,0.2
//X_ROTATION 90,0,1,0
X_DRAWOBJ 1, 0
// Lets do the "flip the back and display screen" thing! Woo hoo!
SHOWSCREEN
WEND
// Create a sphere object.
// Code "borrowed" from GLBasic examples.
FUNCTION CreateSphere: num, r, n, col
LOCAL i,j, theta1, theta2, theta3, pi
pi = ACOS(0)*2
IF r < 0 THEN r = -r
IF n < 4 THEN n = 4
X_AUTONORMALS 2 // smooth edges
X_OBJSTART num
FOR j=0 TO INTEGER(n/2) -1
theta1 = j * 2*pi / n - pi/2;
theta2 = (j + 1) * 2*pi / n - pi/2;
FOR i=0 TO n
theta3 = i * 2*pi / n;
X_OBJADDVERTEX r*COS(theta2) * COS(theta3), r*SIN(theta2), _
r*COS(theta2) * SIN(theta3), i/n, 2*(j+1)/n, col
X_OBJADDVERTEX r*COS(theta1) * COS(theta3), r*SIN(theta1), _
r*COS(theta1) * SIN(theta3), i/n, 2*j/n, col
NEXT
X_OBJNEWGROUP
NEXT
X_OBJEND
ENDFUNCTION // n
Hmm ok I have made a simple disc using Milkeshape and managed to map the texture so it looks right (gave up trying to work out the above) - how on earth do I get it into GLBasic ie. which format am I better off exporting with and then using the import tool in GLBasic? I tried exporting as 3DS, but when I use the GLBasic tool to convert it, nothing seems to happen (other than the brief flash of what looks like a DOS command box). Is this because my file is not an animated model?
I'm hoping to get the package Gernot recommends later on (AC3D?), this is something I bought a license for ages ago and never used - can see why, darn messy interface and a big waste of money I think...
[Edit} Aha! I exported as a Direct X model and the GLBasic x->ddd converter worked fine. :)
[Edit] Hmm ok it worked, but not fine. I can't get my model to display but I replacing it with one of the example ones worked. I tried the DDD Viewer sample and loaded - again nothing. So obviously I must have done something wrong maybe during the export from Milkshape.
[Edit] I'm exporting from Milkeshape as a Direct X 8.0 model. Doesn't seem to be any other DirectX options, and the 3DS export doesn't seem to work.
[Edit] I now remember when and why I got Milkeshape. Not that I like it much, it feels clunky and the UI design is very messy. Feels thrown together to be honest. Anyway I got it because there's a Blitz3D exporter for it. Anyway never mind, I'm going to give up on this for now. Far too tired. :)
For 3D Objects just make sure the texture is always power of 2 in size:
Like 64x128, 256x256, 512x512 or so...
Already was mate. I think the problem was the odd shape I was using. Anyway I decided it might be easier (hah!) to make a model and import it instead. :) So now it's a new problem: I think that something is breaking down from exporter to importer, and I don't point the finger at the GLBasic tool. I think I'm messing something up with Milkeshape. If someone is familiar with this program and has successfully gotten a model from Milkshape into GLBasic, let me know.
I did the old Wumbo3D Model animations with MilkShape. It's excellent for importing/exporting, but the animation capabilities were crap back then.
I use Blender for animations, but it takes a day or so to get a grip on it. After you got the idea, it's pretty easy and fast to use.
I suspect they still are crap. :) Can you remember what you exported your model as from Milkshape? And does the model have to contain animations, skeleton or similar?
Yeah I've used Blender in the past, I find it to be far too complex for my simple needs. The 3D models I need for any games I'm currently working on aren't going to be all that complex. I'll check it out again now though. I'm definitely wanting to give Milkshape the flick.
I think I exported as MD2 then. Yes, I animated Wumbo in MS3D -> The model itself was an AC3D model. That's the best modeller IMO.
Ah well... Unfortunately Milkshape doesn't seem to want to export to MD2 any models that don't contain joints/animations. I'm going to leave this till tomorrow. Hopefully I'll spot what I'm doing wrong then.
does not? I think it did.
Maybe you must select the mesh?
Keeps saying "Found vertices with no bone. No animations exported!" and no file is created. I've also tried selecting the mesh. Maybe I'm not selecting the right exporter...
[Edit] Ok gave up on Milkeshape, and really don't like Blender. Downloaded and tried the demo of AC3D. Fantastic little modeler that. Make my disc, mapped the texture, exported as 3DS, imported into GLBasic and it all worked fine. :)
[Edit] Of course AC3D doesn't do animation, so I guess I'm back looking at Blender again. :) Or AC3D + Milkshape. I'm really impressed with AC3D, just hope they add animation one day. I could put up with Milkshape if the exporters did the job (especially since I already have a license for it). Exporting from AC3D works fine, but as I've said above, none of the compatible exporters in Milkshape seem to work properly. Very odd. I should post on the Milkshape forum I think.
Quote from: Hatonastick[Edit] I now remember when and why I got Milkeshape. Not that I like it much, it feels clunky and the UI design is very messy. Feels thrown together to be honest. Anyway I got it because there's a Blitz3D exporter for it. Anyway never mind, I'm going to give up on this for now. Far too tired. :)
MS exporters are a mixed bunch, there always seems to be caveats, esp with animated formats... I dont know why its so popular?
I don't either. Basically I want something that allows me to make basic non-animated objects in 3D relatively easily and which will actually import into GLBsaic.. AC3D seems to fit that bill although it's a bit pricey for something that doesn't include animation. I also need something that allows me to make "simple" animated models which can be imported into GLBasic without too much in the way of mental gymnastics.
3D really isn't my strong point and quite frankly I find Blender overwhelming despite having messed with it many times over the years, and I've yet to get a non-animated model to import from Milkshape into GLBasic. I don't mind Anim8or which is free, but I don't think it exports to anything compatible with GLbasic.
What animated format are you trying to convert? I believe DDD is a mesh deformation format, ala MD2, so I guess that would be quite a good starting point.
To manually apply a texture to anything other than a simple shape would require a UV co-ordinate set. My advice would be to perceiver with Gernots converter, with a model format that includes the texture information.
Gernot, do you have a DDD file format doc? I may have a go at writing a custom file format converter for some unsupported formats?
Don't write ddd. If you want to write a converter, use the dda format (http://www.glbasic.com/forum/viewtopic.php?id=334) and then (optionally) convert this with a small GLBasic program:
X_LOADOBJ name$+".dda", 0
X_SAVEOBJ name$+".ddd", 0
END
There's 2 reasons for this:
1) The ddd file format is very, very cryptic but small in size
2) The ddd format offers you to "protect" your models against importers (sort of. X_GETFACE still works, though)
3) Somtimes I make changes to the ddd format, so you would have to keep up with it.
4) a bad ddd file might break your game, there's not much error checking in the read_ddd function.
Apparently anim8or's file format is ascii and sounds more like a programming language:
http://www.anim8or.com/resources/an8_format.txt
However although you can make models with it, and there's at least one game "engine" that imports its file format, I think it's in some ways more of a renderer than a modeler. I guess you were talking about more of the more "standard" formats though. :)
Anim8or can export (perfectly) to 3ds, which can be converted (with animations) to ddd. Baggi does that a lot.
Will it convert if it's just an object with a texture (no animations - hmm I think I've answered myself towards the end of this paragraph)? Because I've tried and I can't get it to work. I've made my object in Anim80r, added texture, then exported as 3DS. However when I come to importing it into GLBasic, instead of converting it, Convert3D flashes some sort of error message which quickly disappears before I can read it. Now the thing is I can convert the 3DS object and texture file which AC3D generates using the same tool without any problems.
I might be doing something wrong somewhere - I have great faith in my incompetence when it comes to 3D graphics. :) I've tried both the preview version and the current stable version of Anim8or. Hopefully Baggi can give me some pointers/suggestions as to what I might be doing wrong.
Upload the 3ds file that causes problems. I'll try to fix the converter.
I'll zip it up and email it to you. As well as the animator file and texture. This forum doesn't allow uploads right? And I don't have access to a file server these days (can't be bothered mucking about with the public "free" ones).
There's a bug in my 3ds converter. Great, I found it.
Now importing Anim8or models works. You should reduce the animation frames to the bare neccities, though. (Your model has 100 frames).
Quote from: GernotFrischDon't write ddd. If you want to write a converter, use the dda format (http://www.glbasic.com/forum/viewtopic.php?id=334) and then (optionally) convert this with a small GLBasic program:
X_LOADOBJ name$+".dda", 0
X_SAVEOBJ name$+".ddd", 0
END
There's 2 reasons for this:
1) The ddd file format is very, very cryptic but small in size
2) The ddd format offers you to "protect" your models against importers (sort of. X_GETFACE still works, though)
3) Somtimes I make changes to the ddd format, so you would have to keep up with it.
4) a bad ddd file might break your game, there's not much error checking in the read_ddd function.
Aha, .dda, an interesting read, thanks Gernot ;)
Here's a new kid on the block... just announced today... and freeware ;)
http://lodka3d.googlepages.com/indexeng.html
I'd love to know how or why my model had 100 frames. Ah well I guess if I do use Anim8or I just run the model through Milkshape afterwards. Milkshape seemed to create a much smaller 3DS export file - probably minus the extraneous animations. :)
LODka 3D looks interesting but waaaaay over my head. :)
Gernot I redid the object in Anim8or from scratch. The 3DS export converted into DDD format is now a tiny 7k as opposed to what I had before (140k or something I think it was), so hopefully I've fixed whatever I accidentally added last time.