Skip to content

Commit

Permalink
GafferCycles 0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
boberfly committed Oct 17, 2019
1 parent b1db848 commit a1ee5d3
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 12 deletions.
20 changes: 14 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ add_compile_options("$<$<CONFIG:DEBUG>:-DWITH_CYCLES_DEBUG=1>")
set( WITH_CYCLES_STANDALONE_GUI OFF CACHE INTERNAL "" )
set( WITH_CYCLES_OSL ON CACHE INTERNAL "" )
#set( WITH_CYCLES_LOGGING ON CACHE INTERNAL "" )
set( WITH_CYCLES_OPENSUBDIV ON CACHE INTERNAL "" )
set( WITH_CYCLES_EMBREE ON CACHE INTERNAL "" )
#set( WITH_CYCLES_OPENSUBDIV ON CACHE INTERNAL "" )
#set( WITH_CYCLES_EMBREE ON CACHE INTERNAL "" )
set( OPENSUBDIV_ROOT_DIR ${CMAKE_INSTALL_PREFIX} CACHE INTERNAL "" )
#set( embree_DIR ${CMAKE_INSTALL_PREFIX} CACHE INTERNAL "" )
set( BOOST_ROOT ${GAFFER_ROOT} CACHE INTERNAL "" )
Expand All @@ -27,7 +27,6 @@ set( OSL_ROOT_DIR ${GAFFER_ROOT} CACHE INTERNAL "" )
set( OPENEXR_ROOT_DIR ${GAFFER_ROOT} CACHE INTERNAL "" )
set( WITH_CYCLES_CUDA_BINARIES ON CACHE INTERNAL "" )
set( WITH_OPENCOLORIO OFF CACHE INTERNAL "" )
set( WITH_CYCLES_LOGGING ON CACHE INTERNAL "" )
set( GLEW_ROOT_DIR ${GAFFER_ROOT} CACHE INTERNAL "" )
set( WITH_CYCLES_OPENVDB ON CACHE INTERNAL "" )
set( WITH_OPENVDB_BLOSC ON CACHE INTERNAL "" )
Expand Down Expand Up @@ -83,16 +82,25 @@ add_definitions(
# -DCCL_NAMESPACE_BEGIN=namespace\ IECoreCycles\ {\ namespace\ ccl\ {
# -DCCL_NAMESPACE_END=}\}
-DWITH_OSL=1
-DWITH_EMBREE=1
-DWITH_OPENSUBDIV=1
-DWITH_OPENCL=1
-DWITH_CUDA=1
-DWITH_MULTI=1
-DWITH_OPENVDB=1
-DWITH_OPENVDB_BLOSC=1
-DWITH_CYCLES_LOGGING=1
)

if( WITH_CYCLES_LOGGING )
add_definitions( -DWITH_CYCLES_LOGGING=1 )
endif()

if( WITH_CYCLES_OPENSUBDIV )
add_definitions( -DWITH_OPENSUBDIV=1 )
endif()

if( WITH_CYCLES_EMBREE )
add_definitions( -DWITH_EMBREE=1 )
endif()

if( WITH_CYCLES_DEVICE_OPTIX )
add_definitions( -DWITH_OPTIX=1 )
endif()
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ for the optional dependencies OpenSubdiv and Embree.
* Gaffer Install from GafferHQ
* (optional)OpenSubdiv
* (optional)Embree
* (optional)OptiX
* (optional)Gflags+Glog

**In a terminal (Linux):**
Check Optional dependency install down below for easy python scripts

**In a terminal (Linux/Ubuntu):**
```
export GAFFER_ROOT=<gaffer install path>
export GAFFERCYCLES=<install destination>
Expand All @@ -27,6 +31,21 @@ cmake -DCMAKE_CXX_COMPILER=g++-6 -DGAFFER_ROOT=$GAFFER_ROOT -DCMAKE_INSTALL_PREF
make install -j <num cores>
```

**Optional dependencies+install:**

Run this after cloning the git repo and before building
```
cd dependencies
python ./build/build.py --project Gflags --buildDir $GAFFERCYCLES --forceCCompiler gcc-6 --forceCxxCompiler g++-6
python ./build/build.py --project Glog --buildDir $GAFFERCYCLES --forceCCompiler gcc-6 --forceCxxCompiler g++-6
python ./build/build.py --project Embree --buildDir $GAFFERCYCLES --forceCCompiler gcc-6 --forceCxxCompiler g++-6
python ./build/build.py --project OpenSubdiv --buildDir $GAFFERCYCLES --forceCCompiler gcc-6 --forceCxxCompiler g++-6
cd ../build
cmake -DCMAKE_CXX_COMPILER=g++-6 -DGAFFER_ROOT=$GAFFER_ROOT -DCMAKE_INSTALL_PREFIX=$GAFFERCYCLES -DWITH_CYCLES_EMBREE=ON -DWITH_CYCLES_OPENSUBDIV=ON -DWITH_CYCLES_LOGGING=ON ..
make install -j <num cores>
```
For OptiX, it will need to be installed from Nvidia's website and ```-DWITH_CYCLES_DEVICE_OPTIX=ON -DOPTIX_ROOT_DIR=$OPTIX_ROOT``` added to the cmake line.

### Runtime Instructions

Add to Gaffer extensions path:
Expand Down
3 changes: 3 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ def releaseId() :
" -D CMAKE_CXX_COMPILER={cxx}"
" -D OPTIX_ROOT_DIR={optixPath}"
" -D WITH_CYCLES_DEVICE_OPTIX={withOptix}"
" -D WITH_CYCLES_EMBREE=ON"
" -D WITH_CYCLES_OPENSUBDIV=ON"
" -D WITH_CYCLES_LOGGING=ON"
" ../..".format( gafferCyclesRoot=gafferCyclesDirName, gafferRoot=gafferDirName, withOptix=withOptix, **formatVariables ),

