[MOD] Realtime Reflections

A curated forum for approved mods. Users are unable to create new topics in this forum but can reply to existing topics. Please message a moderator to have your mod moved into this forum area.
User avatar
Nystul
Posts: 1072
Joined: Mon Mar 23, 2015 8:31 am

Re: Investigations on Realtime Reflections in Unity

Post by Nystul » Tue Sep 20, 2016 9:17 am

sure!
sry for causing those issues - wasn't aware of them.

User avatar
Interkarma
Posts: 2887
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Post by Interkarma » Tue Sep 20, 2016 9:29 am

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.

User avatar
Nystul
Posts: 1072
Joined: Mon Mar 23, 2015 8:31 am

Re: Investigations on Realtime Reflections in Unity

Post by Nystul » Tue Sep 20, 2016 9:57 am

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

User avatar
Interkarma
Posts: 2887
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Post by Interkarma » Tue Sep 20, 2016 11:00 am

Cool, thanks! :) I've already created tonight's builds. Will post these now and merge/test changes tomorrow when I can.

User avatar
Nystul
Posts: 1072
Joined: Mon Mar 23, 2015 8:31 am

Re: Investigations on Realtime Reflections in Unity

Post by Nystul » Tue Sep 20, 2016 11:58 am

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)

User avatar
Interkarma
Posts: 2887
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Post by Interkarma » Tue Sep 20, 2016 12:39 pm

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.

User avatar
Nystul
Posts: 1072
Joined: Mon Mar 23, 2015 8:31 am

Re: Investigations on Realtime Reflections in Unity

Post by Nystul » Tue Sep 20, 2016 12:48 pm

sure, will pm you the link to the save file (including the screenshot how it should look)

User avatar
Interkarma
Posts: 2887
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Post by Interkarma » Wed Sep 21, 2016 12:48 am

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.

User avatar
Nystul
Posts: 1072
Joined: Mon Mar 23, 2015 8:31 am

Re: Investigations on Realtime Reflections in Unity

Post by Nystul » Wed Sep 21, 2016 6:44 am

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

User avatar
Interkarma
Posts: 2887
Joined: Sun Mar 22, 2015 1:51 am

Re: Investigations on Realtime Reflections in Unity

Post by Interkarma » Wed Sep 21, 2016 8:16 am

Boom! Fixed!

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

Post Reply