Introduction to Shaders in Unity
https://www.raywenderlich.com/5671826-introduction-to-shaders-in-unity
#shader
https://www.raywenderlich.com/5671826-introduction-to-shaders-in-unity
#shader
kodeco.com
Introduction to Shaders in Unity
Ever wondered about shaders in Unity? In this tutorial, you’ll learn what shaders are, how to display vertex colors and how to animate within shaders.
Google Play Games Plugin for Unity: Tips & Tricks
http://diegogiacomelli.com.br/google-play-games-plugin-for-unity-tips-and-tricks/
#plugin #googleplaygames
http://diegogiacomelli.com.br/google-play-games-plugin-for-unity-tips-and-tricks/
#plugin #googleplaygames
diegogiacomelli.com.br
Google Play Games Plugin for Unity: Tips & Tricks
In this post I will list some tips and tricks that I learned while using the Google Play Games Plugin for Unity.
Scrolling Energy Shader Breakdown
https://www.reddit.com/r/Unity3D/comments/ftp4a2/scrolling_energy_shader_breakdown/
Apply texture - Created the texture in photoshop using the smudge tool, pushing and pulling to create this wavy particle texture. After that using filter > other > offset to make sure the texture properly tiles. Then I set the texture as the color in the shader.
Use texture rgb as alpha - The alpha in a texture is just another channel like the rgb values. Since I want the black areas of the texture to be transparent, I just made the alpha channel equal the red channel. You can do the same thing by constructing the texture to be white on transparent, but I like working with black and white particle sprites.
Change UVs over time to create scroll effect - Take the existing uvs and add the speed you want the uvs to change multiplied by time. o.uv = TRANSFORM_TEX(v.uv, _MainTex).xy + frac(_Time.y * float2(_ScrollSpd.x, _ScrollSpd.y));
Edit tiling scale to stretch texture - When you create a new texture variable in a shader, tiling and offset variables are included in unity's editor, letting you change how the texture scales or its position.
Apply HDR color to RGB - Multiply the existing color by a HDR color you set. HDR lets you set color values beyond the 0 to 1 intensity of what your display outputs, letting the particle be brighter. With a bloom post-processing filter, the HDR color also glows, giving it a proper energy feeling.
Multiply mask over alpha - To let the scrolling particles exist in different shapes, I added an additional mask that is multiplied on top of the previously calculated alpha. This mask needs to have its own UVs defined to make sure it doesn't scroll/scale with the main texture.
Extra - There are additional improvements to add, like giving the mask its own independent scrolling or setting its scale to match the main texture.
#shader #energy
https://www.reddit.com/r/Unity3D/comments/ftp4a2/scrolling_energy_shader_breakdown/
Apply texture - Created the texture in photoshop using the smudge tool, pushing and pulling to create this wavy particle texture. After that using filter > other > offset to make sure the texture properly tiles. Then I set the texture as the color in the shader.
Use texture rgb as alpha - The alpha in a texture is just another channel like the rgb values. Since I want the black areas of the texture to be transparent, I just made the alpha channel equal the red channel. You can do the same thing by constructing the texture to be white on transparent, but I like working with black and white particle sprites.
Change UVs over time to create scroll effect - Take the existing uvs and add the speed you want the uvs to change multiplied by time. o.uv = TRANSFORM_TEX(v.uv, _MainTex).xy + frac(_Time.y * float2(_ScrollSpd.x, _ScrollSpd.y));
Edit tiling scale to stretch texture - When you create a new texture variable in a shader, tiling and offset variables are included in unity's editor, letting you change how the texture scales or its position.
Apply HDR color to RGB - Multiply the existing color by a HDR color you set. HDR lets you set color values beyond the 0 to 1 intensity of what your display outputs, letting the particle be brighter. With a bloom post-processing filter, the HDR color also glows, giving it a proper energy feeling.
Multiply mask over alpha - To let the scrolling particles exist in different shapes, I added an additional mask that is multiplied on top of the previously calculated alpha. This mask needs to have its own UVs defined to make sure it doesn't scroll/scale with the main texture.
Extra - There are additional improvements to add, like giving the mask its own independent scrolling or setting its scale to match the main texture.
#shader #energy
reddit
Scrolling Energy Shader Breakdown
Posted in r/Unity3D by u/WaterMerk • 1,267 points and 24 comments
Fix artifacting in the grid shader.
Normally you can fix this by enabling Unity mipmapping on your textures. However, that doesn't work here because the grid cells aren't textures -- they're generated through a shader.
Instead, I have the grid cell colors slowly bleed into each other as the individual cells get smaller on the screen. When they get smaller than one pixel, there's no such thing as individual cells; everything is uniformly colored with the average of the two colors in the grid.
It's a sort of fake mipmapping that only works for this specific situation.
#shader #grid #mipmap
Normally you can fix this by enabling Unity mipmapping on your textures. However, that doesn't work here because the grid cells aren't textures -- they're generated through a shader.
Instead, I have the grid cell colors slowly bleed into each other as the individual cells get smaller on the screen. When they get smaller than one pixel, there's no such thing as individual cells; everything is uniformly colored with the average of the two colors in the grid.
It's a sort of fake mipmapping that only works for this specific situation.
#shader #grid #mipmap
Free sound assets.
https://www.reddit.com/r/Unity3D/comments/g29erc/i_have_released_my_2000_instrumental_pieces_free/
2059 Instrumental pieces on Google drive Zipped. (non categorized):
https://drive.google.com/drive/folders/18_CBtXX8tJTkIbJ2WsjoZHXNy819UHal?usp=sharing
Link to 1790 CATEGORIZED instrumental pieces in a single zip file:
https://drive.google.com/open?id=1yCZtjPSKW3ifngIP6zzbc9spXspjatIf
#assets #sound
https://www.reddit.com/r/Unity3D/comments/g29erc/i_have_released_my_2000_instrumental_pieces_free/
2059 Instrumental pieces on Google drive Zipped. (non categorized):
https://drive.google.com/drive/folders/18_CBtXX8tJTkIbJ2WsjoZHXNy819UHal?usp=sharing
Link to 1790 CATEGORIZED instrumental pieces in a single zip file:
https://drive.google.com/open?id=1yCZtjPSKW3ifngIP6zzbc9spXspjatIf
#assets #sound
reddit
I have released my 2000+ instrumental pieces free under creative...
As used in games such as Headliner Novinews. As used by Youtubers such as Kyle Le with 42+ million views and 163k+ subs My Instrumental site...
UI Scroll View automatic Content height
https://unitycoder.com/blog/2016/02/23/ui-scroll-view-automatic-content-height/
#ui #auto #contentsize
https://unitycoder.com/blog/2016/02/23/ui-scroll-view-automatic-content-height/
#ui #auto #contentsize
Unity Coding - Unity3D
UI Scroll View automatic Content height
“Hidden” inside the docs ( ) you can find details how to make UI ScrollView content to have automatic size based on the child objects. Here’s images how to use it: – Add …
https://thegamedev.guru/unity-gpu-performance/is-your-game-vertex-bound/
Unity GPU Optimization: Is Your Game.. Vertex Bound
#optimization #gpu #vertex
Unity GPU Optimization: Is Your Game.. Vertex Bound
#optimization #gpu #vertex
TheGamedev.Guru
Unity GPU Optimization: Is Your Game.. Vertex Bound?
Is your game rendering more geometry than your GPU can handle? Here, let me show you a few steps to check if your geometry is causing a performance bottleneck on your players' GPU.
https://thegamedev.guru/unity-gpu-performance/overdraw-optimization/
Unity Overdraw: Improving the GPU Performance of Your Game
#optimization #gpu #overdraw
Unity Overdraw: Improving the GPU Performance of Your Game
#optimization #gpu #overdraw
TheGamedev.Guru
Unity Overdraw: Improving the GPU Performance of Your Game
A single thing has killed the GPU performance of thousands of mobile games: the famous Unity Overdraw. Do you know what overdraw is doing to you?
https://markheath.net/post/async-antipatterns
Async await antipatterns:
1. Forgotten await
2. Ignoring tasks - The danger with this approach is that nothing is going to catch any exceptions thrown. At best, that means you didn't know it failed to complete. At worst, it can terminate your process. So use this approach with caution, and make sure the method has good exception handling.
3. Using async void methods - The trouble is, that the caller of the method has no way to await the outcome of this method. They have no access to the Task that awaited method returned. So you're essentially ignoring a task again.
4. Blocking on tasks with .Result or .Wait - there are some problems here. The first is that using blocking calls like Result ties up a thread that could be doing other useful work. More seriously, mixing async code with calls to .Result (or .Wait()) opens the door to some really nasty deadlock problems.
5. Mixing ForEach with async methods
6. Excessive parallelization
7. Non-thread-safe side-effects - prefer pure functions instead of relying on the calling method to run on the main thread.
8. Missing ConfigureAwait(false) - not so useful for Unity since its api is not thread safe
9. Ignoring the async version
10. try catch without await - dont return Task inside try-catch since the catch will not be triggered if exception happens inside task. It can only be triggered on task creation.
#async #patterns
Async await antipatterns:
1. Forgotten await
2. Ignoring tasks - The danger with this approach is that nothing is going to catch any exceptions thrown. At best, that means you didn't know it failed to complete. At worst, it can terminate your process. So use this approach with caution, and make sure the method has good exception handling.
3. Using async void methods - The trouble is, that the caller of the method has no way to await the outcome of this method. They have no access to the Task that awaited method returned. So you're essentially ignoring a task again.
4. Blocking on tasks with .Result or .Wait - there are some problems here. The first is that using blocking calls like Result ties up a thread that could be doing other useful work. More seriously, mixing async code with calls to .Result (or .Wait()) opens the door to some really nasty deadlock problems.
5. Mixing ForEach with async methods
6. Excessive parallelization
7. Non-thread-safe side-effects - prefer pure functions instead of relying on the calling method to run on the main thread.
8. Missing ConfigureAwait(false) - not so useful for Unity since its api is not thread safe
9. Ignoring the async version
10. try catch without await - dont return Task inside try-catch since the catch will not be triggered if exception happens inside task. It can only be triggered on task creation.
#async #patterns
SoundCode
C# Async Antipatterns
The async and await keywords have done a great job of simplifying writing asynchronous code in C#, but unfortunately they can't magically protect you from getting things wrong. In this article, I want to highlight a bunch of the most common async coding mistakes…
https://m.habr.com/ru/company/pixonic/blog/499642/comments/
Pixockets: как мы написали собственную сетевую библиотеку для игрового сервера
#netcode #network #socket
Pixockets: как мы написали собственную сетевую библиотеку для игрового сервера
#netcode #network #socket
Habr
Pixockets: как мы написали собственную сетевую библиотеку для игрового сервера
Привет! На связи Станислав Яблонский, Lead Server Developer из Pixonic. Когда я только пришел в Pixonic, наши игровые сервера представляли собой приложения на...