Commit fa8141ad authored by Paolo Berto Durante's avatar Paolo Berto Durante

release refactoring, see detailed commit body:

  - new lighting: choice of white, sky or HDRI file
  - fixed headlight xform
  - refactored camera
  - fixed wrong camera xform at init
  - added bunch of new config settings
  - new defaults for pixel samples
  - added env var for winding order
  - fixed several small things
parent 242b46e3
......@@ -41,14 +41,32 @@ TF_INSTANTIATE_SINGLETON(HdNSIConfig);
TF_DEFINE_ENV_SETTING(HDNSI_SHADING_SAMPLES, 64,
"Shading samples (must be >= 1)");
TF_DEFINE_ENV_SETTING(HDNSI_PIXEL_SAMPLES, 2,
TF_DEFINE_ENV_SETTING(HDNSI_PIXEL_SAMPLES, 8,
"Samples per pixel before we stop rendering (must be >= 1)");
TF_DEFINE_ENV_SETTING(HDNSI_CAMERA_LIGHT_INTENSITY, 100,
"Intensity of the camera light, specified as a percentage of <1,1,1>.");
TF_DEFINE_ENV_SETTING(HDNSI_CAMERA_LIGHT_INTENSITY, "1",
"Intensity of the camera light.");
TF_DEFINE_ENV_SETTING(HDNSI_PRINT_CONFIGURATION, 0,
"Should HdNSI print configuration on startup? (values > 0 are true)");
TF_DEFINE_ENV_SETTING(HDNSI_ENV_LIGHT_IMAGE, "",
"File path to the enviroment image.");
TF_DEFINE_ENV_SETTING(HDNSI_ENV_LIGHT_MAPPING, 0,
"Format of enviroment image, spherical (0) or angular (1)");
TF_DEFINE_ENV_SETTING(HDNSI_ENV_LIGHT_INTENSITY, "1",
"Intensity of enviroment image");
TF_DEFINE_ENV_SETTING(HDNSI_ENV_AS_BACKGROUND, 1,
"If display environment image as background");
TF_DEFINE_ENV_SETTING(HDNSI_ENV_USE_SKY, 1,
"Create 3Delight Sky as environment");
TF_DEFINE_ENV_SETTING(HDNSI_MESH_CLOCKWISEWINDING, 0,
"Set the clockwisewinding for mesh");
TF_DEFINE_ENV_SETTING(HDNSI_PRINT_CONFIGURATION, 1,
"Print configuration at startup (values > 0 are true)");
HdNSIConfig::HdNSIConfig()
{
......@@ -61,10 +79,27 @@ HdNSIConfig::HdNSIConfig()
// Read in values from the environment, clamping them to valid ranges.
shadingSamples = std::max(1,
TfGetEnvSetting(HDNSI_SHADING_SAMPLES));
pixelSamples = std::max(1,
TfGetEnvSetting(HDNSI_PIXEL_SAMPLES));
cameraLightIntensity = (std::max(100,
TfGetEnvSetting(HDNSI_CAMERA_LIGHT_INTENSITY)) / 100.0f);
std::string cameraLightIntensityVal =
TfGetEnvSetting(HDNSI_CAMERA_LIGHT_INTENSITY);
cameraLightIntensity = atof(cameraLightIntensityVal.c_str());
envLightPath = TfGetEnvSetting(HDNSI_ENV_LIGHT_IMAGE);
envLightMapping = TfGetEnvSetting(HDNSI_ENV_LIGHT_MAPPING);
std::string envLightIntensityVal =
TfGetEnvSetting(HDNSI_ENV_LIGHT_INTENSITY);
envLightIntensity = atof(envLightIntensityVal.c_str());
envAsBackground = TfGetEnvSetting(HDNSI_ENV_AS_BACKGROUND);
envUseSky = TfGetEnvSetting(HDNSI_ENV_USE_SKY);
meshClockwisewinding = TfGetEnvSetting(HDNSI_MESH_CLOCKWISEWINDING);
if (TfGetEnvSetting(HDNSI_PRINT_CONFIGURATION) > 0) {
std::cout
......@@ -74,7 +109,19 @@ HdNSIConfig::HdNSIConfig()
<< " pixelSamples = "
<< pixelSamples << "\n"
<< " cameraLightIntensity = "
<< cameraLightIntensity << "\n"
<< cameraLightIntensity << "\n"
<< " envLightImage = "
<< envLightPath << "\n"
<< " envLightMapping = "
<< envLightMapping << "\n"
<< " envLightIntensity = "
<< envLightIntensity << "\n"
<< " envAsBackground = "
<< envAsBackground << "\n"
<< " envUseSky = "
<< envUseSky << "\n"
<< " meshClockwisewinding = "
<< meshClockwisewinding << "\n"
;
}
}
......
......@@ -73,6 +73,36 @@ public:
/// Override with *HDNSI_CAMERA_LIGHT_INTENSITY*.
float cameraLightIntensity;
/// Path to the environment light file.
///
/// Override with *HDNSI_ENV_LIGHT_IMAGE*.
std::string envLightPath;
/// Format of the enviroment image
///
/// Override with *HDNSI_ENV_LIGHT_MAPPING*.
int envLightMapping;
/// Intensity of the enviroment image
///
/// Override with *HDNSI_ENV_LIGHT_INTENSITY*
float envLightIntensity;
/// If we render the environment as background.
///
/// Override with *HDNSI_ENV_AS_BACKGROUND*
int envAsBackground;
/// If we render the environment as background.
///
/// Override with *HDNSI_ENV_USE_SKY*
int envUseSky;
/// Set the clockwise to mesh.
///
/// Override with *HDNSI_MESH_CLOCKWISEWINDING*
int meshClockwisewinding;
private:
// The constructor initializes the config variables with their
// default or environment-provided override, and optionally prints
......
......@@ -215,6 +215,12 @@ HdNSIMesh::_CreateNSIMesh(NSIContext_t ctx)
newShape = true;
}
// Set clockwisewinding for the mesh.
const HdNSIConfig &config = HdNSIConfig::GetInstance();
if (config.meshClockwisewinding) {
nsi.SetAttribute(_masterShapeHandle, NSI::IntegerArg("clockwisewinding", 1));
}
// Create the master transform node.
const std::string &masterXformHandle = id.GetString() + "|transform1";
......@@ -247,7 +253,6 @@ HdNSIMesh::_CreateNSIMesh(NSIContext_t ctx)
// Create the default shader node.
_shaderHandle = std::string(colorKey) + "|default1";
const HdNSIConfig &config = HdNSIConfig::GetInstance();
const std::string &shaderPath =
config.delight + "/maya/osl/dl3DelightMaterial";
......
This diff is collapsed.
......@@ -144,6 +144,8 @@ private:
NSIContext_t _ctx;
// Our camera-related handles.
void _CreateNSICamera();
std::string _cameraXformHandle;
std::string _cameraShapeHandle;
......@@ -152,11 +154,23 @@ private:
std::string _outputDriverHandle;
// Our headlight handle.
void _CreateNSIHeadLight();
std::string _headlightXformHandle;
std::string _headlightShapeHandle;
std::string _headlightGeoAttrsHandle;
std::string _headlightShaderHandle;
// Our environment light handles.
void _CreateNSIEnvironmentLight();
std::string _envlightXformHandle;
std::string _envlightShapeHandle;
std::string _envlightGeoAttrsHandle;
std::string _envlightShaderHandle;
std::string _envlightFileShaderHandle;
std::string _envlightCoordShaderHandle;
// Status of the 3Delight renderer.
enum RenderStatus {
Stopped,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment