Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CONVERT FROM GLSL - TO - UNITY SHADERLAB HLSL (CG):
- ---------------------------------------------------
- SYNTAX:
- -------
- vec<n> - float<n>
- mat<n> - float<n>x<n>
- fract - frac
- mix - lerp
- mod - x-y*floor(x/y)
- atan(x,y) - atan2(y,x)
- texture - tex2D
- TYPE CASTING:
- -------------
- vec3(1) ok - float3(1) not ok, float3(1,1,1) or 1
- vec3 a = 1 not ok - float3 a = 1 ok
- INITIALIZED GLOBAL VARIABLES:
- -----------------------------
- vec3 up = vec3(0,1,0) - static float3 up = float3(0,1,0)
- MATRIX MULTIPLICATION:
- ----------------------
- use * - use mul()
- SPECIFICS:
- ----------
- MAIN FUNCTION - mainImage - frag or surf
- UV COORDS - fragCoord/iResolution - i.uv or IN.uv_MainTex
- TIME - iTime - _Time.y
- MOUSE - iMouse - *Must manually add*
- FINAL COLOR - fragColor = color - return color
- TEXTURES - iChannel<n> - *Must manually add*
- BOILERPLATE - None - *Many*
- ***
- *** Additional trick: instead of replace "vec" with "float" , in HLSL we can define own data types,
- *** so you can write following instruction: typedef vector ** <float, 2> vec2; typedef vector <float, 3> vec3;
- ***
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement