AmplifyCreations / AmplifyShaderEditor-Feedback

4 stars 0 forks source link

Indirect Diffuse Light Node #232

Open Dawie3565 opened 1 year ago

Dawie3565 commented 1 year ago

node is adding duplicated pragma in URP 14x and also adding pragma/defines that no longer supported by unity. breaking lighting

many of the uniqueID's are outdated and need updating per changes in each api

/ase_srp_cond_begin:<110000/

pragma multicompile _MAIN_LIGHT_SHADOWS

pragma multicompile _MAIN_LIGHT_SHADOWS_CASCADE

pragma multicompile _MIXED_LIGHTING_SUBTRACTIVE

/ase_srp_cond_end/

/ase_srp_cond_begin:>=110000/

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multicompile LIGHTMAP_SHADOW_MIXING

pragma multicompile SHADOWS_SHADOWMASK

/ase_srp_cond_end/

/ase_srp_cond_begin:<140000/

pragma multi_compilefragment _SHADOWS_SOFT

/ase_srp_cond_end/

/ase_srp_cond_begin:>=150000/

pragma multi_compilefragment _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH

/ase_srp_cond_end/

Dawie3565 commented 11 months ago

Moving back to highest priority Mobile is breaking without this change.

Dawie3565 commented 10 months ago

URP Forward pass

>=10.2.2 thru <12.1.0

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile _MAIN_LIGHT_SHADOWS

pragma multicompile _MAIN_LIGHT_SHADOWS_CASCADE

pragma multi_compilefragment _SHADOWS_SOFT

>=12.1.0 thru <14.0.4

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT

>=14.0.4 thru <=14.0.5

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT

>=14.0.6 thru <=14.0.8

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile EVALUATE_SH_MIXED EVALUATE_SH_VERTEX

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT

>=14.0.9 thru <15.0.6

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile EVALUATE_SH_MIXED EVALUATE_SH_VERTEX

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH

>=15.0.6 thru <16.0.4

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile EVALUATE_SH_MIXED EVALUATE_SH_VERTEX

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH

>=16.0.4 thru <17.0.2

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile EVALUATE_SH_MIXED EVALUATE_SH_VERTEX

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH

>=17.0.2

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile USE_LEGACY_LIGHTMAPS

pragma multicompile EVALUATE_SH_MIXED EVALUATE_SH_VERTEX

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH

Dawie3565 commented 10 months ago

URP GBuffer Pass

>=10.2.2 thru <12.1.0

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile _MIXED_LIGHTING_SUBTRACTIVE

pragma multicompile _MAIN_LIGHT_SHADOWS

pragma multicompile _MAIN_LIGHT_SHADOWS_CASCADE

pragma multi_compilefragment _SHADOWS_SOFT

>=12.1.0 thru <14.0.4

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile _MIXED_LIGHTING_SUBTRACTIVE

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT

>=14.0.4 thru <=14.0.5

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile _MIXED_LIGHTING_SUBTRACTIVE

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT

>=14.0.6 thru <=14.0.8

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile _MIXED_LIGHTING_SUBTRACTIVE

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT

>=14.0.9 thru <15.0.6

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile _MIXED_LIGHTING_SUBTRACTIVE

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH

>=15.0.6 thru <16.0.4

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile _MIXED_LIGHTING_SUBTRACTIVE

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH

>=16.0.4 thru <17.0.2

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile _MIXED_LIGHTING_SUBTRACTIVE

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH

>=17.0.2

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile LIGHTMAP_ON

pragma multicompile DIRLIGHTMAP_COMBINED

pragma multicompile USE_LEGACY_LIGHTMAPS

pragma multicompile _MIXED_LIGHTING_SUBTRACTIVE

pragma multicompile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN

pragma multi_compilefragment _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH

Dawie3565 commented 10 months ago

above was reviewed in Lit templates for a guide to update pragma changes based on api version changes

note that (_MIXED_LIGHTING_SUBTRACTIVE) is only in Gbuffer pass for Lit this is also a open action to add Gbuffer pass in URP Unlit from 14x and higher see action #242

URP Unlit Gbuffer pass --- Fill GBuffer data to prevent "holes", just in case someone wants to reuse GBuffer for non-lighting effects. --- Deferred lighting is stenciled out.

diogovtx commented 6 months ago

Turns out this node was generating code inside Meta pass where it's not even valid. Not related to the problem/solution presented. It would really help me to get a bug/error report instead of what a potential solution might be. This time it really threw me off track and wasted a lot of time.

Fixed in v1.9.4.

diogovtx commented 6 months ago

Reopened because I misunderstood this particular piece of code and its relationship with URP Unlit.

My bad.

Moved to 1.9.5 with highest priority.

Dawie3565 commented 3 months ago

for info only user was reporting they also needed to add

pragma multi_compilefragment _REFLECTION_PROBE_BLENDING

pragma multi_compilefragment _REFLECTION_PROBE_BOX_PROJECTION

URP 6000.0.16 reported light flicker in Unlit indirect lighting

needs more study to verify

Dawie3565 commented 1 week ago

please do not bump this again users reporting its responsible for breaking Builds in URP 17x