CUAShadowFixer

Plugins + Scripts CUAShadowFixer

Download [21.63 MB]
Can we make that CUAShadowFixer automatically applied to all CustomUnityAssets in the scene ?
 
Great, you made the same thing what I tried to make, but better :D Mine assetbundle is 32 Mb, contains custom lux shader and do not work with bakery.
And yeah, would be nice to have scene plugin to replace shaders for every cua.
 
Can we make that CUAShadowFixer automatically applied to all CustomUnityAssets in the scene ?

I'll try to make this feature!

Great, you made the same thing what I tried to make, but better :D Mine assetbundle is 32 Mb, contains custom lux shader and do not work with bakery.
And yeah, would be nice to have scene plugin to replace shaders for every cua.

Thank you! I have several of your plugins that I use all the time, great work on those 😁
 
Mxx updated CUAShadowFixer with a new update entry:

v2 - Scene-wide mode / per-CUA tuning / Cached conversions

  • Scene-wide mode: Add CUAShadowFixer.cslist on an Empty atom (or load it as a Scene or Session Plugin) and it fixes every CustomUnityAsset in the scene at once. Put it on a single CUA atom and it works exactly like before. A new Scene CUAs tab lists every CUA with a checkbox (plus Include all / Exclude all), and the list keeps itself up to date as you add, remove, or rename CUAs.
    SPOILER="Scene-wide mode Tab"]View attachment 603215[/SPOILER]...

Read the rest of this update entry...
 
super usefull plugin! also something that might be cool to have on it would be the possibility to add a function to make objects double side render so objects that are transparent in one side can render back too to fix light leaks , its a tedious process to add boxes all over an enviroment to fix leaks 😅.

edit: here's why i came with this suggestion , in order to have an external light that cast shadows to the inside i have to duplicate the enviroment and use cua editor on the second enviroment so i hide all the enviroment and leave only windows active so enviroment 1 with shadow fix i hide the windows , this is because i can't use the force cast shadows because this enviroment doesn't have external walls .
VaM_2026_07_02_03_26_46_569.png

VaM_2026_07_02_03_26_37_179.png
 
Last edited:
super usefull plugin! also something that might be cool to have on it would be the possibility to add a function to make objects double side render so objects that are transparent in one side can render back too to fix light leaks , its a tedious process to add boxes all over an enviroment to fix leaks 😅.

edit: here's why i came with this suggestion , in order to have an external light that cast shadows to the inside i have to duplicate the enviroment and use cua editor on the second enviroment so i hide all the enviroment and leave only windows active so enviroment 1 with shadow fix i hide the windows , this is because i can't use the force cast shadows because this enviroment doesn't have external walls .
View attachment 603708
View attachment 603707

Really good suggestion! And your method of using a second cua with cua editor or using cubes sounds all too familiar. I'll work on it soon
 
Mxx updated CUAShadowFixer with a new update entry:

v3 - QoL feature: no more light leaking + Faster on bigger scenes

  • Two-sided shadow casting (fix light leaks)
    New toggle in the Fix Shadows tab. A lot of environment light leaks come from single-sided walls. The wall only casts a shadow from the front, so light (such as a directional light) spills through from behind. Turning on "Two-sided shadow casting" makes sure all meshes cast shadows from both faces, sealing those leaks while still keeping the backside see-through. You no longer have to place your own cubes or...

Read the rest of this update entry...
 
@BooMoon I've added a new toggle that makes all faces/walls cast shadows from both sides. If there are some walls you still want to have light come through, you can use the face-hide feature on those specific walls. Also note that windows might block light too after hitting the toggle, but using the face-hide on the outside face will let light shine through it again :)
 
Yo @Mxx, great plugin.

Just found a bug though. From what I can tell from some testing, if the CUA that I'm using this plugin on is parented to another atom, in this case an Empty, then your shader will not apply, even though the debug info in the plugin says "Applied" in green. I can parent the CUA to another CUA, but it seems like Empty, or maybe just any parent that is not a CUA seems to prevent the shadow fix from applying correctly.

I haven't tested this like a full QA test plan for every possible combo, but if it helps the CUA I'm using this on is the door, and doorframe from the following asset pack: https://hub.virtamate.com/resources/asset-pack-v1.60229/

Another thing I noticed, related to parenting, is that any CUA's that are children of the CUA I'm using this plugin on will also have the plugin applied to them. Not sure if that is intentional. So, it looks like there is some sort of parent/child propagation of the shader going on. I don't know the lifecycle stuff for VaM shaders, but maybe something to look in to.

- Metix
 
Yo @Mxx, great plugin.

Just found a bug though. From what I can tell from some testing, if the CUA that I'm using this plugin on is parented to another atom, in this case an Empty, then your shader will not apply, even though the debug info in the plugin says "Applied" in green. I can parent the CUA to another CUA, but it seems like Empty, or maybe just any parent that is not a CUA seems to prevent the shadow fix from applying correctly.

I haven't tested this like a full QA test plan for every possible combo, but if it helps the CUA I'm using this on is the door, and doorframe from the following asset pack: https://hub.virtamate.com/resources/asset-pack-v1.60229/

Another thing I noticed, related to parenting, is that any CUA's that are children of the CUA I'm using this plugin on will also have the plugin applied to them. Not sure if that is intentional. So, it looks like there is some sort of parent/child propagation of the shader going on. I don't know the lifecycle stuff for VaM shaders, but maybe something to look in to.

- Metix

Oh that's interesting 🤔. I'll have a look at it tonight.

In the meantime you could try using the plugin as a scene plugin and see if you can individually turn the CUAs ON/OFF from being included. As a scene plugin it gives you a new tab with a list of all CUAs.
 
Oh that's interesting 🤔. I'll have a look at it tonight.

In the meantime you could try using the plugin as a scene plugin and see if you can individually turn the CUAs ON/OFF from being included. As a scene plugin it gives you a new tab with a list of all CUAs.
Yeah, so even as a scene wide plugin, any CUA that is parented to an Empty will not have the shader applied. Even if it's not a direct parent, like the CUA is parented to another CUA, then that CUA is parented to an Empty.

I do a lot of toggling of bunches of CUA set items on/off. I guess I could just have a CUA be the top level parent of all of them, but it makes organization more challenging.
 
Well, actually, maybe not so fast. Getting an error log that the plugin can't find the shader bundle. It seems to be looking for it in ..saves/plugindata/ rather than the VAR file.

!> CUAShadowFixer: could not load shader bundle file 'cuashadowfixer_r12' from file://G:/VaM/TestInstance/Saves/PluginData/CUAShadowFixer/.

The shader is in the package with the correct name, also the cuashadowfixer_r12 bundle is in saves/plugindata/CUAShadowFixer/

So, not sure what's wrong.
 
Last edited:
Well, actually, maybe not so fast. Getting an error log that the plugin can't find the shader bundle. It seems to be looking for it in ..saves/plugindata/ rather than the VAR file.

!> CUAShadowFixer: could not load shader bundle file 'cuashadowfixer_r12' from file://G:/VaM/TestInstance/Saves/PluginData/CUAShadowFixer/.

The shader is in the package with the correct name, also the cuashadowfixer_r12 bundle is in saves/plugindata/CUAShadowFixer/

So, not sure what's wrong.

Hm, what most likely happened: when the plugin first loaded, VaM had a small hiccup or something while unpacking the shader bundle to Saves/PluginData, and so the copied file ended up incomplete. VaM then cached that corrupted bundle and it "failed" for the rest of the session and won't retry it, which is why it kept erroring even though a file was sitting there.

A quick fix would be to delete the folder Saves/PluginData/CUAShadowFixer and reload the plugin (or restart VaM). That forces the bundle to re-unpack again and it should load fine.

I'll make a hotfix so the plugin detects this and will fix it when it sees it happen.
 
Hm, what most likely happened: when the plugin first loaded, VaM had a small hiccup or something while unpacking the shader bundle to Saves/PluginData, and so the copied file ended up incomplete. VaM then cached that corrupted bundle and it "failed" for the rest of the session and won't retry it, which is why it kept erroring even though a file was sitting there.

A quick fix would be to delete the folder Saves/PluginData/CUAShadowFixer and reload the plugin (or restart VaM). That forces the bundle to re-unpack again and it should load fine.

I'll make a hotfix so the plugin detects this and will fix it when it sees it happen.

Sorry about that. My VaM instance decided to become corrupted right around the same time I updated to this new fix, which was the first thing that started acting up. After CUAs stopped loading, I realized something else was wrong.

New fix works like a charm.

Thanks again!
 
Back
Top Bottom