Announcement

Collapse
No announcement yet.

Abuot BRDFVRayMtl BumpMap transform

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

  • Abuot BRDFVRayMtl BumpMap transform

    Hello,
    VRay Version:Vray 5.20.20
    In BRDFVRayMtl,I need a diffuse map and a bump map.one uv coords with different transform.
    I set the uv coords like this:
    Code:
    VRay::ValueList channelDiff;
    VRay::ValueList channelNorm;
    channelDiff.push_back(VRay::Value(0));
    channelDiff.push_back(VRay::Value(texCoords));
    channelDiff.push_back(VRay::Value(&indices[indexStart_], indexCount_));
    
    channelNorm.push_back(VRay::Value(1));
    channelNorm.push_back(VRay::Value(texCoords));
    channelNorm.push_back(VRay::Value(&indices[indexStart_], indexCount_));
    
    VRay::ValueList mapChannels;
    mapChannels.push_back(VRay::Value(channelDiff));
    mapChannels.push_back(VRay::Value(channelNorm));
    [B]mesh[/B].set_map_channels(mapChannels);
    for diffuse map transform:
    Code:
    VRay::Plugins::TexBitmap diffuseMap...
    ...
    VRay::Plugins::UVWGenChannel uvwchannel0 = mVRayRenderer->newPlugin<VRay::Plugins::UVWGenChannel>();
    uvwchannel0.set_wrap_u(1);
    uvwchannel0.set_wrap_v(1);
    uvwchannel0.set_uvw_transform([B]transformDiff[/B]);
    uvwchannel0.set_uvw_channel[B](0[/B]);
    diffuseMap.set_uvwgen(uvwchannel0);
    [B]brdf[/B].set_diffuse(diffuseMap);
    for bump map transform
    Code:
    VRay::Plugins::TexBitmap bumpMap...
    ...
    VRay::Plugins::UVWGenChannel uvwchannel1 = mVRayRenderer->newPlugin<VRay::Plugins::UVWGenChannel>();
    uvwchannel1.set_wrap_u(1);
    uvwchannel1.set_wrap_v(1);
    uvwchannel1.set_uvw_transform([B]transformNrom[/B]);
    uvwchannel1.set_uvw_channel[B](1[/B]);
    normalMap.set_uvwgen(uvwchannel1);
    [B]brdf[/B].set_bump_map(normalMap);
    [B]brdf[/B].set_bump_type(1);
    But I can`t get transfom effect of bump map,I want know where is the wrong,Or how do it in right way.
    Thank you!

  • #2
    There may be other issues but the first thing I see is that the map_channels format you use is wrong. It is a List of Lists where each List has 3 components - number, IntList and a VectorList. In your case it should be ValueList(ValueList(Value(0), IntList(..), VecorList(..))).

    Comment


    • #3
      Hello,
      My code references the sdk-cpp example "04-file-to-static-mesh" which the uvs set like this:
      Code:
      ValueList channels;
      StringList channelNames;
      const IntList& uvSetIndices = readData.getUVOriginalIndices();
      for (int i = 0; i < readData.getUVSetsCount(); i++) {
      ValueList channel(3);
      const Vector* vectors = readData.getUVValues(i);
      // 3 float values per Vector contained in the UVValues array
      size_t vectorsCount = readData.getUVValuesCount(i) / 3;
      const int* ints = readData.getUVValueIndices(i);
      size_t intsCount = readData.getUVValueIndicesCount(i);
      
      channel[0] = Value(uvSetIndices[i]);
      channel[1] = Value(VectorList(vectors, vectors + vectorsCount));
      channel[2] = Value(IntList(ints, ints + intsCount));
      channels.push_back(Value(channel));
      channelNames.push_back(readData.getUVSetName(i));
      }
      staticMesh.set_map_channels(channels);
      staticMesh.set_map_channels_names(channelNames);
      Except for the channelNames, it is basically the same as mine.

      The description of the function set_map_channels goes like this:
      Code:
      //! A list of mapping channels; each channel itself is a list of 3 elements
      //- the channel index, the channel vertices and the channel faces.
      bool set_map_channels(const ValueList& list) { return setValue("map_channels", list); }
      It's not the same as what you give“ValueList(ValueList(Value(0), IntList(..), VecorList(..)))”
      And there are some syntax errors when compiling the way you do。

      Or I just give me what I need:I have one uv for a mesh, two uv transform correspond to the diffuse_map and
      bump_map respectively.What the right way to write should be

      Thank you...


      Comment


      • #4
        I'm sorry, it's my mistake about the map_channels format. Can you, please, write a vrscene-file by calling VRayRenderer::exportScene(fileName) or even better VRayRenderer::exportScene(fileName, exportSettings) (where exportSettings.compressed and exportSettings.hexArrays are set to false) and send it to us to inspect the data?

        Comment


        • #5
          OK,this is a simple sample,just a piece of mesh.
          there is no diffuse map, with a bump map("Four_noormal.png").
          Attached Files

          Comment


          • #6
            Code:
            uvwchannel1.set_uvw_transform(transformNrom);
            looks correct in theory. The vrscene-file seems to render black (except the GI). I'm not sure if we can help more using this data. Probably a vrscene-file which renders and shows the (wrong) result and an image of what you expect might be useful.

            Comment

            Working...
            X