Hi DC,

here is the link: https://github.com/nvpro-samples/gl_vk_meshlet_cadscene
This should help you with items 1) and 2)

For item 3) see my code below.
The way I assign the data structures in OSG is like that:

//----------------------//Create Meshlet primitive //---------------------- 
_geode->getOrCreateStateSet()->getOrCreateUniform(TASK_INVOCATIONS_PER_MESHLET,osg::Uniform::INT)->set(taskInvocationsPerMeshlet);

osg::ref_ptr<osg::Geometry>geometry=newosg::Geometry;

osg::ref_ptr<osg::ProxyPrimitive>proxyPrimitive=newosg::ProxyPrimitive;

proxyPrimitive->drawMeshTasks=newosg::DrawMeshTasks(0,workgroupsInGeometry*taskInvocationsPerMeshlet);

geometry->setUseDisplayList(false);

geometry->addPrimitiveSet(proxyPrimitive.get());

_geode->addChild(geometry);


//----------------------//Vertices

//----------------------

osg::ref_ptr<osg::Vec4Array>osgVertices=newosg::Vec4Array(toCopy);

for(autoi=0;i<toCopy;++i){    // fill array
//Fill buffer }

//Create BufferandTexture

osg::ref_ptr<osg::VertexBufferObject>verticesBufferObject=newosg::VertexBufferObject();

verticesBufferObject->setUsage(GL_DYNAMIC_READ_ARB);

osgVertices->setBufferObject(verticesBufferObject.get());

osg::ref_ptr<osg::TextureBuffer>vertexTexture=newosg::TextureBuffer(osgVertices.get());

vertexTexture->setInternalFormat(GL_RGBA32F_ARB);

vertexTexture->setInternalFormatMode(Texture::USE_USER_DEFINED_FORMAT);

stateSet->setTextureAttributeAndModes(MESH_VERTEX_ARRAY_TEXTURE_UNIT,vertexTexture.get());


//----------------------//MeshletInfos

//----------------------

osg::ref_ptr<Vec4uiArray>MeshletInfosArray=newVec4uiArray(workgroupsInGeometry);

intstartVertex=1;

intanzahl=_anzahlVertices;

for(autoi=0;i<workgroupsInGeometry;++i){

(*MeshletInfosArray)[i][0]=startVertex;

(*MeshletInfosArray)[i][1]=min(TS_WORKGROUP_SIZE,anzahl);

startVertex+=TS_WORKGROUP_STEP;

anzahl-=TS_WORKGROUP_STEP;

}

//Create BufferandTexture

osg::ref_ptr<osg::VertexBufferObject>meshInfosBufferObject=newosg::VertexBufferObject();

meshInfosBufferObject->setUsage(GL_DYNAMIC_READ_ARB);

MeshletInfosArray->setBufferObject(meshInfosBufferObject.get());

osg::ref_ptr<osg::TextureBuffer>meshInfosTexture=newosg::TextureBuffer(MeshletInfosArray.get());

meshInfosTexture->setInternalFormat(GL_RGBA32UI_EXT);

meshInfosTexture->setInternalFormatMode(Texture::USE_USER_DEFINED_FORMAT);

stateSet->setTextureAttributeAndModes(MESH_INFOS_ARRAY_TEXTURE_UNIT,meshInfosTexture.get());

//----------------------//Create and assign the Task- and Mesh shader as usual 
by using the corresponding shader type
//----------------------


Am 10.05.2022 um 21:20 schrieb DC:
OK.  Thank you.

On Tuesday, May 10, 2022 at 12:59:37 PM UTC-5 Werner Modenbach wrote:

    Hi DC,
    I think we should clarify some aspects before going into the details. If I 
understand well, your problem can be split into 3 parts
    1) You want to convert an existing model into meshlets. This is not related 
to OSG. But I found a git repository from NVIDIA doing this job. I will lookup 
the link and send
    it to you tomorrow.
    2) For this to work you need task/mesh shaders doing their job on the GPU. 
This is also not related to OSG. Maybe you find some starting point in the 
repository as well.
    3) You need to know how to load your shader and how to setup the data 
structures in OSG. I hope I can help you with that by providing some code 
snippets.
    Just let me know when you are ready for that step. But the code I provided 
already should help you.
    Werner


--
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/0a56dc8e-de48-35bd-9879-50f4feef2bc0%40modenbach-ac.de.

Reply via email to