MaterialX Realtime results update in viewport render #10

Merged
Bogdan Nagirniak merged 4 commits from Vasyl-Pidhirskyi/blender-addons:BLEN-412 into materialx-addon 2023-05-18 08:22:01 +02:00
Showing only changes of commit e7a181013a - Show all commits

View File

@ -9,10 +9,6 @@ from ..utils import get_mx_node_input_types
from . import log from . import log
SSS_MIN_RADIUS = 0.0001
DEFAULT_WHITE_COLOR = (1.0, 1.0, 1.0)
def enabled(val): def enabled(val):
if val is None: if val is None:
return False return False
@ -108,7 +104,7 @@ class ShaderNodeBsdfPrincipled(NodeParser):
if enabled(specular): if enabled(specular):
result.set_inputs({ result.set_inputs({
'specular': specular, 'specular': specular,
'specular_color': DEFAULT_WHITE_COLOR, 'specular_color': base_color,
'specular_roughness': roughness, 'specular_roughness': roughness,
'specular_IOR': ior, 'specular_IOR': ior,
'specular_anisotropy': anisotropic, 'specular_anisotropy': anisotropic,
@ -118,7 +114,7 @@ class ShaderNodeBsdfPrincipled(NodeParser):
if enabled(transmission): if enabled(transmission):
result.set_inputs({ result.set_inputs({
'transmission': transmission, 'transmission': transmission,
'transmission_color': DEFAULT_WHITE_COLOR, 'transmission_color': base_color,
'transmission_extra_roughness': transmission_roughness, 'transmission_extra_roughness': transmission_roughness,
}) })
@ -133,14 +129,14 @@ class ShaderNodeBsdfPrincipled(NodeParser):
if enabled(sheen): if enabled(sheen):
result.set_inputs({ result.set_inputs({
'sheen': sheen, 'sheen': sheen,
'sheen_color': DEFAULT_WHITE_COLOR, 'sheen_color': base_color,
'sheen_roughness': roughness, 'sheen_roughness': roughness,
}) })
if enabled(clearcoat): if enabled(clearcoat):
result.set_inputs({ result.set_inputs({
'coat': clearcoat, 'coat': clearcoat,
'coat_color': DEFAULT_WHITE_COLOR, 'coat_color': base_color,
'coat_roughness': clearcoat_roughness, 'coat_roughness': clearcoat_roughness,
'coat_IOR': ior, 'coat_IOR': ior,
'coat_anisotropy': anisotropic, 'coat_anisotropy': anisotropic,