mitsuba2 icon indicating copy to clipboard operation
mitsuba2 copied to clipboard

[❔ other question] how to map four kind textures to a specific shape such as a rectangle shape?

Open keepwonder opened this issue 3 years ago • 3 comments

The following example is from mitsuba2 official document:

<bsdf type="normalmap">
    <texture name="normalmap" type="bitmap">
        <boolean name="raw" value="true"/>
        <string name="filename" value="textures/normalmap.jpg"/>
    </texture>
    <bsdf type="roughplastic"/>
</bsdf>

and this just used one map.

My task is to use four textures choosed from the following png list to render a shape(sorry for that I can't post my pictures) :

marble_red_01_basecolor.png marble_red_01_height.png marble_red_01_normal.png marble_red_01_roughness.png marble_red_01_metallic.png marble_red_01_ambient_occlusion.png

height ,normal ... explained the texure type

and here is an example I tried(some infomation are omitted) :

<shape type="rectangle">
        <bsdf type="blendbsdf">
            <texture name="weight" type="bitmap">
                <string name="filename" value="./images/wooden_planks_01_materials/wooden_planks_01_roughness.png"/>
            </texture>
            <bsdf type="normalmap" id="object_bsdf">
                <texture name="normalmap" type="bitmap">
                    <boolean name="raw" value="true"/>
                    <string name="filename" value="./images/wooden_planks_01_materials/wooden_planks_01_normal.png"/>
                </texture>
                <bsdf type="roughplastic">
                </bsdf>
            </bsdf>

            <bsdf type="bumpmap">
                <float name="scale" value="0.02"/>
                <texture name="floor_tiles_bumpmap" type="bitmap">
                    <boolean name="raw" value="true"/>
                    <string name="filename" value="./images/wooden_planks_01_materials/wooden_planks_01_metallic.png"/>
                </texture>
                <bsdf type="roughplastic">
                    <texture name="diffuse_reflectance" type="bitmap">
                        <string name="filename" value="./images/wooden_planks_01_materials/wooden_planks_01_height.png"/>
                    </texture>
                </bsdf>
            </bsdf>
        </bsdf>
</shape>

and the result turn out to be not ok in my opion.

what is the relationship between bsdf type and my texture type or how to arrange them in xml file to get a correct rendered result?

keepwonder avatar Dec 23 '20 08:12 keepwonder

Could you elaborate further on what you mean by "not ok in your opion". Are you basing this judgement on some sort of ground truth images that you are trying to match? Or other synthetic images produces by a different renderer maybe?

Speierers avatar Dec 23 '20 10:12 Speierers

@Speierers yes, there are some ground truth images. and In my example, if I use the point emitter I defined instead of the envmap with textures/museum.exr from official example, the result image i get is almost dark, why is that ?

and again

what is the relationship between bsdf types and textures type or how to arrange them in xml file to get a correct rendered result?

and how can I attach more than two texures(3, 4, ,5 etc.) to a specific shape?

It seems that there is no detailed docs to explain this?

keepwonder avatar Dec 24 '20 01:12 keepwonder

Hi @keepwonder,

  1. I'm guessing that your point light was either too far away or had too low intensity. Try adjusting these parameters.
  2. Each bsdf entry in the scene XML file will create a BSDF instance. The type attribute specifies which BSDF plugin to use. If you check the source code for that BSDF, you will find helpful comments directly at the top of the class (also visible in the documentation). Importantly, you can also see in the constructor which properties does the BSDF use. For example, in the diffuse constructor, the reflectance texture is read from the properties:

https://github.com/mitsuba-renderer/mitsuba2/blob/fe2a1bd78e3916fccb8a3457e8b552e53f9c32d2/src/bsdfs/diffuse.cpp#L73

And in normalmap, a nested BSDF is expected:

https://github.com/mitsuba-renderer/mitsuba2/blob/fe2a1bd78e3916fccb8a3457e8b552e53f9c32d2/src/bsdfs/normalmap.cpp#L77

It seems like your texture corresponds to a Disney / principled BSDF, which has not yet been implemented (#153). However, you should be able to achieve something reasonable with e.g. a roughconductor, roughplastic or a combination of both.

  1. You can specify as many textures as the BSDF plugin uses. Each texture needs to have a texture block nested inside of your BSDF, with attribute name corresponding to the property name expected by the BSDF (see the documentation or BSDF constructor as shown above to find out which properties are expected).

merlinND avatar Dec 28 '20 10:12 merlinND