Announcement

Collapse
No announcement yet.

SDK Instancing: VRay NEXT Elements all black, no alpha, no diffuse

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

  • SDK Instancing: VRay NEXT Elements all black, no alpha, no diffuse

    In my plugin I implemented instancing a while back using the methods discussed in this thread:

    https://forums.chaosgroup.com/forum/...best-practices

    It works flawlessly in VRay 3.6.

    However, in VRay NEXT (after doing the SDK conversion by using the proper NEXT types like ShadeVec instead of Vector, etc)....if I render with no render elements, it renders fine. But if I add render elements (ex: VRayReflection)...the light cache pass looks fine but as soon as it starts actually rendering buckets, my geometry comes out black....just black holes...the alpha mattes other objects in the scene, the diffuse is black....it renders as if all my geo is set to matte. Not just invisible, but literally matting everything behind it and being black itself. I've stepped through my code and the surfaceProps I pass to the renderer are all normal, nothing else seems out of the ordinary, etc. It's not just the element pass that comes out like this, but every pass include base/diffuse.

    Any ideas what could be causing this? I've scoured the NEXT plugin samples but can't see anything different between them and the 3.6 versions that would justify this problem. I'm sure it's just a simple switch I'm missing somewhere....
    Last edited by tysonibele; 09-04-2019, 08:51 PM.

  • #2
    Hello,

    Seems like your implementation of DefaultVRayShadeData::getSurfaceRenderID returns -1 for render ID. In that case we don't generate the required data for render elements and they all become black.

    Best regards,
    Yavor
    Yavor Rubenov
    V-Ray for 3ds Max developer

    Comment


    • #3
      Thank you Yavor, I knew it would be something simple

      Comment


      • #4
        By the way, I'm having a semi-related different issue now....

        My texmap coordinates come through fine and geometry displays normal textures ok, but no bump mapping comes through. Which instance function(s) are used to calculate bump mapping? Again, I don't see any obvious differences between my own plugin and the VRaySphere/VRayFur/etc projects...I'm sure the missing param is obvious/simple though...

        Comment


        • #5
          Can you get me a simple scene with the issue ?
          Yavor Rubenov
          V-Ray for 3ds Max developer

          Comment


          • #6
            Sure,

            Attached a very simple scene with 2 planes. Left plane is instanced using my plugin with the code we previously worked on in the other thread. You can see the texmap is coming through but the bump is not. Right plane is a default max plane. Both bump and texmap are coming through.

            You can get the plugin for your version of max here:

            http://docs.tyflow.com/download/

            Attached Files

            Comment


            • #7
              It seems that your RenderInstance:: objToCam matrix is a zero matrix.

              You can use something like this in your frameBegin method to initialize it:
              Code:
              objToWorld=node->GetObjTMAfterWSM(t);
              Matrix3 worldToObj=Inverse(objToWorld);
              
              Matrix3 worldToObj=Inverse(objToWorld);
              VR::ShadeTransform vobjToWorld=toShadeTransform(objToWorld);
              VR::ShadeTransform vworldToObj=toShadeTransform(worldToObj);
              
              VR::ShadeTransform vobjToCam=vray->getFrameData().worldToCam*vobjToWorld;
              
              camToObj=toMatrix3(vworldToObj*vray->getFrameData().camToWorld);
              objToCam=toMatrix3(vobjToCam);
              normalObjToCam=toMatrix3(normalTransformMatrix(vobjToCam.m));
              Also RenderInstance:: obBox seems uninitialized.

              Best regards,
              Yavor
              Yavor Rubenov
              V-Ray for 3ds Max developer

              Comment


              • #8
                Thanks for looking into that yavor!

                Edit: just tried it...your solution fixed the problem
                Last edited by tysonibele; 15-04-2019, 08:13 AM.

                Comment


                • #9
                  Glad that helped
                  Yavor Rubenov
                  V-Ray for 3ds Max developer

                  Comment


                  • #10
                    Hi Yavor, I'm back again with another question

                    Elements are no longer returning black, but VRayVelocity is returning no meaningful data...even though frames are rendering fine with motion blur.

                    Do I need to return a special value somewhere to get proper Velocity element coloring?

                    Attached is a scene file with a few particles moving in various directions (Max2017, VRay 3.6, tyFlow 0.16013)...as you can see the base pass renders with motion blur, but the VRayVelocity element is pure grey....while an animated sphere next to the particles generates proper vectors.

                    Attached Files

                    Comment


                    • #11
                      Your ObjectShadeInstance::getVelocity method returns zero velocity.
                      Yavor Rubenov
                      V-Ray for 3ds Max developer

                      Comment


                      • #12
                        Ah, thanks yavor!

                        Comment


                        • #13
                          You are welcome
                          Yavor Rubenov
                          V-Ray for 3ds Max developer

                          Comment

                          Working...
                          X