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:
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:
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.
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?
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.
The same as the ones for a rendering, the ones set with the setParameter method of the VRayPlugin objects.
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 ?
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?
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 ?
How do you set the parameters of your plugin? It should not look like this:
GeomMeshLoader Unit_0_Shape@mesh2 {
}
Here is the code where I set the parameters of the plugin. Hope you can see something:
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(¶m_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(¶m_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(¶m_shaders); // ¶m_* globally defined
baseGeomPlugin->setParameter(¶m_vertices);
baseGeomPlugin->setParameter(¶m_faces);
baseGeomPlugin->setParameter(¶m_normals);
baseGeomPlugin->setParameter(¶m_faceNormals);
baseGeomPlugin->setParameter(¶m_dynamicGeom);
Hi, could you find anything strange in my code ?
Thanks !
By the way… Happy New Year !
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 ?
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="";
}
I finally managed to render a GeomStaticMesh from a Maya Node’s compute function directly and have it in the vrscene:
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>
}