Exa

Import Lightmaps from Unity

Recommended Posts

Hello everyone

I am trying to use Unity Lightmaps with babylon via the Babylon Unity exporter

I use Unity v5.6.3p2 and the BabylonJS Toolkit v 1.0 with Babylon 2.5

For now it's a nightmare, i've tried a lot of combinations with different shader/configuration and nothing works

I do my test with a simple fbx and 2 materials/textures, someone have some informations about that?

Any help appreciated :)

Share this post


Link to post
Share on other sites

BabylonJS Toolkit 3.1 Alpha... Coming Soon... Looking for partners to help finish up the details and get released...

FYI... Check out this screen shot with shadows... I am asking for support of ambient occlusion WITH light map support:

 

Share this post


Link to post
Share on other sites
Just now, Exa said:

It looks like you succeed to get proper shadows with lightmap, did you use only exporter?

That version you have is really a proof of concept version... My new version is WAY BETTER with a tons of built in features for baking lights as well as ton of other stuff like Animation State Machine, Transitions and Partial Blend Tree Support.

I need some 'Technical Guys' to help me finish up a few things like:

1... Playing weighted animation blends on bones (not simply interpolating between animation clips or ranges) 

2... Particle System Update Of Time Features

3... Using a Texture Atlas in GLSL Shader (fract function in GLSL leaves edge seems)

4... LDRCubeTexture implementation for Tone Mapped HDR skyboxes (Hopefully @Sebavan is still going to create this ) :)

5... Animation FootIK implementation (Wish List) :) Ping @Deltakosh ... If you can Gove me tutorial on how I can implement this :)

6... Networking Support (this guy got networking: http://shellshock.io)... I would LOVE if ANYONE can tell me how he is doing this ??? PLEASE :)

7... Terrain Grass Billboard and Detail Prototype Support to go along with the TREE instances support that I have working now for Terrains

8... Lightmaps with ambient occlusion support (Wish List) :) Ping @Deltakosh

Share this post


Link to post
Share on other sites
12 hours ago, Sebavan said:

@MackeyK24 About 4. We are now relying on DDS for environment maps as available here : https://doc.babylonjs.com/overviews/physically_based_rendering#light-setup

Im sorry @Sebavan but I don't see how to use DDS... Are we just using the BABYLON.CubeTexture with a .dds 

or is there some BABYLON.DDSCubeTexture class ... The link just says about converting to .dds

Share this post


Link to post
Share on other sites

I found this in some guys loader:

 scene.environmentTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("src/images/" + options.environment + "SpecularHDR.dds", scene);
    scene.environmentTexture.gammaSpace = false;
    
    if (skybox) {
        skybox.material.reflectionTexture = scene.environmentTexture.clone();
        skybox.material.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
    }
    else {
        skybox = scene.createDefaultSkybox(null, true,);
    }

 

First off if the regular cube texture is use for dds files... how would I serialize that cube texture like any other texture

second ... what is scene.enviromentTexture. and Why would you need or use that if you have a skybox reflection texture ...

What is the advantage od settings a .dds INSTANCE to scene.envorinmentTexture and setting a cloned instance to skybox.reflectionTexture ?

 

Share this post


Link to post
Share on other sites

If Babylon.CubeTexture is the 'customType' in the json then I should just be able to set the raw .dds:

      "reflectionTexture": {
        "customType": "BABYLON.CubeTexture",
        "filtered": true,
        "name": "Level_Skybox.dds",
        "level": 1.0,
        "hasAlpha": false,
        "getAlphaFromRGB": false,
        "coordinatesMode": 5,
        "isCube": true,
        "uOffset": 0.0,
        "vOffset": 0.0,
        "uScale": 1.0,
        "vScale": 1.0,
        "uAng": 0.0,
        "vAng": 0.0,
        "wAng": 0.0,
        "wrapU": 0,
        "wrapV": 0,
        "coordinatesIndex": 0,
        "isRenderTarget": false,
        "renderTargetSize": 0,
        "mirrorPlane": null,
        "renderList": null,
        "animations": null,
        "extensions": null,
        "samplingMode": 3
      },

 Is that the way to use .dds file directly in a texture or is there another class to handle .dds like BABYLON.HDRCubeTexture or a specific BABYLON.DDSCubeTexture that I just don't know about ???

Share this post


Link to post
Share on other sites
22 hours ago, Sebavan said:

@MackeyK24 About 4. We are now relying on DDS for environment maps as available here : https://doc.babylonjs.com/overviews/physically_based_rendering#light-setup

Hey @Sebavan... Do you have a working copy of this IBL Baker...

I gotta say... ITS HARDER to get a panoramic dds file than it was workin with just .HDR.

Every converter I can find DOES NOT create the proper DDS with the frames and mip maps... the ONLY dds files I can get to work are the few VERY LOW RES dds you have samples for like the countrySpecularHDR.dds

I cant get this stupid IBL baker to build... Is say looking for Visual Studio 14 (I think its referring to 15 but says 14)... Cant get old VS2015 to install on my machine after I had VS2017... I tried to run the pre-built version in bin64 and it just CRASHES after loading a few of its .dds files.

