Jump to content

Promoting isPBR in FileLoader.ts


Recommended Posts

Well, the PR for adding isPBR as a parsed value for setting up a skybox is complete.  But, I am currently working on the Javascript exporter, so I needed to looked up the constructor for a HDRCubeTexture, and I just saw the gammaSpace arg.  This is to be false for PBR & true for STD.  Think I need another PR to promote when the parse parameter is defined, so it can be used in both.  Something like:

if (parsedData.environmentTexture !== undefined && parsedData.environmentTexture !== null) {
    // PBR needed for both HDR texture (gamma space) & a sky box
    var isPBR = parsedData.isPBR !== undefined ? parsedData.isPBR : true;
    if (parsedData.environmentTextureType && parsedData.environmentTextureType === "BABYLON.HDRCubeTexture") {
        var hdrSize: number = (parsedData.environmentTextureSize) ? parsedData.environmentTextureSize : 128;
        var hdrTexture = new HDRCubeTexture(rootUrl + parsedData.environmentTexture, scene, hdrSize, true, !isPBR);
        if (parsedData.environmentTextureRotationY) {
            hdrTexture.rotationY = parsedData.environmentTextureRotationY;
        }
        scene.environmentTexture = hdrTexture;
    } else {
        var cubeTexture = CubeTexture.CreateFromPrefilteredData(rootUrl + parsedData.environmentTexture, scene);
        if (parsedData.environmentTextureRotationY) {
            cubeTexture.rotationY = parsedData.environmentTextureRotationY;
        }
        scene.environmentTexture = cubeTexture;
    }
    if (parsedData.createDefaultSkybox === true) {
        var skyboxScale = (scene.activeCamera !== undefined && scene.activeCamera !== null) ? (scene.activeCamera.maxZ - scene.activeCamera.minZ) / 2 : 1000;
        var skyboxBlurLevel = parsedData.skyboxBlurLevel || 0;
        scene.createDefaultSkybox(scene.environmentTexture, isPBR, skyboxScale, skyboxBlurLevel);
    }

I see that the cubeTexture route has gamma space, but depends on the file extension.  For my exporters, just always going to force HDRCubeTexture route.

Is this look right? Should I modify what's new again, or is the last entry still going to cover this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...