Age Verification
This website contains age-restricted material including nudity and explicit content. By entering, you confirm being at least 18 years old or the age of majority in the jurisdiction you are accessing the website from.
I am 18+ or older - Enter
I am under 18 - Exit
Our parental controls page explains how you can easily block access to this site.

Discussions for Scenes for Version 1.2.X Fullscreen Mode here

  Forum / Everything about iStripper

Socialhazard
Joined in Nov 2020

1154 post(s)
October 15, 2022
Nice work guys, keep 'em coming. 👍 😎
Wyldanimal
MODERATOR
Joined in Mar 2008

3961 post(s)
October 15, 2022
The Shader toy shaders
use these Inputs. Some or all of them.
These must be converted to iStripper compatable inputs.
Not all of these can be converted, so there are some shaders that just can't be used..

Shader Inputs
uniform vec3 iResolution; // viewport resolution (in pixels)
uniform float iTime; // shader playback time (in seconds)
uniform float iTimeDelta; // render time (in seconds)
uniform int iFrame; // shader playback frame
uniform float iChannelTime[4]; // channel playback time (in seconds)
uniform vec3 iChannelResolution[4]; // channel resolution (in pixels)
uniform vec4 iMouse; // mouse pixel coords. xy: current (if MLB down), zw: click
uniform samplerXX iChannel0..3; // input channel. XX = 2D/Cube
uniform vec4 iDate; // (year, month, day, time in seconds)
uniform float iSampleRate; // sound sample rate (i.e., 44100)

iMouse can not be converted, but a pseudo Random function can be used to simulate Mouse input.
The Chess shader, does not use Mouse input.
iDate can't be parsed, but a fake date can be created. You can't grab the current date and time of day.

These are inputs that can't be simulated.
uniform float iChannelTime[4]; // channel playback time (in seconds)
uniform vec3 iChannelResolution[4]; // channel resolution (in pixels)
uniform vec4 iMouse; // mouse pixel coords. xy: current (if MLB down), zw: click
uniform float iSampleRate; // sound sample rate (i.e., 44100)

uniform samplerXX iChannel0..3;
these are the input images sent from the scene to the shader, the clip sprite, sprites, etc...
iStripper does NOT support video or sound inputs.


When Possible, it's best to use the Shader toy Names, so that, there is a lot less editing to be done to the shader.

Wyldanimal
MODERATOR
Joined in Mar 2008

3961 post(s)
October 15, 2022
iStripper uses these for the Time and Resolution
u_Elapsed is a float, it is floating point variable ( must use a decimal point with a float, such as 1. or 0. or 3.0 )
it starts counting the time in milliseconds when the shader starts, and continues to count till the shader ends.

u_WindowSize is a vec2 ( it has a width and a height value, or 2 components )
you can use a swizzle to get one or both of them.
u_WindowSize.x gets just the width, this is an int or a single component.
u_WindowSize.y gets just the height, this is an int or a single component.
u_WindowSize.xy gets both, this is a vec2, it has two components
you can also use
u_WindowSize.u in place of u_WindowSize.x
u_WindowSize.v in place of u_WindowSize.y
u_WindowSize.uv in place of u_WindowSize.xy
use care when using swizzles to make sure both sides of an = sign, have the same number of components
this is one of the areas that can cause errors that are next to impossible to hunt down.


this is how we write them in the shader
uniform float u_Elapsed; // The elapsed time in seconds
uniform vec2 u_WindowSize; // Window dimensions in pixels

now that we have the iStripper time and resolution as inputs
we define New variables and assign the iStripper inputs to use
It's easier to use the shader toy names, and NOT edit every place in the shader.

so for the Chess shader, Just define two variables using the shader toy name.

#define iTime u_Elapsed //( varable iTime will get its value from the iStipper variable u_Elapsed )
#define iResolution u_WindowSize //( variable iResolution will get its value from iStripper variable u_WindowSize )

in the shader we can now use
iTime in place of u_Elapsed and
iResolution in place of u_WindowSize

since the shader already is written, using iTime and iResolution variables, you don't have to edit every place where they are used.


EverthangForever
Joined in Oct 2009

2477 post(s)
October 15, 2022 (edited)
Thanks so much @WyldAnimal for explaining what you have done in
making this conversion work. I couldn't get it to compile until
I saw what you did. I was using shadertoy's input uniform int iFrame;
but not substituting the (const int) TFRAME reference, as you did.

Also
Often I've tried using lines like fragColor = gl_FragColor; in the code preamble
to save editing in the past without success, so using it post-void as
vec4 fragColor = vec4(gl_FragColor); could offer me a future solution.


