OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Sharing Vertex Arrays between Geometry Nodes


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Aitor Arrieta
Guest





PostPosted: Tue Oct 14, 2008 2:39 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

Hi all,

I am developing an application in which I have to share the same vertex array between different nodes in order to apply a different texture to each of them. I know that this is possible to do because I have read it. However, I am a beginner in the osg world and I am not able to find the way to do it.

Someone told me that I could use the same geode having different geometries but how can I specify a vertex array for a geode? As far as I know this is impossible, is not it?
I have also read something about using the DrawElementsUShort primitive but how should I use it?

My question is: is there any example of sharing vertex arrays between geometry nodes anywhere? Or has anybody done this before? In short, could anybody please help me with this task?

Thank you very much in advance.

Regards,

Aitor

------------------
Post generated by Mail2Forum
Back to top
Paul Martz
Guest





PostPosted: Tue Oct 14, 2008 2:59 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

osg::Geometry* geom0 = new osg::Geometry;
osg::Geometry* geom1 = new osg::Geometry;
osg::Vec3Array* verts = osg::Vec3Array;
geom0->setVertexArray( verts );
geom1->setVertexArray( verts );

Hope that helps.
-Paul



Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 8:39 AM
To:
Subject: Sharing Vertex Arrays between Geometry Nodes



Hi all,

I am developing an application in which I have to share the same vertex array between different nodes in order to apply a different texture to each of them. I know that this is possible to do because I have read it. However, I am a beginner in the osg world and I am not able to find the way to do it.

Someone told me that I could use the same geode having different geometries but how can I specify a vertex array for a geode? As far as I know this is impossible, is not it?
I have also read something about using the DrawElementsUShort primitive but how should I use it?

My question is: is there any example of sharing vertex arrays between geometry nodes anywhere? Or has anybody done this before? In short, could anybody please help me with this task?

Thank you very much in advance.

Regards,

Aitor




------------------
Post generated by Mail2Forum
Back to top
Aitor Arrieta
Guest





PostPosted: Tue Oct 14, 2008 3:32 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

Hi Paul

Thanks a lot for your reply, but unfortunately I think that my question is not as simple as you think. Sorry because it was my fault as I did not explain myself correctly.

The problem is that I must have a single vertex arrays for many different geometries but each geometry uses only a part of this vertex array.. That is, imagine a single vertex array with indices from 1 to 100. I should have geometry 1 with indices from 1 to 10, geometry 2 with indices from 11 to 20, etc. But all of them sharing the same vertex array, which is used to do some other things.

Sorry for my bad explanation and thanks again for your reply.

Best regards,

Aitor





----- Mensaje original ----
De: Paul Martz <>
Para: OpenSceneGraph Users <>
Enviado: martes, 14 de octubre, 2008 16:54:00
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

osg::Geometry* geom0 = new osg::Geometry;
osg::Geometry* geom1 = new osg::Geometry;
osg::Vec3Array* verts = osg::Vec3Array;
geom0->setVertexArray( verts );
geom1->setVertexArray( verts );

Hope that helps.
-Paul



Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 8:39 AM
To:
Subject: Sharing Vertex Arrays between Geometry Nodes



Hi all,

I am developing an application in which I have to share the same vertex array between different nodes in order to apply a different texture to each of them. I know that this is possible to do because I have read it. However, I am a beginner in the osg world and I am not able to find the way to do it.

Someone told me that I could use the same geode having different geometries but how can I specify a vertex array for a geode? As far as I know this is impossible, is not it?
I have also read something about using the DrawElementsUShort primitive but how should I use it?

My question is: is there any example of sharing vertex arrays between geometry nodes anywhere? Or has anybody done this before? In short, could anybody please help me with this task?

Thank you very much in advance.

Regards,

Aitor




------------------
Post generated by Mail2Forum
Back to top
Paul Martz
Guest





PostPosted: Tue Oct 14, 2008 3:43 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

