MasterK

How to export Unity3D baked light texture???

19 posts in this topic

i used the old exporter. the exported materials mostly only have diffuseTexture.

And i should add lots of lights to scene. and it really down the performance.

How to export the baked light texture and make matreial has lightMapTexture or something else? 

I see the u3d-toolkits may have this function. But it seems too big to me. Is that a simple way to modify exportor code?

@MackeyK24

 I can't explain i ping you almost everytime except you're nice@Deltakosh 

Share this post


Link to post
Share on other sites

OK.

I should try u3d toolkit. and i tried.

there is baked light texture. but in my scene. all black...

Share this post


Link to post
Share on other sites

Light Mapper Mode choose "Shadow Baking" can generate lightmap texture.

But the effect almost none... 

Share this post


Link to post
Share on other sites

This is use realtime light. 

58d0aa0fec6dc_QQ20170321121807.thumb.png.fa1ea1ddada6f15ac15f5ae40c6e1987.png

and this is use baked lightMap. And i see no any effect of lightmap.

58d0aa3bb24fe_QQ20170321121946.thumb.png.29e24c3187e950090afeb513bc727366.png

 

And about prefab. i remove all except one prefab. and create instance in code. so these instances are whole black.

I wonder if the toolkit can handle prefab to create instance?? And the bake light can effect instance???

 

Share this post


Link to post
Share on other sites
15 hours ago, MasterK said:

This is use realtime light.

and this is use baked lightMap. And i see no any effect of lightma

 

And about prefab. i remove all except one prefab. and create instance in code. so these instances are whole black.

I wonder if the toolkit can handle prefab to create instance?? And the bake light can effect instance???

 

Hey @MasterK how are you, I see the light maps, I'M having the same issues, when I bake try to bake just spot lights and put them as mix, I think  the mix mode bakes the lights for static meshes and also does real light  interaction on dynamics meshes please  @MackeyK24   confirm this info about he mix and bake options.

So Tonight I will delete my project folder because I think is reusing the light maps even when I disable the baking.

make sure you have this on for the light baking 

lightmap.JPG.06c8a78694413e024249c28f0c008e40.JPG

, and as soon as I figure how to light the rest of the stuff I will send you a sample fully baked, But the new toolkit will come soon with this fixes, Im stock on the documentation about this because Mackey had  change many things for better on the toolkit .

 

Share this post


Link to post
Share on other sites

I think there's no way to solve the "prefab instance's(i created later) light problem".

So i give up use this bake light.

Share this post


Link to post
Share on other sites
16 hours ago, MasterK said:

I think there's no way to solve the "prefab instance's(i created later) light problem".

So i give up use this bake light.

Hey man @MasterK I made it work last night, to fix it make sure anything you bring from unity  you change the shader to the speculator PBR also 

sahderBad.JPG.b89ca46e4fff5693725f12517bcddc75.JPG to shaderGood.JPG.eff359bcc8c1182e8479c47e103e5ff0.JPG and

make sure you have PRECOMPUTE Realtime GI off and all lights MIX no baking no real time MIX ... let me kn ow if that helps

precomputed.JPG.8d4ffc57be06656586cc091de90b9023.JPG

 

 

CandyLand3.thumb.PNG.92115569d637436fd48a39bdafb4c980.PNGCandyLand2.thumb.PNG.da38f30f65113ef779cd421dd8daf315.PNG

Share this post


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

Did I mention that we desperately need a doc for that?

Yes, you did. 

Even a simple doc. just a few words about the toolkit usage. otherwise we dont know use toolkit to do what. 

And i think the exporter is the most important thing. to use whole toolkit function? left it to insane boys.

Thanks MrVR but i won't try it now...

Because the prefab---instance issue i think can't be solved.

Share this post


Link to post
Share on other sites

Hey @MasterK and @MrVR ... Im back... I had guests in from mainland ... so i had not had a chance to take a look at your problem...

Are you still having problems with light maps ???

