Using WPF for Computer Graphics



Similar documents
14.6 Construction and Animation via Hierarchical Modeling

Windows Presentation Foundation

Windows Presentation Foundation: What, Why and When

for Java developers Building Mobile Applications Introduction 1 Building Mobile Applications

Windows Phone 7 Game Development using XNA

Introduction to C#, Visual Studio and Windows Presentation Foundation

Understanding In and Out of XAML in WPF

The Architectural Design of FRUIT: A Family of Retargetable User Interface Tools

Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

Chapter 6 - The Scene Graph

Windows Presentation Foundation (WPF) User Interfaces

CA Plex and Microsoft Windows Presentation

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Windows Presentation Foundation Tutorial 1

Windows Presentation Foundation (WPF)

Visual Studio 2008: Windows Presentation Foundation

Advanced Windows Store App Development Using C#

Introduction to Computer Graphics

Game Development in Android Disgruntled Rats LLC. Sean Godinez Brian Morgan Michael Boldischar

JavaFX Session Agenda

WPF Viewer for Reporting Services 2008/2012 Getting Started

Data Binding with WPF: Binding to XML

Lab7 : Putting Everything Together

Voice Driven Animation System

COMP175: Computer Graphics. Lecture 1 Introduction and Display Technologies

GRAFICA - A COMPUTER GRAPHICS TEACHING ASSISTANT. Andreas Savva, George Ioannou, Vasso Stylianou, and George Portides, University of Nicosia Cyprus

Search Engine Optimization for Silverlight Applications

Masters of Science in Software & Information Systems

XML in IDSS. This overview is divided broadly into two sections, each of which answers one of the following questions:

How To Teach Computer Graphics

Software Development Interactief Centrum voor gerichte Training en Studie Edisonweg 14c, 1821 BN Alkmaar T:

Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Ch 1: What is Game Programming Really Like? Ch 2: What s in a Game? Quiz #1 Discussion

Java game programming. Game engines. Fayolle Pierre-Alain

MS-20485: Advanced Windows Store App Development Using C#

INTRODUCTION TO RENDERING TECHNIQUES

Lecture Notes, CEng 477

Computer Graphics 1. Chapter 4 (May 20th, 2010, 2-5pm): The scene graph. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

Creating Next-Generation User Experience with Windows Aero, Windows Presentation Foundation and Silverlight on Windows Embedded Standard 7

Microsoft Technology Practice Capability document. WPF and Silverlight Building Rich Interactive Applications with XAML. Overview

Implementing multi-user multi-touch scenarios using WPF in Windows* 8 Desktop Apps

Computer and Information Sciences

Beginning Android 4. Games Development. Mario Zechner. Robert Green

Blender Notes. Introduction to Digital Modelling and Animation in Design Blender Tutorial - week 9 The Game Engine

Mainstream Data Photo Metadata Conference - Metadata and Social Media 26 th May 2016

4 Understanding. Web Applications IN THIS CHAPTER. 4.1 Understand Web page development. 4.2 Understand Microsoft ASP.NET Web application development

GAME DESIGN AND DEVELOPMENT TECHNOLOGY. Game Design and Development Technology I

GUI GRAPHICS AND USER INTERFACES. Welcome to GUI! Mechanics. Mihail Gaianu 26/02/2014 1

GGobi meets R: an extensible environment for interactive dynamic data visualization

Hands-On Lab. Building a Data-Driven Master/Detail Business Form using Visual Studio Lab version: Last updated: 12/10/2010.

INTERNET PROGRAMMING AND DEVELOPMENT AEC LEA.BN Course Descriptions & Outcome Competency

An Automated Testing Tool Using UI Structure

A TOOL FOR SUPPORTING THE PROCESS OF PROPERTY MANAGEMENT AND THE CREATION OF TECHNICAL DRAWINGS

Mobile App Design and Development

Practical Data Visualization and Virtual Reality. Virtual Reality VR Software and Programming. Karljohan Lundin Palmerius

MeshLab and Arc3D: Photo-Reconstruction and Processing of 3D meshes

Data Integration through XML/XSLT. Presenter: Xin Gu

1. Definition of the project. 2. Initial version (simplified texture) 3. Second version (full textures) 5. Modelling and inserting 3D objects

Microsoft Visual Studio: Developing Cross-Platform Apps With C# Using Xamarin

RIA DEVELOPMENT OPTIONS - AIR VS. SILVERLIGHT

Mobile Game and App Development the Easy Way

Beginner s Android Development Tutorial!

Microsoft Virtual Labs. Building Windows Presentation Foundation Applications - C# - Part 1

Introduction to Application Development with Silverlight for Windows Embedded. Abstract. Windows Embedded CE 6.0 R3 Technical Article

WEBfactory Silverlight vs. HTML 5 Version 1.0. July

Institution : Majmaah University. Academic Department : College of Science at AzZulfi. Programme : Computer Science and Information Course :

DATA VISUALIZATION OF THE GRAPHICS PIPELINE: TRACKING STATE WITH THE STATEVIEWER

CHAPTER 14 Understanding an App s Architecture

Teaching Introductory Computer Graphics Via Ray Tracing

Games Development Education to Industry. Dr. Catherine French Academic Group Leader Games Programming, Software Engineering and Mobile Systems

Relationships in WPF Applications

Chapter 13: Program Development and Programming Languages

EPiServer and XForms - The Next Generation of Web Forms

Proseminar Graphikprogrammierung

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

SEPA formats - an introduction to XML. version September

High-performance XML Storage/Retrieval System

Computer Graphics ( / ) Prof. Misha Kazhdan misha@cs.jhu.edu

Chapter 6 - The Scene Graph

McGraw-Hill The McGraw-Hill Companies, Inc.,

Programming with the Microsoft.NET Framework Using Microsoft Visual Studio 2005 (VB)

Introduction to Computer Graphics. Reading: Angel ch.1 or Hill Ch1.

Computer Graphics AACHEN AACHEN AACHEN AACHEN. Public Perception of CG. Computer Graphics Research. Methodological Approaches

Study of GML-Based Geographical Data Visualization Strategy

Graphics Performance Benchmarking Based on VRML Browsers

Computer Science Department CS 470 Fall I

Development Of Mobile Applications GDF Mobilinfo

Introduction to XML Applications

Introduction to Oracle Mobile Application Framework Raghu Srinivasan, Director Development Mobile and Cloud Development Tools Oracle

Essentials of Developing Windows Store Apps Using C# MOC 20484

Instructional Design Framework CSE: Unit 1 Lesson 1

Institutionen för systemteknik Department of Electrical Engineering

What is a programming language?

CS 378: Computer Game Technology

WEB, HYBRID, NATIVE EXPLAINED CRAIG ISAKSON. June 2013 MOBILE ENGINEERING LEAD / SOFTWARE ENGINEER

Using O4X For Your Business Data Visualization Solutions A Technical Overview

CSE 564: Visualization. GPU Programming (First Steps) GPU Generations. Klaus Mueller. Computer Science Department Stony Brook University

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

Using sentence fragments

Transcription:

Using WPF for Computer Graphics Matthew Jacobs, 2008

Evolution of (Graphics) Platforms 1/2 Graphics platforms have been going through the same evolution from low-level to high-level that programming languages and development platforms have experienced

Evolution of (Graphics) Platforms 2/2 Transfers many of the implementation details to the platform software C++ Java Sketchpad CAD OpenGL WPF3D 1 Focus on what is to be accomplished, rather than on how to accomplish it 1 WPF3D didn t actually evolve from OpenGL, rather, WPF3D, when compared to OpenGL, is a package that frees the programmer from a great deal of the implementation details

What is WPF? Windows Presentation Foundation High-level tools for building powerful Windows applications that incorporate user interface and media elements

WPF and XAML XAML (extensible Application Markup Language) code which is high-level Much less code is needed declarative Statements declare objects and their relationships, different from imperative programming where instructions are written to control objects. XML-based (pointy-brackets)

Why use WPF for graphics? (1/2) Built-in library support for UI elements Text 2D Graphics 3D Graphics Rapid prototyping Powerful tools XAMLPad Visual Studio Expression Blend

Why use WPF for graphics? (2/2) Higher level of abstraction than OpenGL Declarative language (XAML) Supports experimentation and rapid prototyping No need for complex IDEs and lengthy compile/link cycles. Draw, transform, and animate 3-D graphics Supports 3-D coordinate spaces, cameras/projections, model/mesh primitives, texturing, illumination, transformation and animation of models

WPF and/or OpenGL? OpenGL is the assembly language of computer graphics WPF contains many high-level packages for easily building graphics Apples to oranges! OpenGL is much more similar to Microsoft s Direct3D (which is the underlying engine that supports WPF)

A Few XML Pointers Nested tags contain zero or more properties Tags are specified in pointybrackets and always contain matching closing tags (or an empty element tag ): <SomeTag> </SomeTag> <AnotherTag /> Tags nested within other tags are referred to as children XML is used to hold and carry data

<Note> Simple XML Example <To>Andy Van Dam</To> <From>CS123 TA</From> <Message>I think the students are really getting it!</message> </Note> Could also be written as: <Note To= Andy Van Dam From= CS123 TA Message= I think the students are really getting it! /> To, From, and Message are all child elements of the Note element

Simple XAML Example <Window x:class="simplewpf.window1 xmlns= http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x= http://schemas.microsoft.com/winfx/2006/xaml Title="Hello App" Height="59" Width="101"> <Grid> </Grid> </Window> Declare Window object Magic that handles XAML XML tags, don t worry about this! Declare window object properties Declare child element Grid <TextBox Text="Hello World!" /> Parses (in XAMLPad) to the actual WPF Object it represents Declare TextBox child of Grid object with Text property Hi Mom Look Ma, No slow compile/link cycles!

Getting Started with WPF 3D (1/2) Need a Viewport control Is a 2D control which displays a 3D scene To display a scene Create and position a set of geometric objects ( models ) Place and configure one or more lights Place and configure a camera The viewport immediately displays a rendering of the scene No need to take a photo ; the camera is always on No need to explicitly tell WPF to traverse the model tree, it s all under the hood!

Getting Started with WPF 3D (2/2) Viewport stencil <Viewport3D > <Viewport3D.Camera> <PerspectiveCamera /> </Viewport3D.Camera> <ModelVisual3D> <Model3DGroup> </Model3DGroup> </ModelVisual3D> </Viewport3D> Set camera properties Set up lights and objects

Setting up a Camera <Viewport3D.Camera> <PerspectiveCamera FarPlaneDistance= 20 LookDirection= 5,-2,-3 UpDirection= 0,1,0 NearPlaneDistance= 1 Position= -5,2,3 FieldOfView= 45 /> </Viewport3D.Camera>

Adding Light to Your Scene Add a simple ambient light source <Model3DGroup> <AmbientLight Color='#FFFFFF'/> </Model3DGroup>

Placing a Triangle (1/4) Triangles are the only 3D primitive supported by WPF (but you know how to make others) Need to define a resource in the application Kind of like setting a variable Allows programmer to reuse objects and values Want to define a reusable MeshGeometry3D which defines our first triangle

Placing a Triangle (2/4) Resources go in the Resources property of the parent element they belong to <MeshGeometry3D x:key= MeshPyramid Positions= 0,0,75-50,-50,0 50,-50,0 TriangleIndices= 0 1 2 /> <Window x:class="simplewpf.window1 xmlns= http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x= http://schemas.microsoft.com/winfx/2006/xaml Title="Hello App Height="59 Width="101"> <Window.Resources> </Window.Resources> <Viewport3D> </Viewport3D> </Window>

Placing a Triangle (3/4) Now that we have a MeshGeometry3D Resource for our triangle, we can use it in our scene Use a GeometryModel3D which references the MeshGeometry3D resource <GeometryModel3D Geometry='{StaticResource MeshPyramid}'/> {StaticResource rsrcname} is a lot of magic. Just think of it as referencing the resource defined above. For more information, look up WPF data binding

Placing a Triangle (4/4) <Viewport3D > <Viewport3D.Camera> <PerspectiveCamera /> </Viewport3D.Camera> <ModelVisual3D> <Model3DGroup> <GeometryModel3D Geometry='{StaticResource MeshPyramid}'/> </Model3DGroup> </ModelVisual3D> </Viewport3D>

Drawing a Pyramid Now that we know how to draw a triangle, we can draw more complicated shapes Modify the MeshGeometry3D to add more triangles to our mesh <MeshGeometry3D x:key= MeshPyramid' /> Positions='0,0,75-50,-50,0 50,-50,0 0,0,75 50,-50,0 50,50,0 0,0,75 50,50,0-50,50,0 0,0,75-50,50,0-50,-50,0' TriangleIndices='0 1 2 3 4 5 6 7 8 9 10 11

Improving the Pyramid Our pyramid doesn t quite look very good Need better lighting Use a directional light source <DirectionalLight Color='#FFFFFF' Direction='1, 1, -1' />

Working With Transformations We can apply transformations (T,R,S and general matrix transforms) to Model3DGroups <Model3DGroup.Transform> <RotateTransform3D CenterX="0" CenterY="0" CenterZ="36.5"> <RotateTransform3D.Rotation> <AxisAngleRotation3D Angle="37" Axis="1 0 0"/> </RotateTransform3D.Rotation> </RotateTransform3D> </Model3DGroup.Transform>