"cd build/{platform}_{buildType} && cmake --build . --config {buildType} --target install -- -j {jobs}".format( jobs=multiprocessing.cpu_count(), **formatVariables ),
Expand Down
2 changes: 1 addition & 1 deletion build_docker.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

python build.py --version 0.9.0 --cyclesVersion 0.8.0 --docker 1 --upload 0 $@
python build.py --version 0.9.1 --cyclesVersion 0.9.1 --docker 1 --upload 0 $@
2 changes: 1 addition & 1 deletion build_docker_optix.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

python build.py --version 0.9.0 --cyclesVersion 0.8.0 --optix 1 --docker 1 --upload 0 $@
python build.py --version 0.9.1 --cyclesVersion 0.9.1 --optix 1 --docker 1 --upload 0 $@
6 changes: 4 additions & 2 deletions build_linux_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [[ -z "${GAFFER_ROOT}" ]]; then
fi

# Packaging variables
VERSION=0.7.0
VERSION=0.9.1
GAFFERVERSION=0.54.1.0

if [[ -z "${GAFFER_BUILD_TYPE}" ]]; then
Expand Down Expand Up @@ -43,14 +43,16 @@ export LD_LIBRARY_PATH=$GAFFER_ROOT/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH:-}
# Dependencies
cmake -E make_directory install/$GAFFERCYCLES
cd dependencies
$GAFFER_ROOT/bin/python ./build/build.py --project Gflags --buildDir $GAFFERCYCLES_INSTALL --forceCCompiler $CC --forceCxxCompiler $CXX
$GAFFER_ROOT/bin/python ./build/build.py --project Glog --buildDir $GAFFERCYCLES_INSTALL --forceCCompiler $CC --forceCxxCompiler $CXX
$GAFFER_ROOT/bin/python ./build/build.py --project Embree --buildDir $GAFFERCYCLES_INSTALL --forceCCompiler $CC --forceCxxCompiler $CXX
$GAFFER_ROOT/bin/python ./build/build.py --project OpenSubdiv --buildDir $GAFFERCYCLES_INSTALL --forceCCompiler $CC --forceCxxCompiler $CXX
cd ..

# CMake build
cmake -E make_directory build/$GAFFERCYCLES
cd build/$GAFFERCYCLES
cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DGAFFER_ROOT=$GAFFER_ROOT -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_INSTALL_PREFIX=$GAFFERCYCLES_INSTALL $@ ../..
cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DGAFFER_ROOT=$GAFFER_ROOT -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_INSTALL_PREFIX=$GAFFERCYCLES_INSTALL -DWITH_CYCLES_EMBREE=ON -DWITH_CYCLES_OPENSUBDIV=ON -DWITH_CYCLES_LOGGING=ON $@ ../..
make -j `getconf _NPROCESSORS_ONLN`
make install

Expand Down
2 changes: 1 addition & 1 deletion cycles
119 changes: 119 additions & 0 deletions python/GafferCyclesUI/CyclesMeshLightUI.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
##########################################################################
#
# Copyright (c) 2019, Alex Fuller. All rights reserved.
#
# 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 John Haddon nor the names of
# any other contributors to this software 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.
#
##########################################################################

import functools

import Gaffer
import GafferCycles

def __shaderMetadata( plug, name ) :

return Gaffer.Metadata.value( plug.node()["__shader"].descendant( plug.relativeName( plug.node() ) ), name )

Gaffer.Metadata.registerNode(

GafferCycles.CyclesMeshLight,

"description",
"""
Turns mesh primitives into Cycles mesh lights by assigning
an emission shader, turning off all visibility except for camera rays,
and adding the meshes to the default lights set.
""",

plugs = {

"cameraVisibility" : [

"description",
"""
Whether or not the mesh light is visible to camera
rays.
""",

],

"parameters" : [

"description",
"""
The parameters of the Cycles emission shader that
is applied to the meshes.
""",

## \todo Extend the Metadata API so we can register a provider for "*",
# which can automatically transfer all internal metadata.
"noduleLayout:section", functools.partial( __shaderMetadata, name = "noduleLayout:section" ),
"nodule:type", functools.partial( __shaderMetadata, name = "nodule:type" ),
"noduleLayout:spacing", functools.partial( __shaderMetadata, name = "noduleLayout:spacing" ),
"plugValueWidget:type", functools.partial( __shaderMetadata, name = "plugValueWidget:type" ),

],

"parameters.*" : [

"description",
"""
Refer to Cycles's documentation of the emission
shader.
""",

"nodule:type", functools.partial( __shaderMetadata, name = "nodule:type" ),
"noduleLayout:section", functools.partial( __shaderMetadata, name = "noduleLayout:section" ),
"nodule:color", functools.partial( __shaderMetadata, name = "nodule:color" ),
"plugValueWidget:type", functools.partial( __shaderMetadata, name = "plugValueWidget:type" ),
"presetNames", functools.partial( __shaderMetadata, name = "presetNames" ),
"presetValues", functools.partial( __shaderMetadata, name = "presetValues" ),

],

"defaultLight" : [

"description",
"""
Whether this light illuminates all geometry by default. When
toggled, the light will be added to the \"defaultLights\" set, which
can be referenced in set expressions and manipulated by downstream
nodes.
""",

"layout:section", "Light Linking",

]

}

)

0 comments on commit a1ee5d3

Please sign in to comment.