Beispiel #1
0
void CoronaRenderer::defineColorMapping()
{
	float gamma = 2.2f;
#if MAYA_API_VERSION > 2015
	if (MColorManagementUtilities::isColorManagementEnabled())
		gamma = 1.0f;
#endif
	MFnDependencyNode depFn(getRenderGlobalsNode());
	context.colorMappingData->colorTemperature = getFloatAttr("colorMapping_colorTemperature", depFn, 6500.0f);
	context.colorMappingData->contrast = getFloatAttr("colorMapping_contrast", depFn, 1.0f);
	context.colorMappingData->gamma = gamma;
	context.colorMappingData->tint = toCorona(getColorAttr("colorMapping_tint", depFn));
	context.colorMappingData->exposure.simple.exponent = getFloatAttr("colorMapping_simpleExposure", depFn, 0.0f);
	context.colorMappingData->highlightCompression = getFloatAttr("colorMapping_highlightCompression", depFn, 1.0f);
	context.colorMappingData->photographicExposure = getEnumInt("exposure_type", depFn) == 1;

	// release 0.39 override camera settings
	if (context.colorMappingData->photographicExposure)
	{
		context.colorMappingData->exposure.photographic.fStop = getFloatAttr("colorMapping_fStop", depFn, 5.6);
		context.colorMappingData->exposure.photographic.iso = getFloatAttr("colorMapping_iso", depFn, 100.0);
		context.colorMappingData->exposure.photographic.shutterSpeed = 1.0f / getFloatAttr("colorMapping_shutterSpeed", depFn, 250.0f);

		if ( this->renderCam != MObject::kNullObj)
		{
			MFnDependencyNode camFn(renderCam);
			if (getBoolAttr("mtco_overrideRenderSettings", camFn, false))
			{
				context.settings->set(Corona::PARAM_COLORMAP_ISO, getFloatAttr("mtco_iso", camFn, 1.0));
				context.settings->set(Corona::PARAM_COLORMAP_F_STOP, getFloatAttr("fStop", camFn, 5.6));
				context.settings->set(Corona::PARAM_COLORMAP_SHUTTER_SPEED, 1.0f / getFloatAttr("mtco_shutterSpeed", camFn, 250.0f));
			}
		}
	}
}
Beispiel #2
0
void CoronaRenderer::defineColorMappingFromCam(MObject& cam)
{
	MFnDependencyNode camFn(cam);
	context.colorMappingData->exposure.photographic.fStop = getFloatAttr("fStop", camFn, 5.6);
	context.colorMappingData->exposure.photographic.iso = getFloatAttr("mtco_iso", camFn, 1.0);
	context.colorMappingData->exposure.photographic.shutterSpeed = 1.0f / getFloatAttr("mtco_shutterSpeed", camFn, 250.0f);
}
Beispiel #3
0
bool isCameraRenderable(MObject obj)
{
    MFnDependencyNode camFn(obj);
    bool renderable = true;
    getBool(MString("renderable"), camFn, renderable);
    if (renderable)
        return true;
    return false;
}
void CoronaRenderer::defineColorMapping()
{
	float gamma = 2.2f;
#if MAYA_API_VERSION > 2015
	if (MColorManagementUtilities::isColorManagementEnabled())
		gamma = 1.0f;
#endif
	MFnDependencyNode depFn(getRenderGlobalsNode());
	context.colorMappingData->colorTemperature = getFloatAttr("colorMapping_colorTemperature", depFn, 6500.0f);
	context.colorMappingData->contrast = getFloatAttr("colorMapping_contrast", depFn, 1.0f);
	context.colorMappingData->gamma = gamma;
	context.colorMappingData->tint = toCorona(getColorAttr("colorMapping_tint", depFn));
	context.colorMappingData->exposure.simple.exponent = getFloatAttr("colorMapping_simpleExposure", depFn, 0.0f);
	context.colorMappingData->highlightCompression = getFloatAttr("colorMapping_highlightCompression", depFn, 1.0f);
	context.colorMappingData->photographicExposure = getEnumInt("exposure_type", depFn) == 1;

	// release 0.39 override camera settings
	if (context.colorMappingData->photographicExposure)
	{
		context.colorMappingData->exposure.photographic.fStop = getFloatAttr("colorMapping_fStop", depFn, 5.6);
		context.colorMappingData->exposure.photographic.iso = getFloatAttr("colorMapping_iso", depFn, 100.0);
		context.colorMappingData->exposure.photographic.shutterSpeed = 1.0f / getFloatAttr("colorMapping_shutterSpeed", depFn, 250.0f);

		std::shared_ptr<MayaScene> mayaScene = MayaTo::getWorldPtr()->worldScenePtr;
		for (auto cam : mayaScene->camList)
		{
			if (!isCameraRenderable(cam->mobject) && (!(cam->dagPath == mayaScene->uiCamera)))
				continue;
			MFnDependencyNode camFn(cam->mobject);
			if (getBoolAttr("mtco_overrideRenderSettings", camFn, false))
			{
				context.settings->set(Corona::PARAM_COLORMAP_ISO, getFloatAttr("mtco_iso", camFn, 1.0));
				context.settings->set(Corona::PARAM_COLORMAP_F_STOP, getFloatAttr("fStop", camFn, 5.6));
				context.settings->set(Corona::PARAM_COLORMAP_SHUTTER_SPEED, 1.0f / getFloatAttr("mtco_shutterSpeed", camFn, 250.0f));
			}
		}
	}
}
Beispiel #5
0
void TheaRenderer::defineCamera()
{
    std::shared_ptr<MayaScene> mayaScene = MayaTo::getWorldPtr()->worldScenePtr;
    std::shared_ptr<RenderGlobals> renderGlobals = MayaTo::getWorldPtr()->worldRenderGlobalsPtr;

    for (auto obj : mayaScene->camList)
    {
        MFnCamera camFn(obj->mobject);

        if (!isCameraRenderable(obj->mobject) && (!(obj->dagPath == mayaScene->uiCamera)))
        {
            continue;
        }

        MMatrix m = obj->transformMatrices[0] * renderGlobals->globalConversionMatrix;
        uint width, height;
        int width_, height_;
        renderGlobals->getWidthHeight(width_, height_);
        width = width_;
        height = height_;
        bool success = true;
        float focalLen = camFn.focalLength();
        float focusDistance = getFloatAttr("focusDistance", camFn, 10.0f);
        focusDistance *= renderGlobals->scaleFactor;
        float fStop = getFloatAttr("fStop", camFn, 5.6f);

        TheaSDK::Transform cameraPos;
        matrixToTransform(m, cameraPos);

        TheaSDK::Transform tn;
        cameraPos = cameraPos * tn.RotateX(-DegToRad(180.0));

        if( renderGlobals->exportSceneFile )
        {
            TheaSDK::XML::Camera cam;
            cam.name = obj->shortName.asChar();
            cam.frame = cameraPos;
            cam.focalLength = focalLen;
            cam.pixels = width;
            cam.lines = height;
            cam.filmHeight = getFloatAttr("verticalFilmAperture", camFn, .9f) * 2.54f * 10.0f;
            cam.shutterSpeed = getFloatAttr("mtth_shutter_speed", camFn, 250.0);

            if( getBoolAttr("depthOfField", camFn, false))
            {
                if( renderGlobals->doDof)
                {
                    cam.focusDistance = focusDistance;
                    cam.depthOfField = getFloatAttr("mtth_focusRange", camFn, 0.1);
                    cam.autofocus = getBoolAttr("mtth_autoFocus", camFn, false);
                    //cam.depthOfField = (focusDistance-nearFocusPlane)/focusDistance;
                    cam.blades = getIntAttr("mtth_diaphragm_blades", camFn, 4);
                    int diaType;
                    getEnum(MString("mtth_diaphragm_type"), camFn, diaType);
                    if( diaType == 0)
                        cam.diaphragm = TheaSDK::Diaphragm::CircularDiaphragm;
                    else
                        cam.diaphragm = TheaSDK::Diaphragm::PolygonalDiaphragm;
                    cam.fNumber = fStop;
                }
            }

            sceneXML.addCamera(cam);
        } else {
            TheaSDK::CameraPointer cameraPtr = TheaSDK::AddStandardCamera(obj->shortName.asChar(), cameraPos, focalLen, width, height);
        }
        break; // only 1 cam at the moment
    }
}
Beispiel #6
0
void IndigoRenderer::defineCamera()
{
	std::shared_ptr<MayaScene> mayaScene = MayaTo::getWorldPtr()->worldScenePtr;
	std::shared_ptr<RenderGlobals> renderGlobals = MayaTo::getWorldPtr()->worldRenderGlobalsPtr;

	for (auto mobj : mayaScene->camList)
	{
		std::shared_ptr<mtin_MayaObject> icam(std::static_pointer_cast<mtin_MayaObject>(mobj));
		MFnCamera camFn(icam->dagPath);
		float lensRadius = 0.01;
		getFloat(MString("mtin_lensRadius"), camFn, lensRadius); 
		bool autoFocus = false;
		getBool(MString("mtin_autoFocus"), camFn, autoFocus); 

		MVector camUp = camFn.upDirection(MSpace::kWorld);
		MVector camView = camFn.viewDirection(MSpace::kWorld);
		MPoint camPos = camFn.eyePoint(MSpace::kWorld);

		MMatrix m = icam->transformMatrices[0];
		MPoint pos, rot, scale;
		getMatrixComponents(m, pos, rot, scale);
		camPos *= renderGlobals->globalConversionMatrix;
		camUp *= renderGlobals->globalConversionMatrix;
		camView *=  renderGlobals->globalConversionMatrix;
		camUp.normalize();
		camView.normalize();

		double focusDistance = camFn.focusDistance();
		double horizFilmAperture = camFn.horizontalFilmAperture();
		double focalLen = camFn.focalLength();

		logger.debug(MString("Using camera: ") + icam->fullName);

		Indigo::SceneNodeCameraRef cam(new Indigo::SceneNodeCamera());
		if( renderGlobals->doDof )
			cam->lens_radius = lensRadius;
		else
			cam->lens_radius = lensRadius / 10000.0;
		//apertureRadius = $iFocalLength / ($FStop * 2.0);
		float exposureDuration = 0.333f;
		getFloat("mtin_exposureDuration", camFn, exposureDuration);
		cam->exposure_duration = exposureDuration;
		cam->focus_distance = focusDistance * scale.x; // scale by global matrix scale
		cam->lens_sensor_dist = focalLen/1000.0;
		cam->autofocus = autoFocus;
		
		//cam->lens_shift_right_distance = 0;
		//cam->lens_shift_up_distance = 0;
	
		cam->sensor_width = (horizFilmAperture * 2.54 * 10.0) / 1000.0;
		cam->camera_type = Indigo::SceneNodeCamera::CameraType_ThinLensPerspective;

		cam->forwards = Indigo::Vec3d(camView.x, camView.y, camView.z);
		cam->up = Indigo::Vec3d(camUp.x, camUp.y, camUp.z);
		cam->setPos(Indigo::Vec3d(camPos.x, camPos.y, camPos.z));

		int appShape = 0;
		getEnum(MString("mtin_apertureShape"), camFn, appShape);
		if( appShape == 0) // circle
			cam->aperture_shape = new Indigo::ApertureCircular();
		if( appShape == 1) // generated
		{
			int numBlades = 5;
			float startAngle = 0.0f;
			float offset = 0.0f;
			float radius = 0.0f;
			getInt("mtin_numBlades", camFn, numBlades);
			getFloat("mtin_startAngle", camFn, startAngle);
			getFloat("mtin_bladeOffset", camFn, offset);
			getFloat("mtin_bladeCurvatureRadius", camFn, radius);
			cam->aperture_shape = new Indigo::ApertureGenerated(numBlades, offset, radius, startAngle);
		}
		if( appShape == 2) // image
		{
			MString fileName;
			getString(MString("mtin_appFile"), camFn, fileName);
			if( fileName.length() > 4)
				cam->aperture_shape = new Indigo::ApertureImage(fileName.asChar());
		}

		sceneRootRef->addChildNode(cam);
	}
}
Beispiel #7
0
void LuxRenderer::defineCamera()
{
	std::shared_ptr<MayaScene> mayaScene = MayaTo::getWorldPtr()->worldScenePtr;
	std::shared_ptr<RenderGlobals> renderGlobals = MayaTo::getWorldPtr()->worldRenderGlobalsPtr;
	std::shared_ptr<MayaObject> mo = mayaScene->camList[0];

	MMatrix cm = mo->dagPath.inclusiveMatrix();
	MFnCamera camFn(mo->mobject);
	this->transformCamera(mo.get(), renderGlobals->doMb && (mo->transformMatrices.size() > 1));

	// lux uses the fov of the smallest image edge
	double hFov = RadToDeg(camFn.horizontalFieldOfView());
	double vFov = RadToDeg(camFn.verticalFieldOfView());
	float fov = hFov;
	int width, height;
	renderGlobals->getWidthHeight(width, height);
	if( height < width)
		fov = vFov;

	// focaldist
	float focusDist = (float)camFn.focusDistance() * renderGlobals->sceneScale;
	float focalLen = (float)camFn.focalLength();
	float fStop = (float)camFn.fStop();

	bool useDOF = false;
	getBool(MString("depthOfField"), camFn, useDOF);
	useDOF = useDOF && renderGlobals->doDof;

	// hither, yon
	float hither = (float)camFn.nearClippingPlane();
	float yon = (float)camFn.farClippingPlane();
	
	// render region
	int left, bottom, right, top;
	renderGlobals->getRenderRegion(left, bottom, right, top);
	int ybot = (height - bottom);
	int ytop = (height - top);
	int ymin = ybot <  ytop ? ybot :  ytop;
	int ymax = ybot >  ytop ? ybot :  ytop;
	float lensradius = (focalLen / 1000.0) / ( 2.0 * fStop );

	int blades = 0;
	getInt(MString("mtlu_diaphragm_blades"), camFn, blades);
	bool autofocus = false;
	getBool(MString("mtlu_autofocus"), camFn, autofocus);
	int dist = 0;
	getInt(MString("mtlu_distribution"), camFn, dist);
	logger.debug(MString("Lens distribution: ") + dist + " " + LensDistributions[dist]);
	float power = 1.0f;
	getFloat(MString("mtlu_power"), camFn, power);
	const char *lensdistribution =  LensDistributions[dist];

	float shutterOpen = 0.0f;
	float shutterClose = renderGlobals->mbLength;

	ParamSet cp = CreateParamSet();
	cp->AddFloat("fov", &fov);
	cp->AddFloat("focaldistance", &focusDist);
	cp->AddFloat("hither", &hither);
	cp->AddFloat("yon", &yon);
	cp->AddFloat("shutteropen", &shutterOpen);
	cp->AddFloat("shutterclose", &shutterClose);
	if( blades > 0)
		cp->AddInt("blades", &blades);
	if( useDOF )
	{
		cp->AddFloat("lensradius", &lensradius);
		cp->AddBool("autofocus", &autofocus);
		cp->AddString("distribution", &lensdistribution);
		cp->AddFloat("power", &power);
	}
	lux->camera("perspective", boost::get_pointer(cp));
	
	if( renderGlobals->exportSceneFile)
		this->luxFile << "Camera \"perspective\" "<< "\"float fov\" [" << fov << "]"  <<"\n";

}
Beispiel #8
0
void CoronaRenderer::defineSettings()
{
	MFnDependencyNode depFn(getRenderGlobalsNode());
	std::shared_ptr<RenderGlobals> renderGlobals = MayaTo::getWorldPtr()->worldRenderGlobalsPtr;
	int w = renderGlobals->getWidth();
	int h = renderGlobals->getHeight();
	context.settings->set(Corona::PARAM_IMAGE_WIDTH, w);
	context.settings->set(Corona::PARAM_IMAGE_HEIGHT, h);

	if (MayaTo::getWorldPtr()->renderType == MayaTo::MayaToWorld::WorldRenderType::IPRRENDER)
		context.settings->set(Corona::PARAM_MINIMIZE_PRECOMP, true);

	if (getBoolAttr("lockSamplingPattern",depFn, false))
		context.settings->set(Corona::PARAM_RANDOM_SEED, 1234);
	else
		context.settings->set(Corona::PARAM_RANDOM_SEED, 0);

	if (renderGlobals->getUseRenderRegion())
	{
		int left, bottom, right, top;
		renderGlobals->getRenderRegion(left, bottom, right, top);
		context.settings->set(Corona::PARAM_IMAGE_REGION_START_X, left);
		context.settings->set(Corona::PARAM_IMAGE_REGION_START_Y, bottom);
		context.settings->set(Corona::PARAM_IMAGE_REGION_END_X, right);
		context.settings->set(Corona::PARAM_IMAGE_REGION_END_Y, top);
	}

	int renderer = getIntAttr("renderer", depFn, 0);
	if( renderer == 0) // progressive
		context.settings->set(Corona::PARAM_RENDER_ENGINE, Corona::RENDER_ENGINE_PROGRESSIVE);
	if( renderer == 1) // bucket rendering
		context.settings->set(Corona::PARAM_RENDER_ENGINE, Corona::RENDER_ENGINE_BUCKET);
	if( renderer == 2) // vcm rendering
		context.settings->set(Corona::PARAM_RENDER_ENGINE, Corona::RENDER_ENGINE_VCM);

	//context.settings->set(Corona::PARAM_RESUME_RENDERING, false);
	
	context.settings->set(Corona::PARAM_BUCKET_SIZE, getIntAttr("image_bucketSize", depFn, 64));
	context.settings->set(Corona::PARAM_BUCKET_SAMPLES_PER_ITERATION, getIntAttr("buckets_initialSamples", depFn, 4));
	context.settings->set(Corona::PARAM_BUCKET_PASSES, getIntAttr("buckets_adaptiveSteps", depFn, 4));
	context.settings->set(Corona::PARAM_BUCKET_ADAPTIVE_THRESHOLD, getFloatAttr("buckets_adaptiveThreshold", depFn, 0.03f));

	context.settings->set(Corona::PARAM_PROGRESSIVE_PASS_LIMIT, getIntAttr("progressive_maxPasses", depFn, 0));
	context.settings->set(Corona::PARAM_PROGRESSIVE_TIME_LIMIT, getIntAttr("progressive_timeLimit", depFn, 60) * 1000);

	context.settings->set(Corona::PARAM_VCM_MODE, getEnumInt("vcm_mode", depFn));
	context.settings->set(Corona::PARAM_PPM_INITIAL_RADIUS, getFloatAttr("ppm_initialRadius", depFn, 2.0f));
	//context.settings->set(Corona::PARAM_BIDIR_DO_MIS, getBoolAttr("bidir_doMis", depFn, true));
	context.settings->set(Corona::PARAM_PPM_PHOTONS_PER_ITER, getIntAttr("ppm_photonsPerIter", depFn, 5000000));
	context.settings->set(Corona::PARAM_PPM_ALPHA, getFloatAttr("ppm_alpha", depFn, .666f));

	context.settings->set(Corona::PARAM_MAX_SAMPLE_INTENSITY, getFloatAttr("maxPtSampleIntensity", depFn, 20.0f));	
	context.settings->set(Corona::PARAM_NUM_THREADS, getIntAttr("threads", depFn, 4));

	if (getBoolAttr("exportSceneFile", depFn, false))
		context.settings->set(Corona::PARAM_EXPORT_PATH, renderGlobals->exportSceneFileName.asChar());
	 
	context.settings->set(Corona::PARAM_THREAD_PRIORITY, Corona::IScheduler::PRIORITY_BELOW_NORMAL); // always render with low priority

	Corona::DisplaceSubdivType subdivTypes[] = { Corona::DisplaceSubdivType::DISPLACE_SUBDIV_WORLD, Corona::DisplaceSubdivType::DISPLACE_SUBDIV_PROJECTED };
	context.settings->set(Corona::PARAM_DISPLACE_SUBDIV_TYPE, subdivTypes[(int)getBoolAttr("displace_useProjectionSize", depFn, true)]);
	context.settings->set(Corona::PARAM_DISPLACE_MAX_SIZE_SCREEN, getFloatAttr("displace_maxProjectSize", depFn, 2.0f));
	context.settings->set(Corona::PARAM_DISPLACE_MAX_SIZE_WORLD, getFloatAttr("displace_maxWorldSize", depFn, 1.0f));

	context.settings->set(Corona::PARAM_MAX_RAY_DEPTH, getIntAttr("raycaster_maxDepth", depFn, 25));
	context.settings->set(Corona::PARAM_MIN_INSTANCE_SAVING, getIntAttr("instance_minSize", depFn, 50000));

	int f = getEnumInt("filtertype", depFn);
	float fw = getFloatAttr("imagefilter_width", depFn, 1.5f);
	float fb = getFloatAttr("imagefilter_blurring", depFn, .5f);
	context.settings->set(Corona::PARAM_IMAGEFILTER, getEnumInt("filtertype", depFn));
	context.settings->set(Corona::PARAM_IMAGEFILTER_WIDTH, getFloatAttr("imagefilter_width", depFn, 1.5f));
	context.settings->set(Corona::PARAM_IMAGEFILTER_BLURRING, getFloatAttr("imagefilter_blurring", depFn, .5f));

	context.settings->set(Corona::PARAM_SHADING_ENABLE, getBoolAttr("doShading", depFn, true));

	Corona::GiSolverType solverTypes[] = { Corona::GiSolverType::GISOLVER_NONE, Corona::GiSolverType::GISOLVER_PATHTRACING, Corona::GiSolverType::GISOLVER_HD_CACHE, Corona::GiSolverType::GISOLVER_UHD_CACHE };
	context.settings->set(Corona::PARAM_SHADING_PRIMARY_SOLVER, solverTypes[getEnumInt("gi_primarySolver", depFn)]);
	context.settings->set(Corona::PARAM_SHADING_SECONDARY_SOLVER, solverTypes[getEnumInt("gi_secondarySolver", depFn)]);

	context.settings->set(Corona::PARAM_GI_TO_AA_RATIO, getIntAttr("pathtracingSamples", depFn, 16));
	//context.settings->set(Corona::PARAM_LIGHT_SAMPLES_MULT, getFloatAttr("lights_areaSamplesMult", depFn, 2.0f));

	context.settings->set(Corona::PARAM_HDCACHE_SAVE, getBoolAttr("gi_saveSecondary", depFn, false));
	context.settings->set(Corona::PARAM_HDCACHE_PRECALC_MODE, getEnumInt("gi_hdCache_precalcMode", depFn));
	context.settings->set(Corona::PARAM_HDCACHE_FILE, Corona::String(getStringAttr("gi_secondaryFile", depFn, "").asChar()));
	context.settings->set(Corona::PARAM_HDCACHE_PRECOMP_DENSITY, getFloatAttr("gi_hdCache_precompMult", depFn, 1.0f));
	context.settings->set(Corona::PARAM_HDCACHE_INTERPOLATION_COUNT, getIntAttr("gi_hdCache_interpolationCount", depFn, 3));
	context.settings->set(Corona::PARAM_HDCACHE_RECORD_QUALITY, getIntAttr("gi_hdCache_ptSamples", depFn, 256));
	context.settings->set(Corona::PARAM_HDCACHE_SMOOTHING, getFloatAttr("gi_hdCache_smoothing", depFn, 2.0f));
	context.settings->set(Corona::PARAM_HDCACHE_MAX_RECORDS, getIntAttr("gi_hdCache_maxRecords", depFn, 100000));
	context.settings->set(Corona::PARAM_HDCACHE_GLOSS_THRESHOLD, getFloatAttr("gi_hdCache_glossyThreshold", depFn, .9f));
	context.settings->set(Corona::PARAM_HDCACHE_WRITABLE_PASSES, getIntAttr("gi_hdCache_writePasses", depFn, 0));
	context.settings->set(Corona::PARAM_HDCACHE_DIR_SENSITIVITY, getFloatAttr("gi_hdCache_dirSensitivity", depFn, 2.0f));
	context.settings->set(Corona::PARAM_HDCACHE_POS_SENSITIVITY, getFloatAttr("gi_hdCache_posSensitivity", depFn, 20.0f));
	context.settings->set(Corona::PARAM_HDCACHE_NORMAL_SENSITIVITY, getFloatAttr("gi_hdCache_normalSensitivity", depFn, 3.0f));

	float uhd_precision = getFloatAttr("uhdPrecision", depFn, 1.0f);
	context.settings->set(Corona::PARAM_UHDCACHE_PRECISION, uhd_precision);

	int uhd_recordQuality = 512;
	float uhd_strictness = 0.075f;
	float uhd_msi = 3.0f;
	int uhdType = getEnumInt("uhdCacheType", depFn);
	if (getEnumInt("gi_secondarySolver", depFn) == 4) // uhd cache
	{
		// 0 == still, 1 == animation. Only animation needs not default settings.
		if (uhdType == 1)
		{
			context.settings->set(Corona::PARAM_UHDCACHE_MSI, uhd_msi * 3.0f);
			context.settings->set(Corona::PARAM_UHDCACHE_RECORD_QUALITY, uhd_recordQuality * .5f);
			context.settings->set(Corona::PARAM_UHDCACHE_STRICTNESS, uhd_strictness * .33f);
			context.settings->set(Corona::PARAM_UHDCACHE_PRECISION, uhd_precision * .4f);
		}
	}

	float gamma = 2.2f;
#if MAYA_API_VERSION > 2015
	if (MColorManagementUtilities::isColorManagementEnabled())
		gamma = 1.0f;
#endif
	context.settings->set(Corona::PARAM_COLORMAP_GAMMA, gamma);
	context.settings->set(Corona::PARAM_COLORMAP_HIGHLIGHT_COMPRESSION, getFloatAttr("colorMapping_highlightCompression", depFn, 1.0f));
	context.settings->set(Corona::PARAM_COLORMAP_CONTRAST, getFloatAttr("colorMapping_contrast", depFn, 1.0f));

	context.settings->set(Corona::PARAM_COLORMAP_COLOR_TEMP, getFloatAttr("colorMapping_colorTemperature", depFn, 6500.0f));
	context.settings->set(Corona::PARAM_COLORMAP_SIMPLE_EXPOSURE, getFloatAttr("colorMapping_simpleExposure", depFn, 0.0f));
	context.settings->set(Corona::PARAM_COLORMAP_TINT, toCorona(getColorAttr("colorMapping_tint", depFn)));
	context.settings->set(Corona::PARAM_COLORMAP_USE_PHOTOGRAPHIC, !getBoolAttr("colorMapping_useSimpleExposure", depFn, true));

	context.settings->set(Corona::PARAM_COLORMAP_ISO, getFloatAttr("colorMapping_iso", depFn, 100.0));
	context.settings->set(Corona::PARAM_COLORMAP_F_STOP, getFloatAttr("colorMapping_fStop", depFn, 5.6));
	context.settings->set(Corona::PARAM_COLORMAP_SHUTTER_SPEED, 1.0f / getFloatAttr("colorMapping_shutterSpeed", depFn, 250.0f));
	// v2.8 exposure from camera
	std::shared_ptr<MayaScene> mayaScene = MayaTo::getWorldPtr()->worldScenePtr;
	if (mayaScene)
	{
		for (auto cam : mayaScene->camList)
		{
			if (!isCameraRenderable(cam->mobject) && (!(cam->dagPath == mayaScene->uiCamera)))
				continue;
			MFnDependencyNode camFn(cam->mobject);
			if (getBoolAttr("mtco_overrideRenderSettings", camFn, false))
			{
				context.settings->set(Corona::PARAM_COLORMAP_ISO, getFloatAttr("mtco_iso", camFn, 1.0));
				context.settings->set(Corona::PARAM_COLORMAP_F_STOP, getFloatAttr("fStop", camFn, 5.6));
				context.settings->set(Corona::PARAM_COLORMAP_SHUTTER_SPEED, 1.0f / getFloatAttr("mtco_shutterSpeed", camFn, 250.0f));
			}
			break;
		}
	}
}
Beispiel #9
0
/* virtual */
bool MayaCameraWriter::writeCameraAttrs(const UsdTimeCode &usdTime, UsdGeomCamera &primSchema)
{
    // Since write() above will take care of any animation on the camera's
    // transform, we only want to proceed here if:
    // - We are at the default time and NO attributes on the shape are animated.
    //    OR
    // - We are at a non-default time and some attribute on the shape IS animated.
    if (usdTime.IsDefault() == isShapeAnimated()) {
        return true;
    }

    MStatus status;

    MFnCamera camFn(getDagPath(), &status);
    CHECK_MSTATUS_AND_RETURN(status, false);

    // NOTE: We do not use a GfCamera and then call SetFromCamera() below
    // because we want the xformOps populated by the parent class to survive.
    // Using SetFromCamera() would stomp them with a single "transform" xformOp.

    // Set the type of projection.
    if (camFn.isOrtho()) {
        primSchema.GetProjectionAttr().Set(UsdGeomTokens->orthographic, usdTime);
    } else {
        primSchema.GetProjectionAttr().Set(UsdGeomTokens->perspective, usdTime);
    }

    // Setup the aperture.
    primSchema.GetHorizontalApertureAttr().Set(
        float(PxrUsdMayaUtil::ConvertInchesToMM(
                camFn.horizontalFilmAperture() *
                camFn.lensSqueezeRatio())),
        usdTime);
    primSchema.GetVerticalApertureAttr().Set(
        float(PxrUsdMayaUtil::ConvertInchesToMM(
                camFn.verticalFilmAperture() *
                camFn.lensSqueezeRatio())),
        usdTime);

    primSchema.GetHorizontalApertureOffsetAttr().Set(
        float(camFn.horizontalFilmOffset()), usdTime);
    primSchema.GetVerticalApertureOffsetAttr().Set(
        float(camFn.verticalFilmOffset()), usdTime);

    // Set the lens parameters.
    primSchema.GetFocalLengthAttr().Set(
        float(camFn.focalLength()), usdTime);

    // Always export focus distance and fStop regardless of what
    // camFn.isDepthOfField() says. Downstream tools can choose to ignore or
    // override them.
    primSchema.GetFocusDistanceAttr().Set(
        float(camFn.focusDistance()), usdTime);
    primSchema.GetFStopAttr().Set(
        float(camFn.fStop()), usdTime);

    // Set the clipping planes.
    GfVec2f clippingRange(camFn.nearClippingPlane(), camFn.farClippingPlane());
    primSchema.GetClippingRangeAttr().Set(clippingRange, usdTime);

    return true;
}