Announcement

Collapse
No announcement yet.

Texture position not setting properly

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

  • Texture position not setting properly

    Hello,

    I applied a texture (standard material), and setting the size, position and rotation. And for rendering, i am sending the same details through UVWGenChannel Transform

    Size and rotation are applying and rendering fine. Position is not rendering as seen in viewport or any other render. I tried exporting vrscene file and checked the position value in uvw_transform, shows fine. Is there any other calculations need to do for position or angle is involved in calculating position?

    please see attached images pic_1 and pic_2 for reference. pic_1 is max viewport and material editor, pic_2 is rendered output.

    here is the value i am getting after export scene.
    uvw_transform=Transform(Matrix(Vector(1.841115e-07, 0.5, 0), Vector(-0.333333, 2.761675e-07, 0), Vector(0, 0, 1)), Vector(-2, -1, 0));

    Please suggest.

    Regards,
    Gopi.
    Attached Files

  • #2
    Here is the answer from a 3D artist:

    I've made some tests on my side and everything works as expected.
    I think that the problem they're facing is that they have first displayed the material in the viewport and then set the texture to be using different UV channel (judging by the screenshot they sent).
    In this case Max still shows the texture in its viewport as if it is applied on the original UV channel, while the render displays the correct result
    To fix this simply uncheck the "Show Shaded Material in Viewport" and check it again.
    I've also attached a short video covering the entire process:

    https://drive.google.com/file/d/1OOg...ew?usp=sharing

    Hope this helps.

    Best regards,
    Stan

    Comment


    • #3
      Hello Stan,

      Thanks for your reply.

      I am doing the same. My map channel is 2 as you see in pic_1 (previous attachments) and same is going into render using uvw_channel.

      also, i tried changing the map channels as shown in video, but whatever the channels i am changing, that is going in render.

      Regards,
      Gopi.

      Comment


      • #4
        Can you send us a sample scene which reproduces the issue?

        Best regards,
        Stan

        Comment


        • #5
          Hello Stan,

          Please find the attached scene file.

          when i tried to export as vrscene (using maxscript) i am getting the following transform values for uvwgen.

          offset - width and height both are 1.0 and size, both are 1.0 and

          angle is 0
          uvw_transform=Transform(Matrix(Vector(1, 0, 0), Vector(0, 1, 0), Vector(0, 0, 1)), Vector(-1, -1, 0));

          angle is 45
          uvw_transform=Transform(Matrix(Vector(0.7071068, 0.7071068, 0), Vector(-0.7071068, 0.7071068, 0), Vector(0, 0, 1)), Vector(0, -1.414213538169861, 0));

          angle is 90
          uvw_transform=Transform(Matrix(Vector(0, 1, 0), Vector(-0.9999999, -5.960464e-08, 0), Vector(0, 0, 1)), Vector(1, -0.9999999403953552, 0));


          in sdk, i tried combining first and second values of vector 1 and 2 of Matrix, then, i am getting position proper. but when angle is also added, then getting the issue.

          Please suggest.

          Regards,
          Gopi.
          Attached Files

          Comment


          • #6
            Maybe your problem stems from the fact that in 3ds Max you use real-world size to map the texture. This might offset the center of rotation and produce different results in Max than the way you rotate the texture in AppSDK.

            On a side note your setup in Max appears to be messy. You do not use a proper gamma correction setup, use standard Max materials and other things that won't lead to optimal results when using V-Ray.

            Best,
            Stan

            Comment


            • #7
              Thank you Stan,

              Will check on this.

              Comment


              • #8
                I forgot to add here the result, may be useful for someone.

                Issue is related with Transform calculation method. Below is the way to solve the issue.

                //////////////////////////////////////
                Matrix posRot = Matrix(Vector(uscl, 0, 0), Vector(0, vscl, 0), Vector(0, 0, 1)); // uscl and vscl are the size of the texture set in max material editor

                auto mX = makeRotationMatrixX(0);
                auto mY = makeRotationMatrixY(0);
                auto mZ = makeRotationMatrixZ(ang); // texture angle

                Transform trans = Transform();
                trans.matrix = posRot * mZ * mY * mX; // getting matrix with size and angle

                // now for offset

                Vector tt = Vector(upos, vpos, 0); // upos and vpos are the changed position values in max material editor
                tt = mZ * tt * -posRot;
                trans.offset = tt; // trans is final Transform we need to set in UVWGenChannel

                ///////////////////////////////////////////////

                Thanks again.
                Gopi.

                Comment


                • #9
                  Thanks for this info, Gopi. I'm glad you have resolved your issue.

                  Best,
                  Stan

                  Comment

                  Working...
                  X