i want to port a shader from shadertoy but there is problem that i have never faced before…
in this particular shader there are (3 buffers along with 1 image tab) & (1 other tab) that is called “common”
so in this tab there are some functions that are calling Textures
so I’m confused that if we are having a common tab, which of these textures are being used in all 4 tabs?
for example in this function
I’m not familiar with it, but my guess is that you can call the common functions from anywhere, and pass in the arguments from the other buffers. You will need to find where that function is being called if you want to know what is being passed in to it.
Although this feature was made for ease of use, but it’s a pain and time consuming in spark ar and shader porting… sometimes it behaves differently compared to shaders which don’t have “common tabs”. for example if you copy common tab’s codes and paste in each buffer separately, and then remove the common tab, the shader will be completly ruied while it shouldn’t be.
I successfully converted this shader without any errors but it’s showing black screen… i think there is a problem in bufferB
something new that i’ve seen in this shader was “Particles”
along with (Numbers, vec2, vec3, vec4 & colors), there are particles that i’m not sure is supported by Meta Spark or not.
this was one of the hardest shaders that i converted but i just don’t know why it’s not working
is there a genius that fix its problem?
I think it should work if you put all of you code in the same file. Then you can expose functions with the export keyword. This will help keep your shader more portable, as opposed to keeping separate files for each buffer.
I had a black screen with this shader even on shader toy, so I think it’s probably some hardware or glsl version incompatibility
The Spark page explains how to import and export the functions.
Basically before each " common " function, you will put export before the name. I’ve done it a few times and it worked perfectly. For example:
I read the code for this effect Probably you have run on ios or mac operating system and encountered a black screen.
Yes, this shader can be used for Android and Windows operating systems.
In general, most of the shaders that are rendered with low fps are shaders that are made for video editing programs such as after effect, programs that do not need to be rendered in real time, and therefore complex calculations can be used in them.
Of course, there is a way to use this shader in spark ar But in the form of a photo
Because the lines drawn by this shader are so thin that they are seen in checkered form when recording video
Even if it was run in realtime, it could not be used because of this problem
Thanks
I didn’t even know such a feature existed, although it still shows a black screen
I should have read all that article later, there might be more things that i don’t know about.
important fact is export does not work with #define
did you successfully converted this shader?
since it doesn’t give any errors, i don’t have any idea what to fix!
when this happens, only experience can resolve such problems.
i had an idea in mind that when user opens this effect, first he/she captures a photo, (like freezing the frame) and then this shaders draws the captured photo. this shader has no use in realtime videgraphy.
Yes, I think I converted this shader a year ago, although many changes had to be made in the code But as I said, you can only take a photo, you can’t run this shader in realtime on the video, it has complicated calculations.
so what causes the black screen, can you share your experiences please?
did you rewrote the code or some minor changes can fix this?
my complain is that I don’t know what to fix or what is wrong since there are no errors.
I didn’t read the version that you converted, but the original version of this shader on the shadertoy site shows that it will not work on Mac or iOS after conversion, if you use updated apple phones when Running the effect will most likely close Instagram and maybe even restart the phone, and if it is used in old versions, you will face a black screen, so I guessed that you probably ran it on these operating systems, but if on Windows operating system or Android, if you encounter this problem, you must have an error in the code
Converting this shader is not easy, it has complications like texelFetch or %