GoConqr has a new look! Let us know what you think.

Flashcards

SIT354 Code Fragments

Dan All Real-Time Graphics And Rendering Undergraduate English 19 cards

SIT354 Code Fragments

Cards in this deck (19)

  1. 1—// Fragment Shader
    // Colour RED
    out_fragmentColour = vec4(1.0f, 0, 0, 1);
    // Fragment Shader // Colour RED out_fragmentColour = vec4(1.0f, 0, 0, 1);
  2. 2—// Fragment Shader
    out_fragmentColour = vec4(frag.normal.x, 0, 0, 1);
    // Fragment Shader out_fragmentColour = vec4(frag.normal.x, 0, 0, 1);
  3. 3—// Fragment Shader
    out_fragmentColour = vec4(frag.normal, 1);
    // Fragment Shader out_fragmentColour = vec4(frag.normal, 1);
  4. 4—// Fragment Shader
    vec2 st = gl_FragCoord.xy/u_resolution.xy;
    vec2 pos = (vec2(0.5)-st)*2;
    out_fragmentColour = vec4(pos,0,1);
    // Fragment Shader vec2 st = gl_FragCoord.xy/u_resolution.xy; vec2 pos = (vec2(0.5)-st)*2; out_fragmentColour = vec4(pos,0,1);
  5. 5—// Fragment Shader
    out_fragmentColour = vec4(mod (10 * pos.x, 1), mod (10 * pos.x, 1),0,1);
    // Fragment Shader out_fragmentColour = vec4(mod (10 * pos.x, 1), mod (10 * pos.x, 1),0,1);
  6. 6—// Fragment Shader
    out_fragmentColour = vec4(sin (10 * pos.x), sin (10 * pos.x), 0, 1);
    // Fragment Shader out_fragmentColour = vec4(sin (10 * pos.x), sin (10 * pos.x), 0, 1);
  7. 7—// Fragment Shader
    out_fragmentColour = vec4 (pow (sin (frequency * pos.x), sharpness) *
    pow (sin (frequency * pos.y), sharpness), 0, 0, 1);
    // Fragment Shader out_fragmentColour = vec4 (pow (sin (frequency * pos.x), sharpness) * pow (sin (frequency * pos.y), sharpness), 0, 0, 1);
  8. 8—// Fragment Shader
    st *= ((a+1.)*3.); // Scale up the space by 3
    st = fract(st); // Wrap around 1.0
    // Now we have 3 spaces that goes from
    // Fragment Shader st *= ((a+1.)*3.); // Scale up the space by 3 st = fract(st); // Wrap around 1.0 // Now we have 3 spaces that goes from
  9. 9—// Vertex Shader
    gl_Position = vec4 (VertexPosition.x,
    VertexPosition.y + 0.1 * sin (30. * VertexPosition.x),
    Vertex
    // Vertex Shader gl_Position = vec4 (VertexPosition.x, VertexPosition.y + 0.1 * sin (30. * VertexPosition.x), Vertex
  10. 10—// Vertex Shader
    float angle = a * 10;
    mat4 T = mat4 (vec4 (cos (angle), sin(angle), 0, 0), vec4 (-sin(angle), cos(angle), 0, 0),
    vec4 (0, 0, 1, 0), vec4 (0, 0, 0, 1) );
    gl_Position = T * vec4 (VertexPosition, 1);
    // Vertex Shader float angle = a * 10; mat4 T = mat4 (vec4 (cos (angle), sin(angle), 0, 0), vec4 (-sin(angle), cos(angle), 0, 0), vec4 (0...
  11. 11—out_fragmentColour = vec4(frag.normal, 1);out_fragmentColour = vec4(frag.normal, 1);
  12. 12—mat4 normalMatrix = transpose(inverse(ViewMatrix * WorldMatrix));
    VertexOut.normal = normalize((normalMatrix * vec4(VertexNormal, 0)).xyz);
    mat4 normalMatrix = transpose(inverse(ViewMatrix * WorldMatrix)); VertexOut.normal = normalize((normalMatrix * vec4(VertexNormal, 0)).xyz);
  13. 13—float Ka = max(0,a);
    float Ia = max(0,b);
    vec3 AmbientColour = vec3 (0.4, 0.7, 0.3);
    colour = colour + Ka * Ia * AmbientColour;
    out_fragmentColour = vec4(colour,1.0);
    float Ka = max(0,a); float Ia = max(0,b); vec3 AmbientColour = vec3 (0.4, 0.7, 0.3); colour = colour + Ka * Ia * AmbientColour; out_fragm...
  14. 14—vec3 N = normalize (frag.normal);
    vec3 L = normalize (vec3 (frag.EyeSpaceLightPosition - frag.EyeSpacePosition));
    colour = L;
    vec3 N = normalize (frag.normal); vec3 L = normalize (vec3 (frag.EyeSpaceLightPosition - frag.EyeSpacePosition)); colour = L;
  15. 15—vec3 LightColour = vec3 (0.9, 0.9, 1.0);
    float Kd = max(0,c);
    // 4. Add in the diffuse component.
    colour = colour + MaterialColour *
    (Kd * max (0.0, dot (N, L))) * LightColour;
    vec3 LightColour = vec3 (0.9, 0.9, 1.0); float Kd = max(0,c); // 4. Add in the diffuse component. colour = colour + MaterialColour * (Kd ...
  16. 16—vec3 R = normalize(reflect (L, N));
    colour = R;
    vec3 R = normalize(reflect (L, N)); colour = R;
  17. 17—vec3 V = normalize (vec3 (frag.EyeSpacePosition) - vec3 (0, 0, 0));
    colour = V;
    vec3 V = normalize (vec3 (frag.EyeSpacePosition) - vec3 (0, 0, 0)); colour = V;
  18. 18—vec3 HighlightColour = vec3 (1.0, 1.0, 1.0);
    float Ks = max(0,d);
    float n = 30 * (max(0,e) + 3);
    colour = colour + MaterialColour *
    (Ks * pow (max (0.0, dot (R, V)), n)) * HighlightColour;
    vec3 HighlightColour = vec3 (1.0, 1.0, 1.0); float Ks = max(0,d); float n = 30 * (max(0,e) + 3); colour = colour + MaterialColour * (Ks *...
  19. 19—fragColour = vec4 ( texture2D( texture1, vec2(s,t)));
    out_fragmentColour = fragColour;
    fragColour = vec4 ( texture2D( texture1, vec2(s,t))); out_fragmentColour = fragColour;

Information

Description
Shader code fragments to accomplish a specific task
Created by
Dan All
Views
39
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?