Bro.. Are you sure we cant do what we talked about before... Just using regular PNG pixels and maybe create some kind of LDRCubeTexture.

I can easily tone map a HDR down to LDR and make the panoramic png... the only problem was trying to use the panorama png with the current babylon renderers and switches to try use panorama files show funny spiral at the very top and very bottom of scene when trying to use as skybox. HDR is way to big and expensive... and these HDR Cubemap DDS (not just simply converting to the DDS format but has to use frames and mip maps and I think 64bbp RGBA Half encoding)... Its going a be tough to freely make those kind of dds files :(

 

Share this post


Link to post
Share on other sites
5 hours ago, Exa said:

@MackeyK24 is there a way to have access to the last version of the Unity exporter or you still keep it private for now?

Im working as fast and best as i can to get a version out. Like I said before I could use a partner to help with some of listed issues :(

 

Share this post


Link to post
Share on other sites

The converter is here in the next chapter of the doc: https://doc.babylonjs.com/overviews/physically_based_rendering#env-map

Main issue is without such converter the environment preprocessing does not work well, and for better result you could even use Lys software. Now maybe you could extract the preprocessed version from Unity... maybe.

It is probably harder than .hdr for your pipeline but it makes the visual result much more consistent. Maybe you could integrate it in your export through command line.

Last thing is where are you documentation wise ? I am really hoping to rely on the exporter and it would be nice to have a doc as currently it makes it pretty hard to use or rely upon. The videos are ok but they can not replace the doc unfortunately.

 

Share this post


Link to post
Share on other sites
4 hours ago, Sebavan said:

 

The converter is here in the next chapter of the doc: https://doc.babylonjs.com/overviews/physically_based_rendering#env-map

 

Yo @Sebavan... I tried... Cant even build the GitHub project.

Is say looking for Visual Studio 14 (I think its referring to 2015 but says Version 14)... Cant get old VS2015 to install on my machine after I had VS2017... I tried to run the pre-built version in bin64 and it just CRASHES after loading a few of its .dds files.

I also tried several DDS conversion software... All of them just basically convert to dds image format... None of them can actually take a panorama HDR and "Auto-Magically" create a single DDS files (with the proper features like mip maps and it looks like some kind of framing for the faces)...

If you look at on of the sample contrySpecularHDR.dds in Visual Studio... the properties says it has frames and using 64bpp RGBA Half pixel encoding... Now if you can get and generate a dds like that your golden... BUT THATS TOUGH...

Thus far... I found a old port of the AMD CubeMapGen windows program... Is I basically have to take the panorama HDR file and SPLIT OUT the Cubemap faces to separate images (using either 3rd party software or my own internal Cubemap splitter based of Unity Image Importer) via a Spherical to Cubical conversion. In unity we can use API to render out Cubemap faces... 3rd party software that lets convert Spherical to cube and save out faces as images... Then I feed those images into another software that is capable of create DDS Cubemap (again which uses frames and mip maps) from cube face images and reconstruct all that back into a single file (but in DDS Cubemap format)... For now I am at least having SOME positive results using the CubeMapGen ... Still don't have a workflow yet :(

 

Share this post


Link to post
Share on other sites

Yo @Sebavan  and @Deltakosh... I found some really simple command line DirectX Texture Tools: TexAssemble Wiki and TexConv Wiki

Its ALOT easier to use/install than IBLBaker (I still never got that going so I really don't know what that software is like, how good are the HDR/DDS Tools it has)

The Latest Binary DirectX Texture Tools.

You can assemble then convert HDR/DDS and many other formats (Note: Convert adds mipmap and compression to an assembled DDS)

Example Usages

// Tone Map High Dynamic Range To TIFF
c:\dxt\texconv country.hdr -wiclossless -wicq 1.0 -ft tif

- AND -

// Assemble Direct Draw Surface Cubemap
c:\dxt\texassemble cube -w 512 -h 512 -o cubemap.dds px.png nx.png py.png ny.png pz.png nz.png

- AND -

// Generate Mip Maps And BC1 Compression
c:\dxt\texconv cubemap.dds -m 0 -y -f BC1_UNORM

I have included the windows .exe in the Toolkit/Plugins/Windows Folder as well :)

 

Share this post


Link to post
Share on other sites
4 hours ago, Deltakosh said:

(make sure you are allowed to redistribute the exe. Most of the time it is a violation of their license)

Yo are right... I will not ship the .exe but will make a reference to the Github releases for the DirectX texture Tools should you wish to use them :)

 

Share this post


Link to post
Share on other sites

Yup, they are not. they are good at assembling textures of differents format cross, strip cube planar... and so on to generate nice DDS from them. but this is not our missing part.

The missing part is the entire prefiltering. This part is used to blur the different mipmaps according to a roughness level. This is what cubemapgen is doing on cpu which is slow. This what you can also  do with IBL Baker (open source) on GPU or LYS (professional tool) in order to ensure that the level of "blur" in the texture fits perfectly with a chosen roughness.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.