Hw03 : shader.

Slides:



Advertisements
Similar presentations
Informationsteknologi Wednesday, December 12, 2007Computer Graphics - Class 171 Today’s class OpenGL Shading Language.
Advertisements

MAT 594CM S10Fundamentals of Spatial ComputingAngus Forbes Week 4 : GLSL Shaders Topics: Shader programs, vertex & fragment shaders, passing data into.
GLSL Applications: 1 of 2 Joseph Kider Source: Patrick Cozzi – Spring 2011 University of Pennsylvania CIS Fall 2011.
GLSL I May 28, 2007 (Adapted from Ed Angel’s lecture slides)
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Mohan Sridharan Based on slides created by Edward Angel GLSL I 1 CS4395: Computer Graphics.
GEOMETRY SHADER. Breakdown  Basics  Review – graphics pipeline and shaders  What can the geometry shader do?  Working with the geometry shader  GLSL.
GAM532 DPS932 – Week 1 Rendering Pipeline and Shaders.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Geometry Shaders. Visualizing Normal Vectors  textbook calls this a “hedgehog plot” but (I think) that this is a misuse of the term  a hedgehog plot.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
A Non-Photorealistic Fragment Shader in OpenGL 2.0 Bert Freudenberg Institut für Simulation und Graphik University of Magdeburg, Germany.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
A Crash Course in HLSL Matt Christian.
CS 480/680 Computer Graphics Shader Applications Dr. Frederick C Harris, Jr. Fall 2011.
Real-Time High Quality Rendering CSE 291 [Winter 2015], Lecture 4 Brief Intro to Programmable Shaders
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Lecture by: Martin Deschamps CSE 4431
GAM532 DPS932 – Week 2 Vertex Shaders. The Shader Pipeline Vertex Processing Primitive Assembly / Processing Rasterization Fragment Process Pixel Output.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Shader Applications Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics.
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E.
OpenGL Shading Language (GLSL)
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
OpenGL Shading Language (GLSL)
Geometry Shader (GLSL)
GLSL II.
Week 3 Lecture 4: Part 2: GLSL I Based on Interactive Computer Graphics (Angel) - Chapter 9.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Background image by chromosphere.deviantart.com Fella in following slides by devart.deviantart.com DM2336 Programming hardware shaders Dioselin Gonzalez.
OpenGL Shading Language
OpenGL Shading Language (GLSL)
OpenGl Shaders Lighthouse3d.com.
GLSL I.  Fixed vs. Programmable  HW fixed function pipeline ▪ Faster ▪ Limited  New programmable hardware ▪ Many effects become possible. ▪ Global.
Advanced Texture Mapping Bump Mapping & Environment Mapping (Reflection)
GLSL II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Shaders, part 2 alexandri zavodny.
Shader.
Introduction to Computer Graphics with WebGL
Tips for Shading Your Terrain
Real-Time Rendering Buffers in OpenGL 3.3
Programmable Pipelines
The Graphic PipeLine
and an introduction to matrices
Carl Johan Gribel, PhD student
Chapter 6 GPU, Shaders, and Shading Languages
Real-time Computer Graphics Overview
Introduction to Computer Graphics with WebGL
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Introduction to Computer Graphics with WebGL
Day 05 Shader Basics.
Introduction to Computer Graphics with WebGL
Chapter VI OpenGL ES and Shader
Simple post-process shaders
Introduction to Shaders
Unity’s Standard Shader Physically Based Shading
ICG 2018 Fall Homework1 Guidance
Programming with OpenGL Part 3: Shaders
© 2012 Elsevier, Inc. All rights reserved.
Advanced Texture Mapping
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
CS 480/680 Computer Graphics GLSL Overview.
CS 480/680 Part 1: Model Loading.
Computer Graphics Shading in OpenGL
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Presentation transcript:

Hw03 : shader

Assignment 03 Subdivision Phong Shading

Result LEVEL = 0 LEVEL = 1 LEVEL = 2

Subdivision (I)

Uniform Variables Subdivision (II) Level // subdivision 的等級 Radius = 1.0f// 距離質心的距離 Centroid = (0.0f,1.0f,0.0f,1.0f)// 質心的位置

Subdivision : Vertex Shader out Vertex{ vec3 vertexEyeSpace; vec3 normal; vec2 _texcoord; }; Output ModelView position / vertexEyeSpace Output normal / texture coordinate

Subdivision : Geometry Shader layout ( triangles ) in; layout ( triangle_strip, max_vertices=85 ) out; in Vertex{ vec3 vertexEyeSpace; vec3 normal; vec2 _texcoord; }vertex[]; out vec3 vertexEyeSpace; outvec3 normal; out vec2 tex;

Subdivision (II) Geometry out Variables //vertex position in eye space, eye position is (0, 0, 0). vec3 vertexEyeSpace; vec3 normal; //vertex normal vec2 _texcoord; //you can have your own decision vec4 gl_Position; //Projection vertex position

Subdivision : Fragment Shader uniform sampler2D colorTexture; in vec2 tex; in vec3 vertexEyeSpace; in vec3 normal; Use Texture coordinate to Access Texture and combine with Phong Lighting Result by Multiply.

GLSL Program Example Phong Shading – (1 / 4) Vertex shader Fragment shader

GLSL Program Example Phong Shading – (2 / 4) Vertex shader Fragment shader

GLSL Program Example Phong Shading – (3 / 4) Vertex shader Fragment shader

GLSL Program Example Phong Shading – (4 / 4) Fixed pipeline Phong shading