article thumbnail

How to get an array of pixel colors from an image?

Cocos

I’m trying to make an effect of pixels appearing with transparency and sequence (first the “darkest” then the rest of the pixels). I want to achieve the effect - “so that the pixels, like water, fill the empty mouth of the river.” But I couldn’t get the array of pixel colors. I’m here to get any help.

Pixel 52
article thumbnail

Cocos Shader Tutorial 1.0 - about UV

Cocos

The vertical axes of textures and picture pixels is shown above, when sampling textures in shaders, that is from top to bottom, which is top-right corner. This is consistent with how most image file formats store pixel data, and with how most graphics APIs work (including DirectX, Vulkan, Metal, WebGPU, but not OpenGL).

Shaders 98
Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Trending Sources

article thumbnail

[Tutorial]Outer Stroke Effect for 2D Sprites

Cocos

Principle Since it’s an outer stroke, it doesn’t occupy the pixels of the original image to draw the edges. Remember the previous article, where we used the image’s Alpha to find edges, determining whether there were pixels with Alpha of 0 around the image. First, we get the uv of the surrounding pixel through the offset uv.

Sprite 52
article thumbnail

Label Plus – An SDF-based BMFont generation and rendering plug-in is here!

Cocos

The issue for most developers is knowing how to use SDF with shaders to achieve these effects. One developer has built an excellent extension that allows you to not worry about this and develop more font styles, saving the shaders for you. Thanks to Signed Distance Fields or SDF, you can do this and so much more with them.

Render 98
article thumbnail

Unlocking GPU Intrinsics in HLSL

Nvidia

For example, a shader can use warp shuffle instructions to exchange data between threads in a warp without going through shared memory, which is especially valuable in pixel shaders where there is no shared memory. Or a shader can perform atomic additions on half-precision floating-point numbers in global memory.

Shaders 52
article thumbnail

[Share] 2D Post-Processing & Lighting Framework

Cocos

You just need the following resources and code: A post-processing shader A material with the shader bound to it A post-processing extension TypeScript file for passing parameters to the material Let’s use an example of creating a screen grayscale effect: 1. You can also drag the material into the module’s material slot in the editor.

Render 52
article thumbnail

GLES2 and GDNative, progress report #1

Mircosoft Game Dev

implement basic texture loading. generate C++ classes for GLSL shaders at compile time. adapt shader compiler to work with GLSL ES 2.0. implement basic texture loading. The RasterizerStorage interface has methods for creating and modifying various resources such as textures, shaders, materials, meshes and many more.

Shaders 52