The code I posted will work for the use case you describe. Indices are part of the PrimitiveSet; assign a different PrimitiveSet (with different indices) to each Geometry and they will index into the same vertex array.
-Paul


Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 9:05 AM
To: OpenSceneGraph Users
Subject: Re: Sharing Vertex Arrays between Geometry Nodes



Hi Paul

Thanks a lot for your reply, but unfortunately I think that my question is not as simple as you think. Sorry because it was my fault as I did not explain myself correctly.

The problem is that I must have a single vertex arrays for many different geometries but each geometry uses only a part of this vertex array.. That is, imagine a single vertex array with indices from 1 to 100. I should have geometry 1 with indices from 1 to 10, geometry 2 with indices from 11 to 20, etc. But all of them sharing the same vertex array, which is used to do some other things.

Sorry for my bad explanation and thanks again for your reply.

Best regards,

Aitor





----- Mensaje original ----
De: Paul Martz <>
Para: OpenSceneGraph Users <>
Enviado: martes, 14 de octubre, 2008 16:54:00
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

osg::Geometry* geom0 = new osg::Geometry;
osg::Geometry* geom1 = new osg::Geometry;
osg::Vec3Array* verts = osg::Vec3Array;
geom0->setVertexArray( verts );
geom1->setVertexArray( verts );

Hope that helps.
-Paul



Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 8:39 AM
To:
Subject: Sharing Vertex Arrays between Geometry Nodes



Hi all,

I am developing an application in which I have to share the same vertex array between different nodes in order to apply a different texture to each of them. I know that this is possible to do because I have read it. However, I am a beginner in the osg world and I am not able to find the way to do it.

Someone told me that I could use the same geode having different geometries but how can I specify a vertex array for a geode? As far as I know this is impossible, is not it?
I have also read something about using the DrawElementsUShort primitive but how should I use it?

My question is: is there any example of sharing vertex arrays between geometry nodes anywhere? Or has anybody done this before? In short, could anybody please help me with this task?

Thank you very much in advance.

Regards,

Aitor








------------------
Post generated by Mail2Forum
Back to top
Aitor Arrieta
Guest





PostPosted: Tue Oct 14, 2008 3:59 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

Hi Paul

Thanks again for your prompt reply and sorry for my stupid message. As I have said before, I am completely a beginner in this osg world...

I will try to apply your code and see what happens.

Regards,

Aitor




----- Mensaje original ----
De: Paul Martz <>
Para: OpenSceneGraph Users <>
Enviado: martes, 14 de octubre, 2008 17:38:17
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

The code I posted will work for the use case you describe. Indices are part of the PrimitiveSet; assign a different PrimitiveSet (with different indices) to each Geometry and they will index into the same vertex array.
-Paul


Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 9:05 AM
To: OpenSceneGraph Users
Subject: Re: Sharing Vertex Arrays between Geometry Nodes



Hi Paul

Thanks a lot for your reply, but unfortunately I think that my question is not as simple as you think. Sorry because it was my fault as I did not explain myself correctly.

The problem is that I must have a single vertex arrays for many different geometries but each geometry uses only a part of this vertex array.. That is, imagine a single vertex array with indices from 1 to 100. I should have geometry 1 with indices from 1 to 10, geometry 2 with indices from 11 to 20, etc. But all of them sharing the same vertex array, which is used to do some other things.

Sorry for my bad explanation and thanks again for your reply.

Best regards,

Aitor





----- Mensaje original ----
De: Paul Martz <>
Para: OpenSceneGraph Users <>
Enviado: martes, 14 de octubre, 2008 16:54:00
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

osg::Geometry* geom0 = new osg::Geometry;
osg::Geometry* geom1 = new osg::Geometry;
osg::Vec3Array* verts = osg::Vec3Array;
geom0->setVertexArray( verts );
geom1->setVertexArray( verts );

Hope that helps.
-Paul



Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 8:39 AM
To:
Subject: Sharing Vertex Arrays between Geometry Nodes



Hi all,

I am developing an application in which I have to share the same vertex array between different nodes in order to apply a different texture to each of them. I know that this is possible to do because I have read it. However, I am a beginner in the osg world and I am not able to find the way to do it.

Someone told me that I could use the same geode having different geometries but how can I specify a vertex array for a geode? As far as I know this is impossible, is not it?
I have also read something about using the DrawElementsUShort primitive but how should I use it?

My question is: is there any example of sharing vertex arrays between geometry nodes anywhere? Or has anybody done this before? In short, could anybody please help me with this task?

Thank you very much in advance.

Regards,

Aitor








------------------
Post generated by Mail2Forum
Back to top
Aitor Arrieta
Guest





PostPosted: Wed Oct 15, 2008 2:22 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

Hi Paul

I don't know if this is a stupid question or not but I'm already going crazy...

I can't use your code because I don't create new geometries. Instead of this, I get an osg::geode from an obj file. At this moment, I can only get a single geometry from the geode and apply a single texture to it. But this is not what I want.

The obj file represents a human figure, and I would like to separate the head from the body because they have different textures. I know which vertices are from the head and which ones for the body so this won't be a problem in this case. The problem is that they must share the same vertex array, which is used to do some morph tasks. My question is, how can I create two different geometries starting from the same geode and sharing the same vertex array? Is this possible or not?

Thanks a lot Paul and sorry for the inconveniences

Regards,

Aitor







----- Mensaje original ----
De: Paul Martz <>
Para: OpenSceneGraph Users <>
Enviado: martes, 14 de octubre, 2008 17:38:17
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

The code I posted will work for the use case you describe. Indices are part of the PrimitiveSet; assign a different PrimitiveSet (with different indices) to each Geometry and they will index into the same vertex array.
-Paul


Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 9:05 AM
To: OpenSceneGraph Users
Subject: Re: Sharing Vertex Arrays between Geometry Nodes



Hi Paul

Thanks a lot for your reply, but unfortunately I think that my question is not as simple as you think. Sorry because it was my fault as I did not explain myself correctly.

The problem is that I must have a single vertex arrays for many different geometries but each geometry uses only a part of this vertex array.. That is, imagine a single vertex array with indices from 1 to 100. I should have geometry 1 with indices from 1 to 10, geometry 2 with indices from 11 to 20, etc. But all of them sharing the same vertex array, which is used to do some other things.

Sorry for my bad explanation and thanks again for your reply.

Best regards,

Aitor





----- Mensaje original ----
De: Paul Martz <>
Para: OpenSceneGraph Users <>
Enviado: martes, 14 de octubre, 2008 16:54:00
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

osg::Geometry* geom0 = new osg::Geometry;
osg::Geometry* geom1 = new osg::Geometry;
osg::Vec3Array* verts = osg::Vec3Array;
geom0->setVertexArray( verts );
geom1->setVertexArray( verts );

Hope that helps.
-Paul



Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 8:39 AM
To:
Subject: Sharing Vertex Arrays between Geometry Nodes



Hi all,

I am developing an application in which I have to share the same vertex array between different nodes in order to apply a different texture to each of them. I know that this is possible to do because I have read it. However, I am a beginner in the osg world and I am not able to find the way to do it.

Someone told me that I could use the same geode having different geometries but how can I specify a vertex array for a geode? As far as I know this is impossible, is not it?
I have also read something about using the DrawElementsUShort primitive but how should I use it?

My question is: is there any example of sharing vertex arrays between geometry nodes anywhere? Or has anybody done this before? In short, could anybody please help me with this task?

Thank you very much in advance.

Regards,

Aitor








------------------
Post generated by Mail2Forum
Back to top
Aitor Arrieta
Guest





PostPosted: Wed Oct 15, 2008 2:33 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

Hi Paul

I don't know but maybe... Would it be easier to combine both textures (head and body) and create a new obj file using this new texture? You should take into account that I have never done something like that (I don't know even which program should I use)

Regards,

Aitor




----- Mensaje original ----
De: Paul Martz <>
Para: OpenSceneGraph Users <>
Enviado: martes, 14 de octubre, 2008 17:38:17
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

The code I posted will work for the use case you describe. Indices are part of the PrimitiveSet; assign a different PrimitiveSet (with different indices) to each Geometry and they will index into the same vertex array.
-Paul


Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 9:05 AM
To: OpenSceneGraph Users
Subject: Re: Sharing Vertex Arrays between Geometry Nodes



Hi Paul

Thanks a lot for your reply, but unfortunately I think that my question is not as simple as you think. Sorry because it was my fault as I did not explain myself correctly.

The problem is that I must have a single vertex arrays for many different geometries but each geometry uses only a part of this vertex array.. That is, imagine a single vertex array with indices from 1 to 100. I should have geometry 1 with indices from 1 to 10, geometry 2 with indices from 11 to 20, etc. But all of them sharing the same vertex array, which is used to do some other things.

Sorry for my bad explanation and thanks again for your reply.

Best regards,

Aitor





----- Mensaje original ----
De: Paul Martz <>
Para: OpenSceneGraph Users <>
Enviado: martes, 14 de octubre, 2008 16:54:00
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

osg::Geometry* geom0 = new osg::Geometry;
osg::Geometry* geom1 = new osg::Geometry;
osg::Vec3Array* verts = osg::Vec3Array;
geom0->setVertexArray( verts );
geom1->setVertexArray( verts );

Hope that helps.
-Paul



Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 8:39 AM
To:
Subject: Sharing Vertex Arrays between Geometry Nodes



Hi all,

I am developing an application in which I have to share the same vertex array between different nodes in order to apply a different texture to each of them. I know that this is possible to do because I have read it. However, I am a beginner in the osg world and I am not able to find the way to do it.

Someone told me that I could use the same geode having different geometries but how can I specify a vertex array for a geode? As far as I know this is impossible, is not it?
I have also read something about using the DrawElementsUShort primitive but how should I use it?

My question is: is there any example of sharing vertex arrays between geometry nodes anywhere? Or has anybody done this before? In short, could anybody please help me with this task?

Thank you very much in advance.

Regards,

Aitor








------------------
Post generated by Mail2Forum
Back to top
Jean-S√?¬©bastien Guay
Guest





PostPosted: Wed Oct 15, 2008 3:06 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

Hi Aitor,

Quote:
I can't use your code because I don't create new geometries. Instead of
this, I get an osg::geode from an obj file. At this moment, I can only
get a single geometry from the geode and apply a single texture to it.
But this is not what I want.

The obj file represents a human figure, and I would like to separate the
head from the body because they have different textures. I know which
vertices are from the head and which ones for the body so this won't be
a problem in this case. The problem is that they must share the same
vertex array, which is used to do some morph tasks. My question is, how
can I create two different geometries starting from the same geode and
sharing the same vertex array? Is this possible or not?

Your life would be simpler if you could get a correct model as soon as
you load it, instead of trying to massage it (and how you massage it
might change from one model to the next).

However, yes, what you ask is possible. You can traverse your model to
the Geode which contains the Geometry, then create new Geometry objects,
attach them to the Geode, and remove the original one. The new Geometry
objects can reference the original one's vertex arrays, and then when
you remove the original one from the Geode the vertex arrays won't be
deleted because other Geometry objects reference them.

Then on your new Geometry object(s), you can do what you want. So you
could add primitive sets for the correct vertices to be used, you could
add texture coordinate arrays (or reuse those from the original Geometry
object), etc.

