No Export .env Button In The Inspector

I have a .dds file set on the scene and it show reflections on sphere but i DONT have a
Export .env button like in the sandbox. Why is that ???

Has your DDS file been preprocessed and include all the MipMap chain ?

I mean did you go through Lys/IblBaker/others ?

Yep … I use cmft command line tools in the toolkit to generate the dds… the reflections are beautiful… just does not show Export .env button even though reflections are fine

@MackeyK24 I’m greatly interested by these commands lines! ('have tried some tests on Linux with CMFT but don’t succeed to get a dds file until now…) Is it possible to share them? (or to send the doc/source link from where you’re find them). I will then add them to the doc.

Did you load it use CreateFromPrefilteredData function to load?

Yes I did load using create from preferred static function

Can you share the DDS with us ? I want to try it locally ?

Yo @sebavan

Here is the dds file made with cmft command line using RGBA16F

Canyon_env.dds.zip (728.7 KB)

Yo @sebavan and @Deltakosh

I thought Babylon supported RGBA32F dds texture files. but i made this RGBA32F dds using cmft command line. It shows up great in Unity but gets Unsupported FourCC code: DX10

Canyon_env_rgbf32f.dds.zip (1.4 MB)

49%20PM

Yes we do support 32F but not all the four CC ones. They need to be saved in the default legacy format for DDS.

About your DDS, it works ok in the sandbox:
image

Here are the conditions to respect to create env files:
!scene.getEngine().premultipliedAlpha && scene.environmentTexture && scene.activeCamera

so your Engine needs to be started in none premultiplied mode:
BABYLON.Engine(canvas, true, { premultipliedAlpha: false…

How to use cmft to save in legacy dds format … is there a switch for that on the command line of cmft ???

I don t know CMFT enough.

Yo @sebavan … Will babylon EVER support NON legacy DDS 32F format ???

If NOT… I will remove that option from my Cubemap Baker Tool (which uses CMFT command line to produce dds files)

Thanks @sebavan … the premultipliedAlpha option worked perfectly to enable Generate .env texture button :slight_smile:

No plan so far but discussion is going on about reusing the filament generator (cmgen) that we could potentially support.

cmgen is fully open source and cross plat.

Yo @Vinc3r

Well i basically create a Static Utilities Function that i can call from my Unity Toolkit Cubemap Baker Dialog… That is where i setup all the options:

That use the ConvertCubemap static function to build command line option and then execute a external process to with the cmft executable

        public static int ConvertCubemap(string input, string output, int size, EditorCubemapFormat format = EditorCubemapFormat.RGBA16F, EditorCubemapLight lighting = EditorCubemapLight.BLINNBRDF, EditorRadianceType radiance = EditorRadianceType.NONE, int glossScale = 10, int gloassBias = 3, bool excludeBase = true, int numberOfCpus = 4, float options_ign = 2.2f, float options_igd = 1.0f, float options_ogn = 1.0f, float options_ogd = 2.2f, string output_format = "dds", string output_type = "cubemap", string edge_fixup = "none")
        {
            string hdrFilter = radiance.ToString().ToLower();
            string hdrSize = size.ToString();
            string hdrBase = excludeBase.ToString().ToLower();
            string hdrGloss = glossScale.ToString();
            string hdrBias = gloassBias.ToString();
            string hdrMips = (radiance != EditorRadianceType.NONE) ? "true" : "false";
            string hdrCpus = (numberOfCpus > 0) ? numberOfCpus.ToString() : "4";
            string hdrFormat = (format == EditorCubemapFormat.RGBA32F) ? "rgba32f" : "rgba16f";
            if (output_format.Equals("hdr", StringComparison.OrdinalIgnoreCase)) hdrFormat = "rgbe";
            string hdrLights = "blinnbrdf";
            switch (lighting) {
                case EditorCubemapLight.PHONG:
                    hdrLights = "phong";
                    break;
                case EditorCubemapLight.PHONGBRDF:
                    hdrLights = "phongbrdf";
                    break;
                case EditorCubemapLight.BLINN:
                    hdrLights = "blinn";
                    break;
                case EditorCubemapLight.BLINNBRDF:
                    hdrLights = "blinnbrdf";
                    break;
            }
            string cmftTools = UnityTools.GetDefaultFilterToolPath();
            string inputPath = input;
            string outputPath = Path.Combine(Path.GetDirectoryName(output), Path.GetFileNameWithoutExtension(output));
            if (inputPath.StartsWith("Assets/", StringComparison.OrdinalIgnoreCase)) inputPath = UnityTools.GetNativePath(inputPath);
            if (outputPath.StartsWith("Assets/", StringComparison.OrdinalIgnoreCase)) outputPath = UnityTools.GetNativePath(outputPath);
            string[] commandLines = new string[] {
              " --input \"" + inputPath + "\"",
              // Filter Options
              " --filter " + hdrFilter,
              " --srcFaceSize " + hdrSize,
              " --dstFaceSize " + hdrSize,
              " --excludeBase " + hdrBase,
              " --glossScale " + hdrGloss,
              " --glossBias " + hdrBias,
              " --lightingModel " + hdrLights,
              " --generateMipChain " + hdrMips,
              " --numCpuProcessingThreads " + hdrCpus,
              // Additional Options
              " --inputGammaNumerator " + options_ign.ToString(),
              " --inputGammaDenominator " + options_igd.ToString(),
              " --outputGammaNumerator " + options_ogn.ToString(),
              " --outputGammaDenominator "  + options_ogd.ToString(),
              // Processing Devices - TODO: Support Edge Fixup Options
              " --edgeFixup " + edge_fixup,
              " --useOpenCL true",
              " --clVendor anyGpuVendor",
              " --deviceType gpu",
              " --deviceIndex 0",
              // Output Parameters
              " --outputNum 1",
              " --output0 \"" + outputPath + "\"",
              " --output0params " + output_format + "," + hdrFormat + "," + output_type
            };
            StringBuilder commandLine = new StringBuilder();
            foreach (var item in commandLines) { commandLine.Append(item); }
            string cmftArguments = commandLine.ToString();
            return UnityTools.ExecuteCommand(cmftTools, cmftArguments);
        }
1 Like

Thanks, I will make some tests on cmft with that.