OPTIM: shader optimization
This commit is contained in:
@@ -17,7 +17,12 @@ float NoisyStarField( in vec2 vSamplePos, float fThreshhold )
|
||||
{
|
||||
float StarVal = Noise2d( vSamplePos );
|
||||
if ( StarVal >= fThreshhold )
|
||||
StarVal = pow( (StarVal - fThreshhold)/(1.0 - fThreshhold), 6.0 );
|
||||
{
|
||||
float t = (StarVal - fThreshhold) / (1.0 - fThreshhold);
|
||||
float t2 = t * t;
|
||||
float t4 = t2 * t2;
|
||||
StarVal = t4 * t2;
|
||||
}
|
||||
else
|
||||
StarVal = 0.0;
|
||||
return StarVal;
|
||||
@@ -57,7 +62,7 @@ void mainImage( out vec4 fragColor, in vec2 fragCoord )
|
||||
// Stars with a slow crawl.
|
||||
float xRate = 0.2;
|
||||
float yRate = -0.06;
|
||||
vec2 vSamplePos = fragCoord.xy + vec2( xRate * float( 1 ), yRate * float( 1 ) );
|
||||
vec2 vSamplePos = fragCoord.xy + vec2( xRate, yRate );
|
||||
float StarVal = StableStarField( vSamplePos, StarFieldThreshhold );
|
||||
vColor += vec3( StarVal );
|
||||
|
||||
@@ -80,4 +85,3 @@ void main()
|
||||
imageStore(image, texelCoord, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user