.obj files with scene graph
So I have finally gotten .obj files to load into my engine -- but only the v, vt, vn, and f commands. I am contemplating how to get the 'g' command in, which defines all further vertices, normals, faces, and textures as a new group. My question is, how is this 'g' command utilized later in the game? Would this be the appropriate place to define child scene node? If so, how can I tell what should be the child of what?
Is this used for animation in anyway?
Thanks.
<3 visage
.OBJ groups are typically used for animation. For example, a tank might have a group called 'turret' that would allow the turret to be rotated relative to the tank.
As I recall, each group in the file is a child of the previous group. In the case of the first 'g', it would be a child of an "unnamed" group. So you might have a tank.obj with some faces describing the tank body, followed by a child 'g' called "turret" that contains the faces of the turret. Or the body might be in a group called "body" with the "turret" group being a child of the "body" group.
For scene graph purposes, you might add a scene node for the .OBJ file as an unnamed group (or with the base filename as the group name). Then, each 'g' command would generate a new child scene node as a child of the currently active group (or the unnamed group in the case of the first 'g').
edit - Scratch some of that. Each group is only a child of the whole object and doesn't do nesting. So, you won't have children of children. Only siblings.
As I recall, each group in the file is a child of the previous group. In the case of the first 'g', it would be a child of an "unnamed" group. So you might have a tank.obj with some faces describing the tank body, followed by a child 'g' called "turret" that contains the faces of the turret. Or the body might be in a group called "body" with the "turret" group being a child of the "body" group.
For scene graph purposes, you might add a scene node for the .OBJ file as an unnamed group (or with the base filename as the group name). Then, each 'g' command would generate a new child scene node as a child of the currently active group (or the unnamed group in the case of the first 'g').
edit - Scratch some of that. Each group is only a child of the whole object and doesn't do nesting. So, you won't have children of children. Only siblings.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement