Have you been watching "the art of code/feathers in the wind"? https://www.youtube.com/watch?v=68IFmCCy_AM
Edit, ah yeh, i see you have his atribution in the shader.
// Remove alpha for black
if (col.r > 0.01)
{
col.a = 1.0;
}
else
{
col.a = .0;
}
// Remove alpha for black
if (col.r > 0.01)
{
col.a = 1.0;
}
else
{
col.a = .0;
}
col.a = ( col.r > 0.01 ) ? 1.0 : 0.0;
col.a = float ( col.r > 0.01 );
if(col.r != 0.0)
{
col.a = 1.0;
}
col.a = ( col.r != 0.0 ) ? 1.0 : 0.0;
col.a = float ( col.r != 0.0 );
col.a = edge ( 0.01, col.r );
@TheEmu
To catch errors in shaders I rely on the error and warning messages written to the vghd.log file when any are encountered
Trouble is..... as I'm still learning. I don't always know what the error codes mean. So my procedure is usually:
1. Try to run the scene
2. Did it run ?
2.+Yes => Finished
2.+No => Read error log
3. Did I understand the error messages ?
3+No => Change the code in some random way => Go back to 1.
vec3 bug = 0.0;
vec3 bug = vec3(0.0);
Obviously if it compiles and runs but looks weird its not going to help you with those type of errors, nor will the logfile though.
@Z22
That is not equivalent to the code that @Calgon was asking about which tested col.r not col.a. He may well have what intended to test col.a but even then the code would not be equivalent as the original threshold was not 0.0.
Edit - you modified your post after I started to reply, but the modified code is still not equivalent to @Calgon 's original.
Edit - there is also a standard GLSL function that can be used for this, see
https://docs.gl/sl4/step
the original code would be equvalent t0
col.a = edge ( 0.01, col.r );
1. Try to run the scene
2. Did it run ?
2.+Yes => Finished
2.+No => Read error log
3. Did I understand the error messages ?
3+No => Change the code in some random way => Go back to 1.
He didnt ask for equivelence though, he asked for a more elegant. I think i understand what he is trying to do in the scene as it is something i have used many times on the girls alpha. That being if the feathers r channel is not 0.0 then the alpha should be 1.0, if it is 0.0 the the alpha should be 0.0. the low number (0.01) is most likely because he doesnt know about != rather than a desire to slice part of the feather off.
on my machine by default the discrepancy is usually only a line or two, but is more if I switch from the Intel to the Nvidia compiler.
2. Read error log
2. Read error log - even if the scene appeared to run properly.
For this problem it is often better to use the softstep() function to get a smoother edge rather than the hard edge you get with the binary if-then-else or the step() function - you get less jagged, less pixelated, edges with smoothstep().
If (col.r > 0.0)
{
col.a = smoothstep(0.0, 0.01, col.r);
}
For this problem it is often better to use the softstep() function to get a smoother edge rather than the hard edge you get with the binary if-then-else or the step() function - you get less jagged, less pixelated, edges with smoothstep().
softstep? typo?
yeh smoothstep would give a nicer edge so...
If (col.r > 0.0)
{
col.a = smoothstep(0.0, 0.01, col.r);
}
Is that right?
col.a = smoothstep(0.0, 0.01, col.r);
don't need the if.
col.a = smoothstep(0.49, 0.51, col.r);
Yes - I've been trying to work through some of his tutorials though I haven't watched that one yet, just hacked the code around..
don't need the if.
That is correct, with smoothstep you don't need any explicit logic for this sort of thing. You might want to tweak the limits, either or both of them, depending on exactly what you want to see but for this particular usage the values you have would seem to be sensible.
If, however, you wanted the transition to be a soft one centred at a value of 0.5 for col.r you would want something like
col.a = smoothstep(0.49, 0.51, col.r);
outp.rgb = mix(Girl1.rgb, outp.rgb, smoothstep(0.50, 0.51, col.b+(sin(u_Elapsed*0.5)) ) );
edit:
col.a = smoothstep(0.0, 0.01, col.r);
don't need the if.
@Z22 GetNormal3Oct.fsh makes a nice variation from using Z22Glasstastic for a mod...Tks lots.
I noticed model left-right (x-axis) is reversed in the z22_SexualPredetor.scn version you posted.
I'd like to include this in the next batch of conversions (as per a shader from another shader)
if thats cool with you.😎 👍
framebuffer
{
size: 3840, 2160
pos: 1920, 1080
id: Backgroundshader
quad
{
// you might need pos:, size:, hotspot: in here too, cant remember off hand
shader: fragment, Backgroundshader.fsh
}
}
framebuffer
{
size: 3840, 2160
pos: 1920, 1080
id: Refract
sprite
{
source: Girl01, 0
source: Backgroundshader, 1
source: Girl02, 2
source: Girl03, 3
shader: fragment, GetNormal3Oct.fsh
}
}
source: Clip
scale: -1, 1
iStripper の無料ユーザーはフォーラム内の주제に参加したり新しい주제を作ることはできません。
でもベーシック카테고리には参加できコミュニティーと接することはできます!