Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Using .3ds with LoadObject but either "animations work and no texture" or "texture works but no animations"??

Author
Message
pseudohaiku
8
Years of Service
User Offline
Joined: 9th Mar 2016
Location:
Posted: 7th Dec 2016 10:30
So I'm exporting a .3ds file from 3ds Max with all default export options - I've got some keyframe animations on the object.

If I use LoadObject - I can see the texture fine using SetObjectImage. I can even put in another mesh and set the textures using SetObjectMeshImage, and that's fine too.

As soon as I use LoadObjectWithChildren, the animations work fine, but the mesh becomes textureless. When I do this with SetObjectImage, the code compiles fine, but it's textureless. When I do it with SetObjectMeshImage, I get an error "mesh index is out of range" - despite working with just LoadObject.

Quote: "LoadImage ( 1, "texture.png" )
LoadObjectWithChildren( 1, "box.3ds" )
SetObjectMeshImage ( 1, 1, 1, 0 )
PlayObjectAnimation ( 1, "3DSMasterAnim", 0, 1, 0, 0 )"


That's literally the code, differentiating with the other commands I'm trying to make it work with. Any ideas? Seems a bit finnicky. Thanks!
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 7th Dec 2016 18:47
Use load object with children,
loop through all GetObjectNumMeshes and texture that mesh with your texture.
Remember, meshes are not objects. An object can contain many child meshes. (Hence the load object with children command)
pseudohaiku
8
Years of Service
User Offline
Joined: 9th Mar 2016
Location:
Posted: 8th Dec 2016 01:02
Hi Mobiius,

Thanks for the reply. Maybe I'm having difficulty grasping the difference between an object and mesh.



Here's the scene with the .3ds object with just 1 "mesh" - I've got some keyframe animation on it, but it seems that I have to load it in with LoadObjectWithChildren to even have it work with the animation commands. You can see what GetObjectNumChildren and GetObjectNumMeshes returns on the left. Not that NumChildren returns 1 here and NumMeshes returns 0.



This is just an example of how I'm setting up the parent/child hierarchy in 3ds max.



Now when I load this into 3ds max the child box (below the main object/mesh) will rotate around and act properly with the keyframe animations of the main object. So that works all fine.

What I don't understand is that ObjectNumChildren returns 2, which makes sense to me as there are two meshes (although only one is technically a child) but ObjectNumMeshes continues to return 0.

Am I doing something wrong setting it up, or exporting from Max? I don't get any export options when I make a .3ds - literally the only thing is texture mapping co-ords.

I'll keep trying to play around with it..
pseudohaiku
8
Years of Service
User Offline
Joined: 9th Mar 2016
Location:
Posted: 8th Dec 2016 01:27
Okay so I noticed that I could use the GetObjectChildID command and found that AppGameKit assigned it as 100001.



So I've managed to texture the object by using SetObjectImage and applying it to the child, and retaining the animation most importantly!

I guess that works for me! But if you have an explanation about the NumMeshes returning 0 it would be nice to know why that was happening.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 8th Dec 2016 09:16
My mistake, children not meshes. Based on your screenshots however, the object contains 2 children and 0 meshes, as the parent object contains no meshes, as it only links the two child objects together, so you'd need to call getNumOfMeshes on the child object, not the parent i'd assume.
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 8th Dec 2016 09:30
Nice thread.I dont know .3ds can load animation. The animation dont have bone right?
pseudohaiku
8
Years of Service
User Offline
Joined: 9th Mar 2016
Location:
Posted: 9th Dec 2016 09:32
Hi Mobiius, it seemed like that same issue carried even when I had a parent mesh > child mesh setup. I don't really know! I'd have to experiment more and check it out.

Hoyoyo80 - the animation for this is just keyframe animation directly on the mesh. I haven't tried using a proper bone system with .3ds yet so I can't say for sure if it works.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 9th Dec 2016 22:58 Edited at: 9th Dec 2016 23:02
I have been doing some work with this as well but using lightwave. It's quite fiddly and sometimes I even have to hand edit the scene file for it to work.

I've resorted to using dummy objects in my (lightwave) scene and replace them with my own objects when loading the scene into AGK.

There's a specific issue for me where I can't associate the generated object with a known object, as the auto object assignment ID is in one order and the [named] bones (other objects) are something else.
I definitely have to assign a pivot key to ensure the object is generated from the scene. It's too unreliable for me, so I'm replacing the placeholder object for my own object when I load the scene.

A few other things:

I need to bake all the co-ords in LW (camera in my case) as any spline interpolation in AppGameKit isn't what I did in LW - it just does it's own interpolation.
I have to edit the scene file for FPS or anim rate as well as the duration each time I edit the original scene!
The pathing in the scene file isn't AppGameKit compliant (e.g. object and textures)

