# GeomStaticSmoothedMesh & debugging procedurals / plugins

**URL:** <https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156>\
**Category:** SDK\
**Created:** [September 25, 2014, 11:54am UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156 "2014-09-25T11:54:14Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dboogert](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@dboogert](https://forums.chaos.com/u/dboogert)\
**Post date:** [September 25, 2014, 11:54am UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156/1 "2014-09-25T11:54:14Z")

</div>

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  
[vray-subd.zip](https://forums.chaos.com/uploads/short-url/qhJAxJTFbwTjrOBgJtxtWrgdADv.zip) (989 KB)

---

<div class="post-metadata">

**Author:** ![vlado](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vlado](https://forums.chaos.com/u/vlado)\
**Post date:** [September 25, 2014, 5:29pm UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156/2 "2014-09-25T17:29:29Z")

</div>

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:```

#include “vraypluginsexporter.h”

…  
VRaySettingsHolder settings;  
SceneInfoWithPlugMan sceneInfo(\*plugman, NULL, &settings);  
VRayPluginsExporterBase \*exporter=VRayPluginsExporterBase::newVRayPluginsExporter(sceneInfo, “/tmp/test.vrscene”);  
exporter-\>doExport();  
VRayPluginsExporterBase::deleteVRayPluginsExporter(exporter);

```auto

It should show all the plugins that exist in the scene, including the ones that you created in the preRenderBegin().

Best regards,
Vlado
```

---

<div class="post-metadata">

**Author:** ![dboogert](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@dboogert](https://forums.chaos.com/u/dboogert)\
**Post date:** [September 26, 2014, 11:29am UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156/3 "2014-09-26T11:29:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vlado](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vlado](https://forums.chaos.com/u/vlado)\
**Post date:** [September 26, 2014, 12:35pm UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156/4 "2014-09-26T12:35:27Z")

</div>

> [@Real Liquid](https://forums.chaos.com/t/real-liquid/45926/6):
>
> 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

---

<div class="post-metadata">

**Author:** ![dboogert](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@dboogert](https://forums.chaos.com/u/dboogert)\
**Post date:** [September 26, 2014, 1:04pm UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156/5 "2014-09-26T13:04:35Z")

</div>

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:

```auto
class MyClass
{
public:
   MyClass() : param_smooth_uv("smooth_uv", true) {}
   void CreateMeshPlugin() 
   {
       geomPlugin->setParameter(&param_smooth_uv);
   }
private:
   VR::smile:efBoolParam param_smooth_uv;
}

```

---

<div class="post-metadata">

**Author:** ![vlado](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vlado](https://forums.chaos.com/u/vlado)\
**Post date:** [September 26, 2014, 2:53pm UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156/6 "2014-09-26T14:53:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dboogert](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@dboogert](https://forums.chaos.com/u/dboogert)\
**Post date:** [September 29, 2014, 7:46am UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156/7 "2014-09-29T07:46:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dboogert](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@dboogert](https://forums.chaos.com/u/dboogert)\
**Post date:** [September 29, 2014, 7:52am UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156/8 "2014-09-29T07:52:01Z")

</div>

> [@Typo](https://forums.chaos.com/t/typo/45942/5):
>
> 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

---

<div class="post-metadata">

**Author:** ![dboogert](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@dboogert](https://forums.chaos.com/u/dboogert)\
**Post date:** [October 16, 2014, 9:44am UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156/9 "2014-10-16T09:44:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dboogert](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@dboogert](https://forums.chaos.com/u/dboogert)\
**Post date:** [October 17, 2014, 11:41am UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156/10 "2014-10-17T11:41:25Z")

</div>

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

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

```auto

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:

```auto

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

```auto

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

 ![plane.png](https://europe1.discourse-cdn.com/chaosprd/original/3X/1/e/1eabde8a975b9473cba3a2438f70fcb039afd29b.png)

---

<div class="post-metadata">

**Author:** ![vlado](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vlado](https://forums.chaos.com/u/vlado)\
**Post date:** [October 17, 2014, 12:48pm UTC](https://forums.chaos.com/t/geomstaticsmoothedmesh-debugging-procedurals-plugins/51156/11 "2014-10-17T12:48:07Z")

</div>

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
