Skip to content

Commit

Permalink
Housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHanke committed Jul 9, 2023
1 parent ada6331 commit 7c072ac
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 53 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,14 @@

bin
.vscode
CryptomatteArnold/dist/1.2.3/ai/ae/alShaders.py
CryptomatteArnold/dist/1.2.3/ai/ae/cryptomatteTemplate.py
CryptomatteArnold/dist/1.2.3/ai/aexml/AEcryptomatteTemplate.xml
CryptomatteArnold/dist/1.2.3/ai/aexml/NEcryptomatteTemplate.xml
CryptomatteArnold/dist/1.2.3/ai/Args/cryptomatte.args
CryptomatteArnold/dist/1.2.3/ai/C4DtoA/res/description/ainode_cryptomatte.h
CryptomatteArnold/dist/1.2.3/ai/C4DtoA/res/description/ainode_cryptomatte.res
CryptomatteArnold/dist/1.2.3/ai/C4DtoA/res/strings_us/description/ainode_cryptomatte.str
CryptomatteArnold/dist/1.2.3/ai/INSTALL
CryptomatteArnold/dist/1.2.3/ai/README
CryptomatteArnold/dist/1.2.3/ai/spdl/cryptomatte.spdl
16 changes: 5 additions & 11 deletions pota/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ add_definitions(-DCM_VERSION="${CM_VERSION}")

# Compiler flags
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# Disable some of the bullshit warnings MSVC wants to barf
# Disable some MSVC warnings
add_definitions( "-W3 -D_CRT_SECURE_NO_WARNINGS -wd4005 -wd4996 -wd4305 -wd4244 -nologo" )
else()
# Statically link stdc++ to avoid GLILBC version clashes
Expand All @@ -29,15 +29,14 @@ else()
set(CMAKE_CXX_FLAGS_DEBUG "-g")
endif()

# check if we have a local cmake include file and include it if we do
# this is useful for setting our arnold location as an alternative to
# environment variables
# Check if we have a local cmake include file and include it if we do
# This is useful for setting our Arnold location as an alternative to environment variables
if(EXISTS ${CMAKE_SOURCE_DIR}/local.cmake)
message(STATUS "Using local.cmake")
include(${CMAKE_SOURCE_DIR}/local.cmake)
endif()

# Find Arnold SDK
# Find the Arnold SDK
find_package(Arnold REQUIRED)
include_directories(${ARNOLD_INCLUDE_DIR})
link_directories(${ARNOLD_LIBRARY_DIR})
Expand Down Expand Up @@ -67,15 +66,12 @@ set(SPDL_INSTALL_DIR ${INSTALL_DIR}/spdl)
set(ARGS_INSTALL_DIR ${INSTALL_DIR}/Args)
set(SCENES_INSTALL_DIR ${INSTALL_DIR})

# file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/docs)

message("Shader binaries will be installed to:\n\t${DSO_INSTALL_DIR}")
message("Shader MTD will be installed to: \n\t${MTD_INSTALL_DIR}")
message("AETemplates will be installed to: \n\t${AE_INSTALL_DIR}")
message("SPDL will be installed to: \n\t${SPDL_INSTALL_DIR}")
message("Katana Args will be installed to: \n\t${ARGS_INSTALL_DIR}")


# Include common files
include_directories(${CMAKE_SOURCE_DIR})

Expand All @@ -89,7 +85,5 @@ foreach(SUBDIR ${SUBDIRECTORIES})
add_subdirectory(${SUBDIR})
endforeach()


# add top-level files
INSTALL(FILES DESTINATION ${INSTALL_DIR})

INSTALL(FILES DESTINATION ${INSTALL_DIR})
7 changes: 3 additions & 4 deletions pota/cmake/FindArnold.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ if (NOT DEFINED ARNOLD_VERSION)
endif()
endif()

# if local.cmake hasn't defined it already...
# If local.cmake hasn't defined it already
if (NOT DEFINED ARNOLD_ROOT)
# if the environment variable isn't set...
# If the environment variable isn't set
if (NOT DEFINED ENV{ARNOLD_ROOT})
message(FATAL_ERROR "Could not find Arnold SDK. Please set ARNOLD_ROOT to point to the root directory of the Arnold SDK. This is the directory containing bin, include etc. Either add a set() statement to a local.cmake file in the source directory, or define it as an environment variable prior to building.")
endif()
Expand All @@ -29,7 +29,7 @@ set(ARNOLD_INCLUDE_DIR ${ARNOLD_ROOT}/include)
message(STATUS "ARNOLD_INCLUDE_DIR is ${ARNOLD_INCLUDE_DIR}")

