Replies: 10 comments 3 replies
-
Hi Bruce,
Thanks for the test model with vsgconv to create a model.vsgt file, and see
that it's just pure nodes/geometry/state and no user objects are assigned.
Looking at the vsgXchange::assimp loader that it isn't checking the assimp
graph for any string names and not assigning any user values on the
objects, so one thing to look at would be to investigate assimp API to see
if it loads string data and if so how to query for it. If assimp can
provide these then using vsg::Object::setValue(...) functionality would be
the way to go.
As another test I converted to .osgt using osgconv, then converted to vsg
using vsgconv and this does pull in the strings but it doesn't render
correctly.
So I think the VSG itself has all the required functionality, but
vsgXchange::assimp doesn't yet map the strings across. I don't expect this
would be too hard to add.
Cheers,
Robert.
Message ID: ***@***.***>
… |
Beta Was this translation helpful? Give feedback.
-
On Tue, 15 Nov 2022 at 20:36, bclay1297 ***@***.***> wrote:
Robert:
thanks for your reply. Based on what you said I modified assimp
3DSConverter.cpp using the code shown below. With this mod in place I can
see the individual object / layer names in the scene delivered from assimp
to vsg. I do not see the name in the node picked by the intersection. Do I
have to climb up to find the parent of the selected node?
Probably :-)
… Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
On Wed, 16 Nov 2022 at 13:59, bclay1297 ***@***.***> wrote:
Sooo that sounds easier than it looks. I do not see a parent link in any
of the structures. Plenty of examples that add children but none for moving
from a node up to the parent
The VSG doesn't have a parent pointers, I chose not to implement them as
they add an vector of C pointers and would increase the size of the
vsg::Node class significantly and as a consequence impact how compactly the
scene graph sits in memory and how fast it can be traversed.
From the ground up the VSG is engineered for speed, so there are a number
of decisions like this made that are different to the OSG, it does mean
some tasks need to be handled in a slightly different way.
I assume I have overlooked something. How can we move from the "picked"
node up to its parent?
As I mentioned in a previous reply, the
LineSegmentIntersector::Intersection has a nodePath member that has the
path taken by the intersection from the topmost node you intersected with
down to the leaf has the intersection.
Hopefully this will be sufficient.
… Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Hi Bruce,
The LineSegmentIntersector::Intersection class has a NodePath
(std::vector<const Node*>) member. Try moving through that in reverse -
haven't done it myself to check though.
Cheers,
Roland
…On Thu, 17 Nov 2022 at 00:59, bclay1297 ***@***.***> wrote:
Sooo that sounds easier than it looks. I do not see a parent link in any
of the structures. Plenty of examples that add children but none for moving
from a node up to the parent
I assume I have overlooked something. How can we move from the "picked"
node up to its parent?
Bruce
—
Reply to this email directly, view it on GitHub
<#584 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPOEQ2KLI4WWONBZV2IVKLWITSFLANCNFSM6AAAAAASBAMZBM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***
.com>
|
Beta Was this translation helpful? Give feedback.
-
I added the following to the bottom of void SceneConverter::convert(const
aiMesh* mesh, vsg::ref_ptr<vsg::Node>& node) to
make sure the names were copied over.
if (mesh->mName.length > 0)
{
node->setValue("nodeName", mesh->mName);
}
When I click on the wheel of the model in the intersection example it loops
through all of the nodes in the nodePath. None of the nodes in the path
have a nodeName. When the model is loaded the debugger shows 12 meshes and
each of them has a name. It seems like the path is not including a parent
node.
Bruce
On Wed, Nov 16, 2022 at 3:22 PM Roland Hill ***@***.***>
wrote:
… Hi Bruce,
The LineSegmentIntersector::Intersection class has a NodePath
(std::vector<const Node*>) member. Try moving through that in reverse -
haven't done it myself to check though.
Cheers,
Roland
On Thu, 17 Nov 2022 at 00:59, bclay1297 ***@***.***> wrote:
> Sooo that sounds easier than it looks. I do not see a parent link in any
> of the structures. Plenty of examples that add children but none for
moving
> from a node up to the parent
>
> I assume I have overlooked something. How can we move from the "picked"
> node up to its parent?
>
> Bruce
>
> —
> Reply to this email directly, view it on GitHub
> <
#584 (reply in thread)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAPOEQ2KLI4WWONBZV2IVKLWITSFLANCNFSM6AAAAAASBAMZBM
>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***
> .com>
>
—
Reply to this email directly, view it on GitHub
<#584 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADNLDTSSG5TOFSPGUUTE4RTWIU67ZANCNFSM6AAAAAASBAMZBM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
I have create a assimp_name branch to flesh out what is needed to apply the assimp names to the corresponding VSG objects. https://github.com/vsg-dev/vsgXchange/tree/assimp_name This will apply the non empty names to the corresponding VSG objects, include the aiMesh -> vsg::VertexIndexDraw nodes. I've tested with a FlightHelment.gltf from the official gltf samples and model.3ds and it looks to work for me. I am seeing a few names duplicated so I'm now wondering if we should maintain a map<string, vsg::StringValue> and apply the StringValue to the VSG objects using object->setObject("name", sharedNameObject) rather than object->setValue("name", name); Making sure the strings are unique would reduce the overhead in memory and might help with matching as you could just match against a pointer. |
Beta Was this translation helpful? Give feedback.
-
I have updated the vsgintersection example in vsgExamples master to print to console the name of node if it's assigned, this is the type of console output I see: intersection = world(-27.4371 -37.8017 3.37203), instanceIndex 0, distance from previous intersection = 0, vsg::Group, vsg::MatrixTransform, vsg::MatrixTransform:name=<3DSRoot>, vsg::MatrixTransform:name=tipweel3, vsg::StateGroup, vsg::VertexIndexDraw:name=3, Arrays[ ref_ptrvsg::Data(vsg::vec3Array 0x7f79215e7044) ref_ptrvsg::Data(vsg::vec3Array 0x7f792160058c) ref_ptrvsg::Data(vsg::vec2Array 0x7f7921619ad4) ref_ptrvsg::Data(vsg::vec4Value 0x7f792162a91c) ] [{7311, 0.529246} {7312, 0.442224} {7313, 0.0285303} ] |
Beta Was this translation helpful? Give feedback.
-
Robert:
Thanks for the update. I pulled the code and ran my test.
I was able to remove the mod I made to the assimp library as well as the
change I made to the vsg::assimp.cpp.
The output from the intersection example helps me see the hierarchy of the
model. One part I do not understand is in the Assimp library where they
converted 5 meshes into 12 meshes but that is a different issue that may
account for some what appears to be redundant nodes.
That raised a related question. How can we find these nodes after reading
the model file so we know which nodes we can be controled? I tried to walk
the model tree but there does not seem to be a way to do that.
Unfortunately I am not up on the c++ 17 syntax so I could not find a way to
get to the children of the models parent vsg::Node;
Bruce
…On Thu, Nov 17, 2022 at 7:26 AM Robert Osfield ***@***.***> wrote:
I have updated the vsgintersection example in vsgExamples master to print
to console the name of node if it's assigned, this is the type of console
output I see:
intersection = world(-27.4371 -37.8017 3.37203), instanceIndex 0, distance
from previous intersection = 0, vsg::Group, vsg::MatrixTransform,
vsg::MatrixTransform:name=<3DSRoot>, vsg::MatrixTransform:name=tipweel3,
vsg::StateGroup, vsg::VertexIndexDraw:name=3, Arrays[
ref_ptrvsg::Data(vsg::vec3Array 0x7f79215e7044)
ref_ptrvsg::Data(vsg::vec3Array 0x7f792160058c)
ref_ptrvsg::Data(vsg::vec2Array 0x7f7921619ad4)
ref_ptrvsg::Data(vsg::vec4Value 0x7f792162a91c) ] [{7311, 0.529246} {7312,
0.442224} {7313, 0.0285303} ]
—
Reply to this email directly, view it on GitHub
<#584 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADNLDTWTHYL46LEDGLH2TILWIYP7ZANCNFSM6AAAAAASBAMZBM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
On Thu, 17 Nov 2022 at 15:57, bclay1297 ***@***.***> wrote:
Thanks for the update. I pulled the code and ran my test.
I was able to remove the mod I made to the assimp library as well as the
change I made to the vsg::assimp.cpp.
So I am good to merge the curl_ssl and assimp_name branches with vsgXchange
master?
The output from the intersection example helps me see the hierarchy of the
model. One part I do not understand is in the Assimp library where they
converted 5 meshes into 12 meshes but that is a different issue that may
account for some what appears to be redundant nodes.
I don't know enough about the particular model and it's represented in the
modelling tool vs what is vsgXchange::assimp is generatation to comment of
whether the 5 vs 12 meshes might be a bug or just the data is/how it can be
represented in the scene graph. Could you provide more details about what
you think is amiss?
That raised a related question. How can we find these nodes after reading
the model file so we know which nodes we can be controled? I tried to walk
the model tree but there does not seem to be a way to do that.
Just write a custom visitor to search the scene graph for the named nodes,
something like:
struct PrintVisitor : public vsg::ConstVisitor
{
void apply(const vsg::Object& object) override
{
std::cout<<object.className();
if (std::string name; object.getValue("name", name))
std::cout<<object.className()<<" name = "<<name<<std::endl;
else std::cout<<object.className()<<" no name."<<std::endl;
object.traverse(*this);
}
};
The other way is to write the file to a .vsgt (text format) file and have a
look at it in an editor.
Unfortunately I am not up on the c++ 17 syntax so I could not find a way to
get to the children of the models parent vsg::Node;
It isn't a C++17 issue, the VSG simply doesn't have parent pointers, as
I've explained before this is a very deliberate performance driven design
decision not to bloat all objects with a parent list.
If you want the parental chain you'll need to accumulate it top down just
like the vsg::LineSegmentIntersector does to create the nodePath it assigns
the LineSegmentInteresector::Intersection structure.
Another difference from the OSG is neither vsg::Visitor/ConstVisitor
accumulate a NodePath, again it's a performance design - to avoid work that
may not be used. This means classes like LineSegmentIntersector have to
implement their own nodePath accumulation. This is a little more work but
saves a lot of time for the majority of visitors that never need a NodePath.
… Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
On Fri, 18 Nov 2022 at 13:22, bclay1297 ***@***.***> wrote:
Robert:
Yes you are good to do the merge of both mods from the windows perspective.
I already did it yesterday :-)
… Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Several of our models have nodes that can be controlled / articulated. As an example, the attached model has nodes
tipper1, tipwheel, tipwheel2, tipwheel3. tipwheel4 as identified by the MeshLab software. How can we get the same information in vsg to add a transform and articulate that part.
change the extension of the file to 3ds. 3ds is not a supported file type for uploads
01-Loader_3dmodel.mp4
Beta Was this translation helpful? Give feedback.
All reactions