mmatl / pyrender

Easy-to-use glTF 2.0-compliant OpenGL renderer for visualization of 3D scenes.
http://pyrender.readthedocs.io/
MIT License
1.31k stars 225 forks source link

How to define a glass/gold/metal Texture? #257

Open laikee99 opened 1 year ago

laikee99 commented 1 year ago

Hi, I was wandering how to define such texture in pyrender, In hunterloftis/pbr, use such code to define:

func Glass(roughness float64) *Uniform {
    return &Uniform{
        Color:        rgb.Energy{1, 1, 1},
        Roughness:    roughness,
        Specularity:  0.042,
        Transmission: 0.91339,
    }
}

func ColoredGlass(r, g, b, roughness float64) *Uniform {
    return &Uniform{
        Color:        rgb.Energy{r, g, b},
        Roughness:    roughness,
        Specularity:  0.042,
        Transmission: 0.91339, // https://www.shimadzu.com/an/industry/electronicselectronic/chem0501005.htm
    }
}

func Gold(roughness, metalness float64) *Uniform {
    return &Uniform{
        Color:     rgb.Energy{1, 0.86, 0.57},
        Metalness: metalness,
        Roughness: roughness,
    }
}

func Mirror(roughness float64) *Uniform {
    return &Uniform{
        Color:     rgb.Energy{0.8, 0.8, 0.8},
        Metalness: 1,
        Roughness: roughness,
    }
}

func Copper(roughness, metalness float64) *Uniform {
    return &Uniform{
        Color:     rgb.Energy{0.98, 0.82, 0.76},
        Metalness: metalness,
        Roughness: roughness,
    }
}

In pyrender, I am confused about the param I should pass, can anyone give me a hint about that? Thanks