Hi, I’m trying to learn Vray SDK but a lot of information I haven’t find in Help. Can anyone tell me any description about class VUtils:StaticMeshInterfacePrimitive or a couple of samples of using it.
The StaticMeshInterfacePrimitive (declared in meshprimitives.h) is the dynamic raytraced primitive used for rendering VRayProxy objects (or any other objects derived from the MeshInterface class).
If you can provide some more information on what you are trying to do, I will be able to give a more detailed reply.
Best regards,
Vlado
I tryed to use it as:
I tryed to use it as
proxy = newDefaultMeshFile();
proxy->init(“J:\\Teapot01.vrmesh”);
ThreadManager *thread = VUtils::newDefaultThreadManager();
meshPrimitive.init(proxy, tm, thread, this);
VUtils::deleteDefaultThreadManager(thread);
int expand(VR:
ynamicRaycasterVR::StaticBox *raycaster, int threadIndex) {if (-1==firstPrimID) firstPrimID=raycaster->getNewRenderID();
raycaster->insertPrimitive(meshPrimitive, &sphere, static_castVR::GeometryGenerator\*(this), firstPrimID);return 0;
}
But it result in render hanging
It should be something like this:
owner=NULL;
ownerIndex=renderID;
const VR::VRaySequenceData &sdata=vray->getSequenceData();
RayServerInterface *rayserver=vray->getRayServer();
meshPrimitive.init(&mfile, vobjToWorld, sdata.threadManager, static_cast<GeometryGenerator*>(this));
rayserver->storeStaticPrimitive(&meshPrimitive, NULL, rayserver->getNewRenderID());
Note that the thread manager must exist for the entire rendering process (the proxy uses it during the rendering) - in the code above, the thread manager from the sequence data is used.
Also, you need to use the storeStaticPrimitive() method of the rayserver, since this is a top-level primitive, rather than insertPrimitive() which is used for primitives of lower levels.
Best regards,
Vlado
Great thanks, Vlado!
It’s really what I wanted to!
One more question…
In case of using StaticMeshInterfacePrimitive
what classes should*i use as inheritance for VRenderInstance?
public VR::Shadeable,public VR::ShadeData,public VR::ShadeInstance,public VR::GeometryGenerator
Should i use void setIntersectionData(Vlado::RSRay &rsray, void *isData) function?
----------------------------------------------------------------------------------------
And one more:
In case of using several same proxies with different transform matrix should i call
for(i =0 ;i<n;i+ +) {
meshPrimitive.init(proxy, tm, sdata.threadManager, this);
rayserver->storeStaticPrimitive(meshPrimitive, NULL, rayserver->getNewRenderID());
}
For the different transformation matrices, you are correct.
You need the setIntersectionData() function as well to fill the final intersection with the proxy primitive.
You need to have instances of those classes (shadeable, shadedata, shadeinstance and geometrygenerator) as you will need pointers to them in the setIntersectionData(). It is not strictly necessary to use inheritance for this, so long as you have objects of the required type somewhere.
If you email me to vlado@chaosgroup.com, I can send you the source code related to rendering proxies - this part is the most tricky aspect of the V-Ray SDK, so I suppose some example code would be useful.
Best regards,
Vlado
Is it possible to init VUtils::StaticMeshInterfacePrimitive from Mesh?
Is it possible to init VUtils::StaticMeshInterfacePrimitive from Mesh?
Not directly; you would need to implement your own MeshInterface that translates the information from a Mesh; do you need this for rendering or for writing out a .vrmesh file?
Best regards,
Vlado
How to get proxy from TriObject?
At this moment we load proxy from file to generate instances by surface. But it is not usefull sometimes. Is it possible to get proxy from TriObjec?
Can we set different materials?
for(i =0 ;i<cm;i+ +) rayserver->storeStaticPrimitive(&meshPrimitive, NULL, rayserver->getNewRenderID());
Can we set different materials? If we have mtls.
Yes, certainly, but it requires some coding (in fact, this is the exact same thing that the .vrmesh export command does). Again, if you are interested in code snippets, please email me.
Best regards,
Vlado
Materials are handled by the Shadeable::shade() method of your primitive - you are free to do anything there (e.g. call a different material to perform the shading based on some id’s or something).
Best regards,
Vlado
EvalColor
to Vlado:
How can we get* unique ID of StaticPrimitive from VRayInterface while EvalColor(ShadeContext& sc) works? We need it for generation of random color.
Great thanks,
Pavel
Hello Pavel,
Please check your email for an example of how to do this.
Best regards,
Vlado