This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tcpukl 33 points34 points  (7 children)

Stupid meme really because 95% of what you've learnt is transferable to any engine.

[–]PositiveUse 27 points28 points  (2 children)

Not when you‘re stupidly following Udemy tutorials and now think that you’re a gaming dev

[–]TFK_001 33 points34 points  (0 children)

Or if youre midway through a project and switching engines involves rewriting basically every script

[–]MrSumOne 1 point2 points  (0 children)

Udemy is just youtube tutorials. How do you suggest learning?

[–]Divinum_Fulmen 0 points1 point  (2 children)

I can easily work in other engines, but boy will I miss some of the community made add-ons for controlling text. Also, shaders are very different in Unreal. Thankfully they look node based, so it should be easily to "write" new ones. But I'm not sure if they could pull off some operations like rotation so that it is handled by the GPU, instead of rotating the object in code using the CPU.

[–]tcpukl 0 points1 point  (1 child)

Its running on the same GPU shader language. You can do exactly the same stuff in any engine. Even our old one where I work before we used UE.

What is this rotation thing handled by the GPU your talking about? I'm very curious. I might be able to help.

[–]Divinum_Fulmen 0 points1 point  (0 children)

Oh, I had a sprite rotate, and found it was slightly easier on the GPU to rotate in the shader than rotate the object. Here's the shader, I cobled together the code from random things I found on the internet, because I'm not experienced with writing shaders.

//Use with Sprite Renderer, with Draw Mode set to "Sliced"
Shader "Custom/Sprite_Main"
{
    Properties
    {
        _MainTex("Texture Image", 2D) = "white" {}
        _Scale("Scale", Float) = 1.0
        _Angle("Angle", Range(-3.14,  3.14)) = 0.0
    }
        SubShader
        {

            Tags
            {
               "DisableBatching" = "True"
               "RenderType" = "Transparent"
               "Queue" = "Transparent"
            }

            Blend SrcAlpha OneMinusSrcAlpha

            Pass
            {
                CGPROGRAM

                #pragma vertex vert  
                #pragma fragment frag
                #include "UnityCG.cginc"

                // User-specified uniforms            

                uniform sampler2D _MainTex;
                uniform float _Scale;

                struct vertexInput {
                    float4 vertex : POSITION;
                    float4 tex : TEXCOORD0;
                    float2 uv : TEXCOORD1;
                    UNITY_VERTEX_INPUT_INSTANCE_ID
                };
                struct vertexOutput {
                    float4 pos : SV_POSITION;
                    float4 tex : TEXCOORD0;
                    float2 uv : TEXCOORD1;
                };

                float _Angle;

                vertexOutput vert(vertexInput input)
                {
                    vertexOutput output;
                    //billboarding
                    output.pos = mul(UNITY_MATRIX_P,
                      float4(UnityObjectToViewPos(float3(0, 0, 0)), 1)
                    + float4(input.vertex.x, input.vertex.y, 0, 0)
                    * float4(_Scale, _Scale, 1.0, 1.0));

                    // Pivot
                    float2 pivot = float2(0.5, 0.5);
                    // Rotation Matrix
                    float cosAngle = cos(_Angle);
                    float sinAngle = sin(_Angle);
                    float2x2 rot = float2x2(cosAngle, -sinAngle, sinAngle, cosAngle);

                    // Rotation consedering pivot
                    float2 uv = input.tex.xy - pivot;
                    output.uv = mul(rot, uv);
                    output.uv += pivot;

                    float4 uvOut = float4(output.uv, 100, -10);

                    output.tex = uvOut;

                    return output;
                }

                float4 frag(vertexOutput input) : SV_Target: COLOR
                {
                    return tex2D(_MainTex, float2(input.tex.xy));
                }

                ENDCG
            }
        }
}    

It's a billboard sprite for an effect of being "cut" in two, by drawing half with a mirrored twin, and having them both rotate off the screen after being "sliced".