ASE template : Cull state exposed to Material

Node-based Shader Editor
Post Reply
VBesson
Posts: 2
Joined: Mon Mar 11, 2019 10:47 am

ASE template : Cull state exposed to Material

Post 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 ?
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: ASE template : Cull state exposed to Material

Post 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.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Amplify_RnD_Rick
Posts: 40
Joined: Wed Mar 01, 2017 6:33 pm

Re: ASE template : Cull state exposed to Material

Post 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!
VBesson
Posts: 2
Joined: Mon Mar 11, 2019 10:47 am

Re: ASE template : Cull state exposed to Material

Post 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
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: ASE template : Cull state exposed to Material

Post 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?
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Post Reply