As I said, it's a lot of trouble. If you can get a valid model right
away, your life will be easier. It's not the kind of thing that's best
done in code... Modeling tools are specialized in manipulating these
kinds of things...

J-S
--
______________________________________________________
Jean-Sebastien Guay
http://www.cm-labs.com/
http://whitestar02.webhop.org/


------------------
Post generated by Mail2Forum
Back to top
Paul Martz
Guest





PostPosted: Wed Oct 15, 2008 4:15 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

I can't say which method would be easier for you. Are you more comfortable with modeling or with coding OSG? If you want to combine textures into a texture atlas, you'll need to use modeling software to make sure the texture coordinate are correct. If you want to make multiple Geometry objects sharing the same vertex array, you'll need to write code to post-process the model.

As J-S says, it'd probably be easier to get your models in the right configuration from the start. However, it sounds like you have no control over how the modelers created your models.
-Paul


Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Wednesday, October 15, 2008 8:33 AM
To: OpenSceneGraph Users
Subject: Re: Sharing Vertex Arrays between Geometry Nodes



Hi Paul

I don't know but maybe... Would it be easier to combine both textures (head and body) and create a new obj file using this new texture? You should take into account that I have never done something like that (I don't know even which program should I use)

Regards,

Aitor




----- Mensaje original ----
De: Paul Martz <>
Para: OpenSceneGraph Users <>
Enviado: martes, 14 de octubre, 2008 17:38:17
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

The code I posted will work for the use case you describe. Indices are part of the PrimitiveSet; assign a different PrimitiveSet (with different indices) to each Geometry and they will index into the same vertex array.
-Paul


Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 9:05 AM
To: OpenSceneGraph Users
Subject: Re: Sharing Vertex Arrays between Geometry Nodes



Hi Paul

Thanks a lot for your reply, but unfortunately I think that my question is not as simple as you think. Sorry because it was my fault as I did not explain myself correctly.

The problem is that I must have a single vertex arrays for many different geometries but each geometry uses only a part of this vertex array.. That is, imagine a single vertex array with indices from 1 to 100. I should have geometry 1 with indices from 1 to 10, geometry 2 with indices from 11 to 20, etc. But all of them sharing the same vertex array, which is used to do some other things.

Sorry for my bad explanation and thanks again for your reply.

Best regards,

Aitor





----- Mensaje original ----
De: Paul Martz <>
Para: OpenSceneGraph Users <>
Enviado: martes, 14 de octubre, 2008 16:54:00
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

osg::Geometry* geom0 = new osg::Geometry;
osg::Geometry* geom1 = new osg::Geometry;
osg::Vec3Array* verts = osg::Vec3Array;
geom0->setVertexArray( verts );
geom1->setVertexArray( verts );

Hope that helps.
-Paul



Quote:
From: [mailto:] On Behalf Of Aitor Arrieta
Sent: Tuesday, October 14, 2008 8:39 AM
To:
Subject: Sharing Vertex Arrays between Geometry Nodes



Hi all,

I am developing an application in which I have to share the same vertex array between different nodes in order to apply a different texture to each of them. I know that this is possible to do because I have read it. However, I am a beginner in the osg world and I am not able to find the way to do it.

Someone told me that I could use the same geode having different geometries but how can I specify a vertex array for a geode? As far as I know this is impossible, is not it?
I have also read something about using the DrawElementsUShort primitive but how should I use it?

My question is: is there any example of sharing vertex arrays between geometry nodes anywhere? Or has anybody done this before? In short, could anybody please help me with this task?

Thank you very much in advance.

Regards,

Aitor












------------------
Post generated by Mail2Forum
Back to top
Aitor Arrieta
Guest





PostPosted: Thu Oct 16, 2008 4:04 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

Hi J-S and Paul

Thanks a lot for your reply. I would like to be able to have a correct model from the beginning but unfortunately I must use a given obj file...

