Announcement

Collapse
No announcement yet.

VUtils:StaticMeshInterfacePrimitive

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

  • VUtils:StaticMeshInterfacePrimitive

    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.

  • #2
    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 only act like I know everything, Rogers.

    Comment


    • #3
      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:ynamicRaycaster<VR::StaticBox> *raycaster, int threadIndex) {if (-1==firstPrimID) firstPrimID=raycaster->getNewRenderID();
      raycaster->insertPrimitive(meshPrimitive, &sphere, static_cast<VR::GeometryGenerator*>(this), firstPrimID);return 0;
      }

      But it result in render hanging
      Last edited by fobus; 13-12-2007, 06:43 AM.

      Comment


      • #4
        It should be something like this:

        Code:
        	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
        I only act like I know everything, Rogers.

        Comment


        • #5
          Great thanks, Vlado!

          It's really what I wanted to!

          Comment


          • #6
            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());
            }
            Last edited by fobus; 14-12-2007, 12:15 AM.

            Comment


            • #7
              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
              I only act like I know everything, Rogers.

              Comment


              • #8
                Is it possible to init VUtils::StaticMeshInterfacePrimitive from Mesh?

                Is it possible to init VUtils::StaticMeshInterfacePrimitive from Mesh?

                Comment


                • #9
                  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
                  I only act like I know everything, Rogers.

                  Comment


                  • #10
                    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?
                    Last edited by fobus; 19-12-2007, 11:41 PM.

                    Comment


                    • #11
                      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.

                      Comment


                      • #12
                        Originally posted by fobus View Post
                        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?
                        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
                        I only act like I know everything, Rogers.

                        Comment


                        • #13
                          Originally posted by fobus View Post
                          for(i =0 ;i<cm;i+ +) rayserver->storeStaticPrimitive(&meshPrimitive, NULL, rayserver->getNewRenderID());

                          Can we set different materials? If we have mtls.
                          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
                          I only act like I know everything, Rogers.

                          Comment


                          • #14
                            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

                            Comment


                            • #15
                              Hello Pavel,

                              Please check your email for an example of how to do this.

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

                              Comment

                              Working...
                              X