Русские видео

Сейчас в тренде

Иностранные видео




Если кнопки скачивания не загрузились НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу страницы.
Спасибо за использование сервиса savevideohd.ru



Writing Unity Shaders Using Depth Textures

If you want to support my Patreon: https://patreon.com/user?u=92850367 Writing Unity Shaders Using Depth Textures Udemy Course: https://www.udemy.com/course/unity-sh... Today I'll be doing this effect that uses the depth texture to create this inverse world like effect This is the math and code to create the rotational effect float2 textureCoordinate = i.screenPosition.xy / i.screenPosition.w; float r = dot(i.viewDir, normalize(i.normal)) * 2 + _Time.y; float g = (atan2(i.normal.y, i.normal.x) / 2 * UNITY_PI ) + 0.5 + _Time.y; fixed4 col = tex2D(_MainTex, float2(r,g)); float depth = Linear01Depth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, textureCoordinate)); float3 color = lerp(_ColorOne, _ColorTwo, depth); float fresnel = pow(dot(i.viewDir, normalize(i.normal) ),0.3); return fixed4(pow(color * fresnel,2)*2 + col * (1-fresnel) * 2,1); Ben here, and I've been writing shaders and full systems of shaders in Unity from scratch for 6-7 years now. Shaders, especially HLSL or CG shaders seem to be less known in Unity, so I just wanted to do my part, share my experiences and really show others how to write shader code. The goal is to teach others how to write optimal shader code that is production-ready. I also want to try to recreate the cool-looking effects we see in other games. It would be awesome to see more and more people write shaders from scratch, understand it at a deeper level and ultimately create their own shaders. Content of this video 0:00 - Intro & Setup 1:37 - Screen Space UVs 3:41 - Depth texture 5:40 - Decode it 8:00 - Color it 9:10 - Fresnel #unity3d #unitydeveloper #gamedev #shaders For more in-depth access I do have a Udemy course that I will continue to update as I create more mini-lessons. https://www.udemy.com/course/unity-sh...

Comments