void SpotLight::prepass(Scene* scene) { #if 0 // render shadow map bool castsShadow = attributeByName("Casts Shadows")->property("value").value<bool>(); if (castsShadow) { QString shadowPath = QString(getenv("AQSIS_TEXTURE_PATH")).split(":")[0]; //Scene* scene = SunshineUi::activeScene(); QString picFile = shadowPath + "/" + scene->assetName(this) + ".z"; QString texFile = shadowPath + "/" + scene->assetName(this) + ".shd"; char picName[1000]; char texName[1000]; strcpy(picName, picFile.toStdString().c_str()); strcpy(texName, texFile.toStdString().c_str()); std::cout << "writing shadow map: " << picFile << std::endl; float shadowResolution = attributeByName("Shadow Resolution")->property("value").value<int>(); RiBegin(RI_NULL); RiDisplay(picName, "zfile", "z", RI_NULL); RiFormat(shadowResolution, shadowResolution, 1); RiPixelSamples(1, 1); RtFloat jitterVal = 0; const char* midpoint = "midpoint"; RiHider("hidden", "jitter", &jitterVal, "depthfilter", &midpoint, RI_NULL); RiSurface("null", RI_NULL); float coneAngle = attributeByName("Cone Angle")->property("value").value<float>(); Camera camera; camera.setCenter(this->center()); camera.setRotate(this->rotate()); camera.setScale(this->scale()); camera.setFOV(coneAngle*2); RenderUtil::renderScene(scene, &camera); RiMakeShadow(picName, texName, RI_NULL); RiEnd(); std::cout << "converting " << picName << " to " << texName << std::endl; // } #endif }
void tShadowRibWriterMgr::framePrologue_display(const structJob ¤tJob) { CM_TRACE_FUNC("tShadowRibWriterMgr::framePrologue_display(job="<<currentJob.name.asChar()<<")"); //refactor 14-1 begin from liqRibTranslator::framePrologue() if( currentJob.pass != rpShadowMap && liqglo.liqglo_rotateCamera == true ) { // philippe : Rotated Camera Case RiFormat( currentJob.height, currentJob.width, currentJob.aspectRatio ); }else{ RiFormat( currentJob.width, currentJob.height, currentJob.aspectRatio ); } //refactor 14-1 end if( currentJob.pass != rpShadowMap ) { //refactor 14 begin to tHeroRibWriterMgr::framePrologue_display() // Smooth Shading RiShadingInterpolation( "smooth" ); // Quantization // overriden to floats when in rendering to Maya's renderView if( !liqglo.m_renderView && liqglo.quantValue != 0 ) { int whiteValue = (int) pow( 2.0, liqglo.quantValue ) - 1; RiQuantize( RI_RGBA, whiteValue, 0, whiteValue, 0.5 ); } else { RiQuantize( RI_RGBA, 0, 0, 0, 0 ); } if( liqglo.m_rgain != 1.0 || liqglo.m_rgamma != 1.0 ) { RiExposure( liqglo.m_rgain, liqglo.m_rgamma ); } //refactor 14 end } if( currentJob.pass == rpShadowMap &&(currentJob.shadowType != stDeep || currentJob.samples == 1 ) ) { //refactor 15 if( liqglo.liquidRenderer.renderName == MString("Pixie") ) { liqFloat zero = 0; RiHider( "hidden", "jitter", &zero, RI_NULL ); } else { liqInt zero = 0; RiHider( "hidden", "int jitter", &zero, RI_NULL ); } //refactor 15 } if( currentJob.pass == rpShadowMap && currentJob.shadowType == stMidPoint ) { //refactor 16 liqString midPoint = "midpoint"; liqFloat midRatio = /*liqglo.liqglo_*/currentJob.midPointRatio; RiHider( "hidden", "depthfilter", &midPoint, RI_NULL ); if ( /*liqglo.liqglo_*/currentJob.midPointRatio != 0 ) RiHider( "hidden", "midpointratio", &midRatio, RI_NULL ); // Output to rib jami //refactor 16 } //----------------------------------------------------- LIQDEBUGPRINTF( "-> Setting Display Options\n" ); //if( currentJob.pass == rpShadowMap ) //MString relativeShadowName( liquidSanitizePath( liquidGetRelativePath( liqglo_relativeFileNames, liqglo_currentJob.imageName, liqglo_projectDir ) ) ); //refactor 17 begin if( currentJob.shadowType != stMinMax ) { if( currentJob.shadowType == stDeep ) { // RiDeclare( "volumeinterpretation", "string" ); liqString volume = "continuous"; if ( currentJob.volume != viContinuous ) volume = "discrete"; if( liqglo.liquidRenderer.renderName == MString("3Delight") ) { RiArchiveRecord( RI_COMMENT, "Display 1"); RiDisplay( const_cast< char* >( /*liqglo.liqglo_*/currentJob.imageName.asChar()), const_cast< char* >( /*liqglo.liqglo_*/currentJob.format.asChar() ), (liqToken)/*liqglo.liqglo_*/currentJob.imageMode.asChar(), "string volumeinterpretation", &volume, RI_NULL ); } else { // Deep shadows cannot be the primary output driver in PRMan & co. // We need to create a null output zfile first, and use the deep // shadows as a secondary output. // if( liqglo.liquidRenderer.renderName != MString("Pixie") ) { RiArchiveRecord( RI_COMMENT, "Display 2"); RiDisplay( "null", "null", "z", RI_NULL ); } MString deepFileImageName = "+" + /*liqglo.liqglo_*/currentJob.imageName; RiArchiveRecord( RI_COMMENT, "Display 3"); RiDisplay( const_cast< char* >( deepFileImageName.asChar() ), const_cast< char* >( /*liqglo.liqglo_*/currentJob.format.asChar() ), (liqToken)/*liqglo.liqglo_*/currentJob.imageMode.asChar(), "string volumeinterpretation", &volume, RI_NULL ); } }//if( liqglo.liqglo_currentJob.deepShadows ) else { RiArchiveRecord( RI_COMMENT, "Display 4"); liqInt aggregate( /*liqglo.liqglo_*/currentJob.shadowAggregation ); RiDisplay( const_cast< char* >( /*liqglo.liqglo_*/currentJob.imageName.asChar() ), const_cast< char* >( /*liqglo.liqglo_*/currentJob.format.asChar() ), (liqToken)/*liqglo.liqglo_*/currentJob.imageMode.asChar(), "int aggregate", &aggregate, RI_NULL ); } }//if( !liqglo.liqglo_currentJob.isMinMaxShadow ) else { RiArchiveRecord( RI_COMMENT, "Display 5"); RiArchiveRecord( RI_COMMENT, "Display Driver:" ); liqInt minmax = 1; RiDisplay( const_cast< char* >( (/*liqglo.liqglo_*/currentJob.imageName+(int)liqglo.liqglo_lframe).asChar() ),//const_cast< char* >( parseString(liqglo_currentJob.imageName).asChar() ), const_cast< char* >(/*liqglo.liqglo_*/currentJob.format.asChar()), (liqToken)/*liqglo.liqglo_*/currentJob.imageMode.asChar(), "minmax", &minmax, RI_NULL ); } exportJobCamera( currentJob, currentJob.camera ); //refactor 17 end //} }