# Find the Arnold library directory
# We link against the lib stub on Windows, because Windows is special.
# We link against the lib stub on Windows
set(ARNOLD_LIBDIR "bin")
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(ARNOLD_LIBDIR "lib")
Expand All @@ -38,7 +38,6 @@ else()
set(ARNOLD_LIBRARY_DIR ${ARNOLD_ROOT}/${ARNOLD_LIBDIR})
endif()


message(STATUS "ARNOLD_LIBRARY_DIR is ${ARNOLD_LIBRARY_DIR}")

if (ARNOLD_INCLUDE_DIR AND ARNOLD_LIBRARY_DIR)
Expand Down
24 changes: 3 additions & 21 deletions pota/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ set(SRC lentil.cpp lentil_loader.cpp lentil_operator.cpp lentil_camera.cpp lenti
set(SHADER lentil)
set(UI ${CMAKE_CURRENT_SOURCE_DIR}/lentil_camera.ui)
set(MTD ${CMAKE_CURRENT_BINARY_DIR}/lentil_camera.mtd)
# set(MTDEXTRA ${CMAKE_CURRENT_SOURCE_DIR}/lentil.mtd)
set(AE ${CMAKE_CURRENT_BINARY_DIR}/lentilTemplate.py)
#set(AEXML ${CMAKE_CURRENT_BINARY_DIR}/AElentilTemplate.xml)
#set(NEXML ${CMAKE_CURRENT_BINARY_DIR}/NElentilTemplate.xml)
#set(SPDL ${CMAKE_CURRENT_BINARY_DIR}/lentil_camera.spdl)
set(KARGS ${CMAKE_CURRENT_BINARY_DIR}/lentil_camera.args)
set(C4DRES ${CMAKE_CURRENT_BINARY_DIR}/C4DtoA)
set(PRESET_SCENES ${CMAKE_SOURCE_DIR}/preset_scenes)


add_library(${SHADER} SHARED ${SRC})

target_link_libraries(${SHADER} ai)
Expand All @@ -24,44 +19,31 @@ execute_process(COMMAND
--ae_template_output ${AE}
--args_output ${KARGS}
--c4d_output ${C4DRES}
#${HTML}
)

install(TARGETS ${SHADER} DESTINATION ${DSO_INSTALL_DIR})
# install(FILES ${MTD} DESTINATION ${MTD_INSTALL_DIR})
# install(FILES ${MTDEXTRA} DESTINATION ${MTD_INSTALL_DIR})
install(FILES ${AE} DESTINATION ${AE_INSTALL_DIR})
#install(FILES ${AEXML} DESTINATION ${AEXML_INSTALL_DIR})
#install(FILES ${NEXML} DESTINATION ${NEXML_INSTALL_DIR})
#install(FILES ${SPDL} DESTINATION ${SPDL_INSTALL_DIR})
install(FILES ${KARGS} DESTINATION ${ARGS_INSTALL_DIR})
install(DIRECTORY ${C4DRES} DESTINATION ${INSTALL_DIR})
install(DIRECTORY ${PRESET_SCENES} DESTINATION ${SCENES_INSTALL_DIR})







# concat mtd files
# Concat MTD files
set(MTD_FILES ${CMAKE_CURRENT_BINARY_DIR}/lentil_camera.mtd ${CMAKE_CURRENT_SOURCE_DIR}/lentil_hardcode.mtd)

function(cat IN_FILE OUT_FILE)
file(READ ${IN_FILE} CONTENTS)
file(APPEND ${OUT_FILE} "${CONTENTS}")
endfunction()

# honestly not sure why these files need to be deleted otherwise they don't update .. weird
# Not sure why these files need to be deleted otherwise they don't update
file (REMOVE ${MTD_INSTALL_DIR}/lentil.mtd)
file (REMOVE ${CMAKE_CURRENT_BINARY_DIR}/lentil.mtd)

# file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/lentil_camera.mtd "")
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/lentil.mtd "")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lentil.mtd "")
foreach(MTD_FILE ${MTD_FILES})
cat(${MTD_FILE} ${CMAKE_CURRENT_BINARY_DIR}/lentil.mtd)
endforeach()

set(MTD_LENTIL ${CMAKE_CURRENT_BINARY_DIR}/lentil.mtd)
install(FILES ${MTD_LENTIL} DESTINATION ${MTD_INSTALL_DIR})
install(FILES ${MTD_LENTIL} DESTINATION ${MTD_INSTALL_DIR})
8 changes: 2 additions & 6 deletions pota/src/lentil.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "aov_data.h"
#include "operator_data.h"

// critsec stuff

extern AtMutex l_critsec;

