Announcement

Collapse
No announcement yet.

Switching between texture folders

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

  • Switching between texture folders

    Hello V-Ray SDK team,

    we would like to export the textures used by our vrscenes in multiple folders. Let's say one folder for textures that were scaled down for better performance and one for full-sized textures. Let's also assume that all BitmapBuffer nodes of vrscenes have no full paths, but just the names of the files as value of the 'file' attribute.

    Now is there a possibility to somehow tell V-Ray which folder should be used for textures? This way we could decide on render start if the full-sized textures or the down-scaled ones should be used, without changing the vrscene file.

    P.S.: The 'setIncludePaths' could not help us here. We also know that V-Ray GPU can automatically resize the textures, but using pre-processed textures will take significantly less time then resizing them on the fly during render start.


    Best regards,
    Alex

  • #2
    Hello Alex,

    Do you want to render the vrscene-file with standalone? If you use AppSDK instead, you can load the vrscene-file, iterate over the BitmapBuffer instances and change their file properties temporarily in memory before rendering. It is a few lines of code. For example, in the scripting languages (Python or js) you can get all BitmapBuffer instances by just executing:
    Code:
    renderer.classes.BitmapBuffer.getInstances()
    This returns an array filled with plugin instances. You can then iterate over them and append the file path to the value of their .file property. Then you render.

    Best regards,
    Stan

    Comment


    • #3
      Hello Stan,

      thank you for the suggestion, yes, we use SDK! Does it mean, that there is no option with some optional texture path, where V-Ray would look inside?

      Your suggestion will definitely work, our problem is however, that we separate the lightset and model textures. The lightset textures remain unchanged, but the model ones are resized. So it will be difficult to just change all bitmaps at once, we have to distinguish between lightset and model textures somehow. But it's solvable.

      Thank you for your help!

      Best regrads,
      Alex


      Comment


      • #4
        Hi Alex,

        You can try the VRAY_ASSETS_PATH environment variable - Path redirection for assets. Bitmaps, meshes, IES profiles, etc. assets are tried to be loaded from this path.

        Best regards,
        Stan

        Comment


        • #5
          Hey Stan,

          I think this would be the thing I was searching for, but the variable seems not to work with V-Ray SDK. Or at least I could not figure out how can I get it to work. I've tried forward and backward slashes in the path, slash or semicolon at the end of the path, point+slash at the beginning of the file name in the vrscene file... Nothing helped. Did I miss something?

          Best regards,
          Alex

          Comment


          • #6
            Hi Alex,

            If you've set the environment variable in a parent process or globally (I'm talking about Windows) it should work. But if you want to set the variable (or any environment variable used by V-Ray) inside the same process, you'd better use the function vray.setEnvVar(name, value) provided by V-Ray AppSDK. This is because of some weirdness in the Microsoft C runtime library. But no matter what language or OS you use, this it the recommended and the only guaranteed-to-work way to do it.

            Best regards,
            Stan

            Comment


            • #7
              Hello Stan,

              thank you very much! Not sure that I could ever figure it our without your advice

              Best regards,
              Alex

              Comment


              • #8
                Hello Alex,

                You're welcome!
                I know, documentation and tutorials are somewhat a weak point.

                Best,
                Stan

                Comment

                Working...
                X