Advanced Materials Using Shaders. Show demo advanced_ogre.

Slides:



Advertisements
Similar presentations
POST-PROCESSING SET09115 Intro Graphics Programming.
Advertisements

Factorial Preparatory Exercise #include using namespace std; double fact(double); int fact(int); int main(void) { const int n=20; ofstream my_file("results.txt");
Image Processing … computing with and about data, … where "data" includes the values and relative locations of the colors that make up an image.
Passing Streams to Functions. Passing Streams to Functions One Rule: always pass a stream as a reference.
Templated Functions. Overloading vs Templating  Overloaded functions allow multiple functions with the same name.
1 Class Vehicle #include #define N 10../.. 2 Class Vehicle class vehicle { public: float speed; char colour[N+1]; char make[N+1];
Filtering Approaches for Real-Time Anti-Aliasing
GAM532 DPS932 – Week 7 Introduction to shadows. Shadow Effects Light Surface No Shadows Shadows.
TEXTURE MAPPING JEFF CHASTINE 1. TEXTURE MAPPING Applying an image (or a texture ) to geometry 2D images (rectangular) 3D images (volumetric – such as.
Strategies and Techniques for Real-Time Shaders Neil Hazzard Software Engineer Autodesk, Media and Entertainment.
Real-time Dynamic HDR Based Lighting in a Static Environment Marcus Hennix Daniel Johansson Gunnar Johansson Martin Wassborn.
Introduction to Shader Programming
CS 468 Cg Texture Mapping Jon Moon Spring 2004 Computer Science Cornell University.
Cg: C for Graphics Jon Moon Based on slides by Eugene Lee.
Shadow Mapping RTR Team Why Shadows? 2 RTR Team 2009.
Environmental Maps Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
Vertex & Pixel Shaders CPS124 – Computer Graphics Ferdinand Schober.
Simple Improvements to LI: Shadows Image Based Lighting László Szécsi.
Computer Science – Game DesignUC Santa Cruz Adapted from Jim Whitehead’s slides Shaders Feb 18, 2011 Creative Commons Attribution 3.0 (Except copyrighted.
1 High Level Shader Language (HLSL) Chapter What is HLSL? The previous vertex and pixel shader programming is to use assembly language to write.
GAM532 DPS932 – Week 1 Rendering Pipeline and Shaders.
Cg – C for Graphics Eric Vidal CS 280. History General graphics processing languages – Renderman shading language (1988) Assembly languages for graphics.
Image Processing.  a typical image is simply a 2D array of color or gray values  i.e., a texture  image processing takes as input an image and outputs.
Queensland University of Technology CRICOS No J INB382/INN382 Real-Time Rendering Techniques Lecture 13: Revision Ross Brown.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Introduction to Nikola Mihaylov, Sep 1, 2008.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Real-time Graphical Shader Programming with Cg (HLSL)
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Visual quality techniques.
Geometric Objects and Transformations. Coordinate systems rial.html.
GPU Shading and Rendering Shading Technology 8:30 Introduction (:30–Olano) 9:00 Direct3D 10 (:45–Blythe) Languages, Systems and Demos 10:30 RapidMind.
Shading. What is Shading? Assigning of a color to a pixel in the final image. So, everything in shading is about how to select and combine colors to get.
A Crash Course in HLSL Matt Christian.
CS 4363/6353 TEXTURE MAPPING PART II. WHAT WE KNOW We can open image files for reading We can load them into texture buffers We can link that texture.
Computer graphics & visualization The programmable (D3D 10) Pipeline.
GAM532 DPS932 – Week 8 Texture Shadow Implementation.
CSE 690: GPGPU Lecture 6: Cg Tutorial Klaus Mueller Computer Science, Stony Brook University.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
Textures Repeated patterns Texture can be uniform or irregular Ex:fabric,soil,brick Surface finish also known as surface texture T = P 1 * V 1 * V c T=
GAM532 DPS932 – Week 2 Vertex Shaders. The Shader Pipeline Vertex Processing Primitive Assembly / Processing Rasterization Fragment Process Pixel Output.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
Game Programming 08 OGRE3D Material in Action 2010 년 2 학기 디지털콘텐츠전공.
Shader Program in Gamebryo. Introduction Shader?  A complete Rendering Effect to apply to an object  Shader Program – Vertex/Pixel Shader Shader Programs.
REAL-TIME VOLUME GRAPHICS Klaus Engel Siemens AG, Erlangen, Germany Eurographics 2006 Real-Time Volume Graphics [05] Transfer Functions.
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
Shaders in OpenGL Marshall Hahn. Introduction to Shaders in OpenGL In this talk, the basics of OpenGL Shading Language will be covered. This includes.
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
Dynamic Gaze-Contingent Rendering Complexity Scaling By Luke Paireepinart.
OpenGL-ES 3.0 And Beyond Boston Photo credit :Johnson Cameraface OpenGL Basics.
File Texture Mapping Pasting images on primitives.
1 Graphics CSCI 343, Fall 2015 Lecture 25 Texture Mapping.
 Learn how you can use the shader through OpenGL ES  Add texture on object and make the object have a different look!!
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.
Overview  Basic requirements of implementation  Image resource  Texture mapping  Advanced requirements of implementation  KGL sprite class.
Gamebryo Shaders.
MP3 Frequently Asked Questions (IN OFFICE HOURS).
CgFX Sébastien Dominé, NVIDIA. Overview What is CgFX? CgFX runtime Production pipeline with CgFX CgFX Tools set Demo.
GLSL I.  Fixed vs. Programmable  HW fixed function pipeline ▪ Faster ▪ Limited  New programmable hardware ▪ Many effects become possible. ▪ Global.
Texture Mapping What is texture mapping? - a method for adding detail, surface texture (a bitmap or raster image), or color to a computer-generated graphic.
An Introduction to the Cg Shading Language Marco Leon Brandeis University Computer Science Department.
Computer Science – Game DesignUC Santa Cruz Tile Engine.
How to write a Pixel Shader CMT3311. Aim The aim of these slides is to introduce you to enough HLSL that you get a general understanding of pixel shaders.
Reflective Shadow Mapping By: Mitchell Allen.
Simple post-process shaders
Introduction to Computer Graphics with WebGL
Computer Graphics Module Overview
Computer Graphics Practical Lesson 10
Computer Graphics Introduction to Shaders
CS 480/680 Computer Graphics GLSL Overview.
CS 480/680 (Fall 2018) Part 2: Texture Loading
Presentation transcript:

Advanced Materials Using Shaders

Show demo advanced_ogre

Extract colour data from multiple textures Blend the colour together Use shadow map to blend the intensity of each pixel

ETTerrainMaterial material ETTerrainMaterial { technique { pass {// splatting} pass {// blend with shadow map} } //other techniques for fallback }

ETTerrainMaterial // splatting pass lighting off vertex_program_ref My/Programs/VSLodMorph2 { } fragment_program_ref My/Programs/PSSplat2 { param_named splatScaleX float 20 param_named splatScaleZ float 20 } texture_unit { // first coverage map, dynamically managed texture ETSplatting0 } // splatting textures

VSLodMorph2 void terrain_vp( float4 position : POSITION, float2 uv1 : TEXCOORD0, float delta : BLENDWEIGHT, out float4 oPosition : POSITION, out float2 oUv1 : TEXCOORD0, uniform float4x4 worldViewProj, uniform float morphFactor ) { position.y = position.y + (delta.x * morphFactor); oPosition = mul(worldViewProj, position); oUv1 = uv1; }

PSSplat2 void main ( float2 iTexCoord0 : TEXCOORD0, out float4 oColor : COLOR, uniform sampler2D covMap1, uniform sampler2D covMap2, uniform sampler2D splat1, …. uniform float splatScaleX, uniform float splatScaleZ ) { float3 cov1 = tex2D(covMap1, iTexCoord0).rgb; float3 cov2 = tex2D(covMap2, iTexCoord0).rgb; iTexCoord0.x *= splatScaleX; iTexCoord0.y *= splatScaleZ; oColor = tex2D(splat1, iTexCoord0) * cov1.x + tex2D(splat2, iTexCoord0) * cov1.y + tex2D(splat3, iTexCoord0) * cov1.z + tex2D(splat4, iTexCoord0) * cov2.x + tex2D(splat5, iTexCoord0) * cov2.y + tex2D(splat6, iTexCoord0) * cov2.z; }

Coverage Maps void createCoverageMap() { WAGO_COVERAGE_MAP *c; c = new WAGO_COVERAGE_MAP("ETSplatting0", "My", 128, 128, 3); c->loadMap("ETcoverage.0.png", "My"); // c = new WAGO_COVERAGE_MAP("ETSplatting1", "My", 128, 128, 3); c->loadMap("ETcoverage.1.png", "My"); // c = new WAGO_COVERAGE_MAP("ETLightmap", "My", 128, 128, 3); c->loadMap("ETlightmap.png", "My"); }

Coverage Maps WAGO_COVERAGE_MAP::WAGO_COVERAGE_MAP(const String &name, const String &group, uint nx, uint nz, int numChannels) { //initialize data mTexture = TextureManager::getSingleton().createManual(name, group, TEX_TYPE_2D, mWidth, mHeight, 1, 0, getFormat(mNumChannels), TU_DEFAULT, this); }

Load from File void WAGO_COVERAGE_MAP::loadMap(const String &filename, const String &res_group) { Image image; image.load(filename, res_group); if (mWidth!=image.getWidth() || mHeight!=image.getHeight()) { image.resize(mWidth, mHeight); } loadFromImage(image); }

ETShader.program fragment_program My/Programs/PSSplat2 cg { source PSSplat2.cg entry_point main profiles ps_2_0 arbfp1 } fragment_program My/Programs/PSLighting cg { source PSLighting.cg entry_point main profiles ps_1_1 arbfp1 }

ETShader.program vertex_program My/Programs/VSLodMorph2 cg { source VSLodMorph.cg entry_point terrain_vp profiles vs_1_1 arbvp1 default_params { param_named_auto morphFactor custom 77 param_named_auto worldViewProj worldviewproj_matrix }