AmplifyCreations / AmplifyShaderEditor-Feedback

4 stars 0 forks source link

Update URP templates - Fog #274

Open Dawie3565 opened 4 months ago

Dawie3565 commented 4 months ago

review Unity URP for changes and update templates and or Nodes below needs to be checked and translated for ASE

////////////////////////////////////////////////////////////////////////////////////////

/ase_srp_cond_begin:<120100/ void shadergraph_LWFog(float3 position, out float4 color, out float density) { color = unity_FogColor; density = ComputeFogFactor(TransformObjectToHClip(position).z); } /ase_srp_cond_end/

////////////////////////////////////////////////////////////////////////////////////////

/ase_srp_cond_begin:>=120100/ void shadergraph_LWFog(float3 positionOS, out float4 color, out float density) { color = unity_FogColor;

if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2)

float viewZ = -TransformWorldToView(TransformObjectToWorld(positionOS)).z;
float nearZ0ToFarZ = max(viewZ - _ProjectionParams.y, 0);
density = 1.0f - ComputeFogIntensity(ComputeFogFactorZ0ToFar(nearZ0ToFarZ));
#else
density = 0.0f;
#endif

} /ase_srp_cond_end/

Dawie3565 commented 4 months ago

Note SG uses

define SHADERGRAPH_FOG(position, color, density) shadergraph_LWFog(position, color, density)