Page 9 of 19

Re: Investigations on Realtime Reflections in Unity

Posted: Tue Sep 20, 2016 9:17 am
by Nystul
sure!
sry for causing those issues - wasn't aware of them.

Re: Investigations on Realtime Reflections in Unity

Posted: Tue Sep 20, 2016 9:29 am
by Interkarma
Cheers, and no problems at all. :)

Will try this and update builds for testers so they can check out your changes, which look amazing btw.

Edit: Yep, that fixed it. New builds up soon with this feature available.

Re: Investigations on Realtime Reflections in Unity

Posted: Tue Sep 20, 2016 9:57 am
by Nystul
perfekt thanks!

edit: I investigated a bit further and found out that it is pretty easy to make it dx9 compliant - the fix basically fulfills the requirement from the error message you encountered - it just uses 4-component output values for the fragment functions - is pretty easy to change the code to fulfill those requirements.

I will issue another pull request upon your changes soon (hopefully this is ok) - I think it will be worth it, having deferred reflections also in the dx9 path

Re: Investigations on Realtime Reflections in Unity

Posted: Tue Sep 20, 2016 11:00 am
by Interkarma
Cool, thanks! :) I've already created tonight's builds. Will post these now and merge/test changes tomorrow when I can.

Re: Investigations on Realtime Reflections in Unity

Posted: Tue Sep 20, 2016 11:58 am
by Nystul
cool! no problem, we are in no hurry ;)

edit: tested the newest live build - indoor reflections work but there seems to be a problem with the updated MetallicGlossMap texture files from the ReflectionMod/Resources folders. Seems like they are not included in the build.
What was the solution for the shaders last time - maybe this could be applied to the textures as well. Or maybe just the meta files of the textures need to be deleted and freshly created by unity)

Re: Investigations on Realtime Reflections in Unity

Posted: Tue Sep 20, 2016 12:39 pm
by Interkarma
Thanks for letting me know. Anything in a Resources folder should be rolled into build. I'll see what's going wrong.

Could you provide me with a quick screen of it working normally (or send me a save at a good spot)? That way I have something to directly check after fix.

Re: Investigations on Realtime Reflections in Unity

Posted: Tue Sep 20, 2016 12:48 pm
by Nystul
sure, will pm you the link to the save file (including the screenshot how it should look)

Re: Investigations on Realtime Reflections in Unity

Posted: Wed Sep 21, 2016 12:48 am
by Interkarma
Thanks for sending through. :)

OK, so issue seems to be that Standard shader variant with keyword _METALLICGLOSSMAP is being stripped from build. This isn't that unusual, as Unity will strip anything it doesn't think is used by a scene at runtime, or isn't present in the Resources folder. Because these materials are created at runtime, Unity doesn't know to include them.

Normally I can fix this easily by just adding a dummy material to Resources, or by adding required shader to variant collection. But I'm having a fun time with this one. Even shotgunning all Standard material keywords to a dummy material and adding every variant to the collection still doesn't yield a working metallic glossmap material at runtime in builds. :evil:

Would I be able to volley back to you for a bit? If you're able to create a working copy of that metallic glossmap material in a test scene (e.g. on a sphere or cube), rather than just at runtime, that should force correct variant to be included in build. It might even help identify what's missing and create a specific dummy material.

Re: Investigations on Realtime Reflections in Unity

Posted: Wed Sep 21, 2016 6:44 am
by Nystul
Sure! Will spend the time on it. After reading the documentation about #pragma multi_compile vs shader_feature I am confident this is the culprit. Will have to test it with multi_compile instead of shader_feature. This is the main difference between the old and the new reflections mod shaders. The old worked so I hope this is it.
Thanks for pointing out that it has to do with the shader keyword. This pointed me into the right direction hopefully.

edit: pull request is issued - shader pragma multi_compile replaces shader pragma shader_feature - hopefully will solve the MetallicGlossMap issue

Re: Investigations on Realtime Reflections in Unity

Posted: Wed Sep 21, 2016 8:16 am
by Interkarma
Boom! Fixed!

All I needed was the usual dummy material to force it into build, and now it works perfectly. Great work! :)