Why is specular_reflectance defined as a Texture in the BSDF class? #545
-
I was going through the Custom Python plugin tutorial to define your own BSDF and comparing it with the c++ code. Most lines are very similar, however, there are a couple of lines which I don't fully understand and are omitted from the python tutorial. In the in dielectric BSDF source code the specular reflectance is initiated as:
The same is also encountered in roughdielectric when initiating Why are in these cases the specular reflectance and alpha initiated as a texture? And how would this initiation be done with Python? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @Virtual-Optix, These fields are initiated as Textures such that they can be spatially varying. For example, in the |
Beta Was this translation helpful? Give feedback.
Hi @Virtual-Optix,
These fields are initiated as Textures such that they can be spatially varying. For example, in the
roughdielectric
we could have a specific area of the shape which is rougher. Theprops.texture
method has some extra logic so that it can create a uniform texture from the default value if the property is not already a Texture.See here for some examples of plugin descriptions in Python. If you want to replicate the
props.texture
behaviour, you can just instantiate the Texture yourself usingmi.load_dict/load_string
.