Dev-Owl / flutter_shader_loader

Loading animation using a widget with a shader
MIT License
5 stars 0 forks source link

Example Project is too old by now #2

Open jhonatan-3a opened 1 year ago

jhonatan-3a commented 1 year ago

nothing in the proyect runs with the latest version of flutter and shaders

Dev-Owl commented 1 year ago

True, check out another example I made: https://github.com/Dev-Owl/flutter_space

jhonatan-3a commented 1 year ago

tysm for the early reply!

jhonatan-3a commented 1 year ago

hey men im in the needs of using this other shader from shader toy, im unable to make the code interpretable by flutter, can i ask how you made the conversion from the shaderToy shader so flutter can read it ? im trying to use this one btw https://www.shadertoy.com/view/XtGGRt

Dev-Owl commented 1 year ago

Only thing I can hand over right now are official docs (https://docs.flutter.dev/development/ui/advanced/shaders). If the shader uses anything of the not supported operations you would need to rewrite it, depending on the shader and used function this could be difficult.

I might find some time later this weekend to check it. Do you get an error message while running the shader?

jhonatan-3a commented 1 year ago

after trying line of code by line of code i found out that the actual problem is this function vec3 nmzHash33(vec3 q) { uvec3_t p = uvec3_t(ivec3_t(q)); p = puvec3_t(374761393U, 1103515245U, 668265263U) + p.zxy + p.yzx; p = p.yzx(p.zxy^(p >> ivec3_t(3))); return vec3(p^(p >> ivec3_t(16))) * (1.0/vec3_t(0xffffffffU)); } that cant be interpreted by impeller and i dont see how to convet it, already tried gpt but not found any solution, and if i remove this function and just return the input this what it would show, pretty much there, but not quite there yet https://imgur.com/oDb41j9

Dev-Owl commented 1 year ago

Yes like the docs say onle vec2 is supported, you will need to rewrite this part. In the end anything has to be based on two argument version. Vec2 Vec4 etc. Maybe you can use a vec4 and ignore the last element.

jhonatan-3a commented 1 year ago

thanks for the response man, really appreciate it

Dev-Owl commented 1 year ago

@jhonsabowsla Have look at https://github.com/Dev-Owl/flutter_space/blob/main/assets/shaders/anotherspace.frag I tried to convert your Shader to Flutter. You can clone the project and start it. Press Space to switch between the shaders.

I had to replace the Star logic as the current state of shader support did not allow me to use the original code.