article thumbnail

Shader array properties

Cocos

stringwizard5: If you use the material.setProperty function, one of the possible arguments that it can take is render pass I am not quite sure what do you mean. We are currently using this shader to create dynamic light effect on 2d sprites, so we are updating it very often. Also every sprite has it’s own material.

Shaders 40
article thumbnail

Color Change of Sprite Renderer

Cocos

To modify the material, you need to add color parameters to the corresponding shader. SpriteRenderer does not provide an interface to modify the color. You can change it by modifying the material. Like this surface-effect.effect.zip (1.2

Render 52
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

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. Use UV in Shader Both 2D and 3D shaders in Cocos are obtained in the vertex shader (VS) and passed to the pixel shader (FS). x,waveFactor.y-uv0.y); x,waveFactor.y-uv0.y);

Shaders 98
article thumbnail

[Tutorial]Outer Stroke Effect for 2D Sprites

Cocos

Original: [link] Author: BitByBit Outer Stroke Effect for 2D Sprites Continuing from the previous article Inner Stroke Effect for 2D Sprites Introduction In the last article, we introduced the method of inner stroke and also discussed its pros and cons. The above is the part of the custom post-processing shader.

Sprite 52
article thumbnail

[CC 3.7.3] Shader Error?

Cocos

Another thing is I noticed that the FPS dropped after the shader was applied to some sprites. So, is there way to cache the rendered texture (including the shader effect) rather than recalculating the same thing every frame. I will check and get back to you.

Shaders 40
article thumbnail

Shader on IOS error

Cocos

I have a question related to shaders. I created a game in which I added a shader; it works fine in web mobile and Android, but in iOS it gives an error during rendering. How to solve this issue version-3.8 error - Attribute a_uv0 is missing, add a dummy data for it. How to solve this issue version-3.8 1.0] } } u_dL: { value: 0.0,

Shaders 40
article thumbnail

[CC 3.7.3] Shader Error?

Cocos

Are you using this material with normal Sprite component ? by default it’s not activated in Sprite component because the commitComp was invoked without any transform data github.com cocos/cocos-engine/blob/develop/cocos/2d/components/sprite.ts#L579-L581 If so, how did you activate USE_LOCAL for it ?

Shaders 40