Announcement

Collapse
No announcement yet.

couple of questions about the SDK

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

  • couple of questions about the SDK

    Hi,

    I'm trying to get up to speed on the sdk. There are really good examples of most things in the shading pipeline, but I don't see anything about customizing the renderer itself. There are a few references in the docs to a renderer example, but I don't think its included. Does it exist?

    The standalone program is built on VRayPluginRenderer? It would be great if there were examples/info on the settings plugins, that way rather than rebuilding a vray from scratch we could just customize the part we need, ie the SettingsOuput plugin to attach to a different output driver.

    From the classes it looks like vray is built to be modular and flexible under the hood. But its kinda hard right now to use that potential with the supplied info .

  • #2
    The standalone renderer is derived from VRayPluginRenderer; you can also create a Settings plugin that directly modifies the sequence/frame data used by the renderer. To create a different output driver specifically, you need to replace the regionDoneCallback member of the sequence data so that you can handle the renderer output directly. There is an example for this in the nightly builds and it will go into the next official update.

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

    Comment


    • #3
      That's awesome! Now if only I could get access to those builds...

      Comment


      • #4
        You can email me to vlado@chaosgroup.com for them; please also mention this thread.

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

        Comment


        • #5
          email sent, thanks

          Comment


          • #6
            The OutputTest example is a great help to understanding how the api fits together, but now I'm stuck on some things, hope you don't mind if I keep tacking questions here

            Where would the best place be to grab the VFB tiles?
            The only thread-safe way I could come up with is to open a pipe in RegionDoneCallback::renderBegin or frameBegin, then write to the pipe in OutputRegion::storeFragmentList, kind of like in the example. But it seems like only the fragment channels are accessible there, how can we get to the VFB channels like REG_CHAN_VFB_COLOR?

            There's also a noticeable performance hit from getting the tiles in storeFragmentList, hopefully that can be minimized when I figure out what I'm doing


            best,

            Michael

            Comment


            • #7
              If you just want to look at the pixel values, you can obtain a PixelBufferInterface from the region that is passed to MyRegionDoneCallback::regionDone(), like this:
              Code:
              void MyRegionDoneCallback::regionDone(VR::OutputRegion *rgn, int threadIndex) {
              	MyOutput *out=static_cast<MyOutput*>(rgn);
              	doneCb->regionDone(out->r, threadIndex);
              
              	// If just access to the final pixels is nessary, it can be done here, without using
              	// MyOutput at all.
              	PixelBufferInterface *pixelBuffer=
              		(PixelBufferInterface*) GET_INTERFACE(out->r, EXT_PIXEL_BUFFER_INTERFACE);
              	if (pixelBuffer) {
              		// Access the pixel data in the rendered bucket
              		int numChannels=pixelBuffer->getNumChannels();
              	}
              }
              In that case, it would be enough to replace only the "region done" callback, and you can skip the MyOutput class altogether.

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

              Comment


              • #8
                That's perfect, thanks! That wasn't working for me because of some windows mess with pipes, and knowing that it should work helped me to straighten it out.

                Just to confirm, from the headers it looks like even though vray can save out exr in half-float, internally everything is stored in 32bit if we use floating point?
                Will 16bit fp be supported any time soon?

                Comment


                • #9
                  Internally V-Ray stores the information in the VFB as 32-bit floating-point numbers; I'm not sure there is any point to go through the trouble to support 16-bit storage - is there any particular reason why you need it?

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

                  Comment


                  • #10
                    Originally posted by vlado View Post
                    I'm not sure there is any point to go through the trouble to support 16-bit storage - is there any particular reason why you need it?
                    Nope, I was mistaken about something, no need at all

                    Comment


                    • #11
                      Is it possible to get the GI preview-phase pixels as well?

                      The RegionDoneCallback::drawRect and RegionDoneCallback::updateRect members aren't passed a thread index, I'm confused how they fit in.

                      I thought maybe I could override RegionDoneCallback::updateRect, then grab the data from the image PixelBufferInterface but that's not working..

                      Comment


                      • #12
                        Well, what I said in the previous post *does* work when the VFB window is displayed

                        Comment


                        • #13
                          The GI preview is implemented using the drawRect() method of the callback.

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

                          Comment


                          • #14
                            Even from drawRect(), I can only get valid pixels if the framebuffer window is set to display. Maybe its the PixelBufferInterface I'm using?

                            Code:
                            void MyRegionDoneCallback::drawRect
                            (
                            const VR::Color &color,
                            const VR::Color &transp,
                            int x0, int y0, int x1, int y1
                            )
                            {
                            	doneCb->drawRect(color, transp, x0, y0, x1, y1);
                            
                            	const RegionRect bucketRect(x0,y0,x1,y1);
                            	size_t size = (size_t)(bucketRect.wwidth * bucketRect.wheight);
                            	PixelBufferInterface* pBuf = this->getImage();
                            
                            	if ( pBuf ) {
                            		if ( !pBuf->getChannelPixels(0, -1, bucketRect, pf_rgb_float, 
                            				               sizeof(float)*size*3, myTile) )
                                            {
                            			cerr << "Error getting GI preview" << endl;
                            		 }
                            	}
                            }
                            But if that's the issue, I don't see how to get the region PixelBufferInterface here in a thread-safe way, as there's no region or thread index passed like in the other methods.

                            And thanks so much for your help Vlado!

                            Comment


                            • #15
                              Well, I've yet to find a way to get it to work, if you have any ideas please let me know.

                              The only thing I can think of is to hide vray's default vfb. But I don't see any way to gain access to the default vfb object. And when standalone is started with -display=0, that initializes vray with VRAY_INIT_NOGUI? In that case there's no way to create another gui vfb.

                              Or, hopefully, there is a way I'm missing to get the gi preview without needing the vfb gui active...

                              Comment

                              Working...
                              X