Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

预滤波HDR环境贴图 #7

Open
Open
@TOMBrian881

Description

您好,目前我发现镜面IBL中的预滤波HDR环境贴图并非是根据粗糙度生成的mipMap图,这导致了对于不同粗糙度的镜面反射都一样
image
可以从上面的图片看到,铁桶上方锈迹斑斑的地方反射也很强

 // 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));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /