Merged changes in the trunk up to revision 53146.
Conflicts resolved: release/datafiles/startup.blend source/blender/blenkernel/CMakeLists.txt source/blender/blenlib/intern/bpath.c source/blender/blenloader/intern/readfile.c
This commit is contained in:
@@ -644,20 +644,15 @@ if(UNIX AND NOT APPLE)
|
||||
if(WITH_BOOST)
|
||||
# uses in build instructions to override include and library variables
|
||||
if(NOT BOOST_CUSTOM)
|
||||
# XXX No more lib dir, is this multithread stuff still needed?
|
||||
if(${WITH_STATIC_LIBS})
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
endif()
|
||||
if(NOT BOOST_ROOT)
|
||||
set(Boost_USE_MULTITHREADED OFF)
|
||||
else()
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
endif()
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(__boost_packages filesystem regex system thread date_time)
|
||||
if (WITH_INTERNATIONAL)
|
||||
list(APPEND __boost_packages locale)
|
||||
endif()
|
||||
find_package(Boost 1.34 COMPONENTS ${__boost_packages})
|
||||
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
|
||||
if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
|
||||
find_package(IcuLinux)
|
||||
endif()
|
||||
@@ -1521,7 +1516,8 @@ elseif(APPLE)
|
||||
endif()
|
||||
|
||||
if(WITH_INPUT_NDOF)
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -weak_framework 3DconnexionClient")
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework 3DconnexionClient")
|
||||
set(NDOF_INCLUDE_DIRS /Library/Frameworks/3DconnexionClient.framework/Headers )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
10
SConstruct
10
SConstruct
@@ -14,7 +14,7 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2006, Blender Foundation
|
||||
# All rights reserved.
|
||||
@@ -294,7 +294,8 @@ if env['OURPLATFORM']=='darwin':
|
||||
print "3D_CONNEXION_CLIENT_LIBRARY not found, disabling WITH_BF_3DMOUSE" # avoid build errors !
|
||||
env['WITH_BF_3DMOUSE'] = 0
|
||||
else:
|
||||
env.Append(LINKFLAGS=['-Xlinker','-weak_framework','-Xlinker','3DconnexionClient'])
|
||||
env.Append(LINKFLAGS=['-F/Library/Frameworks','-Xlinker','-weak_framework','-Xlinker','3DconnexionClient'])
|
||||
env['BF_3DMOUSE_INC'] = '/Library/Frameworks/3DconnexionClient.framework/Headers'
|
||||
|
||||
# for now, Mac builders must download and install the JackOSX framework
|
||||
# necessary header file lives here when installed:
|
||||
@@ -304,7 +305,7 @@ if env['OURPLATFORM']=='darwin':
|
||||
print "JackOSX install not found, disabling WITH_BF_JACK" # avoid build errors !
|
||||
env['WITH_BF_JACK'] = 0
|
||||
else:
|
||||
env.Append(LINKFLAGS=['-Xlinker','-weak_framework','-Xlinker','Jackmp'])
|
||||
env.Append(LINKFLAGS=['-L/Library/Frameworks','-Xlinker','-weak_framework','-Xlinker','Jackmp'])
|
||||
|
||||
if env['WITH_BF_CYCLES_OSL'] == 1:
|
||||
OSX_OSL_LIBPATH = Dir(env.subst(env['BF_OSL_LIBPATH'])).abspath
|
||||
@@ -531,7 +532,8 @@ data_to_c_simple("release/datafiles/bfont.ttf")
|
||||
data_to_c_simple("release/datafiles/bmonofont.ttf")
|
||||
|
||||
data_to_c_simple("release/datafiles/splash.png")
|
||||
data_to_c_simple("release/datafiles/blender_icons.png")
|
||||
data_to_c_simple("release/datafiles/blender_icons16.png")
|
||||
data_to_c_simple("release/datafiles/blender_icons32.png")
|
||||
data_to_c_simple("release/datafiles/prvicons.png")
|
||||
|
||||
data_to_c_simple("release/datafiles/brushicons/add.png")
|
||||
|
@@ -876,6 +876,7 @@ compile_OSL() {
|
||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
||||
cmake_d="$cmake_d -D BUILDSTATIC=ON"
|
||||
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
|
||||
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
|
||||
|
||||
if [ -d $INST/boost ]; then
|
||||
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost -D Boost_NO_SYSTEM_PATHS=ON"
|
||||
@@ -1587,11 +1588,6 @@ install_SUSE() {
|
||||
INFO ""
|
||||
install_packages_SUSE $_packages
|
||||
|
||||
OPENJPEG_USE=true
|
||||
SCHRO_USE=true
|
||||
VORBIS_USE=true
|
||||
THEORA_USE=true
|
||||
|
||||
INFO ""
|
||||
X264_DEV="x264-devel"
|
||||
check_package_version_ge_SUSE $X264_DEV $X264_VERSION_MIN
|
||||
|
@@ -165,7 +165,7 @@ BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
||||
WITH_BF_JACK = True
|
||||
BF_JACK = '/Library/Frameworks/Jackmp.framework'
|
||||
BF_JACK_INC = '${BF_JACK}/headers'
|
||||
BF_JACK_LIB = 'jack'
|
||||
#BF_JACK_LIB = 'jack' # not used due framework
|
||||
BF_JACK_LIBPATH = '${BF_JACK}'
|
||||
|
||||
WITH_BF_SNDFILE = True
|
||||
|
@@ -1,15 +1,5 @@
|
||||
# find library directory
|
||||
import platform
|
||||
import os
|
||||
from Modules.FindPython import FindPython
|
||||
|
||||
bitness = platform.architecture()[0]
|
||||
if bitness == '64bit':
|
||||
LCGDIR = '../lib/linux64'
|
||||
else:
|
||||
LCGDIR = '../lib/linux'
|
||||
LIBDIR = "#${LCGDIR}"
|
||||
|
||||
py = FindPython()
|
||||
|
||||
BF_PYTHON_ABI_FLAGS = py['ABI_FLAGS']
|
||||
@@ -113,7 +103,7 @@ BF_QUICKTIME = '/usr/local'
|
||||
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
|
||||
|
||||
WITH_BF_ICONV = False
|
||||
BF_ICONV = LIBDIR + "/iconv"
|
||||
BF_ICONV = "/usr"
|
||||
BF_ICONV_INC = '${BF_ICONV}/include'
|
||||
BF_ICONV_LIB = 'iconv'
|
||||
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
|
||||
@@ -122,18 +112,7 @@ WITH_BF_BINRELOC = True
|
||||
|
||||
# enable ffmpeg support
|
||||
WITH_BF_FFMPEG = True
|
||||
BF_FFMPEG = LIBDIR + '/ffmpeg'
|
||||
if os.path.exists(LCGDIR + '/ffmpeg'):
|
||||
WITH_BF_STATICFFMPEG = True
|
||||
BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
|
||||
'${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
|
||||
'${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
|
||||
'${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
|
||||
'${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
|
||||
'${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
|
||||
'${BF_FFMPEG_LIBPATH}/libfaad.a'
|
||||
else:
|
||||
BF_FFMPEG = '/usr'
|
||||
BF_FFMPEG = '/usr'
|
||||
BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
|
||||
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
|
||||
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
|
||||
@@ -198,34 +177,30 @@ BF_JEMALLOC_LIBPATH = '${BF_JEMALLOC}/lib'
|
||||
BF_JEMALLOC_LIB = 'jemalloc'
|
||||
BF_JEMALLOC_LIB_STATIC = '${BF_JEMALLOC_LIBPATH}/libjemalloc.a'
|
||||
|
||||
WITH_BF_OIIO = True
|
||||
WITH_BF_OIIO = False
|
||||
WITH_BF_STATICOIIO = False
|
||||
BF_OIIO = LIBDIR + '/oiio'
|
||||
if not os.path.exists(LCGDIR + '/oiio'):
|
||||
WITH_BF_OIIO = False
|
||||
BF_OIIO = '/usr'
|
||||
BF_OIIO = '/usr'
|
||||
BF_OIIO_INC = '${BF_OIIO}/include'
|
||||
BF_OIIO_LIB = 'OpenImageIO'
|
||||
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
|
||||
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
|
||||
|
||||
WITH_BF_OCIO = True
|
||||
WITH_BF_OCIO = False
|
||||
WITH_BF_STATICOCIO = False
|
||||
BF_OCIO = LIBDIR + '/ocio'
|
||||
if not os.path.exists(LCGDIR + '/ocio'):
|
||||
WITH_BF_OCIO = False
|
||||
BF_OCIO = '/usr'
|
||||
BF_OCIO = '/usr'
|
||||
BF_OCIO_INC = '${BF_OCIO}/include'
|
||||
BF_OCIO_LIB = 'OpenColorIO yaml-cpp tinyxml'
|
||||
BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/libOpenColorIO.a ${BF_OCIO_LIBPATH}/libtinyxml.a ${BF_OCIO_LIBPATH}/libyaml-cpp.a'
|
||||
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
|
||||
|
||||
WITH_BF_BOOST = True
|
||||
WITH_BF_BOOST = False
|
||||
WITH_BF_STATICBOOST = False
|
||||
BF_BOOST = LIBDIR + '/boost'
|
||||
if not os.path.exists(LCGDIR + '/boost'):
|
||||
WITH_BF_BOOST = False
|
||||
BF_BOOST = '/usr'
|
||||
BF_BOOST = '/usr'
|
||||
BF_BOOST_INC = '${BF_BOOST}/include'
|
||||
BF_BOOST_LIB = 'boost_date_time boost_filesystem boost_regex boost_system boost_thread'
|
||||
BF_BOOST_LIB = 'boost_filesystem boost_regex boost_system boost_thread boost_date_time'
|
||||
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
|
||||
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a' + \
|
||||
'${BF_BOOST_LIBPATH}/libboost_thread.a'
|
||||
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale'
|
||||
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
|
||||
|
||||
@@ -253,8 +228,6 @@ BF_3DMOUSE_LIB_STATIC = '${BF_3DMOUSE_LIBPATH}/libspnav.a'
|
||||
##
|
||||
CC = 'gcc'
|
||||
CXX = 'g++'
|
||||
##ifeq ($CPU),alpha)
|
||||
## CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -mieee
|
||||
|
||||
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64','-D_LARGEFILE64_SOURCE']
|
||||
CXXFLAGS = []
|
||||
@@ -268,22 +241,12 @@ if WITH_BF_FFMPEG:
|
||||
REL_CFLAGS = []
|
||||
REL_CXXFLAGS = []
|
||||
REL_CCFLAGS = ['-DNDEBUG', '-O2']
|
||||
##BF_DEPEND = True
|
||||
##
|
||||
##AR = ar
|
||||
##ARFLAGS = ruv
|
||||
##ARFLAGSQUIET = ru
|
||||
##
|
||||
|
||||
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wunused-parameter', '-Wstrict-prototypes', '-Werror=declaration-after-statement', '-Werror=implicit-function-declaration', '-Werror=return-type']
|
||||
CC_WARN = ['-Wall']
|
||||
CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
|
||||
|
||||
|
||||
##FIX_STUBS_WARNINGS = -Wno-unused
|
||||
|
||||
LLIBS = ['util', 'c', 'm', 'dl', 'pthread', 'stdc++']
|
||||
##LOPTS = --dynamic
|
||||
##DYNLDFLAGS = -shared $(LDFLAGS)
|
||||
|
||||
BF_PROFILE = False
|
||||
BF_PROFILE_CCFLAGS = ['-pg','-g']
|
||||
@@ -301,4 +264,3 @@ PLATFORM_LINKFLAGS = ['-pthread']
|
||||
#Fix for LLVM conflict with Mesa llvmpipe
|
||||
if WITH_BF_LLVM:
|
||||
PLATFORM_LINKFLAGS += ['-Wl,--version-script=source/creator/blender.map']
|
||||
|
||||
|
@@ -3896,3 +3896,433 @@ Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.LatticePoint.select`
|
||||
|
||||
|
||||
2.64 to 2.65
|
||||
============
|
||||
|
||||
bpy.types.SmokeDomainSettings
|
||||
-----------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.SmokeDomainSettings.adapt_margin`
|
||||
* :class:`bpy.types.SmokeDomainSettings.adapt_threshold`
|
||||
* :class:`bpy.types.SmokeDomainSettings.additional_res`
|
||||
* :class:`bpy.types.SmokeDomainSettings.burning_rate`
|
||||
* :class:`bpy.types.SmokeDomainSettings.flame_ignition`
|
||||
* :class:`bpy.types.SmokeDomainSettings.flame_max_temp`
|
||||
* :class:`bpy.types.SmokeDomainSettings.flame_smoke`
|
||||
* :class:`bpy.types.SmokeDomainSettings.flame_smoke_color`
|
||||
* :class:`bpy.types.SmokeDomainSettings.flame_vorticity`
|
||||
* :class:`bpy.types.SmokeDomainSettings.use_adaptive_domain`
|
||||
|
||||
Removed
|
||||
^^^^^^^
|
||||
|
||||
* **scale**
|
||||
|
||||
bpy.types.BezierSplinePoint
|
||||
---------------------------
|
||||
|
||||
Renamed
|
||||
^^^^^^^
|
||||
|
||||
* **weight** -> :class:`bpy.types.BezierSplinePoint.weight_softbody`
|
||||
|
||||
bpy.types.Material
|
||||
------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.Material.use_light_group_local`
|
||||
|
||||
bpy.types.Curve
|
||||
---------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.Curve.use_map_taper`
|
||||
|
||||
bpy.types.EffectorWeights
|
||||
-------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.EffectorWeights.smokeflow`
|
||||
|
||||
bpy.types.FieldSettings
|
||||
-----------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.FieldSettings.source_object`
|
||||
* :class:`bpy.types.FieldSettings.use_smoke_density`
|
||||
|
||||
bpy.types.GPencilFrame
|
||||
----------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.GPencilFrame.clear`
|
||||
|
||||
bpy.types.UserPreferencesView
|
||||
-----------------------------
|
||||
|
||||
Renamed
|
||||
^^^^^^^
|
||||
|
||||
* **quit_dialog** -> :class:`bpy.types.UserPreferencesView.use_quit_dialog`
|
||||
|
||||
bpy.types.GreasePencilLayers
|
||||
----------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.GreasePencilLayers.new`
|
||||
* :class:`bpy.types.GreasePencilLayers.remove`
|
||||
|
||||
bpy.types.PointCache
|
||||
--------------------
|
||||
|
||||
Removed
|
||||
^^^^^^^
|
||||
|
||||
* **use_quick_cache**
|
||||
|
||||
bpy.types.KinematicConstraint
|
||||
-----------------------------
|
||||
|
||||
Removed
|
||||
^^^^^^^
|
||||
|
||||
* **use_target**
|
||||
|
||||
bpy.types.DopeSheet
|
||||
-------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.DopeSheet.show_only_errors`
|
||||
|
||||
bpy.types.UILayout
|
||||
------------------
|
||||
|
||||
Renamed
|
||||
^^^^^^^
|
||||
|
||||
* **template_color_wheel** -> :class:`bpy.types.UILayout.template_color_picker`
|
||||
|
||||
bpy.types.GPencilStroke
|
||||
-----------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.GPencilStroke.draw_mode`
|
||||
|
||||
bpy.types.UserPreferencesEdit
|
||||
-----------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.UserPreferencesEdit.use_auto_keying_warning`
|
||||
|
||||
bpy.types.MovieTrackingObject
|
||||
-----------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.MovieTrackingObject.keyframe_a`
|
||||
* :class:`bpy.types.MovieTrackingObject.keyframe_b`
|
||||
|
||||
bpy.types.ShrinkwrapModifier
|
||||
----------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.ShrinkwrapModifier.project_limit`
|
||||
|
||||
bpy.types.FileSelectParams
|
||||
--------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.FileSelectParams.use_filter_backup`
|
||||
|
||||
bpy.types.RenderSettings
|
||||
------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.RenderSettings.tile_x`
|
||||
* :class:`bpy.types.RenderSettings.tile_y`
|
||||
* :class:`bpy.types.RenderSettings.use_persistent_data`
|
||||
|
||||
Removed
|
||||
^^^^^^^
|
||||
|
||||
* **parts_x**
|
||||
* **parts_y**
|
||||
* **use_sequencer_gl_render**
|
||||
|
||||
bpy.types.Sculpt
|
||||
----------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.Sculpt.show_diffuse_color`
|
||||
|
||||
bpy.types.SmokeFlowSettings
|
||||
---------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.SmokeFlowSettings.density_vertex_group`
|
||||
* :class:`bpy.types.SmokeFlowSettings.fuel_amount`
|
||||
* :class:`bpy.types.SmokeFlowSettings.noise_texture`
|
||||
* :class:`bpy.types.SmokeFlowSettings.smoke_color`
|
||||
* :class:`bpy.types.SmokeFlowSettings.smoke_flow_source`
|
||||
* :class:`bpy.types.SmokeFlowSettings.smoke_flow_type`
|
||||
* :class:`bpy.types.SmokeFlowSettings.surface_distance`
|
||||
* :class:`bpy.types.SmokeFlowSettings.texture_map_type`
|
||||
* :class:`bpy.types.SmokeFlowSettings.texture_offset`
|
||||
* :class:`bpy.types.SmokeFlowSettings.texture_size`
|
||||
* :class:`bpy.types.SmokeFlowSettings.use_texture`
|
||||
* :class:`bpy.types.SmokeFlowSettings.uv_layer`
|
||||
* :class:`bpy.types.SmokeFlowSettings.velocity_normal`
|
||||
* :class:`bpy.types.SmokeFlowSettings.velocity_random`
|
||||
* :class:`bpy.types.SmokeFlowSettings.volume_density`
|
||||
|
||||
Removed
|
||||
^^^^^^^
|
||||
|
||||
* **use_outflow**
|
||||
|
||||
bpy.types.GameObjectSettings
|
||||
----------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.GameObjectSettings.collision_group`
|
||||
* :class:`bpy.types.GameObjectSettings.collision_mask`
|
||||
|
||||
bpy.types.SpaceView3D
|
||||
---------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.SpaceView3D.grid_scale_unit`
|
||||
* :class:`bpy.types.SpaceView3D.render_border_max_x`
|
||||
* :class:`bpy.types.SpaceView3D.render_border_max_y`
|
||||
* :class:`bpy.types.SpaceView3D.render_border_min_x`
|
||||
* :class:`bpy.types.SpaceView3D.render_border_min_y`
|
||||
* :class:`bpy.types.SpaceView3D.use_render_border`
|
||||
|
||||
bpy.types.DupliObject
|
||||
---------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.DupliObject.orco`
|
||||
* :class:`bpy.types.DupliObject.particle_system`
|
||||
* :class:`bpy.types.DupliObject.persistent_id`
|
||||
* :class:`bpy.types.DupliObject.type`
|
||||
* :class:`bpy.types.DupliObject.uv`
|
||||
|
||||
Removed
|
||||
^^^^^^^
|
||||
|
||||
* **particle_index**
|
||||
|
||||
bpy.types.CyclesRenderSettings
|
||||
------------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.CyclesRenderSettings.use_progressive_refine`
|
||||
|
||||
bpy.types.MaterialTextureSlot
|
||||
-----------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.MaterialTextureSlot.use_map_to_bounds`
|
||||
|
||||
bpy.types.MovieSequence
|
||||
-----------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.MovieSequence.colorspace_settings`
|
||||
|
||||
bpy.types.GPencilLayer
|
||||
----------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.GPencilLayer.clear`
|
||||
|
||||
bpy.types.CYCLES
|
||||
----------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.CYCLES.update_script_node`
|
||||
|
||||
bpy.types.ImageSequence
|
||||
-----------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.ImageSequence.colorspace_settings`
|
||||
|
||||
bpy.types.LatticePoint
|
||||
----------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.LatticePoint.weight_softbody`
|
||||
|
||||
bpy.types.DecimateModifier
|
||||
--------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.DecimateModifier.angle_limit`
|
||||
* :class:`bpy.types.DecimateModifier.decimate_type`
|
||||
* :class:`bpy.types.DecimateModifier.invert_vertex_group`
|
||||
* :class:`bpy.types.DecimateModifier.iterations`
|
||||
* :class:`bpy.types.DecimateModifier.use_collapse_triangulate`
|
||||
* :class:`bpy.types.DecimateModifier.use_dissolve_boundaries`
|
||||
* :class:`bpy.types.DecimateModifier.vertex_group`
|
||||
|
||||
bpy.types.UserPreferencesSystem
|
||||
-------------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.UserPreferencesSystem.multi_sample`
|
||||
|
||||
Removed
|
||||
^^^^^^^
|
||||
|
||||
* **use_antialiasing**
|
||||
|
||||
bpy.types.Text
|
||||
--------------
|
||||
|
||||
Removed
|
||||
^^^^^^^
|
||||
|
||||
* **markers**
|
||||
|
||||
bpy.types.GreasePencil
|
||||
----------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.GreasePencil.clear`
|
||||
|
||||
bpy.types.UserPreferencesFilePaths
|
||||
----------------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.UserPreferencesFilePaths.hide_system_bookmarks`
|
||||
|
||||
bpy.types.ToolSettings
|
||||
----------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.ToolSettings.snap_uv_element`
|
||||
|
||||
bpy.types.ShaderNodeTexCoord
|
||||
----------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.ShaderNodeTexCoord.from_dupli`
|
||||
|
||||
bpy.types.RenderEngine
|
||||
----------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.RenderEngine.update_memory_stats`
|
||||
* :class:`bpy.types.RenderEngine.update_script_node`
|
||||
|
||||
bpy.types.MovieTrackingSettings
|
||||
-------------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.MovieTrackingSettings.reconstruction_success_threshold`
|
||||
* :class:`bpy.types.MovieTrackingSettings.use_fallback_reconstruction`
|
||||
|
||||
Removed
|
||||
^^^^^^^
|
||||
|
||||
* **keyframe_a**
|
||||
* **keyframe_b**
|
||||
|
||||
bpy.types.ThemeUserInterface
|
||||
----------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.ThemeUserInterface.axis_x`
|
||||
* :class:`bpy.types.ThemeUserInterface.axis_y`
|
||||
* :class:`bpy.types.ThemeUserInterface.axis_z`
|
||||
|
||||
bpy.types.BlendDataGreasePencils
|
||||
--------------------------------
|
||||
|
||||
Added
|
||||
^^^^^
|
||||
|
||||
* :class:`bpy.types.BlendDataGreasePencils.new`
|
||||
* :class:`bpy.types.BlendDataGreasePencils.remove`
|
||||
|
||||
bpy.types.Object
|
||||
----------------
|
||||
|
||||
Function Arguments
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
* :class:`bpy.types.Object.dupli_list_create` (scene, settings), *was (scene)*
|
||||
|
98
extern/bullet2/src/BulletCollision/Gimpact/btCompoundFromGimpact.h
vendored
Normal file
98
extern/bullet2/src/BulletCollision/Gimpact/btCompoundFromGimpact.h
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
#ifndef BT_COMPOUND_FROM_GIMPACT
|
||||
#define BT_COMPOUND_FROM_GIMPACT
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
|
||||
#include "btGImpactShape.h"
|
||||
#include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h"
|
||||
|
||||
struct MyCallback : public btTriangleRaycastCallback
|
||||
{
|
||||
int m_ignorePart;
|
||||
int m_ignoreTriangleIndex;
|
||||
|
||||
|
||||
MyCallback(const btVector3& from, const btVector3& to, int ignorePart, int ignoreTriangleIndex)
|
||||
:btTriangleRaycastCallback(from,to),
|
||||
m_ignorePart(ignorePart),
|
||||
m_ignoreTriangleIndex(ignoreTriangleIndex)
|
||||
{
|
||||
|
||||
}
|
||||
virtual btScalar reportHit(const btVector3& hitNormalLocal, btScalar hitFraction, int partId, int triangleIndex)
|
||||
{
|
||||
if (partId!=m_ignorePart || triangleIndex!=m_ignoreTriangleIndex)
|
||||
{
|
||||
if (hitFraction < m_hitFraction)
|
||||
return hitFraction;
|
||||
}
|
||||
|
||||
return m_hitFraction;
|
||||
}
|
||||
};
|
||||
struct MyInternalTriangleIndexCallback :public btInternalTriangleIndexCallback
|
||||
{
|
||||
const btGImpactMeshShape* m_gimpactShape;
|
||||
btCompoundShape* m_colShape;
|
||||
btScalar m_depth;
|
||||
|
||||
MyInternalTriangleIndexCallback (btCompoundShape* colShape, const btGImpactMeshShape* meshShape, btScalar depth)
|
||||
:m_colShape(colShape),
|
||||
m_gimpactShape(meshShape),
|
||||
m_depth(depth)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
|
||||
{
|
||||
btVector3 scale = m_gimpactShape->getLocalScaling();
|
||||
btVector3 v0=triangle[0]*scale;
|
||||
btVector3 v1=triangle[1]*scale;
|
||||
btVector3 v2=triangle[2]*scale;
|
||||
|
||||
btVector3 centroid = (v0+v1+v2)/3;
|
||||
btVector3 normal = (v1-v0).cross(v2-v0);
|
||||
normal.normalize();
|
||||
btVector3 rayFrom = centroid;
|
||||
btVector3 rayTo = centroid-normal*m_depth;
|
||||
|
||||
MyCallback cb(rayFrom,rayTo,partId,triangleIndex);
|
||||
|
||||
m_gimpactShape->processAllTrianglesRay(&cb,rayFrom, rayTo);
|
||||
if (cb.m_hitFraction<1)
|
||||
{
|
||||
rayTo.setInterpolate3(cb.m_from,cb.m_to,cb.m_hitFraction);
|
||||
//rayTo = cb.m_from;
|
||||
//rayTo = rayTo.lerp(cb.m_to,cb.m_hitFraction);
|
||||
//gDebugDraw.drawLine(tr(centroid),tr(centroid+normal),btVector3(1,0,0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
btConvexHullShape* tet = new btConvexHullShape();
|
||||
tet->addPoint(v0);
|
||||
tet->addPoint(v1);
|
||||
tet->addPoint(v2);
|
||||
tet->addPoint(rayTo);
|
||||
btTransform ident;
|
||||
ident.setIdentity();
|
||||
m_colShape->addChildShape(ident,tet);
|
||||
}
|
||||
};
|
||||
|
||||
btCompoundShape* btCreateCompoundFromGimpactShape(const btGImpactMeshShape* gimpactMesh, btScalar depth)
|
||||
{
|
||||
btCompoundShape* colShape = new btCompoundShape();
|
||||
|
||||
btTransform tr;
|
||||
tr.setIdentity();
|
||||
|
||||
MyInternalTriangleIndexCallback cb(colShape,gimpactMesh, depth);
|
||||
btVector3 aabbMin,aabbMax;
|
||||
gimpactMesh->getAabb(tr,aabbMin,aabbMax);
|
||||
gimpactMesh->getMeshInterface()->InternalProcessAllTriangles(&cb,aabbMin,aabbMax);
|
||||
|
||||
return colShape;
|
||||
}
|
||||
|
||||
#endif //BT_COMPOUND_FROM_GIMPACT
|
@@ -384,7 +384,7 @@ bool btGImpactQuantizedBvh::rayQuery(
|
||||
|
||||
|
||||
SIMD_FORCE_INLINE bool _quantized_node_collision(
|
||||
btGImpactQuantizedBvh * boxset0, btGImpactQuantizedBvh * boxset1,
|
||||
const btGImpactQuantizedBvh * boxset0, const btGImpactQuantizedBvh * boxset1,
|
||||
const BT_BOX_BOX_TRANSFORM_CACHE & trans_cache_1to0,
|
||||
int node0 ,int node1, bool complete_primitive_tests)
|
||||
{
|
||||
@@ -402,7 +402,7 @@ SIMD_FORCE_INLINE bool _quantized_node_collision(
|
||||
|
||||
//stackless recursive collision routine
|
||||
static void _find_quantized_collision_pairs_recursive(
|
||||
btGImpactQuantizedBvh * boxset0, btGImpactQuantizedBvh * boxset1,
|
||||
const btGImpactQuantizedBvh * boxset0, const btGImpactQuantizedBvh * boxset1,
|
||||
btPairSet * collision_pairs,
|
||||
const BT_BOX_BOX_TRANSFORM_CACHE & trans_cache_1to0,
|
||||
int node0, int node1, bool complete_primitive_tests)
|
||||
@@ -501,8 +501,8 @@ static void _find_quantized_collision_pairs_recursive(
|
||||
}
|
||||
|
||||
|
||||
void btGImpactQuantizedBvh::find_collision(btGImpactQuantizedBvh * boxset0, const btTransform & trans0,
|
||||
btGImpactQuantizedBvh * boxset1, const btTransform & trans1,
|
||||
void btGImpactQuantizedBvh::find_collision(const btGImpactQuantizedBvh * boxset0, const btTransform & trans0,
|
||||
const btGImpactQuantizedBvh * boxset1, const btTransform & trans1,
|
||||
btPairSet & collision_pairs)
|
||||
{
|
||||
|
||||
|
@@ -363,8 +363,8 @@ public:
|
||||
static float getAverageTreeCollisionTime();
|
||||
#endif //TRI_COLLISION_PROFILING
|
||||
|
||||
static void find_collision(btGImpactQuantizedBvh * boxset1, const btTransform & trans1,
|
||||
btGImpactQuantizedBvh * boxset2, const btTransform & trans2,
|
||||
static void find_collision(const btGImpactQuantizedBvh * boxset1, const btTransform & trans1,
|
||||
const btGImpactQuantizedBvh * boxset2, const btTransform & trans2,
|
||||
btPairSet & collision_pairs);
|
||||
};
|
||||
|
||||
|
@@ -25,6 +25,7 @@ subject to the following restrictions:
|
||||
|
||||
#define CALC_EXACT_INERTIA 1
|
||||
|
||||
|
||||
void btGImpactCompoundShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||
{
|
||||
lockChildShapes();
|
||||
@@ -144,6 +145,31 @@ void btGImpactMeshShape::rayTest(const btVector3& rayFrom, const btVector3& rayT
|
||||
{
|
||||
}
|
||||
|
||||
void btGImpactMeshShapePart::processAllTrianglesRay(btTriangleCallback* callback,const btVector3& rayFrom, const btVector3& rayTo) const
|
||||
{
|
||||
lockChildShapes();
|
||||
|
||||
btAlignedObjectArray<int> collided;
|
||||
btVector3 rayDir(rayTo - rayFrom);
|
||||
rayDir.normalize();
|
||||
m_box_set.rayQuery(rayDir, rayFrom, collided);
|
||||
|
||||
if(collided.size()==0)
|
||||
{
|
||||
unlockChildShapes();
|
||||
return;
|
||||
}
|
||||
|
||||
int part = (int)getPart();
|
||||
btPrimitiveTriangle triangle;
|
||||
int i = collided.size();
|
||||
while(i--)
|
||||
{
|
||||
getPrimitiveTriangle(collided[i],triangle);
|
||||
callback->processTriangle(triangle.m_vertices,part,collided[i]);
|
||||
}
|
||||
unlockChildShapes();
|
||||
}
|
||||
|
||||
void btGImpactMeshShapePart::processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const
|
||||
{
|
||||
@@ -182,6 +208,15 @@ void btGImpactMeshShape::processAllTriangles(btTriangleCallback* callback,const
|
||||
}
|
||||
}
|
||||
|
||||
void btGImpactMeshShape::processAllTrianglesRay(btTriangleCallback* callback,const btVector3& rayFrom, const btVector3& rayTo) const
|
||||
{
|
||||
int i = m_mesh_parts.size();
|
||||
while(i--)
|
||||
{
|
||||
m_mesh_parts[i]->processAllTrianglesRay(callback, rayFrom, rayTo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
const char* btGImpactMeshShape::serialize(void* dataBuffer, btSerializer* serializer) const
|
||||
|
@@ -51,6 +51,7 @@ enum eGIMPACT_SHAPE_TYPE
|
||||
};
|
||||
|
||||
|
||||
|
||||
//! Helper class for tetrahedrons
|
||||
class btTetrahedronShapeEx:public btBU_Simplex1to4
|
||||
{
|
||||
@@ -192,7 +193,7 @@ public:
|
||||
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const = 0 ;
|
||||
|
||||
//! gets boxset
|
||||
SIMD_FORCE_INLINE btGImpactBoxSet * getBoxSet()
|
||||
SIMD_FORCE_INLINE const btGImpactBoxSet * getBoxSet() const
|
||||
{
|
||||
return &m_box_set;
|
||||
}
|
||||
@@ -288,6 +289,15 @@ public:
|
||||
(void) callback; (void) aabbMin; (void) aabbMax;
|
||||
}
|
||||
|
||||
//! Function for retrieve triangles.
|
||||
/*!
|
||||
It gives the triangles in local space
|
||||
*/
|
||||
virtual void processAllTrianglesRay(btTriangleCallback* /*callback*/,const btVector3& /*rayFrom*/, const btVector3& /*rayTo*/) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//!@}
|
||||
|
||||
};
|
||||
@@ -635,25 +645,25 @@ public:
|
||||
return (int )numverts;
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE void get_indices(int face_index,int &i0,int &i1,int &i2) const
|
||||
SIMD_FORCE_INLINE void get_indices(int face_index,unsigned int &i0,unsigned int &i1,unsigned int &i2) const
|
||||
{
|
||||
if(indicestype == PHY_SHORT)
|
||||
{
|
||||
short * s_indices = (short *)(indexbase + face_index*indexstride);
|
||||
unsigned short* s_indices = (unsigned short *)(indexbase + face_index * indexstride);
|
||||
i0 = s_indices[0];
|
||||
i1 = s_indices[1];
|
||||
i2 = s_indices[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
int * i_indices = (int *)(indexbase + face_index*indexstride);
|
||||
unsigned int * i_indices = (unsigned int *)(indexbase + face_index*indexstride);
|
||||
i0 = i_indices[0];
|
||||
i1 = i_indices[1];
|
||||
i2 = i_indices[2];
|
||||
}
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE void get_vertex(int vertex_index, btVector3 & vertex) const
|
||||
SIMD_FORCE_INLINE void get_vertex(unsigned int vertex_index, btVector3 & vertex) const
|
||||
{
|
||||
if(type == PHY_DOUBLE)
|
||||
{
|
||||
@@ -682,7 +692,7 @@ public:
|
||||
|
||||
virtual void get_primitive_triangle(int prim_index,btPrimitiveTriangle & triangle) const
|
||||
{
|
||||
int indices[3];
|
||||
unsigned int indices[3];
|
||||
get_indices(prim_index,indices[0],indices[1],indices[2]);
|
||||
get_vertex(indices[0],triangle.m_vertices[0]);
|
||||
get_vertex(indices[1],triangle.m_vertices[1]);
|
||||
@@ -692,7 +702,7 @@ public:
|
||||
|
||||
SIMD_FORCE_INLINE void get_bullet_triangle(int prim_index,btTriangleShapeEx & triangle) const
|
||||
{
|
||||
int indices[3];
|
||||
unsigned int indices[3];
|
||||
get_indices(prim_index,indices[0],indices[1],indices[2]);
|
||||
get_vertex(indices[0],triangle.m_vertices1[0]);
|
||||
get_vertex(indices[1],triangle.m_vertices1[1]);
|
||||
@@ -885,6 +895,7 @@ public:
|
||||
}
|
||||
|
||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
virtual void processAllTrianglesRay(btTriangleCallback* callback,const btVector3& rayFrom,const btVector3& rayTo) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -1141,6 +1152,8 @@ public:
|
||||
*/
|
||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||
|
||||
virtual void processAllTrianglesRay (btTriangleCallback* callback,const btVector3& rayFrom,const btVector3& rayTo) const;
|
||||
|
||||
virtual int calculateSerializeBufferSize() const;
|
||||
|
||||
///fills the dataBuffer and returns the struct name (and 0 on failure)
|
||||
|
@@ -1,4 +1,30 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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 2
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2006, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): Nathan Letwory.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
Import ('env')
|
||||
|
||||
SConscript(['audaspace/SConscript',
|
||||
|
@@ -33,6 +33,7 @@ set(INC_SYS
|
||||
|
||||
set(SRC
|
||||
FX/AUD_AccumulatorFactory.cpp
|
||||
FX/AUD_BandpassCalculator.cpp
|
||||
FX/AUD_BaseIIRFilterReader.cpp
|
||||
FX/AUD_ButterworthCalculator.cpp
|
||||
FX/AUD_ButterworthFactory.cpp
|
||||
@@ -147,6 +148,7 @@ set(SRC
|
||||
intern/AUD_StreamBufferFactory.h
|
||||
|
||||
FX/AUD_AccumulatorFactory.h
|
||||
FX/AUD_BandpassCalculator.h
|
||||
FX/AUD_BaseIIRFilterReader.h
|
||||
FX/AUD_ButterworthCalculator.h
|
||||
FX/AUD_ButterworthFactory.h
|
||||
|
@@ -1,4 +1,25 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# ***** BEGIN LGPL LICENSE BLOCK *****
|
||||
#
|
||||
# Copyright 2009 Jrg Hermann Mller
|
||||
#
|
||||
# This file is part of AudaSpace.
|
||||
#
|
||||
# AudaSpace is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# AudaSpace 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 Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# ***** END LGPL LICENSE BLOCK *****
|
||||
|
||||
Import ('env')
|
||||
|
||||
|
@@ -1,4 +1,30 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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 2
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2006, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): Nathan Letwory.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
Import ('env')
|
||||
|
||||
sources = env.Glob('intern/*.cpp')
|
||||
|
@@ -1,4 +1,30 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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 2
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2006, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): Nathan Letwory.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
Import ('env')
|
||||
|
||||
sources = env.Glob('intern/*.cpp')
|
||||
|
@@ -1,4 +1,30 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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 2
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2011, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): Nathan Letwory.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
from os import path
|
||||
Import('env')
|
||||
|
||||
|
@@ -38,7 +38,6 @@ set(SRC
|
||||
set(ADDON_FILES
|
||||
addon/__init__.py
|
||||
addon/engine.py
|
||||
addon/enums.py
|
||||
addon/osl.py
|
||||
addon/presets.py
|
||||
addon/properties.py
|
||||
|
@@ -21,7 +21,7 @@
|
||||
bl_info = {
|
||||
"name": "Cycles Render Engine",
|
||||
"author": "",
|
||||
"blender": (2, 6, 3),
|
||||
"blender": (2, 6, 5),
|
||||
"location": "Info header, render engine menu",
|
||||
"description": "Cycles Render Engine integration",
|
||||
"warning": "",
|
||||
@@ -31,8 +31,8 @@ bl_info = {
|
||||
"category": "Render"}
|
||||
|
||||
import bpy
|
||||
from . import ui, properties, engine, presets
|
||||
|
||||
from . import engine
|
||||
|
||||
class CyclesRender(bpy.types.RenderEngine):
|
||||
bl_idname = 'CYCLES'
|
||||
@@ -84,6 +84,10 @@ class CyclesRender(bpy.types.RenderEngine):
|
||||
|
||||
|
||||
def register():
|
||||
from . import ui
|
||||
from . import properties
|
||||
from . import presets
|
||||
|
||||
properties.register()
|
||||
ui.register()
|
||||
presets.register()
|
||||
@@ -91,6 +95,10 @@ def register():
|
||||
|
||||
|
||||
def unregister():
|
||||
from . import ui
|
||||
from . import properties
|
||||
from . import presets
|
||||
|
||||
ui.unregister()
|
||||
properties.unregister()
|
||||
presets.unregister()
|
||||
|
@@ -18,10 +18,8 @@
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def init():
|
||||
import bpy
|
||||
import _cycles
|
||||
import os.path
|
||||
|
||||
@@ -32,6 +30,7 @@ def init():
|
||||
|
||||
|
||||
def create(engine, data, scene, region=0, v3d=0, rv3d=0):
|
||||
import bpy
|
||||
import _cycles
|
||||
|
||||
data = data.as_pointer()
|
||||
|
@@ -1,63 +0,0 @@
|
||||
#
|
||||
# Copyright 2011, Blender Foundation.
|
||||
#
|
||||
# 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 2
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
from . import engine
|
||||
|
||||
devices = (
|
||||
('CPU', "CPU", "Use CPU for rendering"),
|
||||
('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in user preferences"))
|
||||
|
||||
feature_set = (
|
||||
('SUPPORTED', "Supported", "Only use finished and supported features"),
|
||||
('EXPERIMENTAL', "Experimental", "Use experimental and incomplete features that might be broken or change in the future"),
|
||||
)
|
||||
|
||||
shading_systems = (
|
||||
('GPU_COMPATIBLE', "GPU Compatible", "Restricted shading system compatible with GPU rendering"),
|
||||
('OSL', "Open Shading Language", "Open Shading Language shading system that only runs on the CPU"),
|
||||
)
|
||||
|
||||
displacement_methods = (
|
||||
('BUMP', "Bump", "Bump mapping to simulate the appearance of displacement"),
|
||||
('TRUE', "True", "Use true displacement only, requires fine subdivision"),
|
||||
('BOTH', "Both", "Combination of displacement and bump mapping"),
|
||||
)
|
||||
|
||||
bvh_types = (
|
||||
('DYNAMIC_BVH', "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"),
|
||||
('STATIC_BVH', "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"),
|
||||
)
|
||||
|
||||
filter_types = (
|
||||
('BOX', "Box", "Box filter"),
|
||||
('GAUSSIAN', "Gaussian", "Gaussian filter"),
|
||||
)
|
||||
|
||||
aperture_types = (
|
||||
('RADIUS', "Radius", "Directly change the size of the aperture"),
|
||||
('FSTOP', "F/stop", "Change the size of the aperture by f/stops"),
|
||||
)
|
||||
|
||||
panorama_types = (
|
||||
('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
|
||||
('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
|
||||
('FISHEYE_EQUISOLID', "Fisheye Equisolid",
|
||||
"Similar to most fisheye modern lens, takes sensor dimensions into consideration"),
|
||||
)
|
@@ -25,10 +25,44 @@ from bpy.props import (BoolProperty,
|
||||
IntProperty,
|
||||
PointerProperty)
|
||||
|
||||
import math
|
||||
# enums
|
||||
|
||||
from . import enums
|
||||
enum_devices = (
|
||||
('CPU', "CPU", "Use CPU for rendering"),
|
||||
('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in user preferences"))
|
||||
|
||||
enum_feature_set = (
|
||||
('SUPPORTED', "Supported", "Only use finished and supported features"),
|
||||
('EXPERIMENTAL', "Experimental", "Use experimental and incomplete features that might be broken or change in the future"),
|
||||
)
|
||||
|
||||
enum_displacement_methods = (
|
||||
('BUMP', "Bump", "Bump mapping to simulate the appearance of displacement"),
|
||||
('TRUE', "True", "Use true displacement only, requires fine subdivision"),
|
||||
('BOTH', "Both", "Combination of displacement and bump mapping"),
|
||||
)
|
||||
|
||||
enum_bvh_types = (
|
||||
('DYNAMIC_BVH', "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"),
|
||||
('STATIC_BVH', "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"),
|
||||
)
|
||||
|
||||
enum_filter_types = (
|
||||
('BOX', "Box", "Box filter"),
|
||||
('GAUSSIAN', "Gaussian", "Gaussian filter"),
|
||||
)
|
||||
|
||||
enum_aperture_types = (
|
||||
('RADIUS', "Radius", "Directly change the size of the aperture"),
|
||||
('FSTOP', "F/stop", "Change the size of the aperture by f/stops"),
|
||||
)
|
||||
|
||||
enum_panorama_types = (
|
||||
('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
|
||||
('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
|
||||
('FISHEYE_EQUISOLID', "Fisheye Equisolid",
|
||||
"Similar to most fisheye modern lens, takes sensor dimensions into consideration"),
|
||||
)
|
||||
|
||||
class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
@classmethod
|
||||
@@ -41,20 +75,18 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
cls.device = EnumProperty(
|
||||
name="Device",
|
||||
description="Device to use for rendering",
|
||||
items=enums.devices,
|
||||
items=enum_devices,
|
||||
default='CPU',
|
||||
)
|
||||
cls.feature_set = EnumProperty(
|
||||
name="Feature Set",
|
||||
description="Feature set to use for rendering",
|
||||
items=enums.feature_set,
|
||||
items=enum_feature_set,
|
||||
default='SUPPORTED',
|
||||
)
|
||||
cls.shading_system = EnumProperty(
|
||||
name="Shading System",
|
||||
description="Shading system to use for rendering",
|
||||
items=enums.shading_systems,
|
||||
default='GPU_COMPATIBLE',
|
||||
cls.shading_system = BoolProperty(
|
||||
name="Open Shading Language",
|
||||
description="Use Open Shading Language (CPU rendering only)",
|
||||
)
|
||||
|
||||
cls.progressive = BoolProperty(
|
||||
@@ -212,7 +244,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
cls.filter_type = EnumProperty(
|
||||
name="Filter Type",
|
||||
description="Pixel filter type",
|
||||
items=enums.filter_types,
|
||||
items=enum_filter_types,
|
||||
default='GAUSSIAN',
|
||||
)
|
||||
cls.filter_width = FloatProperty(
|
||||
@@ -275,7 +307,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
cls.debug_bvh_type = EnumProperty(
|
||||
name="Viewport BVH Type",
|
||||
description="Choose between faster updates, or faster render",
|
||||
items=enums.bvh_types,
|
||||
items=enum_bvh_types,
|
||||
default='DYNAMIC_BVH',
|
||||
)
|
||||
cls.debug_use_spatial_splits = BoolProperty(
|
||||
@@ -305,6 +337,8 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
class CyclesCameraSettings(bpy.types.PropertyGroup):
|
||||
@classmethod
|
||||
def register(cls):
|
||||
import math
|
||||
|
||||
bpy.types.Camera.cycles = PointerProperty(
|
||||
name="Cycles Camera Settings",
|
||||
description="Cycles camera settings",
|
||||
@@ -314,7 +348,7 @@ class CyclesCameraSettings(bpy.types.PropertyGroup):
|
||||
cls.aperture_type = EnumProperty(
|
||||
name="Aperture Type",
|
||||
description="Use F/stop number or aperture radius",
|
||||
items=enums.aperture_types,
|
||||
items=enum_aperture_types,
|
||||
default='RADIUS',
|
||||
)
|
||||
cls.aperture_fstop = FloatProperty(
|
||||
@@ -349,7 +383,7 @@ class CyclesCameraSettings(bpy.types.PropertyGroup):
|
||||
cls.panorama_type = EnumProperty(
|
||||
name="Panorama Type",
|
||||
description="Distortion to use for the calculation",
|
||||
items=enums.panorama_types,
|
||||
items=enum_panorama_types,
|
||||
default='FISHEYE_EQUISOLID',
|
||||
)
|
||||
cls.fisheye_fov = FloatProperty(
|
||||
@@ -518,7 +552,7 @@ class CyclesMeshSettings(bpy.types.PropertyGroup):
|
||||
cls.displacement_method = EnumProperty(
|
||||
name="Displacement Method",
|
||||
description="Method to use for the displacement",
|
||||
items=enums.displacement_methods,
|
||||
items=enum_displacement_methods,
|
||||
default='BUMP',
|
||||
)
|
||||
cls.use_subdivision = BoolProperty(
|
||||
|
@@ -22,8 +22,6 @@ import bpy
|
||||
|
||||
from bpy.types import Panel, Menu
|
||||
|
||||
from . import enums, engine
|
||||
|
||||
|
||||
class CYCLES_MT_integrator_presets(Menu):
|
||||
bl_label = "Integrator Presets"
|
||||
@@ -947,6 +945,37 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
|
||||
layout.template_color_ramp(mapping, "color_ramp", expand=True)
|
||||
|
||||
|
||||
class CyclesParticle_PT_textures(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Textures"
|
||||
bl_context = "particle"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
psys = context.particle_system
|
||||
return psys and CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
psys = context.particle_system
|
||||
part = psys.settings
|
||||
|
||||
row = layout.row()
|
||||
row.template_list(part, "texture_slots", part, "active_texture_index", rows=2)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
|
||||
col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
|
||||
col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")
|
||||
|
||||
if not part.active_texture:
|
||||
layout.template_ID(part, "active_texture", new="texture.new")
|
||||
else:
|
||||
slot = part.texture_slots[part.active_texture_index]
|
||||
layout.template_ID(slot, "texture", new="texture.new")
|
||||
|
||||
|
||||
class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Simplify"
|
||||
bl_context = "scene"
|
||||
@@ -977,6 +1006,7 @@ def draw_device(self, context):
|
||||
layout = self.layout
|
||||
|
||||
if scene.render.engine == 'CYCLES':
|
||||
from . import engine
|
||||
cscene = scene.cycles
|
||||
|
||||
layout.prop(cscene, "feature_set")
|
||||
@@ -1058,6 +1088,7 @@ def get_panels():
|
||||
bpy.types.TEXTURE_PT_pointdensity_turbulence,
|
||||
bpy.types.TEXTURE_PT_mapping,
|
||||
bpy.types.TEXTURE_PT_influence,
|
||||
bpy.types.TEXTURE_PT_colors,
|
||||
bpy.types.PARTICLE_PT_context_particles,
|
||||
bpy.types.PARTICLE_PT_emission,
|
||||
bpy.types.PARTICLE_PT_hair_dynamics,
|
||||
|
@@ -173,7 +173,6 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
|
||||
|
||||
switch(b_node.type()) {
|
||||
/* not supported */
|
||||
case BL::ShaderNode::type_CURVE_VEC: break;
|
||||
case BL::ShaderNode::type_GEOMETRY: break;
|
||||
case BL::ShaderNode::type_MATERIAL: break;
|
||||
case BL::ShaderNode::type_MATERIAL_EXT: break;
|
||||
@@ -193,9 +192,18 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
|
||||
node = proxy;
|
||||
break;
|
||||
}
|
||||
case BL::ShaderNode::type_CURVE_VEC: {
|
||||
BL::ShaderNodeVectorCurve b_curve_node(b_node);
|
||||
VectorCurvesNode *curves = new VectorCurvesNode();
|
||||
curvemapping_color_to_array(b_curve_node.mapping(), curves->curves, RAMP_TABLE_SIZE, false);
|
||||
node = curves;
|
||||
break;
|
||||
}
|
||||
case BL::ShaderNode::type_CURVE_RGB: {
|
||||
RGBCurvesNode *ramp = new RGBCurvesNode();
|
||||
node = ramp;
|
||||
BL::ShaderNodeRGBCurve b_curve_node(b_node);
|
||||
RGBCurvesNode *curves = new RGBCurvesNode();
|
||||
curvemapping_color_to_array(b_curve_node.mapping(), curves->curves, RAMP_TABLE_SIZE, true);
|
||||
node = curves;
|
||||
break;
|
||||
}
|
||||
case BL::ShaderNode::type_VALTORGB: {
|
||||
|
@@ -289,7 +289,7 @@ SceneParams BlenderSync::get_scene_params(BL::Scene b_scene, bool background)
|
||||
BL::RenderSettings r = b_scene.render();
|
||||
SceneParams params;
|
||||
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
||||
int shadingsystem = RNA_enum_get(&cscene, "shading_system");
|
||||
int shadingsystem = RNA_boolean_get(&cscene, "shading_system");
|
||||
|
||||
if(shadingsystem == 0)
|
||||
params.shadingsystem = SceneParams::SVM;
|
||||
@@ -414,7 +414,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
|
||||
params.progressive = true;
|
||||
|
||||
/* shading system - scene level needs full refresh */
|
||||
int shadingsystem = RNA_enum_get(&cscene, "shading_system");
|
||||
int shadingsystem = RNA_boolean_get(&cscene, "shading_system");
|
||||
|
||||
if(shadingsystem == 0)
|
||||
params.shadingsystem = SessionParams::SVM;
|
||||
|
@@ -52,6 +52,36 @@ static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size
|
||||
}
|
||||
}
|
||||
|
||||
static inline void curvemapping_color_to_array(BL::CurveMapping cumap, float4 *data, int size, bool rgb_curve)
|
||||
{
|
||||
cumap.update();
|
||||
|
||||
BL::CurveMap mapR = cumap.curves[0];
|
||||
BL::CurveMap mapG = cumap.curves[1];
|
||||
BL::CurveMap mapB = cumap.curves[2];
|
||||
|
||||
if(rgb_curve) {
|
||||
BL::CurveMap mapI = cumap.curves[3];
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
float t = i/(float)(size-1);
|
||||
|
||||
data[i][0] = mapR.evaluate(mapI.evaluate(t));
|
||||
data[i][1] = mapG.evaluate(mapI.evaluate(t));
|
||||
data[i][2] = mapB.evaluate(mapI.evaluate(t));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(int i = 0; i < size; i++) {
|
||||
float t = i/(float)(size-1);
|
||||
|
||||
data[i][0] = mapR.evaluate(t);
|
||||
data[i][1] = mapG.evaluate(t);
|
||||
data[i][2] = mapB.evaluate(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool BKE_object_is_modified(BL::Object self, BL::Scene scene, bool preview)
|
||||
{
|
||||
return self.is_modified(scene, (preview)? (1<<0): (1<<1))? true: false;
|
||||
|
@@ -49,12 +49,14 @@ set(SRC_CLOSURE_HEADERS
|
||||
closure/bsdf.h
|
||||
closure/bsdf_ashikhmin_velvet.h
|
||||
closure/bsdf_diffuse.h
|
||||
closure/bsdf_diffuse_ramp.h
|
||||
closure/bsdf_microfacet.h
|
||||
closure/bsdf_oren_nayar.h
|
||||
closure/bsdf_phong_ramp.h
|
||||
closure/bsdf_reflection.h
|
||||
closure/bsdf_refraction.h
|
||||
closure/bsdf_transparent.h
|
||||
closure/bsdf_util.h
|
||||
closure/bsdf_ward.h
|
||||
closure/bsdf_westin.h
|
||||
closure/emissive.h
|
||||
@@ -63,7 +65,6 @@ set(SRC_CLOSURE_HEADERS
|
||||
set(SRC_SVM_HEADERS
|
||||
svm/svm.h
|
||||
svm/svm_attribute.h
|
||||
svm/svm_bsdf.h
|
||||
svm/svm_camera.h
|
||||
svm/svm_closure.h
|
||||
svm/svm_convert.h
|
||||
|
@@ -1,4 +1,30 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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 2
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2011, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): Nathan Letwory.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
import sys
|
||||
import os
|
||||
import Blender as B
|
||||
|
@@ -1,137 +1,296 @@
|
||||
/*
|
||||
* Adapted from Open Shading Language with this license:
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
|
||||
* All Rights Reserved.
|
||||
* 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 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* Modifications Copyright 2011, Blender Foundation.
|
||||
* 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.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Sony Pictures Imageworks nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __OSL_BSDF_H__
|
||||
#define __OSL_BSDF_H__
|
||||
#include "../closure/bsdf_ashikhmin_velvet.h"
|
||||
#include "../closure/bsdf_diffuse.h"
|
||||
#include "../closure/bsdf_oren_nayar.h"
|
||||
#include "../closure/bsdf_phong_ramp.h"
|
||||
#include "../closure/bsdf_diffuse_ramp.h"
|
||||
#include "../closure/bsdf_microfacet.h"
|
||||
#include "../closure/bsdf_reflection.h"
|
||||
#include "../closure/bsdf_refraction.h"
|
||||
#include "../closure/bsdf_transparent.h"
|
||||
#ifdef __ANISOTROPIC__
|
||||
#include "../closure/bsdf_ward.h"
|
||||
#endif
|
||||
#include "../closure/bsdf_westin.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
__device float fresnel_dielectric(float eta, const float3 N,
|
||||
const float3 I, float3 *R, float3 *T,
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
const float3 dIdx, const float3 dIdy,
|
||||
float3 *dRdx, float3 *dRdy,
|
||||
float3 *dTdx, float3 *dTdy,
|
||||
#endif
|
||||
bool *is_inside)
|
||||
__device int bsdf_sample(KernelGlobals *kg, const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3 *eval, float3 *omega_in, differential3 *domega_in, float *pdf)
|
||||
{
|
||||
float cos = dot(N, I), neta;
|
||||
float3 Nn;
|
||||
// compute reflection
|
||||
*R = (2 * cos)* N - I;
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
*dRdx = (2 * dot(N, dIdx)) * N - dIdx;
|
||||
*dRdy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
int label;
|
||||
|
||||
#ifdef __OSL__
|
||||
if(kg->osl && sc->prim)
|
||||
return OSLShader::bsdf_sample(sd, sc, randu, randv, *eval, *omega_in, *domega_in, *pdf);
|
||||
#endif
|
||||
// check which side of the surface we are on
|
||||
if(cos > 0) {
|
||||
// we are on the outside of the surface, going in
|
||||
neta = 1 / eta;
|
||||
Nn = N;
|
||||
*is_inside = false;
|
||||
}
|
||||
else {
|
||||
// we are inside the surface,
|
||||
cos = -cos;
|
||||
neta = eta;
|
||||
Nn = -N;
|
||||
*is_inside = true;
|
||||
}
|
||||
*R = (2 * cos)* Nn - I;
|
||||
float arg = 1 -(neta * neta *(1 -(cos * cos)));
|
||||
if(arg < 0) {
|
||||
*T = make_float3(0.0f, 0.0f, 0.0f);
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
*dTdx = make_float3(0.0f, 0.0f, 0.0f);
|
||||
*dTdy = make_float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
switch(sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
label = bsdf_diffuse_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
#ifdef __SVM__
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
label = bsdf_oren_nayar_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
/*case CLOSURE_BSDF_PHONG_RAMP_ID:
|
||||
label = bsdf_phong_ramp_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_RAMP_ID:
|
||||
label = bsdf_diffuse_ramp_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;*/
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
label = bsdf_translucent_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
label = bsdf_reflection_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
label = bsdf_refraction_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
label = bsdf_transparent_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
label = bsdf_microfacet_ggx_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
|
||||
label = bsdf_microfacet_beckmann_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
#ifdef __ANISOTROPIC__
|
||||
case CLOSURE_BSDF_WARD_ID:
|
||||
label = bsdf_ward_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
#endif
|
||||
return 1; // total internal reflection
|
||||
}
|
||||
else {
|
||||
float dnp = sqrtf(arg);
|
||||
float nK = (neta * cos)- dnp;
|
||||
*T = -(neta * I)+(nK * Nn);
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
*dTdx = -(neta * dIdx) + ((neta - neta * neta * cos / dnp) * dot(dIdx, Nn)) * Nn;
|
||||
*dTdy = -(neta * dIdy) + ((neta - neta * neta * cos / dnp) * dot(dIdy, Nn)) * Nn;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
label = bsdf_ashikhmin_velvet_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_WESTIN_BACKSCATTER_ID:
|
||||
label = bsdf_westin_backscatter_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_WESTIN_SHEEN_ID:
|
||||
label = bsdf_westin_sheen_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
#endif
|
||||
// compute Fresnel terms
|
||||
float cosTheta1 = cos; // N.R
|
||||
float cosTheta2 = -dot(Nn, *T);
|
||||
float pPara = (cosTheta1 - eta * cosTheta2)/(cosTheta1 + eta * cosTheta2);
|
||||
float pPerp = (eta * cosTheta1 - cosTheta2)/(eta * cosTheta1 + cosTheta2);
|
||||
return 0.5f * (pPara * pPara + pPerp * pPerp);
|
||||
default:
|
||||
label = LABEL_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
__device float fresnel_dielectric_cos(float cosi, float eta)
|
||||
__device float3 bsdf_eval(KernelGlobals *kg, const ShaderData *sd, const ShaderClosure *sc, const float3 omega_in, float *pdf)
|
||||
{
|
||||
// compute fresnel reflectance without explicitly computing
|
||||
// the refracted direction
|
||||
float c = fabsf(cosi);
|
||||
float g = eta * eta - 1 + c * c;
|
||||
if(g > 0) {
|
||||
g = sqrtf(g);
|
||||
float A = (g - c)/(g + c);
|
||||
float B = (c *(g + c)- 1)/(c *(g - c)+ 1);
|
||||
return 0.5f * A * A *(1 + B * B);
|
||||
float3 eval;
|
||||
|
||||
#ifdef __OSL__
|
||||
if(kg->osl && sc->prim)
|
||||
return OSLShader::bsdf_eval(sd, sc, omega_in, *pdf);
|
||||
#endif
|
||||
|
||||
if(dot(sd->Ng, omega_in) >= 0.0f) {
|
||||
switch(sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
eval = bsdf_diffuse_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#ifdef __SVM__
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
eval = bsdf_oren_nayar_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
/*case CLOSURE_BSDF_PHONG_RAMP_ID:
|
||||
eval = bsdf_phong_ramp_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_RAMP_ID:
|
||||
eval = bsdf_diffuse_ramp_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;*/
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
eval = bsdf_translucent_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
eval = bsdf_reflection_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
eval = bsdf_refraction_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
eval = bsdf_transparent_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_ggx_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_beckmann_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#ifdef __ANISOTROPIC__
|
||||
case CLOSURE_BSDF_WARD_ID:
|
||||
eval = bsdf_ward_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
eval = bsdf_ashikhmin_velvet_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_WESTIN_BACKSCATTER_ID:
|
||||
eval = bsdf_westin_backscatter_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_WESTIN_SHEEN_ID:
|
||||
eval = bsdf_westin_sheen_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 1.0f; // TIR(no refracted component)
|
||||
}
|
||||
|
||||
__device float fresnel_conductor(float cosi, float eta, float k)
|
||||
{
|
||||
float tmp_f = eta * eta + k * k;
|
||||
float tmp = tmp_f * cosi * cosi;
|
||||
float Rparl2 = (tmp - (2.0f * eta * cosi) + 1)/
|
||||
(tmp + (2.0f * eta * cosi) + 1);
|
||||
float Rperp2 = (tmp_f - (2.0f * eta * cosi) + cosi * cosi)/
|
||||
(tmp_f + (2.0f * eta * cosi) + cosi * cosi);
|
||||
return(Rparl2 + Rperp2) * 0.5f;
|
||||
}
|
||||
|
||||
__device float smooth_step(float edge0, float edge1, float x)
|
||||
{
|
||||
float result;
|
||||
if(x < edge0) result = 0.0f;
|
||||
else if(x >= edge1) result = 1.0f;
|
||||
else {
|
||||
float t = (x - edge0)/(edge1 - edge0);
|
||||
result = (3.0f-2.0f*t)*(t*t);
|
||||
switch(sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
eval = bsdf_diffuse_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#ifdef __SVM__
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
eval = bsdf_oren_nayar_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
eval = bsdf_translucent_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
eval = bsdf_reflection_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
eval = bsdf_refraction_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
eval = bsdf_transparent_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_ggx_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_beckmann_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#ifdef __ANISOTROPIC__
|
||||
case CLOSURE_BSDF_WARD_ID:
|
||||
eval = bsdf_ward_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
eval = bsdf_ashikhmin_velvet_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_WESTIN_BACKSCATTER_ID:
|
||||
eval = bsdf_westin_backscatter_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_WESTIN_SHEEN_ID:
|
||||
eval = bsdf_westin_sheen_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return eval;
|
||||
}
|
||||
|
||||
__device void bsdf_blur(KernelGlobals *kg, ShaderClosure *sc, float roughness)
|
||||
{
|
||||
#ifdef __OSL__
|
||||
if(kg->osl && sc->prim) {
|
||||
OSLShader::bsdf_blur(sc, roughness);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch(sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
bsdf_diffuse_blur(sc, roughness);
|
||||
break;
|
||||
#ifdef __SVM__
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
bsdf_oren_nayar_blur(sc, roughness);
|
||||
break;
|
||||
/*case CLOSURE_BSDF_PHONG_RAMP_ID:
|
||||
bsdf_phong_ramp_blur(sc, roughness);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_RAMP_ID:
|
||||
bsdf_diffuse_ramp_blur(sc, roughness);
|
||||
break;*/
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
bsdf_translucent_blur(sc, roughness);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
bsdf_reflection_blur(sc, roughness);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
bsdf_refraction_blur(sc, roughness);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
bsdf_transparent_blur(sc, roughness);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
bsdf_microfacet_ggx_blur(sc, roughness);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
|
||||
bsdf_microfacet_beckmann_blur(sc, roughness);
|
||||
break;
|
||||
#ifdef __ANISOTROPIC__
|
||||
case CLOSURE_BSDF_WARD_ID:
|
||||
bsdf_ward_blur(sc, roughness);
|
||||
break;
|
||||
#endif
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
bsdf_ashikhmin_velvet_blur(sc, roughness);
|
||||
break;
|
||||
case CLOSURE_BSDF_WESTIN_BACKSCATTER_ID:
|
||||
bsdf_westin_backscatter_blur(sc, roughness);
|
||||
break;
|
||||
case CLOSURE_BSDF_WESTIN_SHEEN_ID:
|
||||
bsdf_westin_sheen_blur(sc, roughness);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __OSL_BSDF_H__ */
|
||||
|
||||
|
@@ -134,8 +134,6 @@ __device int bsdf_ashikhmin_velvet_sample(const ShaderClosure *sc, float3 Ng, fl
|
||||
// TODO: find a better approximation for the retroreflective bounce
|
||||
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
|
||||
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
*domega_in_dx *= 125.0f;
|
||||
*domega_in_dy *= 125.0f;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@@ -74,8 +74,6 @@ __device int bsdf_diffuse_sample(const ShaderClosure *sc, float3 Ng, float3 I, f
|
||||
// TODO: find a better approximation for the diffuse bounce
|
||||
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
|
||||
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
*domega_in_dx *= 125.0f;
|
||||
*domega_in_dy *= 125.0f;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@@ -126,10 +124,8 @@ __device int bsdf_translucent_sample(const ShaderClosure *sc, float3 Ng, float3
|
||||
*eval = make_float3(*pdf, *pdf, *pdf);
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
// TODO: find a better approximation for the diffuse bounce
|
||||
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
|
||||
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
*domega_in_dx *= -125.0f;
|
||||
*domega_in_dy *= -125.0f;
|
||||
*domega_in_dx = -((2 * dot(N, dIdx)) * N - dIdx);
|
||||
*domega_in_dy = -((2 * dot(N, dIdy)) * N - dIdy);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
|
96
intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
Normal file
96
intern/cycles/kernel/closure/bsdf_diffuse_ramp.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Adapted from Open Shading Language with this license:
|
||||
*
|
||||
* Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Modifications Copyright 2012, Blender Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Sony Pictures Imageworks nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __BSDF_DIFFUSE_RAMP_H__
|
||||
#define __BSDF_DIFFUSE_RAMP_H__
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
__device float3 bsdf_diffuse_ramp_get_color(const ShaderClosure *sc, const float3 colors[8], float pos)
|
||||
{
|
||||
int MAXCOLORS = 8;
|
||||
|
||||
float npos = pos * (float)(MAXCOLORS - 1);
|
||||
int ipos = (int)npos;
|
||||
if (ipos >= (MAXCOLORS - 1))
|
||||
return colors[MAXCOLORS - 1];
|
||||
float offset = npos - (float)ipos;
|
||||
return colors[ipos] * (1.0f - offset) + colors[ipos+1] * offset;
|
||||
}
|
||||
|
||||
__device int bsdf_diffuse_ramp_setup(ShaderClosure *sc)
|
||||
{
|
||||
sc->type = CLOSURE_BSDF_DIFFUSE_RAMP_ID;
|
||||
return SD_BSDF | SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
__device void bsdf_diffuse_ramp_blur(ShaderClosure *sc, float roughness)
|
||||
{
|
||||
}
|
||||
|
||||
__device float3 bsdf_diffuse_ramp_eval_reflect(const ShaderClosure *sc, const float3 colors[8], const float3 I, const float3 omega_in, float *pdf)
|
||||
{
|
||||
float3 N = sc->N;
|
||||
|
||||
float cos_pi = fmaxf(dot(N, omega_in), 0.0f);
|
||||
*pdf = cos_pi * M_1_PI_F;
|
||||
return bsdf_diffuse_ramp_get_color(sc, colors, cos_pi) * M_1_PI_F;
|
||||
}
|
||||
|
||||
__device float3 bsdf_diffuse_ramp_eval_transmit(const ShaderClosure *sc, const float3 colors[8], const float3 I, const float3 omega_in, float *pdf)
|
||||
{
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
__device int bsdf_diffuse_ramp_sample(const ShaderClosure *sc, const float3 colors[8], float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
|
||||
{
|
||||
float3 N = sc->N;
|
||||
|
||||
// distribution over the hemisphere
|
||||
sample_cos_hemisphere(N, randu, randv, omega_in, pdf);
|
||||
|
||||
if(dot(Ng, *omega_in) > 0.0f) {
|
||||
*eval = bsdf_diffuse_ramp_get_color(sc, colors, *pdf * M_PI_F) * M_1_PI_F;
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
|
||||
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
*pdf = 0.0f;
|
||||
|
||||
return LABEL_REFLECT|LABEL_DIFFUSE;
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __BSDF_DIFFUSE_RAMP_H__ */
|
@@ -199,12 +199,6 @@ __device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, floa
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
*domega_in_dx = (2 * dot(m, dIdx)) * m - dIdx;
|
||||
*domega_in_dy = (2 * dot(m, dIdy)) * m - dIdy;
|
||||
// Since there is some blur to this reflection, make the
|
||||
// derivatives a bit bigger. In theory this varies with the
|
||||
// roughness but the exact relationship is complex and
|
||||
// requires more ops than are practical.
|
||||
*domega_in_dx *= 10.0f;
|
||||
*domega_in_dy *= 10.0f;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -251,14 +245,6 @@ __device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, floa
|
||||
// eq. 38 and eq. 17
|
||||
*pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2;
|
||||
*eval = make_float3(out, out, out);
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
// Since there is some blur to this refraction, make the
|
||||
// derivatives a bit bigger. In theory this varies with the
|
||||
// roughness but the exact relationship is complex and
|
||||
// requires more ops than are practical.
|
||||
*domega_in_dx *= 10.0f;
|
||||
*domega_in_dy *= 10.0f;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -430,12 +416,6 @@ __device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 Ng,
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
*domega_in_dx = (2 * dot(m, dIdx)) * m - dIdx;
|
||||
*domega_in_dy = (2 * dot(m, dIdy)) * m - dIdy;
|
||||
// Since there is some blur to this reflection, make the
|
||||
// derivatives a bit bigger. In theory this varies with the
|
||||
// roughness but the exact relationship is complex and
|
||||
// requires more ops than are practical.
|
||||
*domega_in_dx *= 10.0f;
|
||||
*domega_in_dy *= 10.0f;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -486,14 +466,6 @@ __device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 Ng,
|
||||
// eq. 38 and eq. 17
|
||||
*pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2;
|
||||
*eval = make_float3(out, out, out);
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
// Since there is some blur to this refraction, make the
|
||||
// derivatives a bit bigger. In theory this varies with the
|
||||
// roughness but the exact relationship is complex and
|
||||
// requires more ops than are practical.
|
||||
*domega_in_dx *= 10.0f;
|
||||
*domega_in_dy *= 10.0f;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -81,8 +81,6 @@ __device int bsdf_oren_nayar_sample(const ShaderClosure *sc, float3 Ng, float3 I
|
||||
// TODO: find a better approximation for the bounce
|
||||
*domega_in_dx = (2.0f * dot(sc->N, dIdx)) * sc->N - dIdx;
|
||||
*domega_in_dy = (2.0f * dot(sc->N, dIdy)) * sc->N - dIdy;
|
||||
*domega_in_dx *= 125.0f;
|
||||
*domega_in_dy *= 125.0f;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
|
@@ -119,15 +119,6 @@ __device int bsdf_phong_ramp_sample(const ShaderClosure *sc, const float3 colors
|
||||
*pdf = (m_exponent + 1) * common;
|
||||
float out = cosNI * (m_exponent + 2) * common;
|
||||
*eval = bsdf_phong_ramp_get_color(sc, colors, cosp) * out;
|
||||
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
// Since there is some blur to this reflection, make the
|
||||
// derivatives a bit bigger. In theory this varies with the
|
||||
// exponent but the exact relationship is complex and
|
||||
// requires more ops than are practical.
|
||||
*domega_in_dx *= 10;
|
||||
*domega_in_dy *= 10;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
137
intern/cycles/kernel/closure/bsdf_util.h
Normal file
137
intern/cycles/kernel/closure/bsdf_util.h
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Adapted from Open Shading Language with this license:
|
||||
*
|
||||
* Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Modifications Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Sony Pictures Imageworks nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __OSL_BSDF_H__
|
||||
#define __OSL_BSDF_H__
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
__device float fresnel_dielectric(float eta, const float3 N,
|
||||
const float3 I, float3 *R, float3 *T,
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
const float3 dIdx, const float3 dIdy,
|
||||
float3 *dRdx, float3 *dRdy,
|
||||
float3 *dTdx, float3 *dTdy,
|
||||
#endif
|
||||
bool *is_inside)
|
||||
{
|
||||
float cos = dot(N, I), neta;
|
||||
float3 Nn;
|
||||
// compute reflection
|
||||
*R = (2 * cos)* N - I;
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
*dRdx = (2 * dot(N, dIdx)) * N - dIdx;
|
||||
*dRdy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
#endif
|
||||
// check which side of the surface we are on
|
||||
if(cos > 0) {
|
||||
// we are on the outside of the surface, going in
|
||||
neta = 1 / eta;
|
||||
Nn = N;
|
||||
*is_inside = false;
|
||||
}
|
||||
else {
|
||||
// we are inside the surface,
|
||||
cos = -cos;
|
||||
neta = eta;
|
||||
Nn = -N;
|
||||
*is_inside = true;
|
||||
}
|
||||
*R = (2 * cos)* Nn - I;
|
||||
float arg = 1 -(neta * neta *(1 -(cos * cos)));
|
||||
if(arg < 0) {
|
||||
*T = make_float3(0.0f, 0.0f, 0.0f);
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
*dTdx = make_float3(0.0f, 0.0f, 0.0f);
|
||||
*dTdy = make_float3(0.0f, 0.0f, 0.0f);
|
||||
#endif
|
||||
return 1; // total internal reflection
|
||||
}
|
||||
else {
|
||||
float dnp = sqrtf(arg);
|
||||
float nK = (neta * cos)- dnp;
|
||||
*T = -(neta * I)+(nK * Nn);
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
*dTdx = -(neta * dIdx) + ((neta - neta * neta * cos / dnp) * dot(dIdx, Nn)) * Nn;
|
||||
*dTdy = -(neta * dIdy) + ((neta - neta * neta * cos / dnp) * dot(dIdy, Nn)) * Nn;
|
||||
#endif
|
||||
// compute Fresnel terms
|
||||
float cosTheta1 = cos; // N.R
|
||||
float cosTheta2 = -dot(Nn, *T);
|
||||
float pPara = (cosTheta1 - eta * cosTheta2)/(cosTheta1 + eta * cosTheta2);
|
||||
float pPerp = (eta * cosTheta1 - cosTheta2)/(eta * cosTheta1 + cosTheta2);
|
||||
return 0.5f * (pPara * pPara + pPerp * pPerp);
|
||||
}
|
||||
}
|
||||
|
||||
__device float fresnel_dielectric_cos(float cosi, float eta)
|
||||
{
|
||||
// compute fresnel reflectance without explicitly computing
|
||||
// the refracted direction
|
||||
float c = fabsf(cosi);
|
||||
float g = eta * eta - 1 + c * c;
|
||||
if(g > 0) {
|
||||
g = sqrtf(g);
|
||||
float A = (g - c)/(g + c);
|
||||
float B = (c *(g + c)- 1)/(c *(g - c)+ 1);
|
||||
return 0.5f * A * A *(1 + B * B);
|
||||
}
|
||||
return 1.0f; // TIR(no refracted component)
|
||||
}
|
||||
|
||||
__device float fresnel_conductor(float cosi, float eta, float k)
|
||||
{
|
||||
float tmp_f = eta * eta + k * k;
|
||||
float tmp = tmp_f * cosi * cosi;
|
||||
float Rparl2 = (tmp - (2.0f * eta * cosi) + 1)/
|
||||
(tmp + (2.0f * eta * cosi) + 1);
|
||||
float Rperp2 = (tmp_f - (2.0f * eta * cosi) + cosi * cosi)/
|
||||
(tmp_f + (2.0f * eta * cosi) + cosi * cosi);
|
||||
return(Rparl2 + Rperp2) * 0.5f;
|
||||
}
|
||||
|
||||
__device float smooth_step(float edge0, float edge1, float x)
|
||||
{
|
||||
float result;
|
||||
if(x < edge0) result = 0.0f;
|
||||
else if(x >= edge1) result = 1.0f;
|
||||
else {
|
||||
float t = (x - edge0)/(edge1 - edge0);
|
||||
result = (3.0f-2.0f*t)*(t*t);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __OSL_BSDF_H__ */
|
||||
|
@@ -182,12 +182,6 @@ __device int bsdf_ward_sample(const ShaderClosure *sc, float3 Ng, float3 I, floa
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
|
||||
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
// Since there is some blur to this reflection, make the
|
||||
// derivatives a bit bigger. In theory this varies with the
|
||||
// roughness but the exact relationship is complex and
|
||||
// requires more ops than are practical.
|
||||
*domega_in_dx *= 10.0f;
|
||||
*domega_in_dy *= 10.0f;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -108,14 +108,6 @@ __device int bsdf_westin_backscatter_sample(const ShaderClosure *sc, float3 Ng,
|
||||
*pdf = 0.5f * M_1_PI_F * powf(cosTheta, m_invroughness);
|
||||
*pdf = (m_invroughness + 1) * (*pdf);
|
||||
*eval = make_float3(*pdf, *pdf, *pdf);
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
// Since there is some blur to this reflection, make the
|
||||
// derivatives a bit bigger. In theory this varies with the
|
||||
// exponent but the exact relationship is complex and
|
||||
// requires more ops than are practical.
|
||||
*domega_in_dx *= 10.0f;
|
||||
*domega_in_dy *= 10.0f;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,8 +168,6 @@ __device int bsdf_westin_sheen_sample(const ShaderClosure *sc, float3 Ng, float3
|
||||
// TODO: find a better approximation for the diffuse bounce
|
||||
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
|
||||
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
*domega_in_dx *= 125.0f;
|
||||
*domega_in_dy *= 125.0f;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
|
@@ -49,17 +49,12 @@ __device void emissive_sample(const float3 Ng, float randu, float randv,
|
||||
/* todo: not implemented and used yet */
|
||||
}
|
||||
|
||||
__device float3 emissive_eval(const float3 Ng, const float3 I)
|
||||
__device float3 emissive_simple_eval(const float3 Ng, const float3 I)
|
||||
{
|
||||
float res = emissive_pdf(Ng, I);
|
||||
|
||||
return make_float3(res, res, res);
|
||||
}
|
||||
|
||||
__device float3 svm_emissive_eval(ShaderData *sd, ShaderClosure *sc)
|
||||
{
|
||||
return emissive_eval(sd->Ng, sd->I);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -53,8 +53,13 @@ __device float3 volume_transparent_eval_phase(const ShaderClosure *sc, const flo
|
||||
|
||||
/* VOLUME CLOSURE */
|
||||
|
||||
__device float3 volume_eval_phase(const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
|
||||
__device float3 volume_eval_phase(KernelGlobals *kg, const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
|
||||
{
|
||||
#ifdef __OSL__
|
||||
if(kg->osl && sc->prim)
|
||||
return OSLShader::volume_eval_phase(sc, omega_in, omega_out);
|
||||
#endif
|
||||
|
||||
float3 eval;
|
||||
|
||||
switch(sc->type) {
|
||||
|
@@ -112,8 +112,8 @@ template<typename T> struct texture_image {
|
||||
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
int ix, iy, nix, niy;
|
||||
float tx = frac(x*width, &ix);
|
||||
float ty = frac(y*height, &iy);
|
||||
float tx = frac(x*width - 0.5f, &ix);
|
||||
float ty = frac(y*height - 0.5f, &iy);
|
||||
|
||||
if(periodic) {
|
||||
ix = wrap_periodic(ix, width);
|
||||
|
@@ -35,7 +35,7 @@ __device void kernel_shader_evaluate(KernelGlobals *kg, uint4 *input, float4 *ou
|
||||
|
||||
/* evaluate */
|
||||
float3 P = sd.P;
|
||||
shader_eval_displacement(kg, &sd);
|
||||
shader_eval_displacement(kg, &sd, SHADER_CONTEXT_MAIN);
|
||||
out = sd.P - P;
|
||||
}
|
||||
else { // SHADER_EVAL_BACKGROUND
|
||||
@@ -63,7 +63,7 @@ __device void kernel_shader_evaluate(KernelGlobals *kg, uint4 *input, float4 *ou
|
||||
|
||||
/* evaluate */
|
||||
int flag = 0; /* we can't know which type of BSDF this is for */
|
||||
out = shader_eval_background(kg, &sd, flag);
|
||||
out = shader_eval_background(kg, &sd, flag, SHADER_CONTEXT_MAIN);
|
||||
}
|
||||
|
||||
shader_release(kg, &sd);
|
||||
|
@@ -42,7 +42,7 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando,
|
||||
ray.time = time;
|
||||
#endif
|
||||
shader_setup_from_background(kg, &sd, &ray);
|
||||
eval = shader_eval_background(kg, &sd, 0);
|
||||
eval = shader_eval_background(kg, &sd, 0, SHADER_CONTEXT_EMISSION);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -52,7 +52,7 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando,
|
||||
|
||||
/* no path flag, we're evaluating this for all closures. that's weak but
|
||||
* we'd have to do multiple evaluations otherwise */
|
||||
shader_eval_surface(kg, &sd, rando, 0);
|
||||
shader_eval_surface(kg, &sd, rando, 0, SHADER_CONTEXT_EMISSION);
|
||||
|
||||
/* evaluate emissive closure */
|
||||
if(sd.flag & SD_EMISSION)
|
||||
@@ -170,7 +170,7 @@ __device float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag,
|
||||
/* evaluate background closure */
|
||||
ShaderData sd;
|
||||
shader_setup_from_background(kg, &sd, ray);
|
||||
float3 L = shader_eval_background(kg, &sd, path_flag);
|
||||
float3 L = shader_eval_background(kg, &sd, path_flag, SHADER_CONTEXT_EMISSION);
|
||||
shader_release(kg, &sd);
|
||||
|
||||
#ifdef __BACKGROUND_MIS__
|
||||
|
@@ -207,7 +207,7 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra
|
||||
|
||||
ShaderData sd;
|
||||
shader_setup_from_ray(kg, &sd, &isect, ray);
|
||||
shader_eval_surface(kg, &sd, 0.0f, PATH_RAY_SHADOW);
|
||||
shader_eval_surface(kg, &sd, 0.0f, PATH_RAY_SHADOW, SHADER_CONTEXT_SHADOW);
|
||||
|
||||
throughput *= shader_bsdf_transparency(kg, &sd);
|
||||
|
||||
@@ -272,7 +272,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
|
||||
ShaderData sd;
|
||||
shader_setup_from_ray(kg, &sd, &isect, &ray);
|
||||
float rbsdf = path_rng(kg, rng, sample, rng_offset + PRNG_BSDF);
|
||||
shader_eval_surface(kg, &sd, rbsdf, state.flag);
|
||||
shader_eval_surface(kg, &sd, rbsdf, state.flag, SHADER_CONTEXT_MAIN);
|
||||
|
||||
kernel_write_data_passes(kg, buffer, &L, &sd, sample, state.flag, throughput);
|
||||
|
||||
@@ -478,7 +478,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
|
||||
ShaderData sd;
|
||||
shader_setup_from_ray(kg, &sd, &isect, &ray);
|
||||
float rbsdf = path_rng(kg, rng, sample, rng_offset + PRNG_BSDF);
|
||||
shader_eval_surface(kg, &sd, rbsdf, state.flag);
|
||||
shader_eval_surface(kg, &sd, rbsdf, state.flag, SHADER_CONTEXT_INDIRECT);
|
||||
shader_merge_closures(kg, &sd);
|
||||
|
||||
/* blurring of bsdf after bounces, for rays that have a small likelihood
|
||||
@@ -666,7 +666,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
|
||||
ShaderData sd;
|
||||
shader_setup_from_ray(kg, &sd, &isect, &ray);
|
||||
float rbsdf = path_rng(kg, rng, sample, rng_offset + PRNG_BSDF);
|
||||
shader_eval_surface(kg, &sd, rbsdf, state.flag);
|
||||
shader_eval_surface(kg, &sd, rbsdf, state.flag, SHADER_CONTEXT_MAIN);
|
||||
shader_merge_closures(kg, &sd);
|
||||
|
||||
kernel_write_data_passes(kg, buffer, &L, &sd, sample, state.flag, throughput);
|
||||
|
@@ -26,11 +26,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "closure/bsdf_util.h"
|
||||
#include "closure/bsdf.h"
|
||||
#include "closure/emissive.h"
|
||||
#include "closure/volume.h"
|
||||
|
||||
#include "svm/svm_bsdf.h"
|
||||
#include "svm/svm.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
@@ -56,11 +56,6 @@ __device_noinline void shader_setup_object_transforms(KernelGlobals *kg, ShaderD
|
||||
__device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
|
||||
const Intersection *isect, const Ray *ray)
|
||||
{
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
OSLShader::init(kg, sd);
|
||||
#endif
|
||||
|
||||
/* fetch triangle data */
|
||||
int prim = kernel_tex_fetch(__prim_index, isect->prim);
|
||||
float4 Ns = kernel_tex_fetch(__tri_normal, prim);
|
||||
@@ -142,11 +137,6 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
|
||||
const float3 P, const float3 Ng, const float3 I,
|
||||
int shader, int object, int prim, float u, float v, float t, float time)
|
||||
{
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
OSLShader::init(kg, sd);
|
||||
#endif
|
||||
|
||||
/* vectors */
|
||||
sd->P = P;
|
||||
sd->N = Ng;
|
||||
@@ -273,11 +263,6 @@ __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
|
||||
|
||||
__device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData *sd, const Ray *ray)
|
||||
{
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
OSLShader::init(kg, sd);
|
||||
#endif
|
||||
|
||||
/* vectors */
|
||||
sd->P = ray->D;
|
||||
sd->N = -sd->P;
|
||||
@@ -320,9 +305,8 @@ __device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData
|
||||
|
||||
#ifdef __MULTI_CLOSURE__
|
||||
|
||||
#ifdef __OSL__
|
||||
__device_inline void _shader_bsdf_multi_eval_osl(const ShaderData *sd, const float3 omega_in, float *pdf,
|
||||
int skip_bsdf, BsdfEval *bsdf_eval, float sum_pdf, float sum_sample_weight)
|
||||
__device_inline void _shader_bsdf_multi_eval(KernelGlobals *kg, const ShaderData *sd, const float3 omega_in, float *pdf,
|
||||
int skip_bsdf, BsdfEval *result_eval, float sum_pdf, float sum_sample_weight)
|
||||
{
|
||||
for(int i = 0; i< sd->num_closure; i++) {
|
||||
if(i == skip_bsdf)
|
||||
@@ -332,38 +316,10 @@ __device_inline void _shader_bsdf_multi_eval_osl(const ShaderData *sd, const flo
|
||||
|
||||
if(CLOSURE_IS_BSDF(sc->type)) {
|
||||
float bsdf_pdf = 0.0f;
|
||||
|
||||
float3 eval = OSLShader::bsdf_eval(sd, sc, omega_in, bsdf_pdf);
|
||||
float3 eval = bsdf_eval(kg, sd, sc, omega_in, &bsdf_pdf);
|
||||
|
||||
if(bsdf_pdf != 0.0f) {
|
||||
bsdf_eval_accum(bsdf_eval, sc->type, eval*sc->weight);
|
||||
sum_pdf += bsdf_pdf*sc->sample_weight;
|
||||
}
|
||||
|
||||
sum_sample_weight += sc->sample_weight;
|
||||
}
|
||||
}
|
||||
|
||||
*pdf = (sum_sample_weight > 0.0f)? sum_pdf/sum_sample_weight: 0.0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
__device_inline void _shader_bsdf_multi_eval_svm(const ShaderData *sd, const float3 omega_in, float *pdf,
|
||||
int skip_bsdf, BsdfEval *bsdf_eval, float sum_pdf, float sum_sample_weight)
|
||||
{
|
||||
for(int i = 0; i< sd->num_closure; i++) {
|
||||
if(i == skip_bsdf)
|
||||
continue;
|
||||
|
||||
const ShaderClosure *sc = &sd->closure[i];
|
||||
|
||||
if(CLOSURE_IS_BSDF(sc->type)) {
|
||||
float bsdf_pdf = 0.0f;
|
||||
|
||||
float3 eval = svm_bsdf_eval(sd, sc, omega_in, &bsdf_pdf);
|
||||
|
||||
if(bsdf_pdf != 0.0f) {
|
||||
bsdf_eval_accum(bsdf_eval, sc->type, eval*sc->weight);
|
||||
bsdf_eval_accum(result_eval, sc->type, eval*sc->weight);
|
||||
sum_pdf += bsdf_pdf*sc->sample_weight;
|
||||
}
|
||||
|
||||
@@ -382,17 +338,12 @@ __device void shader_bsdf_eval(KernelGlobals *kg, const ShaderData *sd,
|
||||
#ifdef __MULTI_CLOSURE__
|
||||
bsdf_eval_init(eval, NBUILTIN_CLOSURES, make_float3(0.0f, 0.0f, 0.0f), kernel_data.film.use_light_pass);
|
||||
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
return _shader_bsdf_multi_eval_osl(sd, omega_in, pdf, -1, eval, 0.0f, 0.0f);
|
||||
else
|
||||
#endif
|
||||
return _shader_bsdf_multi_eval_svm(sd, omega_in, pdf, -1, eval, 0.0f, 0.0f);
|
||||
return _shader_bsdf_multi_eval(kg, sd, omega_in, pdf, -1, eval, 0.0f, 0.0f);
|
||||
#else
|
||||
const ShaderClosure *sc = &sd->closure;
|
||||
|
||||
*pdf = 0.0f;
|
||||
*eval = svm_bsdf_eval(sd, sc, omega_in, pdf)*sc->weight;
|
||||
*eval = bsdf_eval(kg, sd, sc, omega_in, pdf)*sc->weight;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -439,24 +390,14 @@ __device int shader_bsdf_sample(KernelGlobals *kg, const ShaderData *sd,
|
||||
float3 eval;
|
||||
|
||||
*pdf = 0.0f;
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
label = OSLShader::bsdf_sample(sd, sc, randu, randv, eval, *omega_in, *domega_in, *pdf);
|
||||
else
|
||||
#endif
|
||||
label = svm_bsdf_sample(sd, sc, randu, randv, &eval, omega_in, domega_in, pdf);
|
||||
label = bsdf_sample(kg, sd, sc, randu, randv, &eval, omega_in, domega_in, pdf);
|
||||
|
||||
if(*pdf != 0.0f) {
|
||||
bsdf_eval_init(bsdf_eval, sc->type, eval*sc->weight, kernel_data.film.use_light_pass);
|
||||
|
||||
if(sd->num_closure > 1) {
|
||||
float sweight = sc->sample_weight;
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
_shader_bsdf_multi_eval_osl(sd, *omega_in, pdf, sampled, bsdf_eval, *pdf*sweight, sweight);
|
||||
else
|
||||
#endif
|
||||
_shader_bsdf_multi_eval_svm(sd, *omega_in, pdf, sampled, bsdf_eval, *pdf*sweight, sweight);
|
||||
_shader_bsdf_multi_eval(kg, sd, *omega_in, pdf, sampled, bsdf_eval, *pdf*sweight, sweight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,7 +405,7 @@ __device int shader_bsdf_sample(KernelGlobals *kg, const ShaderData *sd,
|
||||
#else
|
||||
/* sample the single closure that we picked */
|
||||
*pdf = 0.0f;
|
||||
int label = svm_bsdf_sample(sd, &sd->closure, randu, randv, bsdf_eval, omega_in, domega_in, pdf);
|
||||
int label = bsdf_sample(kg, sd, &sd->closure, randu, randv, bsdf_eval, omega_in, domega_in, pdf);
|
||||
*bsdf_eval *= sd->closure.weight;
|
||||
return label;
|
||||
#endif
|
||||
@@ -478,12 +419,7 @@ __device int shader_bsdf_sample_closure(KernelGlobals *kg, const ShaderData *sd,
|
||||
float3 eval;
|
||||
|
||||
*pdf = 0.0f;
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
label = OSLShader::bsdf_sample(sd, sc, randu, randv, eval, *omega_in, *domega_in, *pdf);
|
||||
else
|
||||
#endif
|
||||
label = svm_bsdf_sample(sd, sc, randu, randv, &eval, omega_in, domega_in, pdf);
|
||||
label = bsdf_sample(kg, sd, sc, randu, randv, &eval, omega_in, domega_in, pdf);
|
||||
|
||||
if(*pdf != 0.0f)
|
||||
bsdf_eval_init(bsdf_eval, sc->type, eval*sc->weight, kernel_data.film.use_light_pass);
|
||||
@@ -497,17 +433,11 @@ __device void shader_bsdf_blur(KernelGlobals *kg, ShaderData *sd, float roughnes
|
||||
for(int i = 0; i< sd->num_closure; i++) {
|
||||
ShaderClosure *sc = &sd->closure[i];
|
||||
|
||||
if(CLOSURE_IS_BSDF(sc->type)) {
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
OSLShader::bsdf_blur(sc, roughness);
|
||||
else
|
||||
#endif
|
||||
svm_bsdf_blur(sc, roughness);
|
||||
}
|
||||
if(CLOSURE_IS_BSDF(sc->type))
|
||||
bsdf_blur(kg, sc, roughness);
|
||||
}
|
||||
#else
|
||||
svm_bsdf_blur(&sd->closure, roughness);
|
||||
bsdf_blur(kg, &sd->closure, roughness);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -635,6 +565,16 @@ __device float3 shader_bsdf_ao(KernelGlobals *kg, ShaderData *sd, float ao_facto
|
||||
|
||||
/* Emission */
|
||||
|
||||
__device float3 emissive_eval(KernelGlobals *kg, ShaderData *sd, ShaderClosure *sc)
|
||||
{
|
||||
#ifdef __OSL__
|
||||
if(kg->osl && sc->prim)
|
||||
return OSLShader::emissive_eval(sd, sc);
|
||||
#endif
|
||||
|
||||
return emissive_simple_eval(sd->Ng, sd->I);
|
||||
}
|
||||
|
||||
__device float3 shader_emissive_eval(KernelGlobals *kg, ShaderData *sd)
|
||||
{
|
||||
float3 eval;
|
||||
@@ -644,18 +584,11 @@ __device float3 shader_emissive_eval(KernelGlobals *kg, ShaderData *sd)
|
||||
for(int i = 0; i < sd->num_closure; i++) {
|
||||
ShaderClosure *sc = &sd->closure[i];
|
||||
|
||||
if(CLOSURE_IS_EMISSION(sc->type)) {
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
eval += OSLShader::emissive_eval(sd, sc)*sc->weight;
|
||||
else
|
||||
#endif
|
||||
eval += svm_emissive_eval(sd, sc)*sc->weight;
|
||||
|
||||
}
|
||||
if(CLOSURE_IS_EMISSION(sc->type))
|
||||
eval += emissive_eval(kg, sd, sc)*sc->weight;
|
||||
}
|
||||
#else
|
||||
eval = svm_emissive_eval(sd, &sd->closure)*sd->closure.weight;
|
||||
eval = emissive_eval(kg, sd, &sd->closure)*sd->closure.weight;
|
||||
#endif
|
||||
|
||||
return eval;
|
||||
@@ -687,11 +620,11 @@ __device float3 shader_holdout_eval(KernelGlobals *kg, ShaderData *sd)
|
||||
/* Surface Evaluation */
|
||||
|
||||
__device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd,
|
||||
float randb, int path_flag)
|
||||
float randb, int path_flag, ShaderContext ctx)
|
||||
{
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
OSLShader::eval_surface(kg, sd, randb, path_flag);
|
||||
OSLShader::eval_surface(kg, sd, randb, path_flag, ctx);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -706,11 +639,11 @@ __device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd,
|
||||
|
||||
/* Background Evaluation */
|
||||
|
||||
__device float3 shader_eval_background(KernelGlobals *kg, ShaderData *sd, int path_flag)
|
||||
__device float3 shader_eval_background(KernelGlobals *kg, ShaderData *sd, int path_flag, ShaderContext ctx)
|
||||
{
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
return OSLShader::eval_background(kg, sd, path_flag);
|
||||
return OSLShader::eval_background(kg, sd, path_flag, ctx);
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -753,31 +686,25 @@ __device float3 shader_volume_eval_phase(KernelGlobals *kg, ShaderData *sd,
|
||||
for(int i = 0; i< sd->num_closure; i++) {
|
||||
const ShaderClosure *sc = &sd->closure[i];
|
||||
|
||||
if(CLOSURE_IS_VOLUME(sc->type)) {
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
eval += OSLShader::volume_eval_phase(sc, omega_in, omega_out);
|
||||
else
|
||||
#endif
|
||||
eval += volume_eval_phase(sc, omega_in, omega_out);
|
||||
}
|
||||
if(CLOSURE_IS_VOLUME(sc->type))
|
||||
eval += volume_eval_phase(kg, sc, omega_in, omega_out);
|
||||
}
|
||||
|
||||
return eval;
|
||||
#else
|
||||
return volume_eval_phase(&sd->closure, omega_in, omega_out);
|
||||
return volume_eval_phase(kg, &sd->closure, omega_in, omega_out);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Volume Evaluation */
|
||||
|
||||
__device void shader_eval_volume(KernelGlobals *kg, ShaderData *sd,
|
||||
float randb, int path_flag)
|
||||
float randb, int path_flag, ShaderContext ctx)
|
||||
{
|
||||
#ifdef __SVM__
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
OSLShader::eval_volume(kg, sd, randb, path_flag);
|
||||
OSLShader::eval_volume(kg, sd, randb, path_flag, ctx);
|
||||
else
|
||||
#endif
|
||||
svm_eval_nodes(kg, sd, SHADER_TYPE_VOLUME, randb, path_flag);
|
||||
@@ -786,13 +713,13 @@ __device void shader_eval_volume(KernelGlobals *kg, ShaderData *sd,
|
||||
|
||||
/* Displacement Evaluation */
|
||||
|
||||
__device void shader_eval_displacement(KernelGlobals *kg, ShaderData *sd)
|
||||
__device void shader_eval_displacement(KernelGlobals *kg, ShaderData *sd, ShaderContext ctx)
|
||||
{
|
||||
/* this will modify sd->P */
|
||||
#ifdef __SVM__
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
OSLShader::eval_displacement(kg, sd);
|
||||
OSLShader::eval_displacement(kg, sd, ctx);
|
||||
else
|
||||
#endif
|
||||
svm_eval_nodes(kg, sd, SHADER_TYPE_DISPLACEMENT, 0.0f, 0);
|
||||
@@ -818,7 +745,6 @@ __device bool shader_transparent_shadow(KernelGlobals *kg, Intersection *isect)
|
||||
#ifdef __NON_PROGRESSIVE__
|
||||
__device void shader_merge_closures(KernelGlobals *kg, ShaderData *sd)
|
||||
{
|
||||
#ifndef __OSL__
|
||||
/* merge identical closures, better when we sample a single closure at a time */
|
||||
for(int i = 0; i < sd->num_closure; i++) {
|
||||
ShaderClosure *sci = &sd->closure[i];
|
||||
@@ -826,7 +752,11 @@ __device void shader_merge_closures(KernelGlobals *kg, ShaderData *sd)
|
||||
for(int j = i + 1; j < sd->num_closure; j++) {
|
||||
ShaderClosure *scj = &sd->closure[j];
|
||||
|
||||
#ifdef __OSL__
|
||||
if(!sci->prim && sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1) {
|
||||
#else
|
||||
if(sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1) {
|
||||
#endif
|
||||
sci->weight += scj->weight;
|
||||
sci->sample_weight += scj->sample_weight;
|
||||
|
||||
@@ -838,7 +768,6 @@ __device void shader_merge_closures(KernelGlobals *kg, ShaderData *sd)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -846,10 +775,7 @@ __device void shader_merge_closures(KernelGlobals *kg, ShaderData *sd)
|
||||
|
||||
__device void shader_release(KernelGlobals *kg, ShaderData *sd)
|
||||
{
|
||||
#ifdef __OSL__
|
||||
if (kg->osl)
|
||||
OSLShader::release(kg, sd);
|
||||
#endif
|
||||
/* nothing to do currently */
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -379,6 +379,18 @@ typedef struct ShaderClosure {
|
||||
#endif
|
||||
} ShaderClosure;
|
||||
|
||||
/* Shader Context
|
||||
*
|
||||
* For OSL we recycle a fixed number of contexts for speed */
|
||||
|
||||
typedef enum ShaderContext {
|
||||
SHADER_CONTEXT_MAIN = 0,
|
||||
SHADER_CONTEXT_INDIRECT = 1,
|
||||
SHADER_CONTEXT_EMISSION = 2,
|
||||
SHADER_CONTEXT_SHADOW = 3,
|
||||
SHADER_CONTEXT_NUM = 4
|
||||
} ShaderContext;
|
||||
|
||||
/* Shader Data
|
||||
*
|
||||
* Main shader state at a point on the surface or in a volume. All coordinates
|
||||
@@ -466,11 +478,6 @@ typedef struct ShaderData {
|
||||
/* Closure data, with a single sampled closure for low memory usage */
|
||||
ShaderClosure closure;
|
||||
#endif
|
||||
|
||||
#ifdef __OSL__
|
||||
/* OSL context */
|
||||
void *osl_ctx;
|
||||
#endif
|
||||
} ShaderData;
|
||||
|
||||
/* Constrant Kernel Data
|
||||
|
@@ -14,6 +14,7 @@ set(INC_SYS
|
||||
|
||||
set(SRC
|
||||
background.cpp
|
||||
bsdf_diffuse_ramp.cpp
|
||||
bsdf_phong_ramp.cpp
|
||||
emissive.cpp
|
||||
osl_closures.cpp
|
||||
|
@@ -1,4 +1,29 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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 2
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2011, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): Nathan Letwory.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
Import('env')
|
||||
|
||||
|
115
intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp
Normal file
115
intern/cycles/kernel/osl/bsdf_diffuse_ramp.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Adapted from Open Shading Language with this license:
|
||||
*
|
||||
* Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Modifications Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Sony Pictures Imageworks nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <OpenImageIO/fmath.h>
|
||||
|
||||
#include <OSL/genclosure.h>
|
||||
|
||||
#include "osl_closures.h"
|
||||
|
||||
#include "kernel_types.h"
|
||||
#include "kernel_montecarlo.h"
|
||||
#include "closure/bsdf_diffuse_ramp.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
using namespace OSL;
|
||||
|
||||
class DiffuseRampClosure : public CBSDFClosure {
|
||||
public:
|
||||
DiffuseRampClosure() : CBSDFClosure(LABEL_DIFFUSE) {}
|
||||
Color3 colors[8];
|
||||
float3 fcolors[8];
|
||||
|
||||
size_t memsize() const { return sizeof(*this); }
|
||||
const char *name() const { return "diffuse_ramp"; }
|
||||
|
||||
void setup()
|
||||
{
|
||||
sc.prim = this;
|
||||
m_shaderdata_flag = bsdf_diffuse_ramp_setup(&sc);
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
fcolors[i] = TO_FLOAT3(colors[i]);
|
||||
}
|
||||
|
||||
bool mergeable(const ClosurePrimitive *other) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void blur(float roughness)
|
||||
{
|
||||
bsdf_diffuse_ramp_blur(&sc, roughness);
|
||||
}
|
||||
|
||||
void print_on(std::ostream &out) const
|
||||
{
|
||||
out << name() << " ((" << sc.N[0] << ", " << sc.N[1] << ", " << sc.N[2] << "))";
|
||||
}
|
||||
|
||||
float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float& pdf) const
|
||||
{
|
||||
return bsdf_diffuse_ramp_eval_reflect(&sc, fcolors, omega_out, omega_in, &pdf);
|
||||
}
|
||||
|
||||
float3 eval_transmit(const float3 &omega_out, const float3 &omega_in, float& pdf) const
|
||||
{
|
||||
return bsdf_diffuse_ramp_eval_transmit(&sc, fcolors, omega_out, omega_in, &pdf);
|
||||
}
|
||||
|
||||
int sample(const float3 &Ng,
|
||||
const float3 &omega_out, const float3 &domega_out_dx, const float3 &domega_out_dy,
|
||||
float randu, float randv,
|
||||
float3 &omega_in, float3 &domega_in_dx, float3 &domega_in_dy,
|
||||
float &pdf, float3 &eval) const
|
||||
{
|
||||
return bsdf_diffuse_ramp_sample(&sc, fcolors, Ng, omega_out, domega_out_dx, domega_out_dy,
|
||||
randu, randv, &eval, &omega_in, &domega_in_dx, &domega_in_dy, &pdf);
|
||||
}
|
||||
};
|
||||
|
||||
ClosureParam *closure_bsdf_diffuse_ramp_params()
|
||||
{
|
||||
static ClosureParam params[] = {
|
||||
CLOSURE_FLOAT3_PARAM(DiffuseRampClosure, sc.N),
|
||||
CLOSURE_COLOR_ARRAY_PARAM(DiffuseRampClosure, colors, 8),
|
||||
CLOSURE_STRING_KEYPARAM("label"),
|
||||
CLOSURE_FINISH_PARAM(DiffuseRampClosure)
|
||||
};
|
||||
return params;
|
||||
}
|
||||
|
||||
CLOSURE_PREPARE(closure_bsdf_diffuse_ramp_prepare, DiffuseRampClosure)
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
void setup()
|
||||
{
|
||||
sc.N = TO_FLOAT3(N);
|
||||
sc.prim = this;
|
||||
m_shaderdata_flag = bsdf_phong_ramp_setup(&sc);
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
ClosureParam *closure_bsdf_phong_ramp_params()
|
||||
{
|
||||
static ClosureParam params[] = {
|
||||
CLOSURE_VECTOR_PARAM(PhongRampClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(PhongRampClosure, sc.N),
|
||||
CLOSURE_FLOAT_PARAM(PhongRampClosure, sc.data0),
|
||||
CLOSURE_COLOR_ARRAY_PARAM(PhongRampClosure, colors, 8),
|
||||
CLOSURE_STRING_KEYPARAM("label"),
|
||||
|
@@ -65,7 +65,7 @@ public:
|
||||
|
||||
Color3 eval(const Vec3 &Ng, const Vec3 &omega_out) const
|
||||
{
|
||||
float3 result = emissive_eval(TO_FLOAT3(Ng), TO_FLOAT3(omega_out));
|
||||
float3 result = emissive_simple_eval(TO_FLOAT3(Ng), TO_FLOAT3(omega_out));
|
||||
return TO_COLOR3(result);
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,7 @@
|
||||
#include "kernel_types.h"
|
||||
#include "kernel_montecarlo.h"
|
||||
|
||||
#include "closure/bsdf.h"
|
||||
#include "closure/bsdf_util.h"
|
||||
#include "closure/bsdf_ashikhmin_velvet.h"
|
||||
#include "closure/bsdf_diffuse.h"
|
||||
#include "closure/bsdf_microfacet.h"
|
||||
@@ -62,34 +62,34 @@ using namespace OSL;
|
||||
/* BSDF class definitions */
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(Diffuse, diffuse, diffuse, LABEL_DIFFUSE)
|
||||
CLOSURE_VECTOR_PARAM(DiffuseClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(DiffuseClosure, sc.N),
|
||||
BSDF_CLOSURE_CLASS_END(Diffuse, diffuse)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(Translucent, translucent, translucent, LABEL_DIFFUSE)
|
||||
CLOSURE_VECTOR_PARAM(TranslucentClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(TranslucentClosure, sc.N),
|
||||
BSDF_CLOSURE_CLASS_END(Translucent, translucent)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(OrenNayar, oren_nayar, oren_nayar, LABEL_DIFFUSE)
|
||||
CLOSURE_VECTOR_PARAM(OrenNayarClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(OrenNayarClosure, sc.N),
|
||||
CLOSURE_FLOAT_PARAM(OrenNayarClosure, sc.data0),
|
||||
BSDF_CLOSURE_CLASS_END(OrenNayar, oren_nayar)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(Reflection, reflection, reflection, LABEL_SINGULAR)
|
||||
CLOSURE_VECTOR_PARAM(ReflectionClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(ReflectionClosure, sc.N),
|
||||
BSDF_CLOSURE_CLASS_END(Reflection, reflection)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(Refraction, refraction, refraction, LABEL_SINGULAR)
|
||||
CLOSURE_VECTOR_PARAM(RefractionClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(RefractionClosure, sc.N),
|
||||
CLOSURE_FLOAT_PARAM(RefractionClosure, sc.data0),
|
||||
BSDF_CLOSURE_CLASS_END(Refraction, refraction)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(WestinBackscatter, westin_backscatter, westin_backscatter, LABEL_GLOSSY)
|
||||
CLOSURE_VECTOR_PARAM(WestinBackscatterClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(WestinBackscatterClosure, sc.N),
|
||||
CLOSURE_FLOAT_PARAM(WestinBackscatterClosure, sc.data0),
|
||||
BSDF_CLOSURE_CLASS_END(WestinBackscatter, westin_backscatter)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(WestinSheen, westin_sheen, westin_sheen, LABEL_DIFFUSE)
|
||||
CLOSURE_VECTOR_PARAM(WestinSheenClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(WestinSheenClosure, sc.N),
|
||||
CLOSURE_FLOAT_PARAM(WestinSheenClosure, sc.data0),
|
||||
BSDF_CLOSURE_CLASS_END(WestinSheen, westin_sheen)
|
||||
|
||||
@@ -97,35 +97,35 @@ BSDF_CLOSURE_CLASS_BEGIN(Transparent, transparent, transparent, LABEL_SINGULAR)
|
||||
BSDF_CLOSURE_CLASS_END(Transparent, transparent)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(AshikhminVelvet, ashikhmin_velvet, ashikhmin_velvet, LABEL_DIFFUSE)
|
||||
CLOSURE_VECTOR_PARAM(AshikhminVelvetClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(AshikhminVelvetClosure, sc.N),
|
||||
CLOSURE_FLOAT_PARAM(AshikhminVelvetClosure, sc.data0),
|
||||
BSDF_CLOSURE_CLASS_END(AshikhminVelvet, ashikhmin_velvet)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(Ward, ward, ward, LABEL_GLOSSY)
|
||||
CLOSURE_VECTOR_PARAM(WardClosure, N),
|
||||
CLOSURE_VECTOR_PARAM(WardClosure, T),
|
||||
CLOSURE_FLOAT3_PARAM(WardClosure, sc.N),
|
||||
CLOSURE_FLOAT3_PARAM(WardClosure, sc.T),
|
||||
CLOSURE_FLOAT_PARAM(WardClosure, sc.data0),
|
||||
CLOSURE_FLOAT_PARAM(WardClosure, sc.data1),
|
||||
BSDF_CLOSURE_CLASS_END(Ward, ward)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(MicrofacetGGX, microfacet_ggx, microfacet_ggx, LABEL_GLOSSY)
|
||||
CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(MicrofacetGGXClosure, sc.N),
|
||||
CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure, sc.data0),
|
||||
BSDF_CLOSURE_CLASS_END(MicrofacetGGX, microfacet_ggx)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(MicrofacetBeckmann, microfacet_beckmann, microfacet_beckmann, LABEL_GLOSSY)
|
||||
CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(MicrofacetBeckmannClosure, sc.N),
|
||||
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure, sc.data0),
|
||||
BSDF_CLOSURE_CLASS_END(MicrofacetBeckmann, microfacet_beckmann)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(MicrofacetGGXRefraction, microfacet_ggx_refraction, microfacet_ggx, LABEL_GLOSSY)
|
||||
CLOSURE_VECTOR_PARAM(MicrofacetGGXRefractionClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(MicrofacetGGXRefractionClosure, sc.N),
|
||||
CLOSURE_FLOAT_PARAM(MicrofacetGGXRefractionClosure, sc.data0),
|
||||
CLOSURE_FLOAT_PARAM(MicrofacetGGXRefractionClosure, sc.data1),
|
||||
BSDF_CLOSURE_CLASS_END(MicrofacetGGXRefraction, microfacet_ggx_refraction)
|
||||
|
||||
BSDF_CLOSURE_CLASS_BEGIN(MicrofacetBeckmannRefraction, microfacet_beckmann_refraction, microfacet_beckmann, LABEL_GLOSSY)
|
||||
CLOSURE_VECTOR_PARAM(MicrofacetBeckmannRefractionClosure, N),
|
||||
CLOSURE_FLOAT3_PARAM(MicrofacetBeckmannRefractionClosure, sc.N),
|
||||
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannRefractionClosure, sc.data0),
|
||||
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannRefractionClosure, sc.data1),
|
||||
BSDF_CLOSURE_CLASS_END(MicrofacetBeckmannRefraction, microfacet_beckmann_refraction)
|
||||
@@ -196,6 +196,8 @@ void OSLShader::register_closures(OSLShadingSystem *ss_)
|
||||
closure_ambient_occlusion_params(), closure_ambient_occlusion_prepare);
|
||||
register_closure(ss, "phong_ramp", id++,
|
||||
closure_bsdf_phong_ramp_params(), closure_bsdf_phong_ramp_prepare);
|
||||
register_closure(ss, "diffuse_ramp", id++,
|
||||
closure_bsdf_diffuse_ramp_params(), closure_bsdf_diffuse_ramp_prepare);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -48,12 +48,14 @@ OSL::ClosureParam *closure_background_params();
|
||||
OSL::ClosureParam *closure_holdout_params();
|
||||
OSL::ClosureParam *closure_ambient_occlusion_params();
|
||||
OSL::ClosureParam *closure_bsdf_phong_ramp_params();
|
||||
OSL::ClosureParam *closure_bsdf_diffuse_ramp_params();
|
||||
|
||||
void closure_emission_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_background_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_holdout_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_ambient_occlusion_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_bsdf_phong_ramp_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_bsdf_diffuse_ramp_prepare(OSL::RendererServices *, int id, void *data);
|
||||
|
||||
enum {
|
||||
AmbientOcclusion = 100
|
||||
@@ -68,8 +70,11 @@ void name(RendererServices *, int id, void *data) \
|
||||
|
||||
#define CLOSURE_PREPARE_STATIC(name, classname) static CLOSURE_PREPARE(name, classname)
|
||||
|
||||
#define TO_VEC3(v) (*(OSL::Vec3 *)&(v))
|
||||
#define TO_COLOR3(v) (*(OSL::Color3 *)&(v))
|
||||
#define CLOSURE_FLOAT3_PARAM(st, fld) \
|
||||
{ TypeDesc::TypeVector, reckless_offsetof(st, fld), NULL, sizeof(OSL::Vec3) }
|
||||
|
||||
#define TO_VEC3(v) OSL::Vec3(v.x, v.y, v.z)
|
||||
#define TO_COLOR3(v) OSL::Color3(v.x, v.y, v.z)
|
||||
#define TO_FLOAT3(v) make_float3(v[0], v[1], v[2])
|
||||
|
||||
/* BSDF */
|
||||
@@ -77,7 +82,6 @@ void name(RendererServices *, int id, void *data) \
|
||||
class CBSDFClosure : public OSL::ClosurePrimitive {
|
||||
public:
|
||||
ShaderClosure sc;
|
||||
OSL::Vec3 N, T;
|
||||
|
||||
CBSDFClosure(int scattering) : OSL::ClosurePrimitive(BSDF),
|
||||
m_scattering_label(scattering), m_shaderdata_flag(0) { }
|
||||
@@ -85,7 +89,6 @@ public:
|
||||
|
||||
int scattering() const { return m_scattering_label; }
|
||||
int shaderdata_flag() const { return m_shaderdata_flag; }
|
||||
ClosureType shaderclosure_type() const { return sc.type; }
|
||||
|
||||
virtual void blur(float roughness) = 0;
|
||||
virtual float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float &pdf) const = 0;
|
||||
@@ -112,8 +115,7 @@ public: \
|
||||
\
|
||||
void setup() \
|
||||
{ \
|
||||
sc.N = TO_FLOAT3(N); \
|
||||
sc.T = TO_FLOAT3(T); \
|
||||
sc.prim = NULL; \
|
||||
m_shaderdata_flag = bsdf_##lower##_setup(&sc); \
|
||||
} \
|
||||
\
|
||||
|
@@ -75,10 +75,21 @@ struct OSLGlobals {
|
||||
vector<ustring> object_names;
|
||||
};
|
||||
|
||||
/* trace() call result */
|
||||
struct OSLTraceData {
|
||||
Ray ray;
|
||||
Intersection isect;
|
||||
ShaderData sd;
|
||||
bool setup;
|
||||
bool init;
|
||||
};
|
||||
|
||||
/* thread key for thread specific data lookup */
|
||||
struct OSLThreadData {
|
||||
OSL::ShaderGlobals globals;
|
||||
OSL::PerThreadInfo *thread_info;
|
||||
OSLTraceData tracedata;
|
||||
OSL::ShadingContext *context[SHADER_CONTEXT_NUM];
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -47,7 +47,7 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* RenderServices implementation */
|
||||
|
||||
#define TO_MATRIX44(m) (*(OSL::Matrix44 *)&(m))
|
||||
#define COPY_MATRIX44(m1, m2) memcpy(m1, m2, sizeof(*m2))
|
||||
|
||||
/* static ustrings */
|
||||
ustring OSLRenderServices::u_distance("distance");
|
||||
@@ -121,7 +121,7 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr
|
||||
Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM);
|
||||
#endif
|
||||
tfm = transform_transpose(tfm);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, OSL::Transform
|
||||
Transform itfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
|
||||
#endif
|
||||
itfm = transform_transpose(itfm);
|
||||
result = TO_MATRIX44(itfm);
|
||||
COPY_MATRIX44(&result, &itfm);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -166,22 +166,22 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, ustring from, float ti
|
||||
|
||||
if (from == u_ndc) {
|
||||
Transform tfm = transform_transpose(transform_quick_inverse(kernel_data.cam.worldtondc));
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (from == u_raster) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.rastertoworld);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (from == u_screen) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.screentoworld);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (from == u_camera) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.cameratoworld);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -194,22 +194,22 @@ bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, ustring to, fl
|
||||
|
||||
if (to == u_ndc) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.worldtondc);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (to == u_raster) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.worldtoraster);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (to == u_screen) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.worldtoscreen);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (to == u_camera) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.worldtocamera);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr
|
||||
Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM);
|
||||
#endif
|
||||
tfm = transform_transpose(tfm);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, OSL::Transform
|
||||
Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
|
||||
#endif
|
||||
tfm = transform_transpose(tfm);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -272,22 +272,22 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, ustring from)
|
||||
|
||||
if (from == u_ndc) {
|
||||
Transform tfm = transform_transpose(transform_quick_inverse(kernel_data.cam.worldtondc));
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (from == u_raster) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.rastertoworld);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (from == u_screen) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.screentoworld);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (from == u_camera) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.cameratoworld);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -300,22 +300,22 @@ bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, ustring to)
|
||||
|
||||
if (to == u_ndc) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.worldtondc);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (to == u_raster) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.worldtoraster);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (to == u_screen) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.worldtoscreen);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
else if (to == u_camera) {
|
||||
Transform tfm = transform_transpose(kernel_data.cam.worldtocamera);
|
||||
result = TO_MATRIX44(tfm);
|
||||
COPY_MATRIX44(&result, &tfm);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -815,13 +815,10 @@ bool OSLRenderServices::trace(TraceOpt &options, OSL::ShaderGlobals *sg,
|
||||
ray.dD.dy = TO_FLOAT3(dRdy);
|
||||
|
||||
/* allocate trace data */
|
||||
TraceData *tracedata = new TraceData();
|
||||
OSLTraceData *tracedata = (OSLTraceData*)sg->tracedata;
|
||||
tracedata->ray = ray;
|
||||
tracedata->setup = false;
|
||||
|
||||
if(sg->tracedata)
|
||||
delete (TraceData*)sg->tracedata;
|
||||
sg->tracedata = tracedata;
|
||||
tracedata->init = true;
|
||||
|
||||
/* raytrace */
|
||||
return scene_intersect(kernel_globals, &ray, ~0, &tracedata->isect);
|
||||
@@ -831,9 +828,9 @@ bool OSLRenderServices::trace(TraceOpt &options, OSL::ShaderGlobals *sg,
|
||||
bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg, ustring source, ustring name,
|
||||
TypeDesc type, void *val, bool derivatives)
|
||||
{
|
||||
TraceData *tracedata = (TraceData*)sg->tracedata;
|
||||
OSLTraceData *tracedata = (OSLTraceData*)sg->tracedata;
|
||||
|
||||
if(source == u_trace && tracedata) {
|
||||
if(source == u_trace && tracedata->init) {
|
||||
if(name == u_hit) {
|
||||
return set_attribute_int((tracedata->isect.prim != ~0), type, derivatives, val);
|
||||
}
|
||||
|
@@ -106,13 +106,6 @@ public:
|
||||
static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
|
||||
TypeDesc type, bool derivatives, void *val);
|
||||
|
||||
struct TraceData {
|
||||
Ray ray;
|
||||
Intersection isect;
|
||||
ShaderData sd;
|
||||
bool setup;
|
||||
};
|
||||
|
||||
static ustring u_distance;
|
||||
static ustring u_index;
|
||||
static ustring u_camera;
|
||||
|
@@ -51,8 +51,13 @@ void OSLShader::thread_init(KernelGlobals *kg, KernelGlobals *kernel_globals, OS
|
||||
OSLThreadData *tdata = new OSLThreadData();
|
||||
|
||||
memset(&tdata->globals, 0, sizeof(OSL::ShaderGlobals));
|
||||
tdata->globals.tracedata = &tdata->tracedata;
|
||||
tdata->globals.flipHandedness = false;
|
||||
tdata->thread_info = ss->create_thread_info();
|
||||
|
||||
for(int i = 0; i < SHADER_CONTEXT_NUM; i++)
|
||||
tdata->context[i] = ss->get_context(tdata->thread_info);
|
||||
|
||||
kg->osl_ss = (OSLShadingSystem*)ss;
|
||||
kg->osl_tdata = tdata;
|
||||
}
|
||||
@@ -65,6 +70,9 @@ void OSLShader::thread_free(KernelGlobals *kg)
|
||||
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
|
||||
OSLThreadData *tdata = kg->osl_tdata;
|
||||
|
||||
for(int i = 0; i < SHADER_CONTEXT_NUM; i++)
|
||||
ss->release_context(tdata->context[i]);
|
||||
|
||||
ss->destroy_thread_info(tdata->thread_info);
|
||||
|
||||
delete tdata;
|
||||
@@ -77,8 +85,10 @@ void OSLShader::thread_free(KernelGlobals *kg)
|
||||
/* Globals */
|
||||
|
||||
static void shaderdata_to_shaderglobals(KernelGlobals *kg, ShaderData *sd,
|
||||
int path_flag, OSL::ShaderGlobals *globals)
|
||||
int path_flag, OSLThreadData *tdata)
|
||||
{
|
||||
OSL::ShaderGlobals *globals = &tdata->globals;
|
||||
|
||||
/* copy from shader data to shader globals */
|
||||
globals->P = TO_VEC3(sd->P);
|
||||
globals->dPdx = TO_VEC3(sd->dP.dx);
|
||||
@@ -100,15 +110,11 @@ static void shaderdata_to_shaderglobals(KernelGlobals *kg, ShaderData *sd,
|
||||
globals->time = sd->time;
|
||||
|
||||
/* booleans */
|
||||
globals->raytype = path_flag; /* todo: add our own ray types */
|
||||
globals->raytype = path_flag;
|
||||
globals->backfacing = (sd->flag & SD_BACKFACING);
|
||||
|
||||
/* don't know yet if we need this */
|
||||
globals->flipHandedness = false;
|
||||
|
||||
/* shader data to be used in services callbacks */
|
||||
globals->renderstate = sd;
|
||||
globals->tracedata = NULL;
|
||||
|
||||
/* hacky, we leave it to services to fetch actual object matrix */
|
||||
globals->shader2common = sd;
|
||||
@@ -116,6 +122,9 @@ static void shaderdata_to_shaderglobals(KernelGlobals *kg, ShaderData *sd,
|
||||
|
||||
/* must be set to NULL before execute */
|
||||
globals->Ci = NULL;
|
||||
|
||||
/* clear trace data */
|
||||
tdata->tracedata.init = false;
|
||||
}
|
||||
|
||||
/* Surface */
|
||||
@@ -132,14 +141,10 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
|
||||
|
||||
if (prim) {
|
||||
ShaderClosure sc;
|
||||
sc.prim = prim;
|
||||
sc.weight = weight;
|
||||
|
||||
switch (prim->category()) {
|
||||
case OSL::ClosurePrimitive::BSDF: {
|
||||
if (sd->num_closure == MAX_CLOSURE)
|
||||
return;
|
||||
|
||||
CBSDFClosure *bsdf = (CBSDFClosure *)prim;
|
||||
int scattering = bsdf->scattering();
|
||||
|
||||
@@ -151,8 +156,13 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
|
||||
float sample_weight = fabsf(average(weight));
|
||||
|
||||
sc.sample_weight = sample_weight;
|
||||
sc.type = bsdf->shaderclosure_type();
|
||||
sc.N = bsdf->sc.N; /* needed for AO */
|
||||
|
||||
sc.type = bsdf->sc.type;
|
||||
sc.N = bsdf->sc.N;
|
||||
sc.T = bsdf->sc.T;
|
||||
sc.data0 = bsdf->sc.data0;
|
||||
sc.data1 = bsdf->sc.data1;
|
||||
sc.prim = bsdf->sc.prim;
|
||||
|
||||
/* add */
|
||||
if(sc.sample_weight > 1e-5f && sd->num_closure < MAX_CLOSURE) {
|
||||
@@ -162,14 +172,12 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
|
||||
break;
|
||||
}
|
||||
case OSL::ClosurePrimitive::Emissive: {
|
||||
if (sd->num_closure == MAX_CLOSURE)
|
||||
return;
|
||||
|
||||
/* sample weight */
|
||||
float sample_weight = fabsf(average(weight));
|
||||
|
||||
sc.sample_weight = sample_weight;
|
||||
sc.type = CLOSURE_EMISSION_ID;
|
||||
sc.prim = NULL;
|
||||
|
||||
/* flag */
|
||||
if(sd->num_closure < MAX_CLOSURE) {
|
||||
@@ -179,14 +187,12 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
|
||||
break;
|
||||
}
|
||||
case AmbientOcclusion: {
|
||||
if (sd->num_closure == MAX_CLOSURE)
|
||||
return;
|
||||
|
||||
/* sample weight */
|
||||
float sample_weight = fabsf(average(weight));
|
||||
|
||||
sc.sample_weight = sample_weight;
|
||||
sc.type = CLOSURE_AMBIENT_OCCLUSION_ID;
|
||||
sc.prim = NULL;
|
||||
|
||||
if(sd->num_closure < MAX_CLOSURE) {
|
||||
sd->closure[sd->num_closure++] = sc;
|
||||
@@ -195,11 +201,9 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
|
||||
break;
|
||||
}
|
||||
case OSL::ClosurePrimitive::Holdout:
|
||||
if (sd->num_closure == MAX_CLOSURE)
|
||||
return;
|
||||
|
||||
sc.sample_weight = 0.0f;
|
||||
sc.type = CLOSURE_HOLDOUT_ID;
|
||||
sc.prim = NULL;
|
||||
|
||||
if(sd->num_closure < MAX_CLOSURE) {
|
||||
sd->closure[sd->num_closure++] = sc;
|
||||
@@ -226,26 +230,20 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
|
||||
}
|
||||
}
|
||||
|
||||
void OSLShader::eval_surface(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag)
|
||||
void OSLShader::eval_surface(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag, ShaderContext ctx)
|
||||
{
|
||||
/* gather pointers */
|
||||
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
|
||||
OSLThreadData *tdata = kg->osl_tdata;
|
||||
OSL::ShaderGlobals *globals = &tdata->globals;
|
||||
OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
|
||||
|
||||
/* setup shader globals from shader data */
|
||||
shaderdata_to_shaderglobals(kg, sd, path_flag, globals);
|
||||
OSLThreadData *tdata = kg->osl_tdata;
|
||||
shaderdata_to_shaderglobals(kg, sd, path_flag, tdata);
|
||||
|
||||
/* execute shader for this point */
|
||||
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
|
||||
OSL::ShaderGlobals *globals = &tdata->globals;
|
||||
OSL::ShadingContext *octx = tdata->context[(int)ctx];
|
||||
int shader = sd->shader & SHADER_MASK;
|
||||
|
||||
if (kg->osl->surface_state[shader])
|
||||
ss->execute(*ctx, *(kg->osl->surface_state[shader]), *globals);
|
||||
|
||||
/* free trace data */
|
||||
if(globals->tracedata)
|
||||
delete (OSLRenderServices::TraceData*)globals->tracedata;
|
||||
ss->execute(*octx, *(kg->osl->surface_state[shader]), *globals);
|
||||
|
||||
/* flatten closure tree */
|
||||
sd->num_closure = 0;
|
||||
@@ -287,24 +285,19 @@ static float3 flatten_background_closure_tree(const OSL::ClosureColor *closure)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
float3 OSLShader::eval_background(KernelGlobals *kg, ShaderData *sd, int path_flag)
|
||||
float3 OSLShader::eval_background(KernelGlobals *kg, ShaderData *sd, int path_flag, ShaderContext ctx)
|
||||
{
|
||||
/* gather pointers */
|
||||
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
|
||||
OSLThreadData *tdata = kg->osl_tdata;
|
||||
OSL::ShaderGlobals *globals = &tdata->globals;
|
||||
OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
|
||||
|
||||
/* setup shader globals from shader data */
|
||||
shaderdata_to_shaderglobals(kg, sd, path_flag, globals);
|
||||
OSLThreadData *tdata = kg->osl_tdata;
|
||||
shaderdata_to_shaderglobals(kg, sd, path_flag, tdata);
|
||||
|
||||
/* execute shader for this point */
|
||||
if (kg->osl->background_state)
|
||||
ss->execute(*ctx, *(kg->osl->background_state), *globals);
|
||||
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
|
||||
OSL::ShaderGlobals *globals = &tdata->globals;
|
||||
OSL::ShadingContext *octx = tdata->context[(int)ctx];
|
||||
|
||||
/* free trace data */
|
||||
if(globals->tracedata)
|
||||
delete (OSLRenderServices::TraceData*)globals->tracedata;
|
||||
if (kg->osl->background_state)
|
||||
ss->execute(*octx, *(kg->osl->background_state), *globals);
|
||||
|
||||
/* return background color immediately */
|
||||
if (globals->Ci)
|
||||
@@ -327,19 +320,16 @@ static void flatten_volume_closure_tree(ShaderData *sd,
|
||||
|
||||
if (prim) {
|
||||
ShaderClosure sc;
|
||||
sc.prim = prim;
|
||||
sc.weight = weight;
|
||||
|
||||
switch (prim->category()) {
|
||||
case OSL::ClosurePrimitive::Volume: {
|
||||
if (sd->num_closure == MAX_CLOSURE)
|
||||
return;
|
||||
|
||||
/* sample weight */
|
||||
float sample_weight = fabsf(average(weight));
|
||||
|
||||
sc.sample_weight = sample_weight;
|
||||
sc.type = CLOSURE_VOLUME_ID;
|
||||
sc.prim = NULL;
|
||||
|
||||
/* add */
|
||||
if(sc.sample_weight > 1e-5f && sd->num_closure < MAX_CLOSURE)
|
||||
@@ -368,26 +358,20 @@ static void flatten_volume_closure_tree(ShaderData *sd,
|
||||
}
|
||||
}
|
||||
|
||||
void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag)
|
||||
void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag, ShaderContext ctx)
|
||||
{
|
||||
/* gather pointers */
|
||||
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
|
||||
OSLThreadData *tdata = kg->osl_tdata;
|
||||
OSL::ShaderGlobals *globals = &tdata->globals;
|
||||
OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
|
||||
|
||||
/* setup shader globals from shader data */
|
||||
shaderdata_to_shaderglobals(kg, sd, path_flag, globals);
|
||||
OSLThreadData *tdata = kg->osl_tdata;
|
||||
shaderdata_to_shaderglobals(kg, sd, path_flag, tdata);
|
||||
|
||||
/* execute shader */
|
||||
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
|
||||
OSL::ShaderGlobals *globals = &tdata->globals;
|
||||
OSL::ShadingContext *octx = tdata->context[(int)ctx];
|
||||
int shader = sd->shader & SHADER_MASK;
|
||||
|
||||
if (kg->osl->volume_state[shader])
|
||||
ss->execute(*ctx, *(kg->osl->volume_state[shader]), *globals);
|
||||
|
||||
/* free trace data */
|
||||
if(globals->tracedata)
|
||||
delete (OSLRenderServices::TraceData*)globals->tracedata;
|
||||
ss->execute(*octx, *(kg->osl->volume_state[shader]), *globals);
|
||||
|
||||
if (globals->Ci)
|
||||
flatten_volume_closure_tree(sd, globals->Ci);
|
||||
@@ -395,46 +379,25 @@ void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int
|
||||
|
||||
/* Displacement */
|
||||
|
||||
void OSLShader::eval_displacement(KernelGlobals *kg, ShaderData *sd)
|
||||
void OSLShader::eval_displacement(KernelGlobals *kg, ShaderData *sd, ShaderContext ctx)
|
||||
{
|
||||
/* gather pointers */
|
||||
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
|
||||
OSLThreadData *tdata = kg->osl_tdata;
|
||||
OSL::ShaderGlobals *globals = &tdata->globals;
|
||||
OSL::ShadingContext *ctx = (OSL::ShadingContext *)sd->osl_ctx;
|
||||
|
||||
/* setup shader globals from shader data */
|
||||
shaderdata_to_shaderglobals(kg, sd, 0, globals);
|
||||
OSLThreadData *tdata = kg->osl_tdata;
|
||||
shaderdata_to_shaderglobals(kg, sd, 0, tdata);
|
||||
|
||||
/* execute shader */
|
||||
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
|
||||
OSL::ShaderGlobals *globals = &tdata->globals;
|
||||
OSL::ShadingContext *octx = tdata->context[(int)ctx];
|
||||
int shader = sd->shader & SHADER_MASK;
|
||||
|
||||
if (kg->osl->displacement_state[shader])
|
||||
ss->execute(*ctx, *(kg->osl->displacement_state[shader]), *globals);
|
||||
|
||||
/* free trace data */
|
||||
if(globals->tracedata)
|
||||
delete (OSLRenderServices::TraceData*)globals->tracedata;
|
||||
ss->execute(*octx, *(kg->osl->displacement_state[shader]), *globals);
|
||||
|
||||
/* get back position */
|
||||
sd->P = TO_FLOAT3(globals->P);
|
||||
}
|
||||
|
||||
void OSLShader::init(KernelGlobals *kg, ShaderData *sd)
|
||||
{
|
||||
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
|
||||
OSLThreadData *tdata = kg->osl_tdata;
|
||||
|
||||
sd->osl_ctx = ss->get_context(tdata->thread_info);
|
||||
}
|
||||
|
||||
void OSLShader::release(KernelGlobals *kg, ShaderData *sd)
|
||||
{
|
||||
OSL::ShadingSystem *ss = (OSL::ShadingSystem*)kg->osl_ss;
|
||||
|
||||
ss->release_context((OSL::ShadingContext *)sd->osl_ctx);
|
||||
}
|
||||
|
||||
/* BSDF Closure */
|
||||
|
||||
int OSLShader::bsdf_sample(const ShaderData *sd, const ShaderClosure *sc, float randu, float randv, float3& eval, float3& omega_in, differential3& domega_in, float& pdf)
|
||||
|
@@ -55,10 +55,10 @@ public:
|
||||
static void thread_free(KernelGlobals *kg);
|
||||
|
||||
/* eval */
|
||||
static void eval_surface(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag);
|
||||
static float3 eval_background(KernelGlobals *kg, ShaderData *sd, int path_flag);
|
||||
static void eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag);
|
||||
static void eval_displacement(KernelGlobals *kg, ShaderData *sd);
|
||||
static void eval_surface(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag, ShaderContext ctx);
|
||||
static float3 eval_background(KernelGlobals *kg, ShaderData *sd, int path_flag, ShaderContext ctx);
|
||||
static void eval_volume(KernelGlobals *kg, ShaderData *sd, float randb, int path_flag, ShaderContext ctx);
|
||||
static void eval_displacement(KernelGlobals *kg, ShaderData *sd, ShaderContext ctx);
|
||||
|
||||
/* sample & eval */
|
||||
static int bsdf_sample(const ShaderData *sd, const ShaderClosure *sc,
|
||||
@@ -73,10 +73,6 @@ public:
|
||||
static float3 volume_eval_phase(const ShaderClosure *sc,
|
||||
const float3 omega_in, const float3 omega_out);
|
||||
|
||||
/* release */
|
||||
static void init(KernelGlobals *kg, ShaderData *sd);
|
||||
static void release(KernelGlobals *kg, ShaderData *sd);
|
||||
|
||||
/* attributes */
|
||||
static int find_attribute(KernelGlobals *kg, const ShaderData *sd, uint id);
|
||||
};
|
||||
|
@@ -49,6 +49,7 @@ set(SRC_OSL
|
||||
node_output_volume.osl
|
||||
node_particle_info.osl
|
||||
node_refraction_bsdf.osl
|
||||
node_rgb_curves.osl
|
||||
node_rgb_ramp.osl
|
||||
node_separate_rgb.osl
|
||||
node_set_normal.osl
|
||||
@@ -58,6 +59,7 @@ set(SRC_OSL
|
||||
node_translucent_bsdf.osl
|
||||
node_transparent_bsdf.osl
|
||||
node_value.osl
|
||||
node_vector_curves.osl
|
||||
node_vector_math.osl
|
||||
node_velvet_bsdf.osl
|
||||
node_voronoi_texture.osl
|
||||
|
@@ -1,4 +1,30 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# 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 2
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Original Code is Copyright (C) 2011, Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): Nathan Letwory.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
import sys
|
||||
import os
|
||||
import Blender as B
|
||||
|
@@ -19,9 +19,9 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_add_closure(
|
||||
closure color Closure1 = background(),
|
||||
closure color Closure2 = background(),
|
||||
output closure color Closure = background())
|
||||
closure color Closure1 = 0,
|
||||
closure color Closure2 = 0,
|
||||
output closure color Closure = 0)
|
||||
{
|
||||
Closure = Closure1 + Closure2;
|
||||
}
|
||||
|
@@ -20,8 +20,8 @@
|
||||
|
||||
shader node_ambient_occlusion(
|
||||
normal NormalIn = N,
|
||||
color Color = color(0.8, 0.8, 0.8),
|
||||
output closure color AO = ambient_occlusion())
|
||||
color Color = 0.8,
|
||||
output closure color AO = 0)
|
||||
{
|
||||
AO = Color * ambient_occlusion();
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ shader node_attribute(
|
||||
string bump_offset = "center",
|
||||
string name = "",
|
||||
output point Vector = point(0.0, 0.0, 0.0),
|
||||
output color Color = color(0.0, 0.0, 0.0),
|
||||
output color Color = 0.0,
|
||||
output float Fac = 0.0)
|
||||
{
|
||||
getattribute(name, Color);
|
||||
|
@@ -19,9 +19,9 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_background(
|
||||
color Color = color(0.8, 0.8, 0.8),
|
||||
color Color = 0.8,
|
||||
float Strength = 1.0,
|
||||
output closure color Background = background())
|
||||
output closure color Background = 0)
|
||||
{
|
||||
Background = Color * Strength * background();
|
||||
}
|
||||
|
@@ -65,16 +65,16 @@ shader node_brick_texture(
|
||||
float Squash = 1.0,
|
||||
int SquashFrequency = 1,
|
||||
point Vector = P,
|
||||
color Color1 = color(0.2, 0.2, 0.2),
|
||||
color Color2 = color(0.8, 0.8, 0.8),
|
||||
color Mortar = color(0.0, 0.0, 0.0),
|
||||
color Color1 = 0.2,
|
||||
color Color2 = 0.8,
|
||||
color Mortar = 0.0,
|
||||
float Scale = 5.0,
|
||||
float MortarSize = 0.02,
|
||||
float Bias = 0.0,
|
||||
float BrickWidth = 0.5,
|
||||
float RowHeight = 0.25,
|
||||
output float Fac = 0.0,
|
||||
output color Color = color(0.2, 0.2, 0.2))
|
||||
output color Color = 0.2)
|
||||
{
|
||||
point p = Vector;
|
||||
|
||||
|
@@ -19,10 +19,10 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_brightness(
|
||||
color ColorIn = color(0.8, 0.8, 0.8),
|
||||
color ColorIn = 0.8,
|
||||
float Bright = 0.0,
|
||||
float Contrast = 0.0,
|
||||
output color ColorOut = color(0.8, 0.8, 0.8))
|
||||
output color ColorOut = 0.8)
|
||||
{
|
||||
float a = 1.0 + Contrast;
|
||||
float b = Bright - Contrast*0.5;
|
||||
|
@@ -44,10 +44,10 @@ shader node_checker_texture(
|
||||
matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||
float Scale = 5.0,
|
||||
point Vector = P,
|
||||
color Color1 = color(0.8, 0.8, 0.8),
|
||||
color Color2 = color(0.2, 0.2, 0.2),
|
||||
color Color1 = 0.8,
|
||||
color Color2 = 0.2,
|
||||
output float Fac = 0.0,
|
||||
output color Color = color(0.0, 0.0, 0.0))
|
||||
output color Color = 0.0)
|
||||
{
|
||||
point p = Vector;
|
||||
|
||||
|
@@ -22,7 +22,7 @@ shader node_combine_rgb(
|
||||
float R = 0.0,
|
||||
float G = 0.0,
|
||||
float B = 0.0,
|
||||
output color Image = color(0.8, 0.8, 0.8))
|
||||
output color Image = 0.8)
|
||||
{
|
||||
Image = color(R, G, B);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_convert_from_color(
|
||||
color Color = color(0.0, 0.0, 0.0),
|
||||
color Color = 0.0,
|
||||
output string String = "",
|
||||
output float Val = 0.0,
|
||||
output int ValInt = 0,
|
||||
|
@@ -22,7 +22,7 @@ shader node_convert_from_float(
|
||||
float Val = 0.0,
|
||||
output string String = "",
|
||||
output int ValInt = 0,
|
||||
output color Color = color(0.0, 0.0, 0.0),
|
||||
output color Color = 0.0,
|
||||
output vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output point Point = point(0.0, 0.0, 0.0),
|
||||
output normal Normal = normal(0.0, 0.0, 0.0))
|
||||
|
@@ -22,7 +22,7 @@ shader node_convert_from_int(
|
||||
int ValInt = 0,
|
||||
output string String = "",
|
||||
output float Val = 0.0,
|
||||
output color Color = color(0.0, 0.0, 0.0),
|
||||
output color Color = 0.0,
|
||||
output vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output point Point = point(0.0, 0.0, 0.0),
|
||||
output normal Normal = normal(0.0, 0.0, 0.0))
|
||||
|
@@ -24,7 +24,7 @@ shader node_convert_from_normal(
|
||||
output float Val = 0.0,
|
||||
output int ValInt = 0,
|
||||
output vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output color Color = color(0.0, 0.0, 0.0),
|
||||
output color Color = 0.0,
|
||||
output point Point = point(0.0, 0.0, 0.0))
|
||||
{
|
||||
Val = (Normal[0] + Normal[1] + Normal[2]) * (1.0 / 3.0);
|
||||
|
@@ -24,7 +24,7 @@ shader node_convert_from_point(
|
||||
output float Val = 0.0,
|
||||
output int ValInt = 0,
|
||||
output vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output color Color = color(0.0, 0.0, 0.0),
|
||||
output color Color = 0.0,
|
||||
output normal Normal = normal(0.0, 0.0, 0.0))
|
||||
{
|
||||
Val = (Point[0] + Point[1] + Point[2]) * (1.0 / 3.0);
|
||||
|
@@ -19,10 +19,10 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_diffuse_bsdf(
|
||||
color Color = color(0.8, 0.8, 0.8),
|
||||
color Color = 0.8,
|
||||
float Roughness = 0.0,
|
||||
normal Normal = N,
|
||||
output closure color BSDF = diffuse(Normal))
|
||||
output closure color BSDF = 0)
|
||||
{
|
||||
if (Roughness == 0.0)
|
||||
BSDF = Color * diffuse(Normal);
|
||||
|
@@ -20,9 +20,9 @@
|
||||
|
||||
shader node_emission(
|
||||
int TotalPower = 0,
|
||||
color Color = color(0.8, 0.8, 0.8),
|
||||
color Color = 0.8,
|
||||
float Strength = 1.0,
|
||||
output closure color Emission = emission())
|
||||
output closure color Emission = 0)
|
||||
{
|
||||
if (TotalPower)
|
||||
Emission = ((Strength / surfacearea()) * Color) * emission();
|
||||
|
@@ -48,7 +48,7 @@ shader node_environment_texture(
|
||||
string filename = "",
|
||||
string projection = "Equirectangular",
|
||||
string color_space = "sRGB",
|
||||
output color Color = color(0.0, 0.0, 0.0),
|
||||
output color Color = 0.0,
|
||||
output float Alpha = 1.0)
|
||||
{
|
||||
vector p = Vector;
|
||||
|
@@ -19,9 +19,9 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_gamma(
|
||||
color ColorIn = color(0.8, 0.8, 0.8),
|
||||
color ColorIn = 0.8,
|
||||
float Gamma = 1.0,
|
||||
output color ColorOut = color(0.0, 0.0, 0.0))
|
||||
output color ColorOut = 0.0)
|
||||
{
|
||||
ColorOut = pow(ColorIn, Gamma);
|
||||
}
|
||||
|
@@ -56,8 +56,7 @@ shader node_geometry(
|
||||
0.0, 0.0, 0.0, 0.0,
|
||||
0.5, -0.5, 0.0, 1.0);
|
||||
|
||||
vector T = transform(project, generated);
|
||||
T = transform("object", "world", T);
|
||||
vector T = transform("object", "world", transform(project, generated));
|
||||
Tangent = cross(Normal, normalize(cross(T, Normal)));
|
||||
}
|
||||
else {
|
||||
|
@@ -20,12 +20,12 @@
|
||||
#include "node_fresnel.h"
|
||||
|
||||
shader node_glass_bsdf(
|
||||
color Color = color(0.8, 0.8, 0.8),
|
||||
color Color = 0.8,
|
||||
string distribution = "Sharp",
|
||||
float Roughness = 0.2,
|
||||
float IOR = 1.45,
|
||||
normal Normal = N,
|
||||
output closure color BSDF = diffuse(Normal))
|
||||
output closure color BSDF = 0)
|
||||
{
|
||||
float f = max(IOR, 1.0 + 1e-5);
|
||||
float eta = backfacing() ? 1.0 / f: f;
|
||||
|
@@ -20,11 +20,11 @@
|
||||
#include "node_fresnel.h"
|
||||
|
||||
shader node_glossy_bsdf(
|
||||
color Color = color(0.8, 0.8, 0.8),
|
||||
color Color = 0.8,
|
||||
string distribution = "Beckmann",
|
||||
float Roughness = 0.2,
|
||||
normal Normal = N,
|
||||
output closure color BSDF = diffuse(Normal))
|
||||
output closure color BSDF = 0)
|
||||
{
|
||||
if (distribution == "Sharp")
|
||||
BSDF = Color * reflection(Normal);
|
||||
|
@@ -68,7 +68,7 @@ shader node_gradient_texture(
|
||||
string Type = "Linear",
|
||||
point Vector = P,
|
||||
output float Fac = 0.0,
|
||||
output color Color = color(0.0, 0.0, 0.0))
|
||||
output color Color = 0.0)
|
||||
{
|
||||
point p = Vector;
|
||||
|
||||
|
@@ -24,8 +24,8 @@ shader node_hsv(
|
||||
float Saturation = 1.0,
|
||||
float Value = 1.0,
|
||||
float Fac = 0.5,
|
||||
color ColorIn = color(0.0, 0.0, 0.0),
|
||||
output color ColorOut = color(0.0, 0.0, 0.0))
|
||||
color ColorIn = 0.0,
|
||||
output color ColorOut = 0.0)
|
||||
{
|
||||
color Color = rgb_to_hsv(ColorIn);
|
||||
|
||||
|
@@ -37,7 +37,7 @@ shader node_image_texture(
|
||||
string color_space = "sRGB",
|
||||
string projection = "Flat",
|
||||
float projection_blend = 0.0,
|
||||
output color Color = color(0.0, 0.0, 0.0),
|
||||
output color Color = 0.0,
|
||||
output float Alpha = 1.0)
|
||||
{
|
||||
point p = Vector;
|
||||
|
@@ -20,8 +20,8 @@
|
||||
|
||||
shader node_invert(
|
||||
float Fac = 1.0,
|
||||
color ColorIn = color(0.8, 0.8, 0.8),
|
||||
output color ColorOut = color(0.8, 0.8, 0.8))
|
||||
color ColorIn = 0.8,
|
||||
output color ColorOut = 0.8)
|
||||
{
|
||||
color ColorInv = color(1.0) - ColorIn;
|
||||
ColorOut = mix(ColorIn, ColorInv, Fac);
|
||||
|
@@ -99,7 +99,7 @@ shader node_magic_texture(
|
||||
float Distortion = 5.0,
|
||||
float Scale = 5.0,
|
||||
point Vector = P,
|
||||
output color Color = color(0.0, 0.0, 0.0))
|
||||
output color Color = 0.0)
|
||||
{
|
||||
point p = Vector;
|
||||
|
||||
|
@@ -28,9 +28,8 @@ shader node_mapping(
|
||||
{
|
||||
point p = transform(Matrix, VectorIn);
|
||||
|
||||
if(use_minmax)
|
||||
if (use_minmax)
|
||||
p = min(max(mapping_min, p), mapping_max);
|
||||
|
||||
VectorOut = p;
|
||||
}
|
||||
|
||||
|
@@ -282,9 +282,9 @@ shader node_mix(
|
||||
string type = "Mix",
|
||||
int Clamp = 0,
|
||||
float Fac = 0.5,
|
||||
color Color1 = color(0.0, 0.0, 0.0),
|
||||
color Color2 = color(0.0, 0.0, 0.0),
|
||||
output color Color = color(0.0, 0.0, 0.0))
|
||||
color Color1 = 0.0,
|
||||
color Color2 = 0.0,
|
||||
output color Color = 0.0)
|
||||
{
|
||||
float t = clamp(Fac, 0.0, 1.0);
|
||||
|
||||
|
@@ -20,9 +20,9 @@
|
||||
|
||||
shader node_mix_closure(
|
||||
float Fac = 0.5,
|
||||
closure color Closure1 = background(),
|
||||
closure color Closure2 = background(),
|
||||
output closure color Closure = background())
|
||||
closure color Closure1 = 0,
|
||||
closure color Closure2 = 0,
|
||||
output closure color Closure = 0)
|
||||
{
|
||||
float t = clamp(Fac, 0.0, 1.0);
|
||||
Closure = (1.0 - t) * Closure1 + t * Closure2;
|
||||
|
@@ -198,7 +198,7 @@ shader node_musgrave_texture(
|
||||
float Scale = 5.0,
|
||||
point Vector = P,
|
||||
output float Fac = 0.0,
|
||||
output color Color = color(0.0, 0.0, 0.0))
|
||||
output color Color = 0.0)
|
||||
{
|
||||
float dimension = max(Dimension, 1e-5);
|
||||
float octaves = clamp(Detail, 0.0, 16.0);
|
||||
|
@@ -50,7 +50,7 @@ shader node_noise_texture(
|
||||
float Detail = 2.0,
|
||||
point Vector = P,
|
||||
output float Fac = 0.0,
|
||||
output color Color = color(0.2, 0.2, 0.2))
|
||||
output color Color = 0.0)
|
||||
{
|
||||
point p = Vector;
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "stdosl.h"
|
||||
|
||||
surface node_output_surface(closure color Surface = background())
|
||||
surface node_output_surface(closure color Surface = 0)
|
||||
{
|
||||
Ci = Surface;
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "stdosl.h"
|
||||
|
||||
volume node_output_volume(closure color Volume = background())
|
||||
volume node_output_volume(closure color Volume = 0)
|
||||
{
|
||||
Ci = Volume;
|
||||
}
|
||||
|
@@ -19,12 +19,12 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_refraction_bsdf(
|
||||
color Color = color(0.8, 0.8, 0.8),
|
||||
color Color = 0.8,
|
||||
string distribution = "Sharp",
|
||||
float Roughness = 0.2,
|
||||
float IOR = 1.45,
|
||||
normal Normal = N,
|
||||
output closure color BSDF = diffuse(Normal))
|
||||
output closure color BSDF = 0)
|
||||
{
|
||||
float f = max(IOR, 1.0 + 1e-5);
|
||||
float eta = backfacing() ? 1.0 / f: f;
|
||||
|
53
intern/cycles/kernel/shaders/node_rgb_curves.osl
Normal file
53
intern/cycles/kernel/shaders/node_rgb_curves.osl
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* 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 2
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "stdosl.h"
|
||||
#include "oslutil.h"
|
||||
|
||||
float ramp_lookup(color ramp[RAMP_TABLE_SIZE], float at, int component)
|
||||
{
|
||||
float f = clamp(at, 0.0, 1.0) * (RAMP_TABLE_SIZE - 1);
|
||||
|
||||
/* clamp int as well in case of NaN */
|
||||
int i = (int)f;
|
||||
if (i < 0) i = 0;
|
||||
if (i >= RAMP_TABLE_SIZE) i = RAMP_TABLE_SIZE - 1;
|
||||
float t = f - (float)i;
|
||||
|
||||
float result = ramp[i][component];
|
||||
|
||||
if (t > 0.0)
|
||||
result = (1.0 - t) * result + t * ramp[i + 1][component];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
shader node_rgb_curves(
|
||||
color ramp[RAMP_TABLE_SIZE] = {0.0},
|
||||
|
||||
color ColorIn = 0.0,
|
||||
float Fac = 0.0,
|
||||
output color ColorOut = 0.0)
|
||||
{
|
||||
ColorOut[0] = ramp_lookup(ramp, ColorIn[0], 0);
|
||||
ColorOut[1] = ramp_lookup(ramp, ColorIn[1], 1);
|
||||
ColorOut[2] = ramp_lookup(ramp, ColorIn[2], 2);
|
||||
|
||||
ColorOut = mix(ColorIn, ColorOut, Fac);
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ shader node_rgb_ramp(
|
||||
float ramp_alpha[RAMP_TABLE_SIZE] = {0.0},
|
||||
|
||||
float Fac = 0.0,
|
||||
output color Color = color(0.0, 0.0, 0.0),
|
||||
output color Color = 0.0,
|
||||
output float Alpha = 1.0)
|
||||
{
|
||||
float f = clamp(Fac, 0.0, 1.0) * (RAMP_TABLE_SIZE - 1);
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_separate_rgb(
|
||||
color Image = color(0.8, 0.8, 0.8),
|
||||
color Image = 0.8,
|
||||
output float R = 0.0,
|
||||
output float G = 0.0,
|
||||
output float B = 0.0)
|
||||
|
@@ -154,7 +154,7 @@ shader node_sky_texture(
|
||||
vector Vector = P,
|
||||
vector sun_direction = vector(0, 0, 1),
|
||||
float turbidity = 2.2,
|
||||
output color Color = color(0.0, 0.0, 0.0))
|
||||
output color Color = 0.0)
|
||||
{
|
||||
vector p = Vector;
|
||||
|
||||
|
@@ -19,9 +19,9 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_translucent_bsdf(
|
||||
color Color = color(0.8, 0.8, 0.8),
|
||||
color Color = 0.8,
|
||||
normal Normal = N,
|
||||
output closure color BSDF = diffuse(Normal))
|
||||
output closure color BSDF = 0)
|
||||
{
|
||||
BSDF = Color * translucent(Normal);
|
||||
}
|
||||
|
@@ -19,9 +19,9 @@
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_transparent_bsdf(
|
||||
color Color = color(0.8, 0.8, 0.8),
|
||||
color Color = 0.8,
|
||||
normal Normal = N,
|
||||
output closure color BSDF = diffuse(Normal))
|
||||
output closure color BSDF = 0)
|
||||
{
|
||||
BSDF = Color * transparent();
|
||||
}
|
||||
|
@@ -21,10 +21,10 @@
|
||||
shader node_value(
|
||||
float value_value = 0.0,
|
||||
vector vector_value = vector(0.0, 0.0, 0.0),
|
||||
color color_value = color(0.0, 0.0, 0.0),
|
||||
color color_value = 0.0,
|
||||
output float Value = 0.0,
|
||||
output vector Vector = vector(0.0, 0.0, 0.0),
|
||||
output color Color = color(0.0, 0.0, 0.0))
|
||||
output color Color = 0.0)
|
||||
{
|
||||
Value = value_value;
|
||||
Vector = vector_value;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user