Announcement

Collapse
No announcement yet.

GeomStaticSmoothedMesh & debugging procedurals / plugins

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

  • GeomStaticSmoothedMesh & debugging procedurals / plugins

    Hi All,

    I'm investigating a strange subd issue with our plugin which generates GeomStaticMesh plugins to emit geometry for vray. Our plugin just generates a bunch of GeomStaticMesh plugins and optionally GeomStaticSmoothedMesh nodes to wrap the raw geo. Rendering the gometry directly everything is fine but when I render with GeomStaticSmoothedMesh then I get strange UV coordinates with our custom plugin.

    Attached are screen shots of the issue I'm seeing:
    our plugin - no subd: custom_node.png : OK
    maya - no subd: maya_geo.png : OK
    our plugin - subd: custom_node_subdiv.png : FAIL
    maya - subd: maya_geo_subdiv.png : OK

    I'd like to be able to view debug dump then contents of the results of my procedural to validate the data and perhaps to generate test data for further investigation. Basically can I generate an expanded .vrscene file ?

    Cheers
    - Don
    Attached Files

  • #2
    Are the settings of GeomStaticSmoothedMesh the same for the .vrscene exported from Maya, and for the one that you create manually? The same goes for the GeomStaticMesh plugin.

    You can export a .vrscene for the current contents of the plugin manager f.e. in the postRenderEnd() method of your plugin like this:
    Code:
    #include "vraypluginsexporter.h"
    
    ...
    VRaySettingsHolder settings;
    SceneInfoWithPlugMan sceneInfo(*plugman, NULL, &settings);
    VRayPluginsExporterBase *exporter=VRayPluginsExporterBase::newVRayPluginsExporter(sceneInfo, "/tmp/test.vrscene");
    exporter->doExport();
    VRayPluginsExporterBase::deleteVRayPluginsExporter(exporter);
    It should show all the plugins that exist in the scene, including the ones that you created in the preRenderBegin().

    Best regards,
    Vlado
    I only act like I know everything, Rogers.

    Comment


    • #3
      Hi Valdo,

      It looks like the difference is smooth_uv parameter isn't being set / read on GeomStaticMeshes I create in my plugin. I used the example code you sent but it only dumped my procedural and not GeomStaticMeshes plugins I create in my procedural (in the frameBegin function)

      I create a bool parameter called "smooth_uv" and set it on the GeomStaticMeshes I generate but somehow this gets reset before being consumed by the renderer.

      Cheers
      - Don

      Comment


      • #4
        Originally posted by dboogert View Post
        I used the example code you sent but it only dumped my procedural and not GeomStaticMeshes plugins I create in my procedural (in the frameBegin function)
        Hm, do you pass the same plugin manager as the one used to create your plugins? Also, do you give a name to your plugins?

        I create a bool parameter called "smooth_uv" and set it on the GeomStaticMeshes I generate but somehow this gets reset before being consumed by the renderer.
        Can you show me how you set this parameter?

        Best regards,
        Vlado
        I only act like I know everything, Rogers.

        Comment


        • #5
          It looks like there is only one pluginManager and I wasn't naming my plugins but I am now (using Plugin::setPluginName) with no difference.

          Setting the parameter is done something like this:

          Code:
          class MyClass
          {
          public:
             MyClass()  : param_smooth_uv("smooth_uv", true) {}
             void CreateMeshPlugin() 
             {
                 geomPlugin->setParameter(&param_smooth_uv);
             }
          private:
             VR::DefBoolParam param_smooth_uv;
          }

          Comment


          • #6
            Ok, let me try and see if I can recreate the problem here. Which V-Ray version are you using, by the way?

            Best regards,
            Vlado
            I only act like I know everything, Rogers.

            Comment


            • #7
              Hi Vlado,

              This is most likely a problem with the me not setting the smooth_uv parameter correctly but I can't seem to see how this is happening. I'll remove internal dependencies from our plugin so you can compile it.


              - Don

              Comment


              • #8
                Originally posted by vlado View Post
                Ok, let me try and see if I can recreate the problem here. Which V-Ray version are you using, by the way?

                Best regards,
                Vlado
                We see this in vray 2.4

                Comment


                • #9
                  The code snippet to dump plugins worked fine but I was calling it after deleting my plugins!

                  Once I could diff the expanded .vrscenes it was obvious the StaticGeoms I was creating versus what vray4maya was generating were different in UVs. I was creating PRman style per face per vertex UVs to V-Ray which caused the problem. Just welding degenerate UVs fixed it.

                  Cheers
                  -Don

                  Comment


                  • #10
                    I've noticed that when exporting plugins to .vrscene file I'm not getting interpolated attributes say for a deforming mesh.

                    My test scene consists of a single plane with a single moving vertex

                    Click image for larger version