inline void lentil_crit_sec_enter() {
Expand Down Expand Up @@ -54,12 +56,6 @@ enum ChromaticType{
red_cyan
};







struct Camera
{
LensModel lensModel;
Expand Down
7 changes: 0 additions & 7 deletions pota/src/lentil_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

AI_CAMERA_NODE_EXPORT_METHODS(lentilMethods)


static const char* Units[] = {"mm", "cm", "dm", "m", "automatic", NULL};
static const char* CameraTypes[] = {"ThinLens", "PolynomialOptics", NULL};
static const char* ChromaticTypes[] = {"green_magenta", "red_cyan", NULL};
Expand All @@ -15,7 +14,6 @@ static const char* LensModelNames[] = {
NULL
};


node_parameters {
AiParameterEnum("camera_type", ThinLens, CameraTypes);
AiParameterInt("bidir_sample_mult", 5);
Expand Down Expand Up @@ -51,7 +49,6 @@ node_parameters {
AiMetaDataSetBool(nentry, nullptr, "force_update", true);
}


node_plugin_initialize { return true; }
node_plugin_cleanup { }

Expand All @@ -74,7 +71,6 @@ node_finish {

}


camera_create_ray {
Camera* camera_data = (Camera*)AiNodeGetLocalData(node);

Expand Down Expand Up @@ -159,7 +155,6 @@ camera_create_ray {
// }
// }


// approximation using pinhole camera FOV
camera_reverse_ray {
Camera* camera_data = (Camera*)AiNodeGetLocalData(node);
Expand All @@ -171,8 +166,6 @@ camera_reverse_ray {
return true;
}



void registerLentilCamera(AtNodeLib* node) {
node->methods = (AtNodeMethods*) lentilMethods;
node->output_type = AI_TYPE_UNDEFINED;
Expand Down
8 changes: 4 additions & 4 deletions pota/src/lentil_camera.ui
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ui.shader({

with uigen.group(ui, 'General', collapse=False):
ui.parameter('camera_type', 'enum', 'ThinLens', label='Camera Type',
description='Thinlens is super fast, Polynomial optics is super accurate.',
description='ThinLens is super fast, PolynomialOptics is super accurate.',
enum_names=['ThinLens', 'PolynomialOptics'])

ui.parameter('bidir_sample_mult', 'int', 3, label='Samples Multiplier',
Expand All @@ -39,7 +39,7 @@ with uigen.group(ui, 'General', collapse=False):
enum_names=['automatic', 'mm', 'dm', 'cm', 'm'], houdini_default='automatic')

ui.parameter('sensor_width', 'float', 36, label='Sensor Width (mm)',
description='Default is the width of a full frame sensor [36 mm]. Adjustments to the sensor size result in different effective focal lengths of the lens.',
description='Default is the width of a full frame sensor (36 mm). Adjustments to the sensor size result in different effective focal lengths of the lens.',
mn=0.1, mx=100, smn=16, smx=70)

ui.parameter('enable_dof', 'bool', True, label='Enable Depth of Field',
Expand All @@ -64,7 +64,7 @@ with uigen.group(ui, 'General', collapse=False):

with uigen.group(ui, 'Polynomial Optics', collapse=False):
ui.parameter('lens_model', 'enum', 'cooke__speed_panchro__1920__40mm', label='Lens Model',
description='There are many different lenses to choose from, with multiple focal lengths pre-computed. Each lens has its own characteristics. See the online documentation for previews of all lens models.',
description='There are many different lenses to choose from, with multiple pre-computed focal lengths. Each lens has its own characteristics. See the online documentation for previews of all lens models.',
houdini_disable_when='{ cameratype == ThinLens }',
enum_names=[
'canon__retrofocus_wideangle__1982__22mm',
Expand Down Expand Up @@ -117,7 +117,7 @@ with uigen.group(ui, 'Polynomial Optics', collapse=False):

#with uigen.group(ui, 'advanced', collapse=True):
ui.parameter('wavelength', 'float', 550.0, label='Wavelength (nm)',
description='Wavelength in nanometers. The polynomial optics model is spectral, but since Arnold is an RGB renderer we trace every ray with the same wavelength.',
description='Wavelength in nanometers. The polynomial optics model is spectral, but since Arnold is an RGB renderer every ray is traced with the same wavelength.',
mn=390, mx=700, houdini_disable_when='{ cameratype == ThinLens }')
ui.parameter('extra_sensor_shift', 'float', 0, label='Sensor Shift (mm)',
description='The autofocus system is more complicated for polynomial optics than for the thinlens model. This option allows you to slightly push the sensor forward and backward to fine-tune the focus, if needed.',
Expand Down

0 comments on commit 7c072ac

Please sign in to comment.