I have had a lot of trouble in past compiling attempts to convert shaders
which do not end with plain fragColor = .. but use say fragColor.xyz = ...
For example
https://www.shadertoy.com/view/WllfzS by gaz
i would appreciate seeing a conversion of this shader or any similar to help me
better understand the process. Couldn't find ones that @TheEmu had done.
Hope that is possible to show such conversion if you have a spare moment . Thanks a lot.
TheEmu
Joined in Jul 2012

3309 post(s)
October 15, 2022
I have had a lot of trouble in past compiling attempts to convert shaders
which do not end with plain fragColor = .. but use say fragColor.xyz = ...

At some point in the shader you should assign a value to each of the four (x,y,z and a) components of fragColor otherwise they will remain unchanged from their initial values - which for iStripper are all 0.0 but for ShaderToy the a component's initial value is 1.0.

This means that for ShaderToy if no value gets assigned to fragColor.a the pixel will be fully opaque 9and therefore visible) but for iStripper the pixelwill be fully transparent.

So, if a shader ends with fragColor.xyz = ... at some point you need a fragColor.a = ... (probably fragColor.a = 1.0) unless there has already been an assignment to this component earlier in the shader.
EverthangForever
Joined in Oct 2009

2477 post(s)
October 16, 2022 (edited)
OMG, such a simple solution.
All works well now. Thanks a lot @TheEmu
Wyldanimal
MODERATOR
Joined in Mar 2008

3961 post(s)
October 16, 2022 (edited)
For example
https://www.shadertoy.com/view/WllfzS by gaz

here is my conversion

#version 330
#extension GL_EXT_gpu_shader4 : enable
// added the version and open GL extension
// should be the first line of the shader
/////////////////////////////////////////////////////////////////////////////////


// from ShaderToy.com https://www.shadertoy.com/view/WllfzS
// Adapted for iStripper by WyldAnimal

uniform float u_Elapsed;
uniform vec2 u_WindowSize;

#define iTime u_Elapsed
#define iResolution u_WindowSize

/////////////////////////////////////////////////////////////////////////////////

float Scale;
float map(vec3 p)
{
float s=2.;
for(int i = 0; i < 4; i++) {
p=mod(p-1.,2.)-1.;
float r2=1.2/dot(p,p);
p*=r2;
s*=r2;
}
Scale=log2(s);
p = abs(p)-0.8;
if (p.x < p.z) p.xz = p.zx;
if (p.y < p.z) p.yz = p.zy;
if (p.x < p.y) p.xy = p.yx;
return length(cross(p,normalize(vec3(0,.5,1))))/s-Scale*.0015;
}


/////////////////////////////////////////////////////////////////////////////////
// need to convert this from a void to a function and call it by adding
// a void main(void) { to the end of the shader
// what type of variable will the function return?, it is a color and needs to be a vec4
// change void to vec4
//void MainImage(out vec4 fragColor, in vec2 fragCoord) {
vec4 mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv=(2.*fragCoord-iResolution.xy)/iResolution.y;
vec3 p,
ro=vec3(1.,1.,iTime),
w=normalize(vec3(.1*sin(iTime*.5),.3,1)),
u=normalize(cross(w,vec3(cos(-iTime*.16),sin(-iTime*.16),0))),
rd=mat3(u,cross(u,w),w)*normalize(vec3(uv,2));
float h=0.,d,i;
for(i=1.;i<100.;i++)
{
p=ro+rd*h;
d=map(p);
if(d<.0001)break;
h+=d;
}
//fragColor.xyz=35.*vec3(vec3(.7,.9,.7)*cos(Scale*.3)+(cos(p.xyy)*.5+.5))/i;
fragColor=vec4(35.*vec3(vec3(.7,.9,.7)*cos(Scale*.3)+(cos(p.xyy)*.5+.5))/i,1.0);

/////////////////////////////////////////////////////////////////////////////////
//the function needs to return a value.
//it needs to be a vec4
//we will return the varable fragColor
return fragColor;
}

/////////////////////////////////////////////////////////////////////////////////
void main(void) { // this will be run for every pixel of gl_FragCoord.xy
vec4 fragColor = vec4(1.0); // initialize variable fragColor as a vec4
vec4 cc = mainImage(fragColor, gl_FragCoord.xy); // call function mainImage and assign the return vec4 to cc
gl_FragColor = vec4(cc); // set the pixel to the value of vec4 cc
}

download it here
https://virtuastripper.net/Shaders/WllfzS.fsh

and a Variant here
https://virtuastripper.net/Shaders/WllfzS-B.fsh
TheEmu
Joined in Jul 2012

