Page 1 of 1

ASE template : Cull state exposed to Material

Posted: Mon Mar 11, 2019 10:59 am
by VBesson
Hi guys!!
I'm trying to make a Master shader with ASE.

However, I can't manage to expose culling to the inspector.


So I went on the wiki and saw custom templates. http://wiki.amplify.pt/index.php?title= ... n_template

So I extended HDRP_PBR template and now I have a custom culling property that shows up on the materials. However, the canvas seems to overwrite the state: my custom template has

Code: Select all

property {
		[Enum(UnityEngine.Rendering.CullMode)]_Cull("Culling", Float) = 2.0
		/*ase_props*/
}
SubShader
{
/.../
 		Cull [_Cull]
/.../
}
But in the final shader generated by Canvas, there is :

Code: Select all

property {
		[Enum(UnityEngine.Rendering.CullMode)]_Cull("Culling", Float) = 2.0
		(properties from Canvas)
}
Subshader
{
		Cull Off
}
As if it was overwritten by the Subshader's option in ASE's "Output Node" pane.

Is there a way to prevent the Canvas to overwrite the state ? Or any way to expose the Cull to material ?

Re: ASE template : Cull state exposed to Material

Posted: Wed Mar 13, 2019 10:30 am
by Amplify_Borba
Hello, thank you for getting in touch and for bringing this up!

This seems like it might be an issue on our side, so I've escalated it to the developer for further investigation and will let you know as soon as we have any new information to share.

Re: ASE template : Cull state exposed to Material

Posted: Wed Mar 13, 2019 11:13 am
by Amplify_RnD_Rick
Hey VBesson,

Ricardo, the ASE developer here.
So what is happening is that your setting your properties section incorrectly.
It should be declared as follows, with the Properties keyword instead of the property .

Code: Select all

Properties
{
	[Enum (UnityEngine.Rendering.CullMode)]_Cull ("Culling", Float) = 2.0
	/*ase_props*/
}
Please let us know if you have further questions!

Re: ASE template : Cull state exposed to Material

Posted: Sat Mar 23, 2019 5:21 pm
by VBesson
Hi Borba, hi Rick !

Thank you very much for the quick anwser!

Oops, my apologizes Rick, actually I did not copy and paste my code in my previous message. However, I did correctly write Properties in my shader.
Here is a real copy and paste of the beginning of HDSRPPBR.shader after I modified it by adding _Cull variable :

Code: Select all

Shader /*ase_name*/ "Hidden/Templates/HDSRPPBR" /*end*/
{
	/*CustomNodeUI:HDPBR*/
    Properties
    {
		[Enum(UnityEngine.Rendering.CullMode)]_Cull("Culling", Float) = 2.0 // VBESSON CHANGE
		/*ase_props*/
    }

    SubShader
    {
		/*ase_subshader_options:Name=Additional Options
			Option:Vertex Position,InvertActionOnDeselection:Absolute,Relative:Relative
				Absolute:SetDefine:ASE_ABSOLUTE_VERTEX_POS 1
				Absolute:SetPortName:GBuffer:9,Vertex Position
				Relative:SetPortName:GBuffer:9,Vertex Offset
		*/
        Tags
        {
            "RenderPipeline"="HDRenderPipeline"
            "RenderType"="Opaque"
            "Queue"="Geometry"
        }
        
		// VBESSON CHANGE begin
		Cull [_Cull]
		// VBESSON CHANGE end
		Blend One Zero
		ZTest LEqual
		ZWrite On
		ZClip [_ZClip]

		HLSLINCLUDE
		#pragma target 4.5
		#pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
		#pragma multi_compile_instancing
		#pragma instancing_options renderinglayer
		#pragma multi_compile _ LOD_FADE_CROSSFADE

etc etc

Re: ASE template : Cull state exposed to Material

Posted: Tue Mar 26, 2019 6:42 pm
by Amplify_Borba
Hey, no problem!

According to our tests the shader seems to be working:

Image

Here's the modified template we used.

Do you have any errors in the console that might prevent the scripts from successfully compiling?