Not sure if any of my problems are due to Lightwave (or my very old version) or it's the AppGameKit implementation.
I'm still very happy that this is available, but it's not 100% for me, but I've been able to fudge it sufficiently.

I would recommend using placeholder objects in the 3D package and swapping them out when you load the scene and take over the texturing etc. yourself in AGK.

As far as I can see, only the XYZ pos and XYZ rot are read from the scene and nothing else?

Anything more than that (e.g. parented objects or even scale/size isn't observed or handled).

For lightwave, I find my camera object like this:



As you can see from this (at least for lightwave), the camera and all the other [actual] objects are treated as bones.
(Bone$ is just my debug list of recognised "things" in the scene)

Glad someone else is finally having a pop at this!!
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 9th Dec 2016 23:13
Something else you [may] need to look at is the FOV and render depth.

Again, I don't know if this is just Lightwave issues, but I had to set a custom FOV and render depth to make sure the scene looked the same as I expected from the editor scene.

For lightwave, I had to adjust the FOV in my case to 45.xx (can't recall exactly) and change the near and far depths to stop near clipping and to correct distance scaling... hope it's automatic for 3DS files!

Anyway, if you need to do it, the easiest way is to put 4 objects in each extreme corner of your camera view in 3DS and then make sure they are in the same place in AppGameKit in your render.
Then, I used multiple spheres, aligned at a 45 degree angle going away at a factor of 0.5 with the edges touching to work out the distance scaling.

I'm curious to know if this works automatically for 3DS scenes or you will have to do something similar.
pseudohaiku
8
Years of Service
User Offline
Joined: 9th Mar 2016
Location:
Posted: 10th Dec 2016 03:41 Edited at: 10th Dec 2016 03:47
Hey nz0,

I've actually utilized the default camera in AppGameKit when setting up this scene and adjusting it to avoid near clipping and that sort of stuff.. I'm not exporting a camera object from Max or anything like that. The objects I've created are set at 0,0,0 (x,y,z) in Max, with the pivot points set at center X/Y and minimum Z.

But yeah, overall it seems, at least with Max, it's fiddly to get stuff kinda happening. I guess since there's no real standard, unless you can write up a proper exporter for whatever software you're using, you're left to mess around with the commands to try and figure out what's going on.

Animation playback speed is a weird thing, for sure. A lot of it just seems like playing around until you achieve the results you want. I've whipped up this little test below..



I didn't really consider any scaling here, but the plane was created at "100 units" in 3ds max, not sure about the character, but you can kind of just work stuff out by using GetObjectSizeMaxX() or whatever. When I have a proper go at something I'll definitely spend time working out the scaling of everything before I go creating assets haha.

In any case the process from lightwave > AppGameKit sounds pretty different to 3ds > AppGameKit - I guess you have a bit of a different process/set of things you're trying to achieve though.

Everything I really need to do is sorted out - I can texture objects, have them play animations, and all that jazz. The only thing that bothers me is the mesh smoothing and shadows. I'm sure that's just a shader thing though. I have NO idea how to write shaders, but I'd love if there was an easy way to just cut out shadows entirely and have 100% self-illuminated objects. Any ideas?
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 11th Dec 2016 01:03
Because I'm using the 3D package as a path generator / film scripter I needed to be able to bolt the AppGameKit camera onto the scene camera.
I checked and an AppGameKit unit = 1m in Lightwave, so that makes some sense for me.

I don't see any other stuff used by AppGameKit other than pos and rot (and textures, but I'm ignoring them and using my own).
There isn't any default shadowing in AppGameKit yet unfortunately, but if you mean lighting, then you can use lightmaps. I'm just starting with shaders myself as well.

For smoothing the objects, you should be able to check smooth normals somewhere in 3DS I'm guessing, just like lightwave or you can process them in some other tools like ASIMP or Meshlab.

I recently learned a trick where you can use hi-poly normals over a low poly object to give the illusion of a higher poly object. Look at something called XNormal for that and there's some tutorials on youtube.

pseudohaiku
8
Years of Service
User Offline
Joined: 9th Mar 2016
Location:
Posted: 12th Dec 2016 00:07
Aye - in Max even though I had no normal smoothing it was still smoothing all the normals in AppGameKit, but I've found a way in Max that I can export it to get that crisp unsmoothed look, which is what I was wanting.



So there's no dynamic shadows by default in AppGameKit? Would you still be able to accomplish that by using a shader? I guess you could kinda make faux shadows for dynamic objects, or just bake in ambient occlusion for static stuff.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 12th Dec 2016 19:04
There's a thread somewhere on here where someone has been working on shadows (I think you can find it from the main pinned shader thread?) but I'd still like to see it built in.

Login to post a reply

Server time is: 2024-11-24 22:28:07
Your offset time is: 2024-11-24 22:28:07