3309 post(s)
October 16, 2022 (edited)
There is one ***** addition I would make to @Wyldanimal&#039;s version of the shader.

After of ending with gl_FragColor = vec4(cc); it would be better to use

gl_FragColor = vec4(cc) * gl_Color;

as that would use the values of any Color: or Opacity: clauses (and any Animate clauses applied to these properties) appearing in the Sprite, Quad or other node invoking the shader in the .scn file.
EverthangForever
Joined in Oct 2009

2477 post(s)
October 16, 2022 (edited)
@WyldAnimal & @TheEmu, thanks a lot gentlemen for this detail..
  • Relocating the void main(void) node lower down in the .fsh
before declaring gl_FragColor will save lots of 'gl_Frag...' code
replacements above
and
  • including gl_FragColor.a = 1.0; for the alpha component of
fragColor where shadertoy just uses fragColor.xyz = ...

will be useful changes in future conversions which I will try to apply.
I enjoy the lil wave of endorphines one gets when ever shaders compile
in the first instance.😉
Calgon
Joined in May 2022

367 post(s)
October 16, 2022 (edited)
@TheEmu

as that would use the values of any Color: or Opacity: clauses (and any Animate clauses applied to these properties) appearing in the Sprite, Quad or other node invoking the shader in the .scn file.

Found an example of this in your ReHa Small Pool scene


https://www.theemusnest.eu/scenes/Zips/TheEmu%20=%20ReHa.zip

Wyldanimal
MODERATOR
Joined in Mar 2008

3961 post(s)
October 17, 2022
@TheEmu

gl_FragColor = vec4(cc) * gl_Color;

👍
EverthangForever
Joined in Oct 2009

2477 post(s)
October 18, 2022 (edited)
NB: in the above full shader code, you may need to change .fsh header #version 330 to
something lower like #version 120 in order to make @TheEmu 's supplement work.
Wyldanimal
MODERATOR
Joined in Mar 2008

3961 post(s)
October 18, 2022
header #version 330 to
something lower like #version 120 in order to make @TheEmu 's supplement work.

Actually, I think the Opposite case.

ALL of the older shaders should have a Header updated to support version 330
unless the shader is using an obsolete / no longer functioning GLSL command.
All headers should be raised to the higher version.

330 as a minimum, 330 ( 2010 ) should support backward all prior versions.
moving in to the 4.0 version ( also 2010 ) , is where backward compatibility started to be lost.
460 is the current as of 2017.

ALL current GPU's should be supporting version 460 ( 4.6 )

EverthangForever
Joined in Oct 2009