Name:	plane.png
Views:	1
Size:	39.8 KB
ID:	854417

                    Here is what gets written to my debug.vrscene using the previously posted VRayPluginsExporterBase example code:

                    Code:
                    GeomStaticMesh my_plugin0 {
                      vertices=ListVector(
                        Vector(-0.5, -1.110223e-16, 0.5),
                        Vector(0.5, -1.110223e-16, 0.5),
                        Vector(-0.5, -1.110223e-16, -0.5),
                        Vector(0.5, 0.1928756, -0.5)
                      );
                      faces=ListInt(
                        0,1,3,0,3,2);
                      normals=ListVector(
                        Vector(-0.09552449, 0.9908301, 0.09555501),
                        Vector(-0.09552449, 0.9908301, 0.09555501),
                        Vector(-0.09552449, 0.9908301, 0.09555501),
                        Vector(-0.09552449, 0.9908301, 0.09555501)
                      );
                      faceNormals=ListInt(
                        0,1,3,0,3,2);
                      map_channels=List(
                          List(
                              0, 
                              ListVector(
                                Vector(0, 0, 0),
                                Vector(1, 0, 0),
                                Vector(0, 1, 0),
                                Vector(1, 1, 0)
                              ), 
                              ListInt(
                                0,1,2,0,2,3)
                          )
                      );
                      dynamic_geometry=0;
                      smooth_uv_borders=0;
                      smooth_uv=1;
                    }
                    I've instrumented my MyVectorListParam (derived from VR::VRayPluginParameter) to see when and with what times getVectorList is called but it results in zero which results in the following when exporting the scene:

                    Code:
                    frameEnd  dumping expanded vrscene:/tmp/debug1.vrscene
                    t:1010 start:1010 end:1011
                    get vector list ptr:0x7fd5e81197c0 name: 'vertices' time: 0
                    num samples: 2 start: 1010 end:1011
                    get vector list ptr:0x7fd5e81197c0 name: 'vertices' time: 0
                    num samples: 2 start: 1010 end:1011
                    get vector list ptr:0x7fd5e81197c0 name: 'vertices' time: 0
                    num samples: 2 start: 1010 end:1011
                    get vector list ptr:0x7fd5e8119868 name: 'normals' time: 0
                    num samples: 2 start: 1010 end:1011
                    get vector list ptr:0x7fd5e8119868 name: 'normals' time: 0
                    num samples: 2 start: 1010 end:1011
                    get vector list ptr:0x7fd5e8119868 name: 'normals' time: 0
                    num samples: 2 start: 1010 end:1011
                    I would have expected times in the range [1010,1011] and are the multiple calls indication there is a problem in my implementation?

                    Here is the maya polygons exportered with proper interpolated attributes and I suppose I would expect something like this in the export

                    Code:
                    GeomStaticMesh pPlaneShape1@mesh1 {
                      vertices=interpolate(
                        (1010, ListVector(
                        Vector(-0.5, -1.110223e-16, 0.5),
                        Vector(0.5, -1.110223e-16, 0.5),
                        Vector(-0.5, 1.110223e-16, -0.5),
                        Vector(0.5, 0.2014523, -0.5)
                      )),
                        (1011, ListVector(
                        Vector(-0.5, -1.110223e-16, 0.5),
                        Vector(0.5, -1.110223e-16, 0.5),
                        Vector(-0.5, 1.110223e-16, -0.5),
                        Vector(0.5, 0.2359534, -0.5)
                      ))
                      );
                      faces=interpolate(
                        (1010, ListInt(
                        0,1,3,0,3,2)),
                        (1011, ListInt(
                        0,1,3,0,3,2))
                      );
                      normals=interpolate(
                        (1010, ListVector(
                        Vector(-0.09971951, 0.9900061, 0.09971951),
                        Vector(-0.09971951, 0.9900061, 0.09971951),
                        Vector(-0.09971951, 0.9900061, 0.09971951),
                        Vector(-0.09971951, 0.9900061, 0.09971951)
                      )),
                        (1011, ListVector(
                        Vector(-0.1163682, 0.9863656, 0.1163682),
                        Vector(-0.1163682, 0.9863656, 0.1163682),
                        Vector(-0.1163682, 0.9863656, 0.1163682),
                        Vector(-0.1163682, 0.9863656, 0.1163682)
                      ))
                      );
                      faceNormals=interpolate(
                        (1010, ListInt(
                        0,1,2,0,2,3)),
                        (1011, ListInt(
                        0,1,2,0,2,3))
                      );
                      map_channels=interpolate(
                        (1010, List(
                          List(
                              0, 
                              ListVector(
                                Vector(0, 0, 0),
                                Vector(1, 0, 0),
                                Vector(0, 1, 0),
                                Vector(1, 1, 0),
                                Vector(0, 0, 0)
                              ), 
                              ListInt(
                                0,1,3,0,3,2)
                          )
                      )),
                        (1011, List(
                          List(
                              0, 
                              ListVector(
                                Vector(0, 0, 0),
                                Vector(1, 0, 0),
                                Vector(0, 1, 0),
                                Vector(1, 1, 0),
                                Vector(0, 0, 0)
                              ), 
                              ListInt(
                                0,1,3,0,3,2)
                          )
                      ))
                      );
                      map_channels_names=ListString(
                        "map1"
                      );
                      edge_visibility=interpolate(
                        (1010, ListInt(
                        51)),
                        (1011, ListInt(
                        51))
                      );
                      primary_visibility=1;
                      dynamic_geometry=0;
                    }
                    Is there a default interpolated attribute class which I should use instead of my own MyVectorListParam? I get the feeling that I've missed reading the vray sdk docs and some pointers where to start reading would be useful.

                    Thanks
                    - Don

                    Comment


                    • #11
                      Your plugin parameter should support the MyInterpolatingInterface interface that allows the exporter to recognize that it is an interpolated parameter and write the appropriate keyframes into the .vrscene file. Let me know if you need an example for that.

                      Best regards,
                      Vlado
                      I only act like I know everything, Rogers.

                      Comment

                      Working...
                      X