Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
According to the docs it's somewhat done with: myShaderCallBack = function() How would I have to tell the fragmentShader part making use of my example variable abc for other params than float4, e.g for float alpha? "float4 abc; \n" + e.g for float alpha? "float alpha abc; \n" + |
||||
|
with "abc" as my sample variable from outside this throws me an "undeclared identifier abc" error: var fragmentShader =Instead of something like float alpha = 0.5; I would like to make float alpha = abc; work. So, how would I have to tell the fragmentShader part to accept my variable "abc" from normal javascript part using the myShaderCallBack function in a correct way? Thanks for any professional help in advance ;-) |
||||
|
Just declare the float4 abc ;below or above the "Sampler2D tex0" and then use float alpha = abc.w; If you don't want to use float4 then in your shader callback, degine the value abc as the first parameter instead of 4th. Then in your fragment shader you can define it as float abc;instead of float4 and then you don't have to use the subscript "abc.w" whenever you use this in your shader code, you can simply call it by "abc" It seems a bit complicated but once you understand it, it will be an ease for you to do stuff that way. You can watch my HLSL shader video on youtube to understand how shader works in CopperCube. |
||||
|
Thank you very much just_in_case!!! Problem solved plus learned a lot about CC shader scripting from the official docs plus your examples today!!! Feel like maybe posting soon something useful with this, too. |
||||
|
will be waiting for your shader, it seems you are going to release some sort of stickers or something similar shader, I can see you are using my overlay shader code in there in the example code you posted above. So my guess is you are going to create something that deals with overlays and alpha transparency. Hope to see some nice results, Good Luck! |
|