2477 post(s)
October 18, 2022 (edited)
hmm.. I wonder how many people's rigs will show the vghd.log error I got when applying
gl_FragColor = vec4(cc) * gl_Color; Its not ubiquitous apparently. I might look at whether
I need to update my GPU 's drivers or something . Emu's update does compile the .fsh ok if I
use the lower (#version 120) header

0(77) : error C7616: global variable gl_Color is removed after version 140]
2022-10-18T11:46:27[] WARNING[*** Problematic Fragment shader source code ***]
2022-10-18T11:46:27[] WARNING[#version 330
Wyldanimal
MODERATOR
Joined in Mar 2008

3961 post(s)
October 18, 2022 (edited)
gl_Color has been depreciated ( no longer used ) after Version 140

so in the case where a shader will use gl_Color, the Version has to be set to 140 or lower.


gl_Color was a built in system variable and it received an in vec4
EverthangForever
Joined in Oct 2009

2477 post(s)
Wyldanimal
MODERATOR
Joined in Mar 2008

3961 post(s)
EverthangForever
Joined in Oct 2009

2477 post(s)
October 19, 2022
@WA
Wow, thanks so much for this..food for thought ( a feast infact ) 😉 !!
Interesting your effects created by using shaders on shaders in such various ways.
The mixing examples using .scn code to combine2.fsh, difference2.fsh and exclude-one.fsh
open up a lot of possibilities with less demanding shaders. Will explore this some more. Ta 👍
Wyldanimal
MODERATOR
Joined in Mar 2008

3961 post(s)
October 19, 2022
It works with static images as well.
And with clips.

So it's not just limited to two shaders..

Source inputs can be any type of image that uses a named id

EverthangForever
Joined in Oct 2009

2477 post(s)
October 21, 2022
https://www.istripper.com/forum/thread/29408/75?post=750369
Everything about iStripper / Share your FullScreen - Member Created Scenes here
FG692-FG702 Eleven selected WebGL shaders converted to OpenGL to run &/or remix on iStripper's Fullscreen OpenGL platform Standing or floor work randomly applies to all scenes. https://scenes.virtuast...
NB:This group of shaders have been converted using a method
(recently illustrated by @Wyldanimal ) of converting void mainImage to
vec4 mainImage and applying void main(void) as a code footer
calling function mainImage to assign the return vec4 to 'cc'.
@TheEmu 's additional gl_FragColor = vec4(cc) * gl_Color; has been
included..hence all shaders here run as OpenGL #version 130 or less.
EverthangForever
Joined in Oct 2009

2477 post(s)
October 21, 2022 (edited)
@ComteDracula
Thank you so much @EverthangForever. All the scenes work well for me. 😊
Merci, je vais essayer de continuer à utiliser @Wyldanimal méthode car elle préserve le
code original du WebGL beaucoup plus. J'espère que cela permettra aux shaders de compiler plus efficacement.
C'est dommage que nous ne puissions pas trouver de solution de contournement pour @TheEmu
  • gl_Color; référence pour convenir aux versions supérieures d'OpenGL.
---
Thanks, I will try to continue using @Wyldanimal 's method because it preserves the
original code of the WebGL much more. I hope that will make the shaders compile more efficiently.
Its a shame we cannot find a workaround for @TheEmu 's * gl_Color; reference to suit higher OpenGL versions.
Wyldanimal
MODERATOR
Joined in Mar 2008

3961 post(s)
October 21, 2022 (edited)
Its a shame we cannot find a workaround for @TheEmu 's * gl_Color; reference to suit higher OpenGL versions.

the Alph and Color is passed to the shader when the sampler2D texture is input.

instead of using the depreciated gl_color
use instead the Alpha and color of the passed sampler2D texture.

texture2D(texture0).rgba

we get the sample similar to this is a shader.

uniform sampler2D texture0;
uniform vec2 textureSize0;
varying vec4 gl_TexCoord[];

the varying vec4 gl_TexCoord[] now has an array of each Sampler2D texture

varying vec4 texture2D(texture0) is texture0
varying vec4 texture2D(texture1) is texture1
varying vec4 texture2D(texture2) is texture2

so to get the color of the texture0
use
texture2D(texture0).rgb
to get the alpha of texture0
use
texture2D(texture0).a

and then the last line of the void main(void);
to preserve the Alpha would be
gl_FragColor.a = gl_FragColor.a * texture2D(texture0).a

or in the example above to preserve both color and alpha of the input texture
gl_FragColor = vec4(cc) * texture2D(texture0).rgba


Here is a sample test scene that use the antiAlias shader
on the Left I made a copy of the shader and called it antiAlias330
this on uses a version Header of 330
and uses the above code
gl_FragColor = gl_FragColor * texture2D(texture0).rgba
to preserve the color and Alpha of the Sample passed to the shader

on the right I use the same shader but in it's original form.
the color and Alpha is Not preserved.

download the sample scene
https://virtuastripper.net/GL_COLOR_TEST.zip

note:
this
gl_FragColor = gl_FragColor * texture2D(texture0).rgba
can be simplified to this
gl_FragColor *= texture2D(texture0).rgba
Wyldanimal
MODERATOR
Joined in Mar 2008

3961 post(s)
October 21, 2022 (edited)
another way to do it would be to just create a new Variable and assign the rgba to that variable.

vec4 RGBA0 = texture2D(texture0).rgba;

if you have more than one sample
vec4 RGBA0 = texture2D(texture0).rgba;
vec4 RGBA1 = texture2D(texture1).rgba;
vec4 RGBA2 = texture2D(texture2).rgba;

then just use the new variable you created
RGBA0

this
gl_FragColor = vec4(cc) * gl_Color;
becomes this
gl_FragColor = vec4(cc) * RGBA0;

if your shader had multiple Samples paseed to it then use this
for 2 inputs
gl_FragColor = vec4(cc) * RGBA0 * RGBA1;
or this
for 3 inputs
gl_FragColor = vec4(cc) * RGBA0 * RGBA1 * RGBA2;

here is a shader using the above example

get this sample shader
https://virtuastripper.net/Shaders/antiAliasRGBA.fsh

get the sample scene using this shader
https://virtuastripper.net/GL_COLOR-2_Test.scn
TheEmu
Joined in Jul 2012

3309 post(s)
October 21, 2022 (edited)
another way to do it would be to just create a new Variable and assign the rgba to that variable.

That would work, but with the severe limitation that the values could not be made to vary using animate: clauses in the .scn file. It would also introduce complications because values assigned to a uniform in a.scn file are "unscoped" in that they do not only apply to the node in which they are assigned their value so you either have to remember to reset them or use different names in each of your shaders (duplicating any shader that is used twice in a scene.)

(you could, I think, make them vary by using a vertex shader - but that adds another level of awkwardness).
Z22
Joined in Aug 2017

1166 post(s)
October 21, 2022
another way to do it would be to just create a new Variable and assign the rgba to that variable.
That would work, but with the severe limitation that the values could not be made to vary using animate: clauses in the .scn file. It would also introduce complications because values assigned to a uniform in a.scn file are "unscoped" in that they do not only apply to the node in which they are assigned their value so you either have to remember to reset them or use different names in each of your shaders (duplicating any shader that is used twice in a scene.)

(you could, I think, make them vary by using a vertex shader - but that adds another level of awkwardness).

It should be running a seperate instance of the shader anyway shouldnt it? I don't see how an animate in a framebuffer would affect another framebuffer using a seperate instance of the shader or is this animating in a sprite thats a shader in the camera node thing?
EverthangForever
Joined in Oct 2009

2477 post(s)
October 22, 2022 (edited)
The only problem I've ever had running 2 instances of same shader in a .scn
is if I try to run them from the same source or on the same substrate pre-camera node..
Running say, Emu's Tunnel A.fsh from separate source directories fixed that.
Wyldanimal
MODERATOR
Joined in Mar 2008

3961 post(s)
October 22, 2022
That would work, but with the severe limitation that the values could not be made to vary using animate: clauses in the .scn file.

you would use the shader is a frame buffer or a node.
and the shader would preserve the color or opacity assigned in that framebuffer or node..

this gets around the limitation of the version of the shader being limited to 1.4 or lower.

Now, you can use version 3.3 up to 4.5 in the shader while still preserving the color or opacity of the source.


later in the camera
you use the sprite with the source id of the framebuffer or node and that can be animated.

TheEmu
Joined in Jul 2012

3309 post(s)
October 22, 2022 (edited)
@EverthangForever

The problem, a ***** one, is that in the following

Sprite { // node 1
source : source1
shader: myshader
}

Sprite { // Node 2
source : source2
uniform : float, ABCD, 1.0
shader: myshader
}

Sprite { // Node 3
source : source3
shader: myshader
}

Sprite { // Node 4
source : source4
uniform : float, ABCD, 2.0
shader: myshader
}

When the shader runs it will see, and use, the following values for the uniform ABCD

0 - First time for Node1 - uses the default value of 0.0
1 - Node 2 - uses explicitly declared value
1 - Node 3 - "inherits" the value from the previous use
2 - Node 4 - uses explicitly declared value

2 - Second time for node 1 - which is different from the first time
1 - Node 2
1 - Node 3
2 - Node 4

This will be true even if you try to detect the use of default zero values wihin the shader in order to override the default. Furthermre if you then introduce a 5th node and use a different value for the uniform there this value will then be used instead of 2 for the second time for node 2. Also if you change the order of the node the effect on the values used will vary.

This is not a big problem, but is is an annoying one even if you are aware of it, and I am sure it would be a very ***** one for those that encounter it for the first time. Using gl_Color does not have this problem but replacing gl_Color with a user defined uniform variable would have.

A simple example of the annoyance is that if I have scene uing a set of (quads, sprites, clipsprites etc.) all using the default values for a uniform and then decide that for one of them I want to use some non-default value I have to make two edits to the source - one to assigne the uniform its new value in the node I want to change and a second to set it back to its defalut value in the node following it.


@Wyldanimal

Yes you can use a framebuffer - but that is much mre complex than just directly animating Color and/r Opacity. I should have made it clear that I was trying to say that you can't use animate on the user define uniform variable in the way that you can with gl_Color even though you can, with some effort, have the same end result.
TheEmu
Joined in Jul 2012

3309 post(s)
October 22, 2022
https://stackoverflow.com/questions/20286156/why-gl-color-is-not-a-built-in-variable-for-the-fragment-shader

discusses gl_Color. It contains the following paragraph

However, none of this behavior exists in newer versions of GLSL. You must supply your own vertex attributes, your own varyings and you pick between colors using the value of gl_FrontFacing. I actually explained this in more detail in a different question related to OpenGL ES 2.0, but the basic principle is the same.

So I suppose we could use gl_FrontFacing as a replacement for gl_Color. I have not tried this as I have hardware problems at the moment.

You are not allowed to participate yet

As a free user of iStripper, you are not allowed to answer a topic in the forum or to create a new topic.
But you can still access basics categories and get in touch with our community !