[PD] Moving Starfield with GEM
patrice colet
colet.patrice at free.fr
Fri Sep 11 02:17:18 CEST 2015
hi,
what about using a shader?
I've attached some exemple...
Le 11/09/2015 01:45, Pagano, Patrick a écrit :
>
> Hey has anyone done a Star field with GEM?
>
> Do you have a patch i can look at
>
> I would prefer not to use a movie
>
>
> Patrick
>
>
> /Patrick Pagano B.S, M.F.A/
> Audio and Projection Design Faculty
> Digital Worlds Institute
> University of Florida, USA
> (352)294-2020
>
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20150911/b0604dc6/attachment.html>
-------------- next part --------------
// Cyrille Henry 2007
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
-------------- next part --------------
//https://www.shadertoy.com/view/Md2SR3
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// The input, n, should have a magnitude in the approximate range [0, 100].
// The output is pseudo-random, in the range [0,1].
uniform vec2 iResolution, iMouse;
float Hash( float n )
{
return fract( (1.0 + cos(n)) * 415.92653);
}
float Noise2d( in vec2 x )
{
float xhash = Hash( x.x * 37.0 );
float yhash = Hash( x.y * 57.0 );
return fract( xhash + yhash );
}
void main( void )
{
// Add a camera offset in "FragCoord-space".
vec2 vCameraOffset = iMouse.xy;
vec2 vSamplePos = ( gl_FragCoord.xy + floor( vCameraOffset ) ) / iResolution.xy;
vec3 vColor = vec3(0.0, 0.0, 0.0);
// Sky Background Color
vColor += vec3( 0.1, 0.2, 0.4 ) * vSamplePos.y;
// Stars
// Note: Choose fThreshhold in the range [0.99, 0.9999].
// Higher values (i.e., closer to one) yield a sparser starfield.
float fThreshhold = 0.97;
float StarVal = Noise2d( vSamplePos );
if ( StarVal >= fThreshhold )
{
StarVal = pow( (StarVal - fThreshhold)/(1.0 - fThreshhold), 6.0 );
vColor += vec3( StarVal );
}
gl_FragColor = vec4(vColor, 1.0);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: starfield.pd
Type: text/x-puredata
Size: 2884 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20150911/b0604dc6/attachment.bin>
More information about the Pd-list
mailing list