Is there a particular reason why you assign the new curseur to col.rgba into the if?
be outside the if?
Also all(x) returns true if ALL components of x are non-zero… so even with x = (0.1,0.1,0.1) it would return true, and this is not what you’re looking for, I think.
To check if x is (1.0,1.0,1.0) you should iterate through all components of x.
Well, there’s no time value in your patch, nor something that would raise curseur value through time. There’s no trigger event to increase curseur (nor to stop increasing it).
It is not enough rising curseur one time in the if; I’d add a pin
... // and then change
and link a node that goes 0 to 1 in a specified amount of time with the use of some more logic, or patch your way to this without a shader.
I honestly never thought about something like this, so I have not fresh ideas; if you browse through EX9.Texture category you should find some fitting examples.
increment parameter according to time value is for me “every time the mask is white at pixel at xy location, the alpha curseur parameter is increased at this pixel position”.
so it has to be done into the fx file I guess…
M2C… that ain’t gonna happen that way.
In other words, once you “create” another sphere, the corresponding pixels become white, this texture is passed to the .fx, the .fx reads the white pixels and update its own texture once, since the input texture ain’t changing the already white pixels.
In order to increase x.a you should be working with white objects with an alpha, for example.
In my attached example, every frame a new sphere is created/overlaps an old one, so you get an update in the texture, leading to more solid white/red out of the .fx.
You do get then the time/number of frames needed to go from black to white into source texture = 1 / sourceAlphaValue since every frame a new sphere with specified alpha color (in my example 0.002) is added. A bit more math goes to get the time in output texture - it will be faster, since every frame adds up the new source white.
But you can easily see how the .fx is almost useless. That said, this is a way, not the way.
Actually that’s an almost nice effect the one in the destination renderer. I’m gonna treat myself, later.
Too good to be true, indeed; the path to the .fx is wrong, you should drag and drop it. No treats, I knew it.
but my final purpose is to compose a picture from 10 different images.
when the white mask is at xy position, the cursor is increased. at this position, if cursor is between 0 and 0.1? image 1 is displayed, if cursor is between 0.1 and 0.2 image 2 is displayed…
so i guess i have to deal with time value, I mean duration of the white mask which increases the cursor at this location…
little bit tricky ? I hope I’m clear…
thanks anyway, but I’m little bit confused and lost about this issue…
shaders cannot store values and access them in the next frame, this is only possible with texture feedback (then the value needs to be stored in the texture) or compute shaders.
also in the shader you are sampling col1, but you are not using it to do the comparison. i think you mixed that up with col.
anyway, the shader could look like this:
float CurseurOffset = 0.05;
float4 PS(vs2ps In): COLOR
//just the red channel channel from R32F texure in the texture
float curseur = tex2D(SampCurseur, In.TexCd).r;
float4 mask = tex2D(SampMask, In.TexCd);
if (all(mask.rgb >= 1))
curseur += CurseurOffset;
//clamp curseur value to 0..1
curseur = saturate(curseur);
//just write curseur value into red channel of the output
return float4(curseur, 0, 0, 1);
thanks tonfilm !
would it be possible to create a texture which goes from black to white at the position where my white mask is still at the same position during 10 sec for instance… then I can analyse this color texture to draw the final one…
the question is how to deal with time in shaders…?
shaders do not know time, but if you think about it, its just a matter of how much you increase the value per frame. so Timing -> FrameDifference -> / should do the trick.
then you calculate the CurseurOffset you put int to the shader in your patch like that: