x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Use of stencil Ref, Comp and Pass

Does anyone know how can you make these lines of code in a material?

 Stencil
         {
             Ref 1
             Comp always 
             Pass replace 
         }

 Stencil
         {
             Ref 1
             Comp notequal
             Pass keep
         }

Also, do you know how to change the render queue in a material?

Product Version: UE 4.21
Tags:
more ▼

asked Dec 30 '18 at 07:20 PM in Rendering

avatar image

JuanPabloHdz
1 1

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

There are set from the engine code, not material. You cannot change queue in material. You can however change queue per object by adjusting translucency sort priority.

more ▼

answered Dec 30 '18 at 09:53 PM

avatar image

Deathrey
7.7k 129 29 289

avatar image JuanPabloHdz Dec 30 '18 at 11:29 PM

I think I had to be more concise. What I wanted to do in a material was this: Shader "Mask" { Properties { _MainTex("Diffuse", 2D)="white"{} } SubShader { Tags{"Queue"="Geometry-1"}

         ColorMask 0
         ZWrite off
 
         Stencil
         {
             Ref 1
             Comp always 
             Pass replace 
         }
 
         CGPROGRAM
         #pragma surface surf Lambert
 
         sampler2D _MainTex;
 
         struct Input
         {
             float2 uv_MainTex;
         };
 
         void surf (Input IN, inout SurfaceOutput o)
         {
             fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
             o.Albedo = c.rgb;
         }
         ENDCG
     }
     FallBack "Diffuse"
 }

And this:

 Shader "Wall" 
 {
     Properties
     {
         _MainTex("Diffuse", 2D)="white"{}
     }
     SubShader
     {
         Tags{"Queue"="Geometry"}
 
         Stencil
         {
             Ref 1
             Comp notequal
             Pass keep
         }
 
         CGPROGRAM
         #pragma surface surf Lambert
 
         sampler2D _MainTex;
 
         struct Input
         {
             float2 uv_MainTex;
         };
 
         void surf (Input IN, inout SurfaceOutput o)
         {
             fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
             o.Albedo = c.rgb;
         }
         ENDCG
     }
     FallBack "Diffuse"
 }
 

Any ideas of how to do it?

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question