Интегрирован модуль импорта моделей из FreeCAD в Blender
This commit is contained in:
parent
d26698d1a6
commit
6af0f188a7
25 changed files with 1563 additions and 1 deletions
27
cg/blender/utils/shininess_to_roughness.py
Normal file
27
cg/blender/utils/shininess_to_roughness.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# original alg from https://github.com/assimp/assimp/issues/4573
|
||||
# Copyright (C) 2023 Ilia Kurochkin <brothermechanic@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
__version__ = "0.1"
|
||||
|
||||
import math
|
||||
|
||||
|
||||
def shiny_to_rough(shininess):
|
||||
""" convert shiny to roughness """
|
||||
a, b = -1.0, 2.0
|
||||
c = (shininess / 100.0) - 1.0
|
||||
D = math.pow(b,2) - (4 * a * c)
|
||||
roughness = (-b + math.sqrt(D)) / (2 * a)
|
||||
if roughness < 0:
|
||||
roughness = 0
|
||||
return roughness
|
Loading…
Add table
Add a link
Reference in a new issue