This site uses cookies to improve your experience. To help us insure we adhere to various privacy regulations, please select your country/region of residence. If you do not select a country, we will assume you are from the United States. Select your Cookie Settings or view our Privacy Policy and Terms of Use.
Cookie Settings
Cookies and similar technologies are used on this website for proper function of the website, for tracking performance analytics and for marketing purposes. We and some of our third-party providers may use cookie data for various purposes. Please review the cookie settings below and choose your preference.
Used for the proper function of the website
Used for monitoring website traffic and interactions
Cookie Settings
Cookies and similar technologies are used on this website for proper function of the website, for tracking performance analytics and for marketing purposes. We and some of our third-party providers may use cookie data for various purposes. Please review the cookie settings below and choose your preference.
Strictly Necessary: Used for the proper function of the website
Performance/Analytics: Used for monitoring website traffic and interactions
Good evening, I just finished writing my own custom shader to create 2D shadows on sprites, but I can’t find a way to increase the render area of the sprite. The sprite size is 450x450, I created an atlas and used the trim option, this reduced the frame to 156x393. Is there a way to increase the render bounds?
Blockquote const sprite = this.getComponent(Sprite); const mat = sprite.customMaterial; mat.setProperty(‘dissolveThreshold’, 0.5); Version 3.6.x, x, I using this code but it not bring Property affect to shader Ok, this work if turn of Packable in main Sprite inspector
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);
In this “Unity Sprite Outline” tutorial we’ll discover how to create both a “Sprite Innerline” and a “Outer Sprite Outline”. Simply, the Inner Sprite Outline shader is drawn “inside” the sprite, while “Outer” is the opposite. Inner Sprite Outline HLSL. Outer Sprite Outline HLSL. Amplify Shader.
My sprite doesnt look right after given a material, I wanted to achieve a addtive like effect. heres what it looks like now! Im a new user and unfortunately I can only post one image. The source image has smooth alpha gradient. screenshot-20241218-160021|437x273 Im using cocos creator 3.8.3
My sprite doesnt look right after given a material, I wanted to achieve a addtive like effect. heres what it looks like now! Im a new user and unfortunately I can only post one image. The source image has smooth alpha gradient.screenshot-20241218-160021|437x273 Im using cocos creator 3.8.3
My sprite doesnt look right after given a material, I wanted to achieve a addtive like effect. heres what it looks like now! Im a new user and unfortunately I can only post one image. The source image has smooth alpha gradient.screenshot-20241218-160021|437x273 Im using cocos creator 3.8.3
My sprite doesnt look right after given a material, I wanted to achieve a addtive like effect. heres what it looks like now! Im a new user and unfortunately I can only post one image. The source image has smooth alpha gradient.screenshot-20241218-160021|437x273 Im using cocos creator 3.8.3
Even after modifying the vertex buffer ( vb ), the changes are not reflecting on the sprite. I understand that in Cocos Creator 3.8 , I can access the vbo and modify the vertex colors using: let ur = this.node.getComponent(UIRenderer); let vb = ur['_renderData'].chunk.vb;
I have a sprite (a regular line) and I wanted to apply a wave effect to it. I tried to normalize by passing the dimensions of the sprite (line) to the shader like this mat.setProperty("iRsolutetion", new Vec2(1.0 / this.node.getComponent(UITransform).contentSize.width, this task tormented me. it doesn’t work properly.
About shaders. For most game developers, shaders are this scary monster that presents itself with such a complexity that it seems out of reach. In reality, shaders are quite simple by default and just get more complex the more you add to them. Our sprite is 32x32 pixels in size, and it must be drawn at some position.
some issues… I see a lot of error when export shader: I am not familiar with shaders, but looks like there was a problem with imports: When I changed includes as in builtin spriteshader everything start to work Hi, thanks, now I can login. However, looks like in Cocos Creator 3.7.1
Hello, you may want to change the uv0 settings from the shader code. So 0 means the far left side of the sprite and 1 represents the far right side of the sprite. In the example they show on the manual, they made it so that the effect changes along the x-axis from the uv0.x It is important to know that the uv0.x
One shader is used, only the sprite texture changes. On a smaller texture, the distortion is greater than on a larger texture. The HelloWorld texture has a size of 196 X 270. I scaled it up in the graphics editor to 400 x 554 and the distortion is barely noticeable. Do you need some tweaks or is this a bug?
I am trying to create a 'CustomMaterial' to stack 2 shader effects. Maybe someone has a better way/idea to solve the problem of only having one CCEffect on one Node/Sprite/etc…? When I do effectAsset: new EffectAsset I get an error, because of the type mismatch. Thanks, tL.
I am trying to create a 'CustomMaterial' to stack 2 shader effects. Maybe someone has a better way/idea to solve the problem of only having one CCEffect on one Node/Sprite/etc…? When I do effectAsset: new EffectAsset I get an error, because of the type mismatch. Thanks, tL.
I am trying to create a 'CustomMaterial' to stack 2 shader effects. Maybe someone has a better way/idea to solve the problem of only having one CCEffect on one Node/Sprite/etc…? When I do effectAsset: new EffectAsset I get an error, because of the type mismatch. Thanks, tL.
Thank you so much for telling me how to find that component, but it’s too bad it’s not related to the original problem, which is the shader. ;-( It’s simply an error log caused by a missing asset in some component. Is there a difference between applying the material to the sprite and the label?
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.
I’m attempting to make a UI mask with a sprite stencil. I have a shader that I’ve made that essentially takes the sprite and adds a glitchy effect to it… (like a static glitch on a hologram display) It works great with sprites and does exactly what I want it to do.
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.2 17:49:37 [ERROR]: [ERROR] file /Applications/Cocos/Creator/3.8.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm:
I’m attempting to make a UI mask with a sprite stencil. I have a shader that I’ve made that essentially takes the sprite and adds a glitchy effect to it… (like a static glitch on a hologram display) It works great with sprites and does exactly what I want it to do.
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. First of all declare your array on the shader. stringwizard5: Glad to hear it’s working for you!
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.
I have written a thunder shader and attacked to my Sprite. Checkout: chunks.zip (1.9 KB) It shows in the editor. But it doesn’t show in preview in Browser. It shows some warnings: I use Cocos Creator 3.7.3.
I am having an issue with creating shader. CCProgram sprite-vs %{. #if Hello Cocos Team. I couldn’t include the cc-local. No errors were shown at the editor, but when I previewed I got the following error at the browser console.
I am having an issue with creating shader. CCProgram sprite-vs %{. #if Hello Cocos Team. I couldn’t include the cc-local. No errors were shown at the editor, but when I previewed I got the following error at the browser console.
I am having an issue with creating shader. CCProgram sprite-vs %{. #if Hello Cocos Team. I couldn’t include the cc-local. No errors were shown at the editor, but when I previewed I got the following error at the browser console.
I am having an issue with creating shader. CCProgram sprite-vs %{. #if Hello Cocos Team. I couldn’t include the cc-local. No errors were shown at the editor, but when I previewed I got the following error at the browser console.
I am having an issue with creating shader. CCProgram sprite-vs %{. #if Hello Cocos Team. I couldn’t include the cc-local. No errors were shown at the editor, but when I previewed I got the following error at the browser console.
I am having an issue with creating shader. CCProgram sprite-vs %{. #if Hello Cocos Team. I couldn’t include the cc-local. No errors were shown at the editor, but when I previewed I got the following error at the browser console.
I’m just learning how a shader works. So, I just copied from the built-in sprite effect file to mine. Now, back to the issue, I think, only “cc_matWorld” is used from #include <builtin/uniforms/cc-local> If I commented both of these lines, there were no error. But, everything stopped working as intended.
For the test, I just added a custom material to the sprite. I was hoping that in the inspector it would be possible to change variables and see the result in the scene window, but unfortunately when I run this in a browser or player, the image does not match what I see in the scene. I’m interested in the 2D scene!
Hello, before refering me to the tests or explaining in the theory what a shader is and how code it, can someone actually share a simple working code to apply to a sprite? I have been researching for a week now through old threads and tutorials all over the internet and the code has completly change in cocos2dx 4.0, thanks, R
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
y * sin(rad); o.rgb *= mix(startColor.rgb, endColor.rgb, smoothstep(edge1, edge2, diagCoord)); o *= color; ALPHA_TEST(o); return o; } }% [topic] When I use above codes, the shaders I apply to the sprite work fine when I’m in the editor, or when I run it in an emulator. 1.0], editor: {type: color} } endColor: { value: [1.0,
y * sin(rad); o.rgb *= mix(startColor.rgb, endColor.rgb, smoothstep(edge1, edge2, diagCoord)); o *= color; ALPHA_TEST(o); return o; } }% [topic] When I use above codes, the shaders I apply to the sprite work fine when I’m in the editor, or when I run it in an emulator. 1.0], editor: {type: color} } endColor: { value: [1.0,
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. 17:39:35 [ERROR]: [ERROR] file /Applications/CocosCreator/Creator/3.8.0/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-metal/MTLCommandBuffer.mm:
2nd, reset the effect in the material of your poker chip to default(standard for 3d, builtin-sprite for 2d), this will help you check if there is some compatibility problems with your custom shader. if it shows correctly in your build preview after doing this, that means you should re-check your shader. hope it can help.
I installed extensions in VS C (Cocos Effect, Shader languages support for VS Code) my next thought was to get into the shader to try working with the texture there, but I ran into difficulties: 1.) I want to achieve the effect - “so that the pixels, like water, fill the empty mouth of the river.”
Hello, so my issue is such, I have made a shader that causes a UV distortion in the fragment shader, to simulate “flame-like” effects at the edges. There are two variants of these shaders, one where the distortion is dependent on cc_time[0] i.e the time elapsed in seconds when a game is running. 1.0 - newUV.x), min(newUV.y,
We organize all of the trending information in your field so you don't have to. Join 5,000+ users and stay up to date on the latest articles your peers are reading.
You know about us, now we want to get to know you!
Let's personalize your content
Let's get even more personalized
We recognize your account from another site in our network, please click 'Send Email' below to continue with verifying your account and setting a password.
Let's personalize your content