Hi Nick, good to hear you are getting closer. Due to the fact that standard classes of paged data handle vertex arrays etc. autonomously and mesh shaders work different I think you have to look up where this handling is done and write your own derived class. Werner
On 31. Mai 2022 21:28:08 MESZ, Trajce Nikolov NICK <[email protected]> wrote: >Hi again Werner, > >I think I got it after reading few articles, actually the main one from >NVIDIA. Do you have experience in using this with paged data? > >On Sat, May 28, 2022 at 8:35 PM Trajce Nikolov NICK < >[email protected]> wrote: > >> Hi Werner! >> >> Thanks soo much for the shared code and the hints!!! I have a better >> understanding now how all works together wrt. buffers. Just this >snippet, >> if you are willing to provide more hints. >> >> int startVertex = 1; >> >> int anzahl = _anzahlVertices; >> >> for (auto i=0; i<workgroupsInGeometry; ++i) { >> >> (*MeshletInfosArray)[i][0] = startVertex; >> >> (*MeshletInfosArray)[i][1] = min(TS_WORKGROUP_SIZE, anzahl); >> >> startVertex += TS_WORKGROUP_STEP; >> >> anzahl -= TS_WORKGROUP_STEP; >> >> } >> >> >> The ideal is to have a working code, a bit more robust then the one I >found in the repo in the meshshaders branches. But I am getting there >slowly :-) >> >> >> This is indeed a big thing! >> >> >> Big thanks! >> >> Nick >> >> >> >> ><https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> >Virus-free. >> www.avast.com >> ><https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> >> <#m_-4127028168198206277_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >> >> On Sat, May 28, 2022 at 3:09 PM Trajce Nikolov NICK < >> [email protected]> wrote: >> >>> Okay. Thanks a buch for these hints! I am starting next week with >this. >>> Will post findings >>> >>> On Sat, May 28, 2022, 14:44 Werner Modenbach < >>> [email protected]> wrote: >>> >>>> Yes, that is the only (?) way. >>>> >>>> >>>> On 28. Mai 2022 12:23:48 MESZ, Trajce Nikolov NICK < >>>> [email protected]> wrote: >>>>> >>>>> Hi! >>>>> >>>>> I haven't looked at the code yet, just want to clarify one thing: >you >>>>> are providing the meshlets verts uvs normals through 1d texture? >>>>> >>>>> On Wed, May 25, 2022, 12:17 Trajce Nikolov NICK < >>>>> [email protected]> wrote: >>>>> >>>>>> Hi! >>>>>> >>>>>> Thanks a bunch! Is your code in the repo so I can have a look? >>>>>> >>>>>> On Wed, May 25, 2022, 09:17 Werner Modenbach < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Hi Nick, >>>>>>> There is nothing special in the contents of the buffers. They >are >>>>>>> just arrays like vertex array. Special is the definition as >buffer objects >>>>>>> and "overlaying" them with a texture like shown in my code. In >the shader >>>>>>> you have the instance ID and from that you access the meshlet >info via the >>>>>>> 1D texture. Get your operation parameters from there and fetch >vertices, >>>>>>> normals, colors etc. also via the textures. >>>>>>> The only difficulty is the size limit of the textures. So you >>>>>>> eventually have to split the arrays. >>>>>>> That's it. >>>>>>> Werner >>>>>>> >>>>>>> >>>>>>> On 24. Mai 2022 22:59:52 MESZ, Trajce Nikolov NICK < >>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> I am also researching this subject. Have you succeeded? Any >hints >>>>>>>> about the meshelts buffer objects? Any other hints? >>>>>>>> >>>>>>>> Thank you a bunch for any shared info! >>>>>>>> >>>>>>>> Nick >>>>>>>> >>>>>>>> On Wed, May 11, 2022 at 5:35 PM DC ><[email protected]> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> Thanks Werner! >>>>>>>>> This will certainly help me get started. >>>>>>>>> >>>>>>>>> Much appreciated, >>>>>>>>> DC >>>>>>>>> >>>>>>>>> On Wednesday, May 11, 2022 at 4:13:08 AM UTC-5 Werner >Modenbach >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> 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 = new osg::Geometry; >>>>>>>>>> >>>>>>>>>> osg::ref_ptr<osg::ProxyPrimitive> proxyPrimitive = new >osg::ProxyPrimitive; >>>>>>>>>> >>>>>>>>>> proxyPrimitive->drawMeshTasks = new osg::DrawMeshTasks(0, >workgroupsInGeometry * taskInvocationsPerMeshlet); >>>>>>>>>> >>>>>>>>>> geometry->setUseDisplayList(false); >>>>>>>>>> >>>>>>>>>> geometry->addPrimitiveSet(proxyPrimitive.get()); >>>>>>>>>> >>>>>>>>>> _geode->addChild(geometry); >>>>>>>>>> >>>>>>>>>> // ---------------------- >>>>>>>>>> // Vertices >>>>>>>>>> >>>>>>>>>> // ---------------------- >>>>>>>>>> >>>>>>>>>> osg::ref_ptr<osg::Vec4Array> osgVertices = new >osg::Vec4Array(toCopy); >>>>>>>>>> >>>>>>>>>> for (auto i=0; i<toCopy; ++i) { // fill array >// Fill buffer >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> // Create Buffer and Texture >>>>>>>>>> >>>>>>>>>> osg::ref_ptr<osg::VertexBufferObject> >verticesBufferObject = new osg::VertexBufferObject(); >>>>>>>>>> >>>>>>>>>> verticesBufferObject->setUsage(GL_DYNAMIC_READ_ARB); >>>>>>>>>> >>>>>>>>>> osgVertices->setBufferObject(verticesBufferObject.get()); >>>>>>>>>> >>>>>>>>>> osg::ref_ptr<osg::TextureBuffer> vertexTexture = new >osg::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 = new >Vec4uiArray(workgroupsInGeometry); >>>>>>>>>> >>>>>>>>>> int startVertex = 1; >>>>>>>>>> >>>>>>>>>> int anzahl = _anzahlVertices; >>>>>>>>>> >>>>>>>>>> for (auto i=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 Buffer and Texture >>>>>>>>>> >>>>>>>>>> osg::ref_ptr<osg::VertexBufferObject> >meshInfosBufferObject = new osg::VertexBufferObject(); >>>>>>>>>> >>>>>>>>>> meshInfosBufferObject->setUsage(GL_DYNAMIC_READ_ARB); >>>>>>>>>> >>>>>>>>>> >MeshletInfosArray->setBufferObject(meshInfosBufferObject.get()); >>>>>>>>>> >>>>>>>>>> osg::ref_ptr<osg::TextureBuffer> meshInfosTexture = new >osg::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/7680959c-297e-41ff-9159-464b38c8df73n%40googlegroups.com >>>>>>>>> ><https://groups.google.com/d/msgid/osg-users/7680959c-297e-41ff-9159-464b38c8df73n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>>>> . >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> trajce nikolov nick >>>>>>>> >>>>>>>> -- >>>>>>> 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/eb4531f5-3420-4c75-be46-539490c5c659%40email.android.com >>>>>>> ><https://groups.google.com/d/msgid/osg-users/eb4531f5-3420-4c75-be46-539490c5c659%40email.android.com?utm_medium=email&utm_source=footer> >>>>>>> . >>>>>>> >>>>>> -- >>>> 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/3fd7dcac-1cec-43d9-ac91-04e22f331bd9%40email.android.com >>>> ><https://groups.google.com/d/msgid/osg-users/3fd7dcac-1cec-43d9-ac91-04e22f331bd9%40email.android.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> >> >> -- >> trajce nikolov nick >> >> >> ><https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> >Virus-free. >> www.avast.com >> ><https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> >> <#m_-4127028168198206277_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >> > > >-- >trajce nikolov nick > >-- >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/CAO-%2BzinW15LPhd_E-nzJCMca0QpF8nENeqQx7OAENhHnQA%2BaFw%40mail.gmail.com. -- 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/0ab4c82f-1f17-47e9-aa1d-9c02b5a3f7fb%40email.android.com.
