AmplifyCreations / AmplifyShaderEditor-Feedback

4 stars 0 forks source link

HDRP Double Sided Mode Disabled does not behave same as SG #279

Closed Dawie3565 closed 7 months ago

Dawie3565 commented 7 months ago

Issue: Amplify shaders in HDRP do not behave the same as SG when “Doble Sided Mode” is set = Disabled with Graph.

Shader Graph: set graph option = Disabled still allows double sided to be enabled or disabled within shaders and only sets the default for shader to be off

  SG = Disabled 
 _DoubleSidedEnable = 0
 _DoubleSidedNormalMode = 2

  SG = Enabled
 _DoubleSidedEnable = 1
 _DoubleSidedNormalMode = 2

  SG = Flipped Normals 
 _DoubleSidedEnable = 1
 _DoubleSidedNormalMode = 0

 SG = Mirrored Normals 
 _DoubleSidedEnable = 1
 _DoubleSidedNormalMode = 0

Amplify Editor: set graph option = Disabled is fully stipping key words from compiled shader, however also it is still leaving toggles for double sided and normal mode. The properties for toggle on/off are left still within the shader that results in a condition for broken option when enable within default GUI is turned on by users.
Note (1): This does not impact Unlit templates as it uses different logic. Note(2): If the intent of original pre ASE_v1.9.5.31 was to strip key words, then it should have been a new option prior to double sided mode with double sided mode as sub option and fully removed related properties also. this is problematic as DoubleSidedConstants maybe dependencies on property values even when not used within unity systems.

Fix: Update the amplify HDRP templates for logic to match same as Shader Graph. New logic:

Option:Double-Sided:Disabled,Enabled,Flipped Normals,Mirrored Normals:Disabled Disabled,Enabled,Flipped Normals,Mirrored Normals:SetDefine:ASE_NEED_CULLFACE 1 Disabled,Enabled,Flipped Normals,Mirrored Normals:SetDefine:pragma shader_featurelocal _DOUBLESIDED_ON Disabled:SetShaderProperty:_DoubleSidedEnable,0 Disabled:SetShaderProperty:_DoubleSidedNormalMode,2 Enabled:SetShaderProperty:_DoubleSidedEnable,1 Enabled:SetShaderProperty:_DoubleSidedNormalMode,2 Flipped Normals:SetShaderProperty:_DoubleSidedEnable,1 Flipped Normals:SetShaderProperty:_DoubleSidedNormalMode,0 Mirrored Normals:SetShaderProperty:_DoubleSidedEnable,1 Mirrored Normals:SetShaderProperty:_DoubleSidedNormalMode,0

Dawie3565 commented 7 months ago

closed in ASE 1.9.3.3