Share this post


Link to post
Share on other sites

@MackeyK24

Yeah still. And even if light map problem be solved, the prefab/instance light can't.

can the exporter make one prefab as a mesh and others instances ??

Share this post


Link to post
Share on other sites
38 minutes ago, MasterK said:

@MackeyK24

Yeah still. And even if light map problem be solved, the prefab/instance light can't.

can the exporter make one prefab as a mesh and others instances ??

 What prefab light problem... Can you make a quick video and show me exactly what problem you are talking about?

 

Share this post


Link to post
Share on other sites
On 2017/3/21 at 0:25 PM, MasterK said:

This is use realtime light. 

58d0aa0fec6dc_QQ20170321121807.thumb.png.fa1ea1ddada6f15ac15f5ae40c6e1987.png

and this is use baked lightMap. And i see no any effect of lightmap.

58d0aa3bb24fe_QQ20170321121946.thumb.png.29e24c3187e950090afeb513bc727366.png

 

And about prefab. i remove all except one prefab. and create instance in code. so these instances are whole black.

I wonder if the toolkit can handle prefab to create instance?? And the bake light can effect instance???

 

if i have 100 trees. i manually delete 99 trees only left node in U3D. and load in BJS and create 99 instance by code.

and the 100 trees use same one material. so the lightmap can't fit for 100 trees.

 

Share this post


Link to post
Share on other sites
On 3/22/2017 at 8:01 AM, MrVR said:

Hey man @MasterK I made it work last night, to fix it make sure anything you bring from unity  you change the shader to the speculator PBR also 

sahderBad.JPG.b89ca46e4fff5693725f12517bcddc75.JPG to shaderGood.JPG.eff359bcc8c1182e8479c47e103e5ff0.JPG and

make sure you have PRECOMPUTE Realtime GI off and all lights MIX no baking no real time MIX ... let me kn ow if that helps

precomputed.JPG.8d4ffc57be06656586cc091de90b9023.JPG

 

 

CandyLand3.thumb.PNG.92115569d637436fd48a39bdafb4c980.PNGCandyLand2.thumb.PNG.da38f30f65113ef779cd421dd8daf315.PNG

Actually all the BLACK Texture and LIGHT issues had to do with the combination of Light Type and Lightmapper Shadow Bake  options...

Now this is changed no in the new 1.1 version... But basically light mapper Full light baking option don't allow ANY lights in scene and on top of that if you look at the code (.cs) files.. It also set ALL materials.disableLighting = true and materials.useEmissiveAsImmunation = true... My intent was if you had that option on YOU MUST use emissive texture instead of albedo of diffuse to self illuminate for mobile platforms that can't afford ANY lights at all.

If you where in Shadow Baking mode... Only NON baking lights included in scene (light.mode == Baked)... Realtime lights and mixed lights only... Mixed lights are used for baking AND to also include in scene. 

The new version this now a switch that is defaulted to Auto... if manual... You must BUILD the final light maps using the "Generate" button on lighting panel...

There is NO Full light baking now... if you want to do something like that for mobile platforms... Just don't use any runtime lights, only baking... and setup your materials to self illuminate.

Again... the new version fixes all this and uses WHATEVER shader that uses uses the standard unity material property names like _Color and _MainTex (Diffuse Or Albedo)... So you don't have to changes shaders on all your props (if they use unity material property names).

Precomputed lighting basically says UNITY will maintain some "Precomputed Values" for Light Intensity, Ambient Intensity and Reflection Intensity for the whole scene... It will be hard to MATCH up these exact pre-computed values in Babylon so your babylon looks EXACTLY the the design time unity version that is shows in the Unity Game Window... Now the new version has a Lighting section on the SceneController that will allow you to scale up down these values in your babylon scene so you can make your babylon scene look as close as possible to the original unity scene (as far as various lighting values are concerned)

If you take OFF pre-computed lighting off in unity... the Lighting values will be the same in babylon (or as close as the two different shaders... Unity HLSL and Babylon GLSL renders the scene). Then you simply increase the various lighting intensity values for your light and your ambient light and your reflection values... which default to 1.0... Same as unity WITHOUT pre-computed lighting

I prefer to work WITHOUT precomputed lighting so my scene look the same.

DOCUMENTATION... I basically pawned this off on @MrVR ... I have working with him the on inner working of the toolkit and he agreed to handle the doc write-ups (that i will go over and publish on unity docs). 

We hope to have soon ...

Note the new version requires Unity version 5.6 (Many Unity Pipeline and Breaking API changes to handle the NEW unity Lighmapping features and bug fixes) and Babylon version 3.0 minimum ... So i am also waiting for both Unity 5.6 ... released on March 31st and whenever babylon 3.0 goes to stable version and available as Babylon-3.0 (like the Babylon-2.5 version are currently named)

So what you see above from @MrVR nighttime candy land scene is my version 1.0.1 beta... New upcoming Version 1.1 should fix ALOT of everyones problems plus bring a TONS of awesome game developer features... Babylon Runtime Instantiate Prefab Support and and brand new lightweight Animation State Machine that supports multiple animation states (also playable via code: this.manager.playAnimation("Running", mimes) ... or whatever) and AnimationEvents marked at design time direction in the Transform OR Skeletal Animation Clip... Also using code like:

 

            this.onAnimationEvent("TestEvent", (evt:BABYLON.IAnimationStateEvent)=>{
                var stringArg = evt.stringParameter;
                console.log("===> Got Animation Event: " + stringArg);
            })

 

Also... Tools like Cubemap Splitter and Static Mesh Combiner...

Be on the look out for the new and improved version :)

 

Share this post


Link to post
Share on other sites

@MasterK the realtime light issue is Ambient lighting... i think you have the FIRST 1.0.0 release and in that version on scene controller crank Ambient Level up to 2.5 or something... Or wait a bit for new version .. on the 31st i will put out new version for the hard care fold trying to use without docs... Again hope to have docs real soon after that.

I still don't know exactly what your saying about 100 and remove 99...

 

But think my new Mesh Combiner can help with the props... Keep all 100 trees on the scene (provided they are static)... under a EMPTY parent game object then use the Mesh Combiner to combine all meshes by material... So your you had 100 tress that used a total of 3 different materials you would end up with 3 combined meshes... one for each material used... you will then end up with design time combined and optimized meshes that you WONT need to come back at runtime and create copies of that you then are probably want to try and merge at runtime... Mesh combiner way better...

if you want to instantiate a "Fully Scripted" component ... just put the component on the the Babylon Prefab Layer then can use that prefab at runtime at create as many as you want... this.manager.instiatePrefab("Player", "MyPlayer", new BABYLON.Vector3(0,0,0));

the manager api fully implements DEEP COMPLEX cloning with full script and metadata support...

Can also break down scene and make fully scripted Character in SEPARATE scene and use SceneController import scene mesh dependency feature...

 

Share this post


Link to post
Share on other sites
44 minutes ago, MasterK said:

if i have 100 trees. i manually delete 99 trees only left node in U3D. and load in BJS and create 99 instance by code.

and the 100 trees use same one material. so the lightmap can't fit for 100 trees.

 

 Can you package up that scene and ill see what i can doc with those props from your scene and make a video showing how to handle some of your problems.  just make a unity export package with all the stuff required for your scene and send it to me... [email protected]

 

MasterK likes this

Share this post


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

Hey @MasterK and @MrVR ... Im back... I had guests in from mainland ... so i had not had a chance to take a look at your problem...

Are you still having problems with light maps ???

HI  @Deltakosh, @MasterK, @MackeyK24 

The toolkit its no ready PLEASE BE PATIENCE I have been testing and working on this for months but I need to go over a few things with @MackeyK24 before any docs are release, this will be available soon.

 

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.