Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 22:25:27 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 22:30:45 +0300
commitfbc03fdd10836f79c509e5d8c19514bc5f983253 (patch)
tree98400266dd9245625b4a148fa1a82f1ba174b2c1 /materials_utils
parent45f47e15d4d9c0629a9a277f8d665f806f7834a7 (diff)
Cycles: update addons for squared roughness convention.
Diffstat (limited to 'materials_utils')
-rw-r--r--materials_utils/material_converter.py3
-rw-r--r--materials_utils/materials_cycles_converter.py8
2 files changed, 6 insertions, 5 deletions
diff --git a/materials_utils/material_converter.py b/materials_utils/material_converter.py
index c682e612..bf52bec1 100644
--- a/materials_utils/material_converter.py
+++ b/materials_utils/material_converter.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import bpy
+import math
from mathutils import Vector
from bpy.types import Operator
from .warning_messages_utils import (
@@ -665,7 +666,7 @@ def makeCyclesFromBI(cmat):
# Make Diffuse and Output nodes
mainShader = makeMainShader(TreeNodes)
- mainShader.inputs['Roughness'].default_value = cmat.specular_intensity
+ mainShader.inputs['Roughness'].default_value = math.sqrt(max(cmat.specular_intensity, 0.0))
mainDiffuse = mainShader
materialOutput = makeMaterialOutput(TreeNodes)
links.new(mainShader.outputs['BSDF'], materialOutput.inputs['Surface'])
diff --git a/materials_utils/materials_cycles_converter.py b/materials_utils/materials_cycles_converter.py
index ddd4eb6e..13e1e1ec 100644
--- a/materials_utils/materials_cycles_converter.py
+++ b/materials_utils/materials_cycles_converter.py
@@ -6,7 +6,7 @@ import bpy
from os import path as os_path
from bpy.types import Operator
from math import (
- log2, ceil,
+ log2, ceil, sqrt,
)
from bpy.props import (
BoolProperty,
@@ -381,7 +381,7 @@ def AutoNode(active=False, operator=None):
else:
# Create Clay Material (Diffuse, Glossy, Layer Weight)
shader.inputs['Color'].default_value = PAINT_SC_COLOR
- shader.inputs['Roughness'].default_value = 0.9
+ shader.inputs['Roughness'].default_value = 0.9486
# remove Color Ramp and links from the default shader and reroute
try:
@@ -415,10 +415,10 @@ def AutoNode(active=False, operator=None):
shader.inputs['Roughness'].default_value = cmat.specular_intensity
if shader.type == 'ShaderNodeBsdfGlossy':
- shader.inputs['Roughness'].default_value = 1 - cmat.raytrace_mirror.gloss_factor
+ shader.inputs['Roughness'].default_value = sqrt(max(1 - cmat.raytrace_mirror.gloss_factor, 0.0))
if shader.type == 'ShaderNodeBsdfGlass':
- shader.inputs['Roughness'].default_value = 1 - cmat.raytrace_mirror.gloss_factor
+ shader.inputs['Roughness'].default_value = sqrt(max(1 - cmat.raytrace_mirror.gloss_factor, 0.0))
shader.inputs['IOR'].default_value = cmat.raytrace_transparency.ior
if shader.type == 'ShaderNodeEmission':