Announcement

Collapse
No announcement yet.

Getting Started Help - Need Advice / Samples

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

  • Getting Started Help - Need Advice / Samples

    Hello everyone,

    I'm diving into the VRay SDK, in hopes of understanding how best to integrate VRay into our Jewelry Design Studio software. In our previous products we've always used the V-Ray for Rhino plugin within Rhinoceros (our CAD engine) and so our experience has only been with that plugin.

    I'm hoping someone can help me bridge the gap between the V-Ray Rhino world and the SDK. Here are some task I need our software to perform, if anyone has any suggestions on where to look for samples/examples I would greatly appreciate it.

    - Assign Materials to Rhino Objects (that VRay will understand)
    - Save/Export the Rhino Objects into a format to be Rendered by Rhino
    - Give access to viewing the VFB; Hide/Show the VFB and view that most recent Render
    - Render the Design

    So far I've been able to render some sample .vrscene files that were created using V-Ray for Rhino and exported. And I can launch the render using the SDK, and see the VFB, but it quickly disappears after the render completes. I'd like the VFB to stay there until the user chooses to close it.

    Here is some code I've tried so far:
    Click image for larger version

Name:	image.png
Views:	475
Size:	73.5 KB
ID:	1177658

    Also as far as best practices, should I hold one a single static instance of Renderer? Or should we be newing it up each time like this?​

    Click image for larger version

Name:	image.png
Views:	405
Size:	37.6 KB
ID:	1177659

    Sorry if this all seems very ignorant, I'm a bit out of my depth with VRay. But I hope to get the basics down, so that we can move forward with VRay as our embedded rendering engine.

    Thank you for any help you can give me.

    Jason Stevenson
    JewelBeetle Software LLC​

  • #2
    Hello Jason,

    Each VRayRenderer instance has its own VFB (which may not be shown but it is there). So in order to keep the VFB alive (and visible) you need to keep the renderer alive. In your example you destroy the renderer immediately after the render completes.

    If you need only one VRayRenderer instance and it fits into for your workflow, you can keep and reuse it. Otherwise, you can create a new instance wherever you need it. It's up to you.

    The V-Ray AppSDK package contains an example folder and there is a csharp folder inside.

    Regarding Rhino and V-Ray for Rhino, I can ask my colleagues to help.

    Best regards,
    Stan

    Comment


    • #3
      Stan,

      Thank you for the advice. I've restructured how we are calling the Renderer and now we keep just a singleton of that object, and reuse it with all of our methods, and it lives the whole life of our application. I've spent the past 2 days trying to be able to render anything that is built from scratch. If I take a pre-built vrscene it is working fine. However we need to be able to convert our Rhino Objects (meshes) into VRay objects and build the scene, since we don't have access to VRay for Rhino and are trying to use just the App SDK.

      I've written a lot of logic to try to convert our Rhino objects into the corresponding objects in VRay, and I'm way out of my depth on this subject. I'm hoping someone can point me at simple example of building a minimum VRScene from scratch, so that I can try to adapt it to our use case within Rhino 7.

      Here is a high-level method I was trying to get to work, but it only ever produces an all black scene, do you see anything obviously wrong? This is all just me throwing stuff at the wall trying to get something to stick. Sorry if it looks very wrong. Appreciate any help...


      Click image for larger version

Name:	image.png
Views:	374
Size:	149.2 KB
ID:	1177732
      Click image for larger version

Name:	image.png
Views:	373
Size:	100.1 KB
ID:	1177733
      Click image for larger version

Name:	image.png
Views:	370
Size:	54.1 KB
ID:	1177734​​​
      Attached Files

      Comment


      • #4
        Setting up V-Ray scenes is a very big subject and beyond the scope of this forum. I'd recommend start reading from here:
        https://docs.chaos.com/display/APPSDK
        You can also use the code generator example from the AppSDK package:
        AppSDK\examples\csharp\advanced\02-scene-from-code
        to convert an already existing .vrscene-file to C# code and inspect it.
        BTW, it's not necessary to convert the array of vertices and faces to List<> because arrays already (explicitly) support the IList<> interface but you can read about that and much more in the docs.

        Comment


        • #5
          Thank you stanislav.kirilov I didn't know about the examples folder with the SDK. I've already read through all of your SDK, and went through the "Tutorial" but it wasnt really very helpful, it just takes you through the SDK which isn't different information.

          I'll scour the install folder for the SDK and see what else I'm missing.

          I was just hoping someone there would be kind enough to supply a minimum set of code to produce "something". It's tough to know if I'm on the right track when you have to start with a blank sheet of paper...

          You guys have a diagram showing what a minimum renderable scene is, but you don't have any example in c# showing it actually working...

          And there is no information that I can find anywhere on the internet about App SDK. Everything on YouTube is about V-Ray for Rhino (which is what we've always used). I'm not sure if this is going to work to partner with you guys if I can't get some minimum help...

          I'm going to reach out to Plamena and Boris to see if they can be of any more help.

          Thanks for the help.

          Jason Stevenson

          Comment


          • #6
            kent_west1 Hi Have you resolved this issue? I am also trying to write some custom VRay stuff within Rhino/Grasshopper, and having the exact same "Black Scene" issue. Hope I could get some help...

            Comment


            • #7
              Hello, juhun_lee
              The cause for your issue could be diverse - from no lights in the scene, to the material assigned to the object, missing assets, render view too far away from the object and more...
              You could check the minimal renderable scene doc, and the code examples from the AppSDK installation package. The introduction doc is a helpful resource as well.

              You could also send us a log from the rendering - either a console log, or the contents of the Log tab in the VFB window.
              An exported scene could also be helpful - if possible - renderer.exportScene("export.vrscene")​

              Comment


              • #8
                plamen.grozev Hi Thanks for your reply.

                It turned out that my camera and object transformations were wrong. (like camera pointing to totally different direction)
                Now, I am having applying a texture map to an object


                Comment

                Working...
                X