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.

Ostatnie posty - Strona 1448

  Forum

TheEmu
Dołączył: Jul 2012
7424 post(y/ów)

Discussions for Scenes for Version 1.2.X Fullscreen Mode here

Wszystko o iStripper
October 25, 2017, 5119 odpowiedzi
@Z22 - a ***** simplification of your WetLook2.fsh shader is

uniform sampler2D texture0;
varying vec4 gl_TexCoord[];
void main ()
{
vec4 Girl = texture2D ( texture0, gl_TexCoord[0].xy );
// Create a b/w image of the girl
gl_FragColor = vec4 ( vec3(Girl.r+Girl.g+Girl.b)/3.0, Girl.a );
// Discard values outside the range 0.55 to 0.57
if ( abs(gl_FragColor.r-0.56) > 0.01 ) { discard; }
}

It just uses a less wordy way of expressing the way the texture is reduced to a monochrome version and uses a single "if" when deciding whether to discard or not. In this case it makes little difference, but in more complex cases it is better to keep ifs down to a minimum because they prevent various bits of the shader being executed in parallel by the GPU so I replaced the separate checks against an upper and lower limit with a single check against how far the value is away from the centre of the allowed range.

However, the main point of this post is to point out that up to now you have been tweaking the parameters used in a shader by editing the values of constants in the shader itself. There is nothing wrong with this, but it does mean that you can end up with a lot of very similar shaders differing only the values of a couple of parameters. For this reason it is usualy more convenient to make the control parameters inputs into the shader by declaring them as uniform variables and assigning values to these in the .scn file. That way you can have one shader being used by many .scn files with each using different values for the control parameters.

For example, using the WetLook2 shader above it could be defined as

uniform sampler2D texture0;
uniform vec2 wetBand;
varying vec4 gl_TexCoord[];
void main ()
{
vec4 Girl = texture2D ( texture0, gl_TexCoord[0].xy );
// Create a b/w image of the girl
gl_FragColor = vec4 ( vec3(Girl.r+Girl.g+Girl.b)/3.0, Girl.a );
// Discard values outside the range defined by WetBand
if ( abs(gl_FragColor.r-wetBand.x) > wetBand.y ) { discard; }
}

then in the scene file you could have

framebuffer {
size: 7680, 4320
id: WetLook
source: RadialBlur, 0
uniform: wetBand, vec2, 0.56, 0.01
shader: fragment, WetLook2.fsh
blend: false
}

You can use uniform: to supply float, int vec2, vec3 or vec4 inputs to a shader.

You can have any number of such uniform: clauses in a scene node supplying any number of parameters of various types to a shader.
TheEmu
Dołączył: Jul 2012
7424 post(y/ów)

Discussions for Scenes for Version 1.2.X Fullscreen Mode here

Wszystko o iStripper
October 25, 2017, 5119 odpowiedzi
Although in practice it makes little difference in practice the "correct" version of RadialBlur.fsh would be

//Original taken from "halloween" scene by totem(istripper)
//Adapted by z22 and then by TheEmu.

uniform sampler2D texture0;
varying vec4 gl_TexCoord[];

const float blurSize = 1.5 / 1024.0;

const vec2 blur1 = vec2(+1.1,+0.1)*blurSize;
const vec2 blur2 = vec2(+1.1,-0.1)*blurSize;

void main(void)
{
// Apply a radialy symetric blur using 9 sample points comprising a
// central point, at the current pixel position, with 8 more at the
// corners of an octagon, though not a regular octagon.

vec2 vTexCoord = gl_TexCoord[0].xy;

vec4 c0 = texture2D ( texture0, vTexCoord );

vec4 c1 = texture2D ( texture0, vTexCoord + blur1.xy );
vec4 c2 = texture2D ( texture0, vTexCoord + blur1.yx );

vec4 c3 = texture2D ( texture0, vTexCoord - blur1.xy );
vec4 c4 = texture2D ( texture0, vTexCoord - blur1.yx );

vec4 c5 = texture2D ( texture0, vTexCoord + blur2.xy );
vec4 c6 = texture2D ( texture0, vTexCoord + blur2.yx );

vec4 c7 = texture2D ( texture0, vTexCoord - blur2.xy );
vec4 c8 = texture2D ( texture0, vTexCoord - blur2.yx );

gl_FragColor = ( c0 + c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) / 9.0;

}

The octagon is not a regular one because its vertical and horizontal sides will have a different length (in texture coordinate space) to its diagonal sides. This is further distorted by the different scale factors for the vertical and horizontal axes that apply when going from texture coordinates to screen coordinates. (Texture coordinates run from 0.0 to 1.0 for both X and Y).

To use a regular octagonal spacing in texture space for the sample points change blur1 and blur2 to use cos and sin of 22.5 degrees instead of 1.1 and 0.1 and increase blurSize to compenate for the change in the sample distance from the central point that this introduces, I am now using

const float blurSize = 4.5 / 1024.0;

const vec2 blur1 = vec2(+0.9238,+0.3826)*blurSize;
const vec2 blur1 = vec2(+0.9238,-0.3826)*blurSize;
stefnev1
MODERATOR
Dołączył: Jul 2008
17726 post(y/ów)