article thumbnail

Does the shader have a built-in function to get the texture size?

Cocos

Assuming you’re using the latest versions of GLSL, you can get texture size with the “textureSize()” Example code here… uniform sampler2D myTexture; // Uniform for the texture void main() { //Note: if you don’t specify a LOD, glsl will default to 0 automatically ivec2 texSize = textureSize(myTexture, 0); // Get size of the texture at LOD 0 int width (..)

Texture 52
article thumbnail

Tutorial: Cocos Shader Series - Use a Noise Map to Make a Dissolve Texture

Cocos

x, I using this code but it not bring Property affect to shader Ok, this work if turn of Packable in main Sprite inspector Blockquote const sprite = this.getComponent(Sprite); const mat = sprite.customMaterial; mat.setProperty(‘dissolveThreshold’, 0.5); Version 3.6.x,

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

Potential of shader graph and VFX graph in Unity 

iXie gaming

Among these, Shader Graph and VFX Graph stand out as the most important additions as they empower developers to craft complex shaders and breath-taking visual effects with relative ease. Shader Graph Shader Graph is a node-based visual interface that allows artists and developers to create shaders without writing complex code.

Shaders 52
article thumbnail

Identifying Shader Limiters with the Shader Profiler in NVIDIA Nsight Graphics

Nvidia

and later feature the new Real-Time Shader Profiler, the first temporal sampling profiler for GPU shaders. and later feature the new Real-Time Shader Profiler, the first temporal sampling profiler for GPU shaders. This profiler enables you to examine the most expensive shaders at each moment in your frame.

Shaders 52
article thumbnail

Write a Post-Processing Shader using CRP Step-by-Step - Guide to Cocos Cyberpunk Source Code

Cocos

This series of articles will analyze the source code from various perspectives to improve your learning efficiency. Download the project source code for free at: [link] Today’s content is relatively simple, suitable for both juniors to explore and seniors for entertainment. So they came and asked: How do I add a new Shader for the CRP?

Shaders 52
article thumbnail

Shader Help required (UV distortion with cc_time[0])

Cocos

When package option is enable, it will try to pack your texture into a larger texture (2048x2048 if I remember correctly). So the shader code will aplly to that larget texture, the uv coordinate you used on the original texture is calulated for this bigger texture, which will have result you received in the video.

Shaders 40
article thumbnail

[Tutorial] Write a Post-Processing Shader using CRP Step-by-Step - Guide to Cocos Cyberpunk Source Code

Cocos

This series of articles will analyze the source code from various perspectives to improve your learning efficiency. Download the project source code for free at: [link] Today’s content is relatively simple, suitable for both juniors to explore and seniors for entertainment. So they came and asked: How do I add a new Shader for the CRP?

Shaders 52