Material Ambient Light
-
- English
- paulevs
- Thread is Unresolved
-
-
material was created with code
What do you mean?
I had built my own shader in which 15-20% of the texture was output as emissive, which tricked it out poorly.
Could you maybe show me the trick you use? -
What do you mean?
You can create standard lit shader with code, it is a part of API:
-
Ah, ok thanks
-
I'm not sure, but this bug can be related to missing scripts in objects. Unity HDRP uses small scripts attached to objects as guidelines for shading engine, and in my experiments I noticed that all scripts attached to objects are not exported. Probably objects don't receive environment information due to missing HDRP scripts? If this is true then fix will be just adding these scripts to assets programmatically (from API side or from plugin side)
-
Sorry for my late response! It looks like that Unity is apparently stripping some shader variants when building the asset bundles (which are required to receive ambient light correctly)... I don't think we can fix that ingame (e.g. when loading the plugin), unless the default HDRP lit/unlit shader is used, so this needs to be done when building the bundles. I'll take a closer look at this issue and report back once I have a solution
in my experiments I noticed that all scripts attached to objects are not exported. Probably objects don't receive environment information due to missing HDRP scripts?
The reason is that the game uses IL2CPP, which doesn't support scripts loaded from asset bundles unfortunately (which is a pity)... but it's not causing this issue. HDRP only uses specific scripts for certain components (like cameras or lights), but they should still work in asset bundles.
-
unless the default HDRP lit/unlit shader is used
In my example above I used default lit shader. That actually happens to both default and custom shaders - they just don't receive scene environment light
-
In my example above I used default lit shader. That actually happens to both default and custom shaders - they just don't receive scene environment light
Yes, it happens for any shader, but I just meant that we could fix it retroactively if the element uses the default HDRP lit/unlit shader The game has its own copy of that shader in cache (which includes all necessary shader variants), so we could basically just replace the shader manually when loading the prefab. But of course that doesn't work for custom shaders, so it would be only a partial solution
Participate now!
Don’t have an account yet? Create a new account now and be part of our community!