Standard Shader, SetTextureOffset / SetTextureScale for emission only

Hey,

I wanted to animate my emission using offset.
But it seems like standard shader only use _MainTex scale/offset instead of their own.
This makes it impossible to animate only emission for me.

I am new to all this multi_compile and shader_feature things.
Just wanted to do the thing that worked all time long.

Would be nice, if someone could help me.

Just sample your emissive with new UVs. You can either specify these in a vertex program or just manipulate _MainTex’s UVs

Shader "Custom/NewShader" {
    Properties {
        _Color ("Color", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" {}

//add your props for adjusting UVs
        _EmissiveXOffset("Emissive X Offset", Float) = 0.0
        _EmissiveYOffset("Emissive Y Offset", Float) = 0.0
        _EmissiveTiling("Emissive Tiling", Float) = 1.0
}

....rest of shader here....

void surf (Input IN, inout SurfaceOutputStandard o) {
          
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
            o.Albedo = c.rgb;
           
//more efficient to setup UV's in vertex program but you get the idea
            float2 emissiveUV = float2(IN.uv_MainTex.x + EmissiveXOffset, IN.uv_MainTex.y + EmissiveYOffset) * _EmissiveTiling;
            fixed4 e = tex2D(_MainTex, emissiveUV);
            o.Emission = e.rgb;
1 Like

Sory, as said, I am using the standard shader. I don’t want to recode all needed features.
Just wanted to animate the emission while keeping all the other features in place.

There’s no way to do that without a custom shader. The existing one is not designed for it, so, if that’s what you want to do, you need to have a custom shader, either a modified standard shader (very difficult) or a surface shader that matches a majority of the standard shader features (simpler, as posted above).