Announcement

Collapse
No announcement yet.

Geometry not visible in vrscene

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Geometry not visible in vrscene

    Hi,
    I am generating from Maya some GeomStaticMesh, which are properly rendered on the screen.
    However, when exporting to a vrscene too, I can see see that the objects directly created in Maya have an entry like:
    Code:
    GeomStaticMesh pCubeShape2@mesh1 {
      vertices=ListVector(
        Vector(-0.5, -0.5, 0.5),
        Vector(0.5, -0.5, 0.5),
        Vector(-0.5, 0.5, 0.5),
        Vector(0.5, 0.5, 0.5),
    <...>
    However GeomStaticMesh objects created from my plugin appear empty in the vrscene, and do not have a GeomStaticMesh type, but rather the name of the plugin:
    Code:
    GeomMeshLoader Unit_0_Shape@mesh2 {
    }
    Is it normal that the mesh descriptor is empty and is not of GeomStaticMesh type ? It makes it difficult for me to troubleshoot.
    Thanks.

  • #2
    Are you sure the parameters have been set correctly?
    Does V-Ray for Maya execute the code that sets them when exporting the vrscene file?
    V-Ray developer

    Comment


    • #3
      Hi, I believe I didn't do the necessary because parameters to export as vrscene do not ring me a bell.
      What parameters should I set ?
      The only ones I set and the geomstatismesh plugin parameters.
      Thanks.

      Comment


      • #4
        The same as the ones for a rendering, the ones set with the setParameter method of the VRayPlugin objects.
        V-Ray developer

        Comment


        • #5
          So is there a kind of vrayscene plugin I need to initialize and apply the same parameters too ?
          What's the name of this plugin ?

          Comment


          • #6
            Nope, there is nothing like this. If your plugin has been exported correctly, it should be present in the vrscene automatically.
            Have you debugged your plugin to see if the compute method is called correctly when exporting vrscene?
            V-Ray developer

            Comment


            • #7
              In Maya Vray render settings I select the option to render as a vrscene and on screen (see picture attached). The onscreen render occurs properly, which make me think that the geometry is properly sent to vray. Anything else I should do ?
              Click image for larger version

Name:	Capture d’écran 2015-12-16 à 22.55.57.png
Views:	1
Size:	30.1 KB
ID:	859216

              Comment


              • #8
                How do you set the parameters of your plugin? It should not look like this:

                Code:
                GeomMeshLoader Unit_0_Shape@mesh2 {
                }
                V-Ray/PhoenixFD for Maya developer

                Comment


                • #9
                  Here is the code where I set the parameters of the plugin. Hope you can see something:

                  Code:
                              baseGeomPlugin=newPlugin("GeomStaticMesh");
                          
                               oneMesh=parentUnitNode->getMesh(frame); // That's a function generating the geometry in a structure
                               param_vertices.setCount(oneMesh->vertices.length());
                              for (int i=0;i<oneMesh->vertices.length();i++)
                              {
                                  MVector oneVector=oneMesh->vertices[i];
                                  param_vertices[i]=VR::Vector(oneVector.x,oneVector.y,oneVector.z);
                              }
                              
                              param_faces.setCount(oneMesh->faces.length());
                             
                              for (int i=0;i<oneMesh->faces.length()/3;i++)
                              {
                                  setFace(param_faces,i,oneMesh->faces[i*3],oneMesh->faces[i*3+1],oneMesh->faces[i*3+2]);
                              }
                  
                              param_normals.setCount(oneMesh->normals.length());
                              for (int i=0;i<oneMesh->normals.length();i++)
                              {              
                                  MVector oneVector=oneMesh->normals[i];
                                  param_normals[i]=VR::Vector(oneVector.x,oneVector.y,oneVector.z);
                              }
                              baseGeomPlugin->setParameter(&param_shaders);
                              
                              param_faceNormals.setCount(oneMesh->faceNormals.length()*3);
                              for (int i=0;i<oneMesh->faceNormals.length();i++)
                              {
                                  setFace(param_faceNormals,i,oneMesh->faceNormals[i],oneMesh->faceNormals[i],oneMesh->faceNormals[i]);
                              }
                              param_shaders.setCount(oneMesh->indices.length());
                    
                             for (int i=0;i<oneMesh->indices.length();i++)
                              {
                                  param_shaders[i]=oneMesh->indices[i];
                              }
                              baseGeomPlugin->setParameter(&param_shaders);
                  
                              DefMapChannelsParam *param_uvs=new DefMapChannelsParam("map_channels",1);
                              DefMapChannelsParam::MapChannelList &mapChannelsList=param_uvs->getMapChannels();
                              DefMapChannelsParam::MapChannel &chan=(*(mapChannelsList.newElement()));
                              
                              chan.idx=0;
                              chan.verts.setCount(oneMesh->u.length());
                              chan.faces.setCount(oneMesh->uvid.length());
                              
                              for (int i=0;i<oneMesh->u.length();i++)
                              {
                                  chan.verts[i]=Vector(oneMesh->u[i], oneMesh->v[i],0.0f);
                              }
                  
                              for (int i=0;i<oneMesh->uvid.length();i++)
                              {
                                  chan.faces[i]=oneMesh->uvid[i];
                              }
                  
                         baseGeomPlugin->setParameter(param_uvs);
                         baseGeomPlugin->setParameter(&param_shaders); // &param_* globally defined
                         baseGeomPlugin->setParameter(&param_vertices);
                         baseGeomPlugin->setParameter(&param_faces);
                         baseGeomPlugin->setParameter(&param_normals);
                         baseGeomPlugin->setParameter(&param_faceNormals);
                         baseGeomPlugin->setParameter(&param_dynamicGeom);

                  Comment


                  • #10
                    Hi, could you find anything strange in my code ?
                    Thanks !

                    By the way... Happy New Year !

                    Comment


                    • #11
                      Oh, I now understand what you meant with Parameters. No indeed, I do not use any parameter.
                      I was expecting the geomMeshLoader struct to hold the geometry, but found out the geometry is set into geomStaticMesh.
                      Now my issue is that the geomStaticMesh structure is not created into my vrscene...

                      Any specific setting to have this possible ?

                      Code:
                      GeomMeshLoader [COLOR="#FF0000"]Unit_0_Shape@mesh1[/COLOR] {
                      }
                      
                      Node Unit_0_Shape@node {
                        transform=Transform(Matrix(Vector(1, 0, 0), Vector(0, 1, 0), Vector(0, 0, 1)), Vector(0, 12, 0));
                        geometry=[COLOR="#FF0000"]Unit_0_Shape@mesh1[/COLOR];
                        material=lambert1@material;
                        nsamples=1;
                        visible=1;
                        user_attributes="";
                      }
                      Last edited by lcrivell; 16-02-2016, 02:06 AM.

                      Comment


                      • #12
                        I finally managed to render a GeomStaticMesh from a Maya Node's compute function directly and have it in the vrscene:
                        Code:
                        void myNode::createVRayPlugin(VR::VRayGeomInfo *geomInfo)
                        {
                               if (!geomInfo) return;
                            
                            plugman=geomInfo->getPluginManager();
                            if (!plugman) return;
                            
                            bool existing=false;
                            
                            VRayPlugin *geom=static_cast<VRayPlugin*>(geomInfo->newPlugin("GeomStaticMesh", existing));
                            
                            if (!existing)
                            {
                               <do the parameters initialization>
                           }
                           <populate parameters>
                        }

                        Comment

                        Working...
                        X