Announcement

Collapse
No announcement yet.

V-Ray scene access python API

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

  • V-Ray scene access python API

    In the latest nightly builds there is the possibility to modify the V-Ray scene before rendering through a python callback; there is some info about this feature here: http://www.spot3d.com/vray/help/maya...ene_access.htm

    This is not a final implementation - we are interested in any comments and suggestions for improvements, so any feedback is welcome!

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

  • #2
    Very very nice Vlado.
    Perhaps the possibility to play with the "header" vrscene (change the resolution, change includes files (very important, to update my include geometry, my include shaders, etc etc))...

    From a friend (a TD like me) in my studio :

    It's an asomeone feature that makes me want to bye Vray for my how hobby! o_O Amazing!
    This feature will make great studio working with Vray! ^^

    But from what I see, it's not very "sexy". It looks a little like the way mel is working in Maya and it's a pity...

    I explain (I've mod the exemple wich are not very clear ^^):

    nodeList = vray.utils.findByType("Node") # Get all Node plugins << This is ok!
    mat = vray.utils..Plugin( nodeList[0].get("material") ) # Get the material of the first node << Whait what? This is not very understandable.
    This should be better:
    mat = nodeList[0].getMaterial()
    Or even:
    mat = nodeList[0].get("material")
    More clear I think. Same for the rest:
    brdf = Plugin(p.get("brdf")) # Get the BRDF for the material
    Not very clear, many call to do a simple thing. This should be better:
    brdf = mat.get("brdf")
    Or
    brdf = mat.getBrdf()
    Better I think.
    brdf.set("color_tex", Color(1.0, 0.0, 0.0)) # Set the BRDF color to red
    This line is not very complicate but this could be even better:
    brdf.setColorTex( Color(1.0, 0.0, 0.0) )
    To be honnest I can understand that this form is not possible:
    getMaterial()
    getBrdf()
    setColor()
    Because there is so many parameters and they name can be anything (custom nodes).

    So this is, for me, a good, average technical/user way:
    mat = nodeList[0].get("material")
    brdf = mat.get("brdf")

    Because the way you show is, IMHO, to complicate and will prove cumbersome to use...

    Regard,

    Dorian
    www.deex.info

    Comment


    • #3
      The resolution you can change by modifying the "SettingsOutput" plugin. Inclusion of other .vrscene files is also a planned feature (a side question - should these be injected into the scene directly, or they should remain as #include directives if you export the scene)?

      Thanks for the other comments; indeed it is not very easy to implement "getNNN" methods for all possible parameters, but we can certainly think about a general get() method that takes a string.

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

      Comment


      • #4
        I want for example, manage all the inclusion of other .vrscene, like :
        myInclucleList = vray.utils.getInclude("/tmp/myScene.vrscene")
        Result : myInclucleList = ["/tmp/v01/myGeometry01.vrscene", "/tmp/v01/myGeometry02.vrscene", "/tmp/v01/myShader01.vrscene", "/tmp/v01/myTransform.vrscene"]
        myNewInclucleList = list()
        for myInclude in myInclucleList:
        myInclude.replace("v01", "v02")
        myNewInclucleList.append(myInclude)

        vray.utils.setInclude("/tmp/myScene.vrscene", myNewInclucleList, override = True)#will override/replace


        And also something to choose where to export all vrscene, like :
        vray.utils.exportOption(type = "material", "/tmp/myMaterial/v03/myScene.vrscene")
        vray.utils.exportOption(type = "transform", "/tmp/transform/v03/myScene.vrscene")
        vray.utils.exportOption(type = "light", "/tmp/light/v03/myScene.vrscene")

        etc etc
        Last edited by bigbossfr; 07-03-2011, 06:43 AM.
        www.deex.info

        Comment


        • #5
          Ok, thanks for the suggestions; from what I understand, these are not specifically related to modifying the V-Ray scene though - you just want to process a given .vrscene file in a more convenient way, not necessarily during a pre-render callback, is this correct?

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

          Comment


          • #6
            Yes, this is correct.
            Thank you Vlado.
            www.deex.info

            Comment


            • #7
              Ok then; this is slightly different from our goal with the scene access API. We might eventually get to that at one point, but in the meantime, there are many other text file processing tools that can greatly help in this regard.

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

              Comment


              • #8
                ohohoh...what do i see here...will test this asap and give some feedback....seems like this is a very good way to go!!!!
                OLIVER MARKOWSKI - Head of 3D at RISE | Visual Effects Studios

                Comment


                • #9
                  This is really a great feature, but is it possible to evaluate the python script for every frame when rendering in batch mode?

                  I've exported a very large particle sim to vrscene files separated per frame and want to add them to my renderscene at rendertime.

                  This is my python script:

                  from vray.utils import *
                  import maya.cmds as cmds

                  frame = '%04d' % cmds.currentTime(q=1)

                  addSceneContent('U:/jacob/maya/VR_particles/010/007/pt_seed_1_'+frame+'.vrscene', 'seed1')

                  nodes = findByType('Node')

                  pnodes = [x for x in nodes if 'particleSystem' in x.name()]

                  shader = exportMaterial('lambert1')
                  for node in pnodes:
                  node.set('material', shader)

                  Will this works fine in maya, it doesn't update when rendering an animation in batchmode (which is stated in the docs).

                  I can get it working if I don't separate the vrscene files per frame, but the sim is too big to have in one large file.

                  But again, this is a really cool feature. Thanks vlado.

                  Regards,
                  Jacob
                  Jacob Børsting
                  Head of Pipeline @ Ghost VFX

                  Comment


                  • #10
                    Originally posted by jbvfx View Post
                    I can get it working if I don't separate the vrscene files per frame, but the sim is too big to have in one large file.
                    Hm, V-Ray should be able to handle large scenes without problem (it will not try to load the entire animation data - just what is necessary for rendering a particular frame).

                    Right now it will not work, but we can change things a bit so that you would be able to call addSceneContent() for all your frames at once (like I said, V-Ray will not immediately load the entire data for the frames).

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

                    Comment


                    • #11
                      So having a scene which is 1gb per frame in one big vrscene file (ex. 100gb for a 100frame animation), shouldn't be a problem in regards to network traffic and memory load?
                      Jacob Børsting
                      Head of Pipeline @ Ghost VFX

                      Comment


                      • #12
                        It wouldn't be much of a problem for memory load. For network traffic, it depends, I guess. V-Ray will still need to skim over the file even if it does not read everything. But if most of the file is geometry data, then it should be ok.

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

                        Comment


                        • #13
                          Alright. I will try to do some benchmarks to see what kinda overhead I'm getting on a very large vrscene file with particledata.
                          Jacob Børsting
                          Head of Pipeline @ Ghost VFX

                          Comment

                          Working...
                          X