Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equivalent of Kt and Kr in dielectric material? #434

Open
gugray opened this issue Aug 22, 2024 · 3 comments
Open

Equivalent of Kt and Kr in dielectric material? #434

gugray opened this issue Aug 22, 2024 · 3 comments

Comments

@gugray
Copy link

gugray commented Aug 22, 2024

I am trying to achieve the effect of colored glass in v4. Information I have found online (e.g. here) points me to the Kt property of the glass material in v3. "color Kt" [0.7 1 0.7 ]

v4's dielectric material does not have the Kt ad Kr properties which were available for glass in v3. If I try and start from a v3 file with glass, the --upgrade function converts "color Kt" [0.7 1 0.7 ] to "rgb Kt" [0.7 1 0.7 ]. The result, however, is rejected by v4 with the error ""Kr": unused parameter".

What is the right way to achieve colored glass in v4?

@shadeops
Copy link
Contributor

In pbrt-v4 I believe the approach to take is to use a homogeneous Medium and set the appropriate absorption values.

red_glass

Left sphere is a diffuse transmission, right sphere is a default dielectric with a interior medium that absorbs everything but red.

@gugray
Copy link
Author

gugray commented Aug 24, 2024

Thank you! May I trouble you to include an XML snippet for the two spheres?

@shadeops
Copy link
Contributor

PixelFilter "gaussian" "float xradius" [ 2 ] "float yradius" [ 2 ]
Sampler "zsobol" "integer pixelsamples" [ 8192 ]
Integrator "volpath" "integer maxdepth" [ 5 ]
Accelerator "bvh"
Film "gbuffer"
    "string filename" [ "pbrt.exr" ]
    "integer xresolution" [ 1280 ]
    "integer yresolution" [ 720 ]


Transform [ 0.707106781186547462 -0.353553390593273731 -0.612372435695794581 0.0
            0 0.866025403784438597 -0.5 0.0
           -0.707106781186547573 -0.353553390593273897 -0.612372435695794359 0.0
            0.0 0.0 4.0 1.0 ]
Camera "perspective" "float fov" [ 45 ] "float screenwindow" [ -1 1 -0.5625 0.5625 ]

WorldBegin

    AttributeBegin
        Translate -2 3 0
        Rotate -50 0 0 1
        Rotate -90 0 1 0
        AreaLightSource "diffuse"
            "float scale" [ 200 ]
            "bool twosided" [ false ]
        AttributeBegin
            Rotate 180 1 0 0
            Shape "disk" "float radius" [ 0.25 ]
        AttributeEnd
    AttributeEnd

    Texture "/mat/checkerboard" "spectrum" "checkerboard"
        "rgb tex1" [ 0.75 0.75 0.75 ]
        "rgb tex2" [ 0.3 0.3 0.3 ]
        "float uscale" [ 300 ]
        "float vscale" [ 300 ]

    MakeNamedMaterial "/mat/ground"
        "string type"
        "diffuse" "texture reflectance" [ "/mat/checkerboard" ]

    MakeNamedMaterial "/mat/red_diffuse"
        "string type" "diffusetransmission"
        "rgb transmittance" [ 1 0 0 ]

    MakeNamedMaterial "/mat/glass" "string type" "dielectric"
        "rgb eta" [ 1.33 1.33 1.33 ]
        "float roughness" [ 0.001 ]


    AttributeBegin
        MakeNamedMedium "/mat/red_interior"
            "string type" "homogeneous"
            "float scale" [ 10 ]
            "rgb sigma_a" [ 0.01 1.0 1.0 ]
            "rgb sigma_s" [ 0.01 0.01 0.01 ]
    AttributeEnd

    AttributeBegin
        NamedMaterial "/mat/ground"
        AttributeBegin
            ReverseOrientation
            Shape "bilinearmesh"
                "normal N" [ 0 1 0 0 1 0 0 1 0 0 1 0 ]
                "point3 P" [ -50 0 -50 50 0 -50 -50 0 50 50 0 50 ]
                "integer indices" [ 0 1 2 3 ]
        AttributeEnd
    AttributeEnd

    AttributeBegin
        Translate -0.25 0.5 0.25
        Scale 0.2 0.2 0.2
        NamedMaterial "/mat/red_diffuse"
        AttributeBegin
            Shape "sphere"
        AttributeEnd
    AttributeEnd

    AttributeBegin
        Translate 0.25 0.5 -0.25
        Scale 0.2 0.2 0.2
        NamedMaterial "/mat/glass"
        MediumInterface "/mat/red_interior" ""
        AttributeBegin
            Shape "sphere"
        AttributeEnd
    AttributeEnd

I used the GPU (volume pathtracer), then ran it through imgtool's denoiser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants