More Cal3D

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Guest

More Cal3D

Post by Guest »

i just started using irrlicht. it seems very easy to use and i look forward to using it more.

my question has to do with cal3d.

i looked around the forums and used advice from Captain Kill and Zola to create a quick cal3d node. also downloaded the code for CCal3DSceneNode. (can't remember the link). i 'm using the same cal3d version but the latest irrlicht, so there might be a difference. anyway, the model shows up but the textures are upside down. here's a screenshot:

Image
(those blue boxes and the big white box are just the bounding boxes for the bones and for the entire model, respectively)

Also, it appears that the model shows up sideways and facing down. does this have to do with the left handed coord system used by cal3d? i thought this would only affect the arrangement of the polygons and not the orientation of the model. maybe i'm not transforming the model correctly?


Image

finally:

this was a quick setup to see if i could, indeed, get cal3d into irrlicht so i just used the code i found elsewhere. cal3d is designed so that you store a *core* model, and you instance actual models that will be displayed later. so a CoreModel is to a class as a Model is to an instance of a class if we're talking about C++. therefore, i think that the CoreModel should not actually be a part of the SceneNode. It should instead be some stored in some global CoreModel place. And only the instance Model(s) should belong to a node. my question is, is there the concept of a core node that does not actually belong to the scene that irrlicht uses? or should i just basically come up with my own storage/management of core models solution?

thanks in advance. again, i look forward to using irrlicht.
maldoror
Posts: 5
Joined: Tue Oct 05, 2004 10:51 pm

Post by maldoror »

fyi: i'm the guy who posted the above, but i just now registered to the forums :oops:
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

"Also, it appears that the model shows up sideways and facing down. does this have to do with the left handed coord system"

I am not a coder, but not, is not the usual problem of left handed system, etc. It'd be much worse if so. But the puppet looks in a piece a well.

Invert UVs direction vertically, and change the root bone AXIS orientation, seems something pretty easy to do in any engine with a line of code. Surely u can add it to your loader.

A tip: I don't know why, I suspect jox (and many others) no a line to do that ;)

I mean, I see no "fatal errors" on it. is usual problem that one, axes swaped of the root or main object (usually root, as is the father, not the mesh or the polygons) , or UVs inverted, tend to be common, and also easy to fix.

May a coder give now the final answer to solve it in code. ;)
Finally making games again!
http://www.konekogames.com
maldoror
Posts: 5
Joined: Tue Oct 05, 2004 10:51 pm

Post by maldoror »

vermeer (and everyone else who took a peek),
thanks for your reply. i finally figured it out. here's the proper pic:


Image

The problem was that on all coords the y and z need to be swapped: y=z,z=y and the texturing coords need to be inverted on the y (-y).

here are the relevant lines:

Code: Select all

tmp.Pos.set(meshVertices[i][0],meshVertices[i][2],meshVertices[i][1]);									//tmp.Pos.set(meshVertices[i][0],meshVertices[i][1],meshVertices[i][2]);
the old code is commented out. notice how the old code had order: x, y, z, the new code has order, x, z, y

here's the change for the texturing:

Code: Select all

//tmp.TCoords.set(meshTextureCoordinates[i][0],meshTextureCoordinates[i][1]);
tmp.TCoords.set(meshTextureCoordinates[i][0],-meshTextureCoordinates[i][1]);	

again, thanks. i'm gonna look into properly integrating cal3d into irrlicht. no promises tho :wink:

/r
Captain_Kill
Posts: 124
Joined: Sun Jun 27, 2004 11:02 am
Contact:

Post by Captain_Kill »

w00t! :o Congrats! 8) Thanks for sharing the code too, m8! :D Ya made my day with that... :twisted:

Fyi, I'm also considering doing a Cal3D scene node. I have MSN if you want to share ideas or anything.
2.8GHz P4 with HT - 512MB DDR - ATI Radeon 9600XT 256MB - Windows XP - VC++ 6 and VC++ 2003

Dark Reign 3 Home Page: http://darkreign3.notwhatyouthink.org/
Dark Reign 3 Forums: http://notwhatyouthink.org/darkreign3bb/
maldoror
Posts: 5
Joined: Tue Oct 05, 2004 10:51 pm

Post by maldoror »

hi captain. i don't have msn. i try to avoid instant messenger as it is as bad as a cell phone.

i'll make a thread instead and that can be the development thread for the cal3d scene node.

i'll do so later; work is getting in the way :wink:

edit:
here's the link to the cal3d scene node devel thread:
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=4110

/r
Captain_Kill
Posts: 124
Joined: Sun Jun 27, 2004 11:02 am
Contact:

Post by Captain_Kill »

Ah, ok! :)
2.8GHz P4 with HT - 512MB DDR - ATI Radeon 9600XT 256MB - Windows XP - VC++ 6 and VC++ 2003

Dark Reign 3 Home Page: http://darkreign3.notwhatyouthink.org/
Dark Reign 3 Forums: http://notwhatyouthink.org/darkreign3bb/
Post Reply