Announcement

Collapse
No announcement yet.

Some questions about texture

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

  • Some questions about texture

    I have some questions about TexBitmap.

    In obj-import example, what number 1 means?

    ValueList channel;
    channel.push_back(Value(1));
    channel.push_back(Value(obj->textureVertices));
    channel.push_back(Value(obj->faceTextures));

    In addition, Does TexBitmap support texture transformation?
    Our software needs to provide texture translation, rotation, and scaling.
    How to register 'texture transformation matrix' at TexBitmap?

    Thanks~.

  • #2
    The parameter you're asking about actually belongs to the GeomStaticMesh plugin. (The UV mapping data belongs to the mesh. When a ray intersects the geometry it gets the texture mapping data from it for the particular intersection point.) It is one of the more complex parameters, called "map_channels" and it contains a list of UV mapping channels because in some situations there are multiple sets of UV data for the same mesh. Each channel (or UV set if you like) is defined by another list of exactly three elements. The first, which you were asking about is the channel index and the other two contain the actual data - UV coordinates and their indices. The channel index is needed by V-Ray to know which of the sets to use. The default index is 1 and this will work without doing anything additionally. If another index is used to identify the map channel (for example index 0, which is the default index in Maya) texturing plugins will need to know about it. For this you will have to specify the index explicitly in a UVWGen plugin, such as UVWGenChannel with its 'uvw_channel' parameter.

    So, you have your texture plugin which could be any one of over a hundred mostly procedural textures or just a file texture with TexBitmap. All those plugins have the 'uvwgen' parameter for connecting one of the UVWGen[...] plugins. This is optional. It will work without a UVWGen if you don't need to use an index other than 1 and you don't need additional UVW data modifications. But in your case you also want to modify the UVW data. The UVWGenChannel plugin has a 'uvw_transform' parameter that does exactly what you asked for. There is also the 'tex_transform' parameter that does the same thing, but only after the other modifications this plugin offers (mirroring, wrapping, etc. - all disabled by default) are applied.
    Nikola Goranov
    Chaos Developer

    Comment


    • #3

      Thank you for the reply.
      Can I clarify one thing?

      I understand that single GeoStaticMesh can have multiple sets of UV data.
      GeoStaticMesh has set_map_channel function that link between node's mesh and texCoords data.

      Is UVWGenChannel related to MTLSingleBRDF?

      I know that MTLSingleBRDF includes TexBitmap(real image file)
      and has set_diffuse_tex function that link node's material and texture image.

      Where is a position of UVWGenChannel? (mesh or material)

      Comment


      • #4
        UVWGenChannel (or any other UVWGen[...] plugin) is connected to a texture - in this case TexBitmap. So you would call set_uvwgen() on the TexBitmap instance to associate the UVWGenChannel instance with it.
        Nikola Goranov
        Chaos Developer

        Comment


        • #5
          Hi, npg

          It works very well.
          Could I ask you one more question?

          We have prepared single geometry and diffuse texture.
          And then we want to add transparent texture for adjusting transparency of the diffuse texture.

          Does TexBitmap include transparent map?
          Last edited by robin87; 03-07-2017, 01:30 AM.

          Comment


          • #6
            Could we use set_opacity() of BRDFVRayMtl plugin?

            Comment


            • #7
              Hi, you can use TexBlend like this (described in vrscene syntax):
              TexBlend blend {
              color_a=baseTexture;
              color_b=overlayTexture;
              blend_amount=1;
              composite=1;
              }
              So instead of diffuse=baseTexture in the material you will have diffuse=blend.
              overlayTexture is a TexBitmap just like baseTexture, the only difference is that its BitmapBuffer points to another file.
              Notice that for this to work properly the color data in the bitmap needs to be black in the transparent part. If it is gray for example, the base texture will become brighter.

              The above example is for blending two textures. The opacity property of BRDFVRayMtl is slightly different - it makes rays go through the material. In theory you could make a two-layer material where the top layer has the overlay with respective opacity values from the image alpha channel and the bottom layer holds the base image, but this would be much less efficient for rendering than the texture blending.
              Nikola Goranov
              Chaos Developer

              Comment


              • #8
                If we have not rgb information on transparency map,
                can we replace alpha channel of base texture with alpha channel of transparency map?

                Comment


                • #9
                  I'm not sure what you mean.
                  In the example above we had two textures, which I like to call base and overlay. Do you mean using the alpha channel of the overlay texture as alpha for the base? This would make the base useless because only the parts that are already overwritten by the overlay will have non-zero alpha.

                  Notice that even though the 'diffuse' parameter of BRDFVRayMtl is of type AColor, you need to set the alpha channel separately to the 'opacity' parameter to make the material transparent. This can be done for example by passing the AColor from the texture through a TexAColorOp plugin and using its 'alpha' output.
                  Nikola Goranov
                  Chaos Developer

                  Comment


                  • #10
                    It will be very helpful to me.

                    Our transparency map is similar to attached image.

                    Comment


                    • #11
                      Can you describe exactly what you want to achieve and which part is unclear to you, please?
                      Nikola Goranov
                      Chaos Developer

                      Comment


                      • #12
                        Hi, Nikola

                        Our transparent textures cannot be drawn.
                        I thought AColor means RGB+Alpha.

                        However, when we apply png texture to rectangle geometry, the color is black.

                        How to control alpha channel of texture?
                        Explain this part to me, again.

                        Thanks.


                        Comment


                        • #13
                          The alpha channel of the input texture is ignored by the diffuse parameter of BRDFVRayMtl. You have to connect it separately to the opacity parameter. You can use TexAColorOp to separate the alpha channel of an AColor texture as a float texture:
                          Code:
                          TexAColorOp acolorOp {
                            color_a=myTexBitmapPlugin;
                          }
                          
                          BRDFVRayMtl myMaterial {
                            opacity=acolorOp::alpha;
                            diffuse=myTexBitmapPlugin;
                            // ....
                          }
                          Here we use the "alpha" output parameter of TexAColorOp instead of the default full color output. You can do this like so in C++:
                          Code:
                          // material is BRDFVRayMtl, acolorOp is TexAColorOp
                          material.setValue("opacity", acolorOp, "alpha");
                          Nikola Goranov
                          Chaos Developer

                          Comment


                          • #14
                            Your comments are really helpful.

                            We have successfully applied transparency map.
                            Thanks.

                            Comment

                            Working...
                            X