Author Topic: Multi/Sub Object Models..  (Read 4343 times)

Offline niksha

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Multi/Sub Object Models..
« on: 2008-Mar-13 »
Hey guys, has anyone here (using 3dsMax) tried importing complex models or models using Multi/Sub materials into GLB? Did someone tried using Render to Texture for baking the textures?

If anyone did, how did you get it to work? I can import simple models or complex models into GLB (even bumpmaps work fine) without any problem (single frame tested only) but have to alwasy replace the baked textures with some simple texture  versions, else the texture showed up unwrapped inside the GLB (models shows up fine).

I have the model turned into mesh and all, and it works fine with single, unbaked textures, but the moment texture is complex, it shows up unwrapped in-game. :(


I am also having problems turning ambient light on (it turns on like a spot light, lighting from one side only). Maybe the problems are connected.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10759
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Multi/Sub Object Models..
« Reply #1 on: 2008-Mar-14 »
Hmm... You have several textures for your object? You must make that one texture. Is there an option in 3DMax?
I don't have max - it's a bit expensive for me.

Offline niksha

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Multi/Sub Object Models..
« Reply #2 on: 2008-Mar-14 »
No, only one texture (baked texture) but it's spread out.. for eg.:

Render to Texture option in max generates following texture for 2 poly model (multi/sub material using IDs)..

.. in-game on the model, it shows up like this..


On the other hand, a simple texture (since the model simply uses this texture for both polies anyway)..

.. in-game on the model, it shows up like this..

^ That's what I want.

Now I am just wondering, how will this work for complex models (like trees, characters, tanks.. etc.) which cannot do without texture baking (unless I use one texture for every part of the model :P). I am no pro modeller, so maybe someone can tell me how (I am just trying to do what I did when modding games like Doom3 and Unreal..).




-----------------


Other probems I am having :D

Best exlained with pictures again..



1) In pic-1, the bump maps and lighting (using 1 ambient and 2 spot lights, including 1 for bumpmaps) are working fine. But I can't seem to find a way to move the shrub on the Y axis. Is there a way to make objects like plants automatically alight on top of terrain? Some collision based trick? Even manually, how can I get the plants aligned on top of the terrain... without them going underground like that? (adjusting every model in max just won't work here since there will be hundreds of these models all over the place)

I mean, creating a level to the detail of which I am used to will be painful if I have to manually align every grass and rock object all over the world. Still, I am more than willing to do that if I can figure out how :P

PS: I tried going through the examples codes but that stuff just flew right into my head, not even over it. Can someone please explain it to a noob?


2) In pic-2, I am rotating the objects.. so since the spot lights are static, the scene screws up.. however, I DO love the way it shows the bump maps when animating (well, rotating models with the mouse). So what I want to know is how can I just move the camera with the mouse, for example, in the games like Oblivion, just move the cam around the character. What I want is to just let the player move the camera around without locking onto any object (like in SC or Warcraft, moving mouse to the edge of the screen moves the screen to that direction). Also, when needed, how can I restrict the cam movement around an object instead of rotating the object itself?


3).. what came before? The egg or the chicken?





Thanks for the help :)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10759
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Multi/Sub Object Models..
« Reply #3 on: 2008-Mar-14 »
1.Use X_COLLISIONRAY on the ground to find out the y-coordinate of an x,z point ;)

OMG! You're the most terrific modeler I personally met

2. Did you take a look at the Entity wrapper I wrote? You can bind the camera to a player there.
It's just:
X_CAMERA ply_x +cos(phi)*d, ply_y+height, ply_z-sin(phi)*d, ply_x, ply_y, ply_z
where ply_xyz = player pos
height = heigt of camera above player
d = distance of cam to player

3. the chicken

Offline niksha

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Multi/Sub Object Models..
« Reply #4 on: 2008-Mar-14 »
Quote from: GernotFrisch
1.Use X_COLLISIONRAY on the ground to find out the y-coordinate of an x,z point ;)

2. Did you take a look at the Entity wrapper I wrote? You can bind the camera to a player there.
It's just:
X_CAMERA ply_x +cos(phi)*d, ply_y+height, ply_z-sin(phi)*d, ply_x, ply_y, ply_z
where ply_xyz = player pos
height = heigt of camera above player
d = distance of cam to player

3. the chicken
Thanks, going to give it a try again now. :)



Quote from: GernotFrisch
OMG! You're the most terrific modeler I personally met
Umm, the models are Blizzard's, I created the levels using those models (atleast PC Gamer loved it) and retextured everything for high-res. However, for my game, obviously, I am working on 'everything' from scratch (what I couldn't do with Wc3..).

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10759
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Multi/Sub Object Models..
« Reply #5 on: 2008-Mar-14 »
Awesome!

Offline niksha

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Multi/Sub Object Models..
« Reply #6 on: 2008-Mar-14 »
Alright, I am stuck here. Is there a simple example somewhere which shows X_Collisionray in action with a 3d object? Even if I check and it returns positive for object colliding something at Y axis, how do I move the object exactly on the top of the ground? (also, what exactly does the "scal#" value for?)

This is why CnP method of learning can be a big pain :(


Help please.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10759
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Multi/Sub Object Models..
« Reply #7 on: 2008-Mar-14 »
OK, like this:

Code: (glbasic) [Select]
scale = X_COLLISIONRAY(id_world, 0, x,0,z,   0,1,0)
// scale is the length of the ray from point x,0,z to the intersection
// with your model in the direction 0,1,0 (straight up)
IF scale // not 0
   X_MOVEMENT x,scale,z
   X_DRAWOBJ my_plant,0
ENDIF

Offline niksha

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Multi/Sub Object Models..
« Reply #8 on: 2008-Mar-14 »
Thanks a lot Gernot. I was able to get X_ROTATION to work with the model as well side by side. Thanks :)


Now to get the chicken into the game... err, I mean the player model.

Offline niksha

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Multi/Sub Object Models..
« Reply #9 on: 2008-Mar-17 »
I am back.. with more questions of course..

(Let me know if this is getting annoying)

a) I still can't get that texture working. (Gernot, I can send you the model and texture if you are free and it's not a problem)

b) What's the best way of creating a world in 3D according to you? Like the shot above of the terrain, I intend to tile squares like that all over the place (which I haven't figured out.. how to tile them without overlapping). Will that slow down the game? Or should i just create the (whole) terrain in the 3d app and import it in GLB. Basically, should I just create the game in the 3d app and import them in GLB one by one or as in whole? (will that slow down the game? consume too much memory.. unless GLB uses LOD tricks or something similar).

c) Any tutorial that explains working with the lights? THe samples you get from the homepage are good, but the problem is that they come with too much unrequired code as well (like that sphere+dynamic light tutorial) and for a noob like me, figuring out simple dynamic lightining among all the model import and rotation codes is.. well, a pain (not to mention, there isn't really detailed commenting going on in them).


Thanks again (actually, my priority is the tiling problem, b).



EDIT: BTW, for light. I want to basically create a flashlight & lamps or fire.. (with dynamic shadows). Is there a way to assign a texture as a dynamic light? or attach a light at some precise point on a model (for a flashlight).


EDIT 2: Ok, so I am testing some really big terrain (using one texture, unfortunately, since multi textures doesn't work) and it seems to work fine (can't tell if there will be slowdowns without adding additional content). However, the draw distance, or the 'fog' is too low in GLB for 3d view. Can't seem to find the option to increase it in help file (or wether it can have performance loss). I am going to give ther hexen demo another try now (since it uses large areas).

Still, the problem with using multi/sub material in max is killing the fun (I can't imagine working on complex models without this.. unless someone can tell me the way to do it). :(

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10759
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Multi/Sub Object Models..
« Reply #10 on: 2008-Mar-18 »
a) Just upload it or send me directly, no matter.
b) For a tiled terrain, take a look at the 3D Island demo (it's in the samples\3d, no?). You should try to avoid creating the terrain new for every frame, though.
c) See Samples\3D. There's a very small sample for every light type IIRC.

If you use the entity system, you can attach a light to an entity, no problem. If not, you have to place the light yourself at the position+direction of the character. No big deal for me, but you might be better off using the entity system.

You can set either a linear for that has a near and a far plane, or you can use a exponential fog, that applies to the full distance of your viewport (X_MAKE3D fov, zNear, zFar)

I don't know about sub-materials. Please send some model and we'll see.

Offline niksha

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Multi/Sub Object Models..
« Reply #11 on: 2008-Mar-19 »
Sorry about the delay (some problem with net here). I just mailed you the model and the settings.

As for the samples.. I am an idiot, I didn't know there were samples with the demo (I thought the samples were the apps from the homepage). :D


The adventure continues..