Jump to content

What is scene._environmentBRDFTexture?


Recommended Posts

While I still want to know what that is, I found it because I was looking at scene level environment texture.  Is there functionality to cause a sky box to be added without actually creating the mesh yourself?  Could this maybe be added, where the programmer is still responsible for the radius?  Blender can do this, but I do not think it actually needs a box.


Link to comment
Share on other sites

Thanks.  Something weird though, I cannot find "createDefaultEnvironment" in the scene.ts file.  I tried the one in Github. Finally found it in sceneHelpers.  I see EnvironmentHelper has no serialized options, or a parse method.  That would mean the JSON exporter would not be able to set the option (overrides actually) of a default environment.

Think I'll just try to see if environment texture through for now.  Possibly add Blender custom properties later.

Link to comment
Share on other sites

Well, re-activating topic since I found new stuff.  I am currently reading node trees now, and this what it looks like from Blender 2.79 / cycles.


For .babylon (JSON), there is actually both facilities for environment textures & skybox right in babylonFileLoader.ts.  Sorry, but I do not know what some of this stuff is.  I just got this hiker cave file from https://hdrihaven.com/hdris/.  blender works with this.  Is this a BABYLON.HDRCubeTexture?  If so, what is the hdrSize, an arbitrary number that is a power of 2, or the size of the texture?  I an not sure how or if I can get a texture dimension from Blender.  Next would be what is environmentTextureRotationY?

Would anything need to be different when using PBR vs not?  I hope not, since that is all that is serializable.

Link to comment
Share on other sites

Ok, been playing some more, does it make sense that the equivalent of the HDRTexture vs createFromPrefilteredData in Blender / Cycles is the color_space parameter of the Environment Texture?  In the picture above, it is set to Color, but here is the dropdownlist:



Should it be createFromPrefilteredData  when Non-Color Data?

Link to comment
Share on other sites

Also, found that this code probably is not in use for the skybox part, anyway.  The lines in FileLoader are:

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(undefined, true, skyboxScale, skyboxBlurLevel);

The environmentTexture arg for createDefaultSkybox is being check that is valid, which undefined is not:

Scene.prototype.createDefaultSkybox = function(environmentTexture?: BaseTexture, pbr = false, scale = 1000, blur = 0, setGlobalEnvTexture = true): Nullable<Mesh> {

    if (!environmentTexture) {
        Tools.Warn("Can not create default skybox without environment texture.");
        return null;

Seems that scene.environmentTexture from a few lines above could be passed.  hard coding pbr being true is unfortunate.  Wish there was a parsed value for that.

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.

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.


  • Recently Browsing   0 members

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