预滤波HDR环境贴图
Opened this issue · 2 comments
TOMBrian881 commented
您好,目前我发现镜面IBL中的预滤波HDR环境贴图并非是根据粗糙度生成的mipMap图,这导致了对于不同粗糙度的镜面反射都一样
可以从上面的图片看到,铁桶上方锈迹斑斑的地方反射也很强
// Prefilter
osg::ref_ptr<osg::Image> img1 = new osg::Image;
{
osg::Shader* fs = osgDB::readShaderFile(
osg::Shader::FRAGMENT, SHADER_DIR "std_environment_prefiltering.frag.glsl");
osgVerse::Pipeline::createShaderDefinitions(fs, 100, 130);
img1->allocateImage(w, h, 1, GL_RGB, GL_UNSIGNED_BYTE);
img1->setInternalTextureFormat(GL_RGB8);
osg::ref_ptr<osg::Program> prog = new osg::Program;
prog->addShader(vs); prog->addShader(fs);
cam1 = createRTTCameraForImage(osg::Camera::COLOR_BUFFER, img1.get(), true);
cam1->getOrCreateStateSet()->setAttributeAndModes(
prog.get(), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
cam1->getOrCreateStateSet()->setTextureAttributeAndModes(0, hdrMap.get());
cam1->getOrCreateStateSet()->addUniform(new osg::Uniform("EnvironmentMap", (int)0));
cam1->getOrCreateStateSet()->addUniform(new osg::Uniform("GlobalRoughness", 4.0f));
}
TOMBrian881 commented
xarray commented
您好,非常感谢。我会检查一下生成数据的程序,有可能是没有正确使用texLod函数。如果您能帮忙找到问题所在并提交pull request,那就再感谢不过了~