So I don't have any option but trying to solve my problem by code. I have been doing some tests today and at this moment I'm able to separate the two geometries applying different textures for each of them and sharing the same vertex array but with different primitive sets. I'm still having some problems with the vertices near the neck but I think that I know how to solve them. Let's wait until tomorrow...

I'm also having some strange problems with the light or something like that because I only see the textures from the back of the human figure. If I see the figure from the front everything is black... It's strange because when I had only a single geometry everything was ok and I have not set anything about lights after that... Maybe it could be a problem with the normals but if I remove the normal array from the geometries the problem is still there. Do you know what could be happenning?

Thank you very much for your help.

Regards,

Aitor





----- Mensaje original ----
De: Jean-S√?¬©bastien Guay <>
Para: OpenSceneGraph Users <>
Enviado: mi√?¬©rcoles, 15 de octubre, 2008 16:29:59
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

Hi Aitor,

Quote:
I can't use your code because I don't create new geometries. Instead of
this, I get an osg::geode from an obj file. At this moment, I can only
get a single geometry from the geode and apply a single texture to it.
But this is not what I want.

The obj file represents a human figure, and I would like to separate the
head from the body because they have different textures. I know which
vertices are from the head and which ones for the body so this won't be
a problem in this case. The problem is that they must share the same
vertex array, which is used to do some morph tasks. My question is, how
can I create two different geometries starting from the same geode and
sharing the same vertex array? Is this possible or not?

Your life would be simpler if you could get a correct model as soon as
you load it, instead of trying to massage it (and how you massage it
might change from one model to the next).

However, yes, what you ask is possible. You can traverse your model to
the Geode which contains the Geometry, then create new Geometry objects,
attach them to the Geode, and remove the original one. The new Geometry
objects can reference the original one's vertex arrays, and then when
you remove the original one from the Geode the vertex arrays won't be
deleted because other Geometry objects reference them.

Then on your new Geometry object(s), you can do what you want. So you
could add primitive sets for the correct vertices to be used, you could
add texture coordinate arrays (or reuse those from the original Geometry
object), etc.

As I said, it's a lot of trouble. If you can get a valid model right
away, your life will be easier. It's not the kind of thing that's best
done in code... Modeling tools are specialized in manipulating these
kinds of things...

J-S
--
______________________________________________________
Jean-Sebastien Guay (
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://www.cm-labs..com/
http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

------------------
Post generated by Mail2Forum
Back to top
Robert Osfield
Guest





PostPosted: Thu Oct 16, 2008 4:23 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

Hi Aitor,

Can't you use the a modelling tool yourself and fix the model?

Robert.

On Thu, Oct 16, 2008 at 4:59 PM, Aitor Arrieta <> wrote:
Quote:
Hi J-S and Paul

Thanks a lot for your reply. I would like to be able to have a correct model
from the beginning but unfortunately I must use a given obj file...

So I don't have any option but trying to solve my problem by code. I have
been doing some tests today and at this moment I'm able to separate the two
geometries applying different textures for each of them and sharing the same
vertex array but with different primitive sets. I'm still having some
problems with the vertices near the neck but I think that I know how to
solve them. Let's wait until tomorrow...

I'm also having some strange problems with the light or something like that
because I only see the textures from the back of the human figure. If I see
the figure from the front everything is black... It's strange because when I
had only a single geometry everything was ok and I have not set anything
about lights after that... Maybe it could be a problem with the normals but
if I remove the normal array from the geometries the problem is still there.
Do you know what could be happenning?

Thank you very much for your help.

Regards,

Aitor




----- Mensaje original ----
De: Jean-Sébastien Guay <>
Para: OpenSceneGraph Users <>
Enviado: miércoles, 15 de octubre, 2008 16:29:59
Asunto: Re: Sharing Vertex Arrays between Geometry Nodes

Hi Aitor,

Quote:
I can't use your code because I don't create new geometries. Instead of
this, I get an osg::geode from an obj file. At this moment, I can only
get a single geometry from the geode and apply a single texture to it.
But this is not what I want.

The obj file represents a human figure, and I would like to separate the
head from the body because they have different textures. I know which
vertices are from the head and which ones for the body so this won't be
a problem in this case. The problem is that they must share the same
vertex array, which is used to do some morph tasks. My question is, how
can I create two different geometries starting from the same geode and
sharing the same vertex array? Is this possible or not?

Your life would be simpler if you could get a correct model as soon as
you load it, instead of trying to massage it (and how you massage it
might change from one model to the next).

However, yes, what you ask is possible. You can traverse your model to
the Geode which contains the Geometry, then create new Geometry objects,
attach them to the Geode, and remove the original one. The new Geometry
objects can reference the original one's vertex arrays, and then when
you remove the original one from the Geode the vertex arrays won't be
deleted because other Geometry objects reference them.

Then on your new Geometry object(s), you can do what you want. So you
could add primitive sets for the correct vertices to be used, you could
add texture coordinate arrays (or reuse those from the original Geometry
object), etc.

As I said, it's a lot of trouble. If you can get a valid model right
away, your life will be easier. It's not the kind of thing that's best
done in code... Modeling tools are specialized in manipulating these
kinds of things...

J-S
--
______________________________________________________
Jean-Sebastien Guay
http://www.cm-labs..com/
http://whitestar02.webhop.org/








------------------
Post generated by Mail2Forum
Back to top
Jean-S√?¬©bastien Guay
Guest





PostPosted: Thu Oct 16, 2008 4:31 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

Hi Aitor,

Quote:
I'm also having some strange problems with the light or something like
that because I only see the textures from the back of the human figure.
If I see the figure from the front everything is black... It's strange
because when I had only a single geometry everything was ok and I have
not set anything about lights after that... Maybe it could be a problem
with the normals but if I remove the normal array from the geometries
the problem is still there. Do you know what could be happenning?

Did you copy the other arrays from the original Geometry object to the
new one(s)? The normal array and color arrays need to be copied, and
normalBinding and colorBinding need to be set to BIND_PER_VERTEX.

Actually, I think just cloning the original Geometry object, removing
any PrimitiveSets it had, and then adding new ones would work best,
least chance to make a mistake copying things yourself.

J-S
--
______________________________________________________
Jean-Sebastien Guay
http://www.cm-labs.com/
http://whitestar02.webhop.org/


------------------
Post generated by Mail2Forum
Back to top
Skylark (Jean-Sébastien Guay)
Professional


Joined: 05 Jan 2009
Posts: 2249

PostPosted: Thu Oct 16, 2008 4:43 pm    Post subject:
Sharing Vertex Arrays between Geometry Nodes
Reply with quote

Hi Robert,

Quote:
Can't you use the a modelling tool yourself and fix the model?

We've been over this with him (Paul and I mostly). We've explained why
fixing the model directly in a modeling tool would be preferable, what
the tradeoffs are, etc.

If at this point he's decided to proceed this way, I think we have to
have confidence that he's willing to accept the consequences, and help
him to get it to work.

Just my opinion of course.

J-S
--
______________________________________________________
Jean-Sebastien Guay
http://www.cm-labs.com/
http://whitestar02.webhop.org/


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Ability to apply StateAttributeAndMod... Blanky General [forum] 0 Wed Aug 07, 2019 3:08 pm View latest post
No new posts Force OSG for GLES 2.0 to reenable ve... plamen_t General 4 Tue Jun 11, 2019 11:57 am View latest post
No new posts Layered rendering with a geometry shader AnyOldName3 General 8 Tue May 14, 2019 11:25 pm View latest post
No new posts Retrieve the triangles indices array ... Paradox General 1 Mon May 13, 2019 11:16 am View latest post
No new posts Dragging individual model nodes arfaa General [forum] 9 Tue Apr 23, 2019 1:10 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP