3D Graphics without Plugins using SVG

Similar documents
Table of Contents. 1. Introduction Design Data Flow Diagram Program s Design Requirements.20

Student: Jiewei Lin Advisor: Dr. Chris Pollett Committee Members: Dr. Sin-Min Lee Dr. Ho Kuen Ng May 20, 2003

Lesson 9. Three-Dimensional Geometry

Clipping. CSC 7443: Scientific Information Visualization

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

Culling. Computer Graphics CSE 167 Lecture 12

Adaptive Point Cloud Rendering

Visible Surface Detection. (Chapt. 15 in FVD, Chapt. 13 in Hearn & Baker)

CSE 167: Introduction to Computer Graphics Lecture #9: Visibility. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

CS488. Visible-Surface Determination. Luc RENAMBOT

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

VISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH

THE DEPTH-BUFFER VISIBLE SURFACE ALGORITHM

Skills Practice Skills Practice for Lesson 2.1

Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts

Clipping & Culling. Lecture 11 Spring Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling

Texture. Texture Mapping. Texture Mapping. CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

Introduction to Computer Graphics with WebGL

Lecture 11: Ray tracing (cont.)

Models and Architectures

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

3D Design with 123D Design

ARCHITECTURE & GAMES. A is for Architect Simple Mass Modeling FORM & SPACE. Industry Careers Framework. Applied. Getting Started.

Computer Graphics I Lecture 11

SHAPE AND STRUCTURE. Shape and Structure. An explanation of Mathematical terminology

Two basic types: image-precision and object-precision. Image-precision For each pixel, determine which object is visable Requires np operations

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Draw and Classify 3-Dimensional Figures

Motivation. Culling Don t draw what you can t see! What can t we see? Low-level Culling

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

5 Subdivision Surfaces

More Visible Surface Detection. CS116B Chris Pollett Mar. 16, 2005.

Real-Time Non- Photorealistic Rendering

CSE 167: Introduction to Computer Graphics Lecture #11: Visibility Culling

PowerVR Hardware. Architecture Overview for Developers

Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics 7: Viewing in 3-D

Let s start with occluding contours (or interior and exterior silhouettes), and look at image-space algorithms. A very simple technique is to render

ECE 104 Fundamentals of Computer Graphics Project 1

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

2.5 Animations. Applications. Learning & Teaching Design User Interfaces. Content Process ing. Group Communi cations. Documents.

2.5 Animations. Contents. Basics. S ystem s. Services. Usage. Computer Architectures. Learning & Teaching Design User Interfaces.

Vocabulary. Term Page Definition Clarifying Example. cone. cube. cylinder. edge of a threedimensional. figure. face of a polyhedron.

Computer Science 474 Spring 2010 Viewing Transformation

9. Visible-Surface Detection Methods

Geometric Features for Non-photorealistiic Rendering

SFU CMPT 361 Computer Graphics Fall 2017 Assignment 2. Assignment due Thursday, October 19, 11:59pm

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

Advances in MicroStation 3D

Viewing with Computers (OpenGL)

Hardware-driven visibility culling

3D Rendering and Ray Casting

CS 563 Advanced Topics in Computer Graphics Culling and Acceleration Techniques Part 1 by Mark Vessella

Chapter 4. Chapter 4. Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 1

8. Hidden Surface Elimination

4.5 VISIBLE SURFACE DETECTION METHODES

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE 167: Introduction to Computer Graphics Lecture #5: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

CS 130 Exam I. Fall 2015

Scalable Vector Graphics commonly known as SVG is a XML based format to draw vector images. It is used to draw twodimentional vector images.

03 Vector Graphics. Multimedia Systems. 2D and 3D Graphics, Transformations

CGS 3220 Lecture 13 Polygonal Character Modeling

WebGL (Web Graphics Library) is the new standard for 3D graphics on the Web, designed for rendering 2D graphics and interactive 3D graphics.

Chapter 5. Projections and Rendering

The School District of Palm Beach County Kindergarten Mathematics Scope st Trimester

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

Computer Science 426 Midterm 3/11/04, 1:30PM-2:50PM

Shadow Algorithms. CSE 781 Winter Han-Wei Shen

(K.CC) Know number names and the count sequence.

Interactive Inverted Perspective Rendering for Architectural Visualization

OUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

Graphics for VEs. Ruth Aylett

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Point Cloud Filtering using Ray Casting by Eric Jensen 2012 The Basic Methodology

Computer Graphics Shadow Algorithms

VTU QUESTION PAPER SOLUTION UNIT -1 INTRODUCTION

CSE4030 Introduction to Computer Graphics

Assignment Guide: Chapter 11 Geometry (L3)

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Image Precision Silhouette Edges

Unit 7: 3D Figures 10.1 & D formulas & Area of Regular Polygon

Hidden Surface Removal

Pipeline Operations. CS 4620 Lecture 10

Name Class Date. Use Euler s Formula to find the missing number for each polyhedron.

Visualisatie BMT. Rendering. Arjan Kok

COMPUTER GRAPHICS COURSE. Rendering Pipelines

Transformations in Ray Tracing. MIT EECS 6.837, Durand and Cutler

Computer Graphics 1. Chapter 2 (May 19th, 2011, 2-4pm): 3D Modeling. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2011

Computer Graphics Ray Casting. Matthias Teschner

Visible-Surface Detection 1. 2IV60 Computer graphics set 11: Hidden Surfaces. Visible-Surface Detection 3. Visible-Surface Detection 2

Maya tutorial. 1 Camera calibration

Raycasting. Chapter Raycasting foundations. When you look at an object, like the ball in the picture to the left, what do

Transcription:

3D Graphics without Plugins using SVG Paungkaew Sangtrakulcharoen Department of Computer Science San Jose State University San Jose, CA 95192-0103 Tel. 408-223-1980 paungkaew@hotmail.com Advisor: Committee members: Dr. Chris Pollett Dr. Cay Horstmann Dr. Ho Kuen Ng

Outline Introduction Requirements Project Design & Implementation Optimization Conclusion

Introduction Browsers with Plugins X3D Browsers without Plugins by SVG

Introduction (cont.) X3D document X3D Browser <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE X3D SYSTEM "latest.dtd"> <X3D> <Scene> <Transform> <Shape> <Appearance> <Material diffusecolor="1 0 0"/> </Appearance> <Box size="1.0 1.0 1.0" /> </Shape> </Transform> </Scene> </X3D>

Introduction (cont.) SVG document Mozilla-SVG browser <?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg"> <g transform="scale(0.5)"> <polygon style="fill:lime; stroke:blue; stroke-width:10" </g> </svg> points="350,75 458,137.5 458,262.5 350,325 242,262.6 242,137.5"/>

Introduction (cont.) X3D source data <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE X3D SYSTEM "latest.dtd"> <X3D> <Scene> <Transform translation="-2-1 0"> <Shape> <Sphere radius="2"/> </Shape> </Transform> <Transform translation="3 0.15 0"> <Shape> <Cone bottomradius="2" height="2"/> </Shape> </Transform> <Transform translation="-2 3 0"> <Shape> <Box size="1.5 1.5 1.5"/> </Shape> </Transform> <Transform translation="3 3 0"> <Shape> <Cylinder radius="1.5" height="2.5"/> </Shape> </Transform> </Scene> </X3D> The output document Buttons for changing perspectives

Requirements DTD file A source X3D file must be validated with X3DToSVG.dtd. X3D tags supported by this application <Appearance>, <Box>, <Cone>, <Cylinder>, <Group>, <Material>, <Transform>, <Shape>, <Sphere>, <Scene>, <X3D> Features and User Interface Have features for the user to navigate a scene as it can be done in an X3D browser.

Requirements (cont.) The sample of the output document

Requirements (cont.) Maximum Load The program responds within a second when we change perspectives of the scene that renders up to 300-320 ( tested on machines having AMD AthlonXP or Pentium IV processor running 1300 1400 MHz and 512 MB Memory).

Requirements (cont.) # of Polygons Processing Time (milliseconds) 32 (a cone) ~30-60 64 (a sphere) ~110-130 128 (two spheres) ~290-320 192 (three spheres) ~560-590 256 (four spheres) ~750-870 320 (five spheres) ~1090-1190 384 (six spheres) ~1590-1680 448 (seven spheres) ~1972-2133 512(eight spheres) ~2444-2654 576(nine spheres) ~3024-3405 640(ten spheres) ~3225-3755 672(ten spheres + one cone) ~3625-4266 A processing-time table of different test cases

Requirements (cont.) Limitations Our program cannot guarantee to display some scenes of overlapping and intersecting objects correctly.

A golf ball with a tee sits on a green Figure 1 An incorrect view A correct view Figure 2 Users have to subdivide the to get a correct view of this scene. The program cannot subdivide A leg of this tee should appear on the green, not behind the green. Figure 3

Project s Design & Implementation X3D document Load X3D file A DOM structure of a X3D file Viewing Pipeline A mesh of forming 3D graphics Visible Surface Detection Sorted front-face && Sorted back-face Surfacerendering A view of a 3D scene

Project s Design & Implementation (cont.) Visible-Surface Detection Can be classified in two categories, an objectspace method and an image-space method. Most visible-surface detection algorithms in computer graphics use image-space methods such as depth-buffer method or z-buffer method. Only object-space methods can be used in our project.

Project s Design & Implementation (cont.) 0 1 2 3 objects sorted objects box sphere cylinder cone sort objects according their depths sphere cone cylinder box 64 33 10 6 visible invisible visible invisible visible invisible visible invisible

Project s Design & Implementation (cont.) sphere cone cylinder box sorted objects 64 33 10 6 visible invisible visible invisible visible invisible visible invisible Sort each group sorted visible sorted invisible sorted visible sorted invisible sorted visible sorted invisible sorted visible sorted invisible sorted sorted invisible sorted visible

Project s Design & Implementation (cont.) The polygon s depth (x4, y4, z4) x = (x1+x2+x3+x4)/4 y = (y1+y2+y3+y4)/4 z = (z1+z2+z3+z4)/4 (x1, y1, z1) A center point (x, y, z) (x2, y2, z2) (x3, y3, z3) The depth of the polygon

Project s Design & Implementation (cont.) Primitive Plane Point3D Polygon Vector createtag( ) modifywc( ) createvc( ) createprojection( ) adjustcenter( ) createplane( ) findintensity( ) modifygradienttag( ) A, B, C visibility Transform matrix translate( ) rotate( ) reset( ) X3D, Y3D, Z3D Xp, Yp, Zp Visibility setxyz( ) rotate_translate( ) translate( ) rotate( ) scale( ) project( ) vertices id object plane visibility setvisibility( ) isvisible( ) getdepth( ) A, B, C size( ) normalize( ) addvector( ) dotvector( ) Box Cone Cylinder Sphere createfirstwc( ) assignprojectiontofaces( ) createnormalvector( ) findcolor( ) getvcandprojection( ) getshade( ) createfirstwc( ) assignprojectiontofaces( ) createnormalvector( ) findcolor( ) getvcandprojection( ) getshade( ) createfirstwc( ) assignprojectiontofaces( ) createnormalvector( ) findcolor( ) getvcandprojection( ) getshade( ) createfirstwc( ) assignprojectiontofaces( ) createnormalvector( ) findcolor( ) getvcandprojection( ) getshade( )

Optimization Optimize the rendering algorithms The first version (non-optimized version): Renders every polygon on the scene (both front-face and backface ). The second version: About 50% of the system processing time is coming from the surface-rendering procedure. Want to reduce the bottleneck surface-rendering processing time. Selectively renders only front-face. Improve the performance by 30-40%. Has time complexity O ( n 2 ln n ) ; n is the number of

Optimization (cont.) # of Polygons System processing time Surface-rendering processing time 36 ~70-80 ms ~ 30-40 ms 113 ~ 240-290 ms ~ 110-140 ms 192 ~ 560-590 ms ~ 280-310 ms 309 ~ 1000-1400 ms ~ 700-930 ms Comparing between the system processing time and the surface-rendering processing time.

Optimization (cont.) # of Polygons Processing time 32 (a cone) ~30-60 ms 64 (a sphere) ~110-130 ms 128 (two spheres) ~290-320 ms 192 (three spheres) ~560-590 ms 256 (four spheres) ~750-870 ms 320 (five spheres) ~1090-1190 ms 384 (six spheres) ~1590-1680 ms 448 (seven spheres) ~1972-2133 ms 512(eight spheres) ~2444-2654 ms 576(nine spheres) ~3024-3405 ms 640(ten spheres) ~3225-3755 ms 4500 4000 3500 3000 2500 2000 1500 1000 500 0 version 2 32 64 128 192 256 320 384 448 512 576 640 672 A graph associated with results shown in the table version 2 672(ten spheres + one cone) ~3625-4266 ms The processing time of our program version 2

Optimization (cont.) The third version: Apply the hidden-surface removal algorithm to reduce a number of rendered so that the surface-rendering time can decrease. This algorithm is to check and remove any UNSEEN or HIDDEN front-face. The algorithm for detecting a hidden surface is every front-face must be checked with the other CLOSER that belong to DIFFERENT objects.

Optimization (cont.) Sphere has 32 frontface Cone has 16 frontface The second version renders = 32 + 16 The third version renders < 32 + 16 Because some front faces of the sphere are hidden by some front faces of the cone.

Optimization (cont.) Ironically, it drops the performance more than 100 % because the overhead of the hidden-surface removal process is more than the time we save from the surface-rendering process.

Optimization (cont.) Test Case I: 36 Version Processing Time % Performance Increases or Drops (compared with Version I) I ~90-110 ms - II ~60-80 ms Increases 20-30 % III ~230-270 ms Drops > 100% Test Case II: 192 Version Processing Time % Performance Increases or Drops (compared with Version I) I ~ 830-850 ms - II ~ 560-590 ms Increases 32-36 % III ~ 3895-6690 ms Drops > 100 %

Optimization (cont.) Of all three versions, the second version has the best performance. The third version, which we thought would be the best, has the worst performance because of the overhead of the hiddensurface removal process.

Optimization (cont.) Performance hints to speed up JavaScript Avoid using a dot operator because it requires time to dereference. Locally cache values if we need to access them very often. IMPROVE Use a var statement when possible. IMPROVE Try to reuse the object when possible because a constructor new can be slow. IMPROVE It is recommended to use the forms of the Array constructor that specify a size or take a list of initial elements. It will speed up the code. NOT IMPROVE

Conclusion Project Achievements Succeeded in using SVG (originally designed for 2D graphics) to render 3D graphics. Deliver an application which translates X3D to SVG, produces a view of smooth shaded 3D objects, and has features for the user to navigate the scene. Optimized the application and achieved a performance improvement around 30-40%.

Conclusion (cont.) Discover that not all of performance hints which claimed to boost JavaScript code can speed up the program. Successfully used JavaScript in a nonstandard way to develop a nontrivial and complicated task like a rendering program.

Conclusion (cont.) Future Work Subdivide so that the translator can display overlapping and intersecting objects correctly. Clip a part of the scene outside the viewing limit.

Conclusion (cont.) Optimize a hidden-surface removal algorithm. Reduce a number of front-face to be checked by using a hidden-object removal approach instead.

Conclusion (cont.) A hidden-surface removal method thirty two frontface verified with A hidden-object removal method sixteen frontface a boundary box ( only six will be verified) verified with sixteen frontface

Some of sphere are outside the viewing limit but they are still rendered by our program.

Polygons are sorted ONLY with the other of the same collection (object). Polygons are sorted with every other polygon in the scene Correct views from an X3D browser