This document is a presentation on algorithms, computer graphics, and mathematics for game developers and computer scientists. It covers topics like the Twelve-Marble Problem, Fibonacci sequences, 3D modeling with lathe modifiers, cameras and lights in Three.js, depth of field, and assigning homework on modeling a chess board and creating scenes with different lights and cameras. Homework is due on July 2nd.
The document is a lecture presentation on algorithms and computer graphics for game developers and computer scientists. It covers the following topics:
- An introduction to the course, which will cover algorithms, computer graphics using Three.js, mathematics, and physics for 3D simulations.
- A discussion of algorithms, including their definition, characteristics, design, optimization, and programming examples. Big-O notation for analyzing algorithm efficiency is also introduced.
- An overview of the class structure, which will include weekly lessons, quizzes, homework, and group discussions.
- A section on simple algorithms, including examples to calculate factorials and an explanation of recursion versus iteration.
- An introduction to Big-O
The document provides an overview of 3D geometric primitives and meshes in Three.js. It discusses various geometry types like BoxGeometry, SphereGeometry, CylinderGeometry, and their constructors. It also covers coordinate systems and basic 3D components like points, lines, and triangles. The document is from a lecture on Three.js meshes, geometries, and primitives, with code examples for creating different geometric shapes.
The document discusses computer graphics and provides examples of its applications. It discusses graphics inbuilt functions such as arc(), initgraph(), closegraph(), and line(). It provides code snippets and explanations for these functions. It also lists algorithms for direct and Bresenham lines, circles, ellipses, and their code programs. Finally, it mentions static and dynamic applications of computer graphics.
The document contains an algorithm for drawing an ellipse using the midpoint algorithm. It initializes the graphics system and gets user input for the major and minor radii. It calculates an initial decision parameter P and plots the first point. It then loops while a condition on the x and y coordinates is met, incrementing x by 1 each iteration. The decision parameter P is updated each iteration based on whether it is greater than or less than 0. Symmetric points are plotted in each quadrant to draw the ellipse. After drawing across the minor axis, it continues the algorithm to draw across the major axis by initializing new parameters and looping while y is not 0, updating the decision parameter P1 and decrementing y each iteration.
The document provides an algorithm and sample program to implement Bresenham's circle drawing algorithm in C.
The algorithm reads the radius of the circle, initializes the starting points and decision variable, and then uses a do-while loop to plot pixels on the circle by incrementing x and conditionally incrementing or decrementing y based on the decision variable.
The sample program includes code to read the radius, initialize graphics mode, set starting points, and implement the do-while loop to plot pixels and delay between each pixel for visualization. It plots all four quadrants of the circle.
The document provides an introduction to computer graphics including:
1) Computer graphics are images created using computers through specialized software and hardware. They have made computers easier to use and better for interpreting data.
2) Computer graphics are used in many fields including science, engineering, medicine, business, art, entertainment, education and more.
3) Common techniques in computer graphics include computer-aided design, rendering, and image processing. Rendering generates images from 3D models using computer programs.
CS 354 Transformation, Clipping, and CullingMark Kilgard
This document summarizes a lecture on graphics transformations, clipping, and culling. It discusses how vertex positions are transformed from object space to normalized device coordinates space using the modelview and projection matrices. It also covers generalized clipping against the view frustum and user-defined clip planes, as well as back face culling. The lecture provides examples of translation, rotation, scaling, orthographic, and perspective transformations.
This document is a presentation on algorithms, computer graphics, and mathematics for game developers and computer scientists. It covers topics like the Twelve-Marble Problem, Fibonacci sequences, 3D modeling with lathe modifiers, cameras and lights in Three.js, depth of field, and assigning homework on modeling a chess board and creating scenes with different lights and cameras. Homework is due on July 2nd.
The document is a lecture presentation on algorithms and computer graphics for game developers and computer scientists. It covers the following topics:
- An introduction to the course, which will cover algorithms, computer graphics using Three.js, mathematics, and physics for 3D simulations.
- A discussion of algorithms, including their definition, characteristics, design, optimization, and programming examples. Big-O notation for analyzing algorithm efficiency is also introduced.
- An overview of the class structure, which will include weekly lessons, quizzes, homework, and group discussions.
- A section on simple algorithms, including examples to calculate factorials and an explanation of recursion versus iteration.
- An introduction to Big-O
The document provides an overview of 3D geometric primitives and meshes in Three.js. It discusses various geometry types like BoxGeometry, SphereGeometry, CylinderGeometry, and their constructors. It also covers coordinate systems and basic 3D components like points, lines, and triangles. The document is from a lecture on Three.js meshes, geometries, and primitives, with code examples for creating different geometric shapes.
The document discusses computer graphics and provides examples of its applications. It discusses graphics inbuilt functions such as arc(), initgraph(), closegraph(), and line(). It provides code snippets and explanations for these functions. It also lists algorithms for direct and Bresenham lines, circles, ellipses, and their code programs. Finally, it mentions static and dynamic applications of computer graphics.
The document contains an algorithm for drawing an ellipse using the midpoint algorithm. It initializes the graphics system and gets user input for the major and minor radii. It calculates an initial decision parameter P and plots the first point. It then loops while a condition on the x and y coordinates is met, incrementing x by 1 each iteration. The decision parameter P is updated each iteration based on whether it is greater than or less than 0. Symmetric points are plotted in each quadrant to draw the ellipse. After drawing across the minor axis, it continues the algorithm to draw across the major axis by initializing new parameters and looping while y is not 0, updating the decision parameter P1 and decrementing y each iteration.
The document provides an algorithm and sample program to implement Bresenham's circle drawing algorithm in C.
The algorithm reads the radius of the circle, initializes the starting points and decision variable, and then uses a do-while loop to plot pixels on the circle by incrementing x and conditionally incrementing or decrementing y based on the decision variable.
The sample program includes code to read the radius, initialize graphics mode, set starting points, and implement the do-while loop to plot pixels and delay between each pixel for visualization. It plots all four quadrants of the circle.
The document provides an introduction to computer graphics including:
1) Computer graphics are images created using computers through specialized software and hardware. They have made computers easier to use and better for interpreting data.
2) Computer graphics are used in many fields including science, engineering, medicine, business, art, entertainment, education and more.
3) Common techniques in computer graphics include computer-aided design, rendering, and image processing. Rendering generates images from 3D models using computer programs.
CS 354 Transformation, Clipping, and CullingMark Kilgard
This document summarizes a lecture on graphics transformations, clipping, and culling. It discusses how vertex positions are transformed from object space to normalized device coordinates space using the modelview and projection matrices. It also covers generalized clipping against the view frustum and user-defined clip planes, as well as back face culling. The lecture provides examples of translation, rotation, scaling, orthographic, and perspective transformations.
This document provides an overview of graphics programming in C using Turbo C++. It outlines the course content which includes drawing points, lines, polygons, circles and filling areas. It also discusses geometric transformations in 2D and 3D as well as line clipping algorithms. It provides details on setting up the integrated development environment and creating a graphics header file to initialize and exit graphics mode. It includes code examples to display a single point on the screen by approximating pixel coordinates as integers.
For all who wish to learn c graphics programming, no knowledge of graphics concepts is required. C Graphics programming is very easy and interesting. You can use graphics programming for developing your own games, in making projects, for animation etc. It's not like traditional C programming in which you have to apply complex logic in your program and then you end up with a lot of errors and warnings in your program. In C graphics programming you have to use standard library functions ( need not worry if you don't know functions ) to get your task done. Just you pass arguments to the functions and it's done. On this website you will find almost all functions with detailed explanation and a sample program showing the usage of a function. To make things easy you are provided with executable files which you can download and execute. Firstly you should know the function initgraph which is used to initialize the graphics mode . To initialize graphics mode we use initgraph function in our program. initgraph function is present in "graphics.h" header file, so your every graphics program should include "graphics.h" header file. We will discuss initgraph withe help of following sample program:-
The document discusses computer graphics concepts including pixels, colors, shapes, text, and programming. It covers:
1) Pixels are the smallest controllable elements that make up a digital image. Each pixel has a location and color value.
2) Colors are used for backgrounds and foregrounds. There are predefined color codes for text and graphics.
3) Basic shapes include lines, rectangles, circles, ellipses, polygons, and pie slices. Functions like line(), rectangle(), and circle() are used to draw shapes.
4) Text functions allow setting font, size, color, and position in graphics mode. Outtext() displays text.
5) Example programs demonstrate drawing shapes and text
This document is a practical file submitted by a student for their Computer Graphics subject. It contains an index listing the topics covered, which include introductions to computer graphics and its applications, descriptions of basic graphics functions in C++ like line, circle, and ellipse drawing algorithms, and examples of applications programs. The file provides information and code samples to help the student learn about core computer graphics concepts and programming.
This document summarizes a lecture on understanding color. It discusses color representation, compositing, Porter-Duff blend modes, hardware blending, additional blend modes, color perception, tristimulus values, color spaces like RGB, CMYK and HSL, gamma correction, and the relevance of color theory to graphics. It also announces an in-class quiz, upcoming assignment and lecture topics.
Shadow Volumes on Programmable Graphics Hardwarestefan_b
The document proposes a method for computing shadow volumes on programmable graphics hardware. It involves using textures to store vertex positions and silhouette edge information. A quad texture stores data for each edge indicating whether it is silhouetted against each light source. During shadow rendering, this texture is used as a vertex array to extrude shadow quads for silhouetted edges. This approach avoids CPU processing and enables dynamic scenes by keeping all data on the GPU.
The Ring programming language version 1.5.3 book - Part 48 of 184Mahmoud Samir Fayed
This document provides documentation on creating a 2D game engine in Ring. It discusses organizing the project into layers, including the games layer, game engine classes layer, and interface to graphics library layer. It then describes the key classes in the game engine - Game, GameObject, Sprite, Text, Animate, Sound, and Map. It provides details on the attributes and methods for each class. It also provides an example of how to load the game engine library, create a Game object, and start drawing text to the screen. The document is intended to teach how to structure a 2D game engine project using different programming paradigms in Ring.
The Ring programming language version 1.3 book - Part 38 of 88Mahmoud Samir Fayed
This document describes a game engine project built in Ring for creating 2D games. It discusses the different layers of the project, including the games layer, game engine classes layer, interface to graphics libraries layer, and graphics library bindings layer. It provides details on the RingAllegro and RingLibSDL libraries used for graphics. It outlines the main game engine classes like Game, GameObject, Sprite, Text, Animate, Sound, and Map. It gives examples of how to use the engine to create a game window, draw text, and move text. The goal of the project is to allow games to be built with Ring using different programming paradigms like declarative programming for games and object-oriented programming for the engine classes
Matlab Feature Extraction Using Segmentation And Edge DetectionDataminingTools Inc
This document discusses several image processing techniques in Matlab:
1) Edge detection using the edge function and Sobel and Canny edge detection algorithms.
2) The radon transform which computes projections of an image along specified directions and the inverse radon transform used to reconstruct images from projections.
3) Marker-controlled watershed segmentation which separates touching objects in an image using morphological operations like gradients and markers.
CS 354 Object Viewing and RepresentationMark Kilgard
- The document summarizes a lecture on viewing and representing 3D objects in computer graphics. It discusses representing objects as triangle meshes and storing vertex data in arrays indexed by triangle lists. It also covers transforms like glFrustum and gluLookAt for viewing, and examples of modeling transforms.
- Common ways to represent 3D objects include procedural, explicit polygon meshes, and implicit surfaces. Triangle meshes stored with unique vertex positions and triangle indices are popular due to efficiency and compatibility with OpenGL/GPU rendering.
- The lecture also covered projection transforms, modeling transforms, lighting, and "look at" camera positioning for 3D viewing. Next lecture will discuss mesh properties and OpenGL rendering details.
This document provides an overview of the CS 354 Computer Graphics course taught by Mark Kilgard at the University of Texas. The key points are:
- Mark Kilgard and Randall Smith will teach the course using lectures and programming assignments in OpenGL.
- Grading will be based on tests, quizzes, homework assignments, and software projects implementing simple 3D graphics concepts in OpenGL.
- Students will learn fundamental 3D graphics concepts like transformations, lighting, and shading by programming in OpenGL and GLSL shaders.
- The goal is to teach practical graphics programming skills for applications like games, visualizations, and more.
The document describes a graphics editor program that simulates the MS Paint application. It uses OpenGL for graphics rendering and GLUT for creating windows and rendering scenes. Key features implemented include tools for drawing shapes, images, and text. OpenGL functions are used for rendering while GLUT functions handle window creation and events. The design section covers header files, OpenGL/GLUT functions, and user-defined functions for tasks like drawing, erasing, and filling shapes. Implementation details are provided for various drawing algorithms and user interface elements.
This ppt explains basic topics of computer graphics like - pixel, resolution, text mode, graphics mode, various types of displays, applications of computer graphics etc.
The document summarizes a lecture on blending, compositing, and anti-aliasing in computer graphics. It discusses how colors are combined during rendering using blending operations, and how compositing operates on entire images rather than individual pixels. Porter-Duff models for digital image compositing are explained, along with how they relate to OpenGL blending functions.
The document describes a geometry shader-based approach to bump mapping that has several advantages over traditional CPU-based approaches. The geometry shader constructs an object-to-texture space mapping for each triangle, allowing lighting computations to be done efficiently in texture space in the pixel shader. It addresses issues like texture mirroring and lighting discontinuities. Examples and Cg source code are provided to illustrate the technique.
The document summarizes a lecture on further details of the graphics pipeline. It discusses how triangles described by vertex positions in normalized device coordinates are rasterized into pixels on the screen. The lecture covers oriented edge equations, being inside a triangle, rasterization approaches like scanline rasterization, and basic fragment shading through color interpolation. Homework status and the lecturer's office hours are also provided.
- The lecture covered graphics math topics including homogeneous coordinates and projective transformations.
- Homework 2 was due and an in-class quiz was given. Details on Project 1 were announced.
- The final exam date was moved and last class will be a review session. Daily quiz solutions will be provided.
- Office hours and last lecture topics were reviewed to introduce the current lecture on further graphics math concepts.
The document discusses manipulating object behavior at runtime through various techniques like inheritance, mixins, traits, composition, and proxies. It provides examples of how component-based systems in Unity3D and Crafty.js allow adding and removing behaviors to entities without changing their implementation. ECMAScript 6 proxies are presented as a flexible way to define object behavior through get and set handlers. Traits.js is shown as an alternative approach using proxies to compose reusable behaviors.
This document discusses machine learning concepts including algorithms, data inputs/outputs, runtimes, and trends in academia vs industry. It notes that while academia focuses on algorithm complexity, industry prioritizes data-driven approaches using large datasets. Ensemble methods combining many simple models generally perform better than single complex models. Specific ML techniques discussed include word segmentation using n-gram probabilities, perceptrons for classification, SVD for recommendations and clustering, and crowdsourcing ensembles. The key lessons are that simple models with large data outperform complex models with less data, and that embracing many small independent models through ensembles is effective.
This document provides an overview of graphics programming in C using Turbo C++. It outlines the course content which includes drawing points, lines, polygons, circles and filling areas. It also discusses geometric transformations in 2D and 3D as well as line clipping algorithms. It provides details on setting up the integrated development environment and creating a graphics header file to initialize and exit graphics mode. It includes code examples to display a single point on the screen by approximating pixel coordinates as integers.
For all who wish to learn c graphics programming, no knowledge of graphics concepts is required. C Graphics programming is very easy and interesting. You can use graphics programming for developing your own games, in making projects, for animation etc. It's not like traditional C programming in which you have to apply complex logic in your program and then you end up with a lot of errors and warnings in your program. In C graphics programming you have to use standard library functions ( need not worry if you don't know functions ) to get your task done. Just you pass arguments to the functions and it's done. On this website you will find almost all functions with detailed explanation and a sample program showing the usage of a function. To make things easy you are provided with executable files which you can download and execute. Firstly you should know the function initgraph which is used to initialize the graphics mode . To initialize graphics mode we use initgraph function in our program. initgraph function is present in "graphics.h" header file, so your every graphics program should include "graphics.h" header file. We will discuss initgraph withe help of following sample program:-
The document discusses computer graphics concepts including pixels, colors, shapes, text, and programming. It covers:
1) Pixels are the smallest controllable elements that make up a digital image. Each pixel has a location and color value.
2) Colors are used for backgrounds and foregrounds. There are predefined color codes for text and graphics.
3) Basic shapes include lines, rectangles, circles, ellipses, polygons, and pie slices. Functions like line(), rectangle(), and circle() are used to draw shapes.
4) Text functions allow setting font, size, color, and position in graphics mode. Outtext() displays text.
5) Example programs demonstrate drawing shapes and text
This document is a practical file submitted by a student for their Computer Graphics subject. It contains an index listing the topics covered, which include introductions to computer graphics and its applications, descriptions of basic graphics functions in C++ like line, circle, and ellipse drawing algorithms, and examples of applications programs. The file provides information and code samples to help the student learn about core computer graphics concepts and programming.
This document summarizes a lecture on understanding color. It discusses color representation, compositing, Porter-Duff blend modes, hardware blending, additional blend modes, color perception, tristimulus values, color spaces like RGB, CMYK and HSL, gamma correction, and the relevance of color theory to graphics. It also announces an in-class quiz, upcoming assignment and lecture topics.
Shadow Volumes on Programmable Graphics Hardwarestefan_b
The document proposes a method for computing shadow volumes on programmable graphics hardware. It involves using textures to store vertex positions and silhouette edge information. A quad texture stores data for each edge indicating whether it is silhouetted against each light source. During shadow rendering, this texture is used as a vertex array to extrude shadow quads for silhouetted edges. This approach avoids CPU processing and enables dynamic scenes by keeping all data on the GPU.
The Ring programming language version 1.5.3 book - Part 48 of 184Mahmoud Samir Fayed
This document provides documentation on creating a 2D game engine in Ring. It discusses organizing the project into layers, including the games layer, game engine classes layer, and interface to graphics library layer. It then describes the key classes in the game engine - Game, GameObject, Sprite, Text, Animate, Sound, and Map. It provides details on the attributes and methods for each class. It also provides an example of how to load the game engine library, create a Game object, and start drawing text to the screen. The document is intended to teach how to structure a 2D game engine project using different programming paradigms in Ring.
The Ring programming language version 1.3 book - Part 38 of 88Mahmoud Samir Fayed
This document describes a game engine project built in Ring for creating 2D games. It discusses the different layers of the project, including the games layer, game engine classes layer, interface to graphics libraries layer, and graphics library bindings layer. It provides details on the RingAllegro and RingLibSDL libraries used for graphics. It outlines the main game engine classes like Game, GameObject, Sprite, Text, Animate, Sound, and Map. It gives examples of how to use the engine to create a game window, draw text, and move text. The goal of the project is to allow games to be built with Ring using different programming paradigms like declarative programming for games and object-oriented programming for the engine classes
Matlab Feature Extraction Using Segmentation And Edge DetectionDataminingTools Inc
This document discusses several image processing techniques in Matlab:
1) Edge detection using the edge function and Sobel and Canny edge detection algorithms.
2) The radon transform which computes projections of an image along specified directions and the inverse radon transform used to reconstruct images from projections.
3) Marker-controlled watershed segmentation which separates touching objects in an image using morphological operations like gradients and markers.
CS 354 Object Viewing and RepresentationMark Kilgard
- The document summarizes a lecture on viewing and representing 3D objects in computer graphics. It discusses representing objects as triangle meshes and storing vertex data in arrays indexed by triangle lists. It also covers transforms like glFrustum and gluLookAt for viewing, and examples of modeling transforms.
- Common ways to represent 3D objects include procedural, explicit polygon meshes, and implicit surfaces. Triangle meshes stored with unique vertex positions and triangle indices are popular due to efficiency and compatibility with OpenGL/GPU rendering.
- The lecture also covered projection transforms, modeling transforms, lighting, and "look at" camera positioning for 3D viewing. Next lecture will discuss mesh properties and OpenGL rendering details.
This document provides an overview of the CS 354 Computer Graphics course taught by Mark Kilgard at the University of Texas. The key points are:
- Mark Kilgard and Randall Smith will teach the course using lectures and programming assignments in OpenGL.
- Grading will be based on tests, quizzes, homework assignments, and software projects implementing simple 3D graphics concepts in OpenGL.
- Students will learn fundamental 3D graphics concepts like transformations, lighting, and shading by programming in OpenGL and GLSL shaders.
- The goal is to teach practical graphics programming skills for applications like games, visualizations, and more.
The document describes a graphics editor program that simulates the MS Paint application. It uses OpenGL for graphics rendering and GLUT for creating windows and rendering scenes. Key features implemented include tools for drawing shapes, images, and text. OpenGL functions are used for rendering while GLUT functions handle window creation and events. The design section covers header files, OpenGL/GLUT functions, and user-defined functions for tasks like drawing, erasing, and filling shapes. Implementation details are provided for various drawing algorithms and user interface elements.
This ppt explains basic topics of computer graphics like - pixel, resolution, text mode, graphics mode, various types of displays, applications of computer graphics etc.
The document summarizes a lecture on blending, compositing, and anti-aliasing in computer graphics. It discusses how colors are combined during rendering using blending operations, and how compositing operates on entire images rather than individual pixels. Porter-Duff models for digital image compositing are explained, along with how they relate to OpenGL blending functions.
The document describes a geometry shader-based approach to bump mapping that has several advantages over traditional CPU-based approaches. The geometry shader constructs an object-to-texture space mapping for each triangle, allowing lighting computations to be done efficiently in texture space in the pixel shader. It addresses issues like texture mirroring and lighting discontinuities. Examples and Cg source code are provided to illustrate the technique.
The document summarizes a lecture on further details of the graphics pipeline. It discusses how triangles described by vertex positions in normalized device coordinates are rasterized into pixels on the screen. The lecture covers oriented edge equations, being inside a triangle, rasterization approaches like scanline rasterization, and basic fragment shading through color interpolation. Homework status and the lecturer's office hours are also provided.
- The lecture covered graphics math topics including homogeneous coordinates and projective transformations.
- Homework 2 was due and an in-class quiz was given. Details on Project 1 were announced.
- The final exam date was moved and last class will be a review session. Daily quiz solutions will be provided.
- Office hours and last lecture topics were reviewed to introduce the current lecture on further graphics math concepts.
The document discusses manipulating object behavior at runtime through various techniques like inheritance, mixins, traits, composition, and proxies. It provides examples of how component-based systems in Unity3D and Crafty.js allow adding and removing behaviors to entities without changing their implementation. ECMAScript 6 proxies are presented as a flexible way to define object behavior through get and set handlers. Traits.js is shown as an alternative approach using proxies to compose reusable behaviors.
This document discusses machine learning concepts including algorithms, data inputs/outputs, runtimes, and trends in academia vs industry. It notes that while academia focuses on algorithm complexity, industry prioritizes data-driven approaches using large datasets. Ensemble methods combining many simple models generally perform better than single complex models. Specific ML techniques discussed include word segmentation using n-gram probabilities, perceptrons for classification, SVD for recommendations and clustering, and crowdsourcing ensembles. The key lessons are that simple models with large data outperform complex models with less data, and that embracing many small independent models through ensembles is effective.
The document is a slide presentation about computer graphics and OpenGL. It introduces the graphics pipeline, discusses concepts like transformations and coordinate frames in OpenGL, and provides an example OpenGL ES application for iOS that renders a teapot with lighting effects. Key points covered include the graphics pipeline stages of modeling, posing, rendering and rasterization, using transformation matrices for positioning objects, and how OpenGL handles rendering through functions like glPushMatrix and glDrawElements.
The Ring programming language version 1.5.3 book - Part 58 of 184Mahmoud Samir Fayed
This document provides an overview of how to build a 2D game engine in Ring using different programming paradigms. It discusses using declarative programming for the game layer, object-oriented programming for game engine classes, and procedural programming for the graphics library interface. The document outlines the layers of the engine including graphics library bindings, the interface layer, game engine classes, and the games layer. It provides details on key classes like Game, GameObject, Sprite, Text, Animate, Sound, and Map that can be used to build games. Examples are given for creating a game window and drawing/animating text to demonstrate using the engine.
This document contains the slides from a class on algorithms, computer graphics, and mathematics for game developers and computer scientists. The class covered introductions to JavaScript, computer graphics, and Three.js. It included discussions of debugging JavaScript code, the HTML DOM, Fibonacci sequences, Z-buffering, and more. The class was presented by Dr. Saajid Abuluaih and included code examples and references for further reading.
Architecture for scalable Angular applicationsPaweł Żurowski
Architecture for applications that scales. It uses redux pattern and ngrx implementation with effects and store.
It's refreshed (but still 2+) presentation from my inner talk for colegues.
The document describes a datastore frontend that the author developed for personal use. It aims to be reactive, keystroke-minimal, and easy to run without a build step. The document then provides code for a Graph class that implements a basic graph data structure in JavaScript. The Graph class uses proxies to intercept calls and track changes to graph vertices and their relationships. It allows setting and getting vertex values, as well as performing computations on the graph in a simple way.
How I hacked the Google Daydream controllerMatteo Pisani
Matteo Pisani hacked the Google Daydream VR controller to work on iOS devices by reverse engineering the Bluetooth data packets. He used tools like BlueCap and CoreBluetooth to analyze the packet data and decode sensor readings for gyroscope, accelerometer, magnetometer, touchpad, and buttons. Pisani then used JavaScript and the AHRS algorithm to accurately map the sensor data to 3D orientation of a Daydream controller model in an HTML/WebGL viewer. This hack extends compatibility of the Daydream controller beyond Android to desktop and other platforms.
2014 yılının sonunda sonlandırılması beklenen HTML standardının 5. sürümü çoktandır tarayıcılar tarafından destekleniyor. HTML5 ile gelen Canvas, Websockets ve diğer özelliklerle nasıl daha canlı, daha Flash uygulamalarına benzer, web uygulamaları geliştirebileceğimizi inceledik.
Migrating your Web app to Virtual RealityDenis Radin
HTML/CSS is an ultimate stack for UI development however hyping VR technology still have no way to reuse millions of Web applications already available. This talk is about theory and practice of porting existing HTML/CSS apps into Virtual Reality.
Oculus Rift is bought by Facebook, HTC investing 10 billions in VR apps developers, Sony got VR for PlayStation, Nintendo is going VR. Virtual Reality is booming and number of households having VR doubles every month. The same do number of VR applications. However it is still not possible to bring best UI development practices into Virtual Reality using UI development unicorn - Web platform.
This talk gives insights on ways possible for displaying HTML/CSS content in Virtual Reality. Should we go CSS way or WebGL? What are possible solutions and most expected pitfalls? Why HTML is still a good choice to develop interfaces for VR? How Web developers can contribute to VR industry? These are questions answered.
This document discusses lessons that can be learned from the history of web development. It covers the importance of tools, the need for debugging proficiency, understanding abstractions, attention to pixel-level details, inspiration from problems, and appreciation for elegant code. Specific examples highlight issues with closures, libraries, debugging network performance, drag and drop interactions, and classic examples of beautiful code from early computers and Macintosh. The goal is to remind developers to thoroughly understand the foundations of the web platform.
This document discusses the process of rendering views and pixels on the screen from a high level object to pixels. It covers the key steps of measure, layout, and draw and explains important concepts like double buffering, vsync, and avoiding overdraw. Key topics include how the GPU helps with rasterization, using viewtreeobserver for size changes, different root view types, and using constraint layout for a more optimized layout. It emphasizes best practices like minimizing unnecessary layout requests and using tools like hierarchy viewer and GPU profiling.
From Hello World to the Interactive Web with Three.js: Workshop at FutureJS 2014Verold
The first workshop at the first ever FutureJS conference in Barcelona. From Three.js Hello World to building your first interactive 3D app, to connecting your web app with the Internet of Things.
This document provides an overview of HTML5 and its capabilities for building interactive web applications. It discusses the history and development of HTML5, including the roles of the WHATWG and W3C. It also summarizes key HTML5 features such as JavaScript, Canvas, WebSockets, storage options, and emerging 3D capabilities. Throughout, it provides examples of how these features can be used to create games, multimedia experiences, and real-time applications on the modern web.
This document discusses best practices for developing a chess game app called ChessMate. It covers topics like architecture patterns, design principles, testing practices, code quality, and project organization. Examples are provided to illustrate concepts like separation of concerns, dependency injection, protocol-oriented programming and value types vs reference types. The goal is to build a well-designed, extensible and maintainable chess app following industry standards.
- The document describes creating a custom Hero class in JavaScript that extends the createjs.Bitmap class. The Hero class overrides the initialize method to set properties like velocity and adds a tick method to update the position based on velocity.
- Creating an instance of Hero and adding it to the stage results in a jumping animation as the tick method increases velocity and position each frame.
- The document provides instructions on loading the Hero class, instantiating a Hero, and displaying it jumping on the canvas.
Unethical JavaScript - Giorgio Natili - Codemotion Rome 2017Codemotion
As Douglas Crockford said, JavaScript is one of the most misunderstood languages. Also if the new standardizations brought to a more cohesive lingo, there are still development habits that create unpredictable effects and unreadable code. During this session, we'll dive in those habits discussing how the most recent versions of ECMA script help to write a cleaner and more sustainable JavaScript.
The X-Ray Engine is a game engine, used in the S.T.A.L.K.E.R. game series. Its code was made public in September 16 2014, and since then, STALKER fans continue its development. A large project size, and a huge number of bugs in the games, gives us a wonderful chance to show what PVS-Studio is capable of.
Similar to Class[6][5th aug] [three js-loaders] (20)
Leveraging Generative AI to Drive Nonprofit InnovationTechSoup
In this webinar, participants learned how to utilize Generative AI to streamline operations and elevate member engagement. Amazon Web Service experts provided a customer specific use cases and dived into low/no-code tools that are quick and easy to deploy through Amazon Web Service (AWS.)
This presentation was provided by Steph Pollock of The American Psychological Association’s Journals Program, and Damita Snow, of The American Society of Civil Engineers (ASCE), for the initial session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session One: 'Setting Expectations: a DEIA Primer,' was held June 6, 2024.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Diana Rendina
Librarians are leading the way in creating future-ready citizens – now we need to update our spaces to match. In this session, attendees will get inspiration for transforming their library spaces. You’ll learn how to survey students and patrons, create a focus group, and use design thinking to brainstorm ideas for your space. We’ll discuss budget friendly ways to change your space as well as how to find funding. No matter where you’re at, you’ll find ideas for reimagining your space in this session.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPRAHUL
This Dissertation explores the particular circumstances of Mirzapur, a region located in the
core of India. Mirzapur, with its varied terrains and abundant biodiversity, offers an optimal
environment for investigating the changes in vegetation cover dynamics. Our study utilizes
advanced technologies such as GIS (Geographic Information Systems) and Remote sensing to
analyze the transformations that have taken place over the course of a decade.
The complex relationship between human activities and the environment has been the focus
of extensive research and worry. As the global community grapples with swift urbanization,
population expansion, and economic progress, the effects on natural ecosystems are becoming
more evident. A crucial element of this impact is the alteration of vegetation cover, which plays a
significant role in maintaining the ecological equilibrium of our planet.Land serves as the foundation for all human activities and provides the necessary materials for
these activities. As the most crucial natural resource, its utilization by humans results in different
'Land uses,' which are determined by both human activities and the physical characteristics of the
land.
The utilization of land is impacted by human needs and environmental factors. In countries
like India, rapid population growth and the emphasis on extensive resource exploitation can lead
to significant land degradation, adversely affecting the region's land cover.
Therefore, human intervention has significantly influenced land use patterns over many
centuries, evolving its structure over time and space. In the present era, these changes have
accelerated due to factors such as agriculture and urbanization. Information regarding land use and
cover is essential for various planning and management tasks related to the Earth's surface,
providing crucial environmental data for scientific, resource management, policy purposes, and
diverse human activities.
Accurate understanding of land use and cover is imperative for the development planning
of any area. Consequently, a wide range of professionals, including earth system scientists, land
and water managers, and urban planners, are interested in obtaining data on land use and cover
changes, conversion trends, and other related patterns. The spatial dimensions of land use and
cover support policymakers and scientists in making well-informed decisions, as alterations in
these patterns indicate shifts in economic and social conditions. Monitoring such changes with the
help of Advanced technologies like Remote Sensing and Geographic Information Systems is
crucial for coordinated efforts across different administrative levels. Advanced technologies like
Remote Sensing and Geographic Information Systems
9
Changes in vegetation cover refer to variations in the distribution, composition, and overall
structure of plant communities across different temporal and spatial scales. These changes can
occur natural.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
Film vocab for eal 3 students: Australia the movie
Class[6][5th aug] [three js-loaders]
1. ALGORITHMS, COMPUTER GRAPHICS, AND
MATHEMATICS FOR GAME DEVELOPERS &
COMPUTER SCIENTISTS
PREPARED AND PRESENTED BY
Dr.Saajid Abuluaih, PhD
5th of Jun, 2021
Class[6]: ThreeJS Loaders
4. 4
WHAT COULD YOU MISS ABOUT THIS TEST?
THE AWARENESS TEST
This following video illustrates a selective attention test that you may exercise without even notice.
Please, watch the following video and count how many times the white T-shirt team passes the ball.
The right answer is: 15 times …
References:
Selective Attention Test
The Monkey Business Illusion
The Invisible Gorilla (featuring Daniel Simons) - EMMY Winner
Selective Attention/ Invisible Gorilla Experiment: See Through Your Focus
BUT, did you see the Gorilla
5. 5
WHAT COULD YOU MISS ABOUT THIS TEST?
THE AWARENESS TEST
Here is Jordan Peterson explains about the Gorilla Experiment …
References:
Jordan Peterson Gorilla Experiment
7. Bubble sort is a classic sorting algorithm that compares two
adjacent elements of an array and swaps them if they are not in
the intended order. The process keeps moving forward to the last
elements of the array, and if the swap occurs even once the whole
process will be repeated to check if the array is sorted or not.
7
TODAY’S ALGORITHM,
BUBBLE SORT
function BubbleSort(inputArr) {
let n = inputArr.length;
let notSorted;
do{
notSorted = false;
for (let i = 0; i < n - 1; i++) {
if (inputArr[i]>inputArr[i+1]) {
let tmp = inputArr[i];
inputArr[i] = inputArr[i+1];
inputArr[i+1] = tmp;
notSorted = true;
}
}
}while(notSorted);
return inputArr;
}
References:
JavaScript Bubble Sort: A Guide By JAMES GALLAGHER
(Image Source)
9. Autodesk 3Ds MAX provides you with a very powerful tool called “Array”. Array tool enables you to copy
instantaneously a predefined scene element.
9
3DS MAX: MODELLING,
ARRAY
References:
Autodesk: Array
Creating Arrays of Objects
(image source)
10. What can you do with array tool? Your imagination is the only limit.
10
3DS MAX: MODELLING,
ARRAY
(image source) (image source) (My design)
(image source) (image source) (image source)
12. 12
QUICK QUIZ
DECIDE WHICH IS WHICH! Z-UP VS Y-UP, AND
LEFT-HANDED VS RIGHT-HANDED
The following image is for Unitiy3D Transform gizmo. What do you think about it? Is it Left-Handed or
Right-Handed Coordinate System? Is it Y-up or Z-up Coordinate System?
(Image source)
13. 13
QUICK QUIZ
DECIDE WHICH IS WHICH! Z-UP VS Y-UP, AND
LEFT-HANDED VS RIGHT-HANDED
The following image is for 3Ds MAX Transform gizmo. What do you think about it? Is it Left-Handed or
Right-Handed Coordinate System? Is it Y-up or Z-up Coordinate System?
(Image source)
14. 14
QUICK QUIZ
DECIDE WHICH IS WHICH! Z-UP VS Y-UP, AND
LEFT-HANDED VS RIGHT-HANDED
The following image is for Unreal Engine Transform gizmo. What do you think about it? Is it Left-Handed
or Right-Handed Coordinate System? Is it Y-up or Z-up Coordinate System?
(Image source)
15. 15
QUICK QUIZ
DECIDE WHICH IS WHICH! Z-UP VS Y-UP, AND
LEFT-HANDED VS RIGHT-HANDED
The following image is for Blender Transform gizmo. What do you think about it? Is it Left-Handed or
Right-Handed Coordinate System? Is it Y-up or Z-up Coordinate System?
(Image source)
16. 16
QUICK QUIZ
DECIDE WHICH IS WHICH! Z-UP VS Y-UP, AND
LEFT-HANDED VS RIGHT-HANDED
The following image is for Maya Transform gizmo. What do you think about it? Is it Left-Handed or Right-
Handed Coordinate System? Is it Y-up or Z-up Coordinate System?
(Image source)
17. 17
QUICK QUIZ
DECIDE WHICH IS WHICH! Z-UP VS Y-UP, AND
LEFT-HANDED VS RIGHT-HANDED
The following image is for Three.js Transform gizmo. What do you think about it? Is it Left-Handed or
Right-Handed Coordinate System? Is it Y-up or Z-up Coordinate System?
(Image source)
(Image source)
19. 19
Dat.GUI JavaScript Library
What is dat.GUI?
Dat.GUI is, arguable, the best debugging tool for your JavaScript code.
It enables you to tweak the values of your variables on real time. It
creates type of HTML elements, with form’s fields that are mapped to
your variables with values that are initially specified. If the data type
of a specific variable is Boolean; it will create a check box. However, if
the property is a function; it will create a button. First, you need to
install JavaScript dependency using npm, as follows:
To get started with dat.GUI, first import it to your project:
Instantiate it:
With that, you have a starter that can be render to a small open/close
dropdown menu.
Now you need to add fields to it
(Image source)
References:
Nowhere Near Ithaca
Github - dat.GUI
JSfiddle
import * as dat from 'dat.gui';
let gui = new dat.GUI();
npm install --save dat.gui
20. 20
Dat.GUI JavaScript Library
What is dat.GUI?
In order to add new a new element to the panel; you use:
The ‘add’ method takes two main parameters. The first one, the
object. The second one, the name of the property that you need to
control. In our wireframe red box, these properties can control the
box’s dimensions and it locations:
However, we may be able to enhance it a bit.
(Image source)
gui.add(...);
gui.add(line.position, 'x');
gui.add(line.position, 'y');
gui.add(line.position, 'z');
gui.add(line.scale, 'x');
gui.add(line.scale, 'y');
gui.add(line.scale, 'z');
References:
Nowhere Near Ithaca
Github - dat.GUI
JSfiddle
21. 21
Dat.GUI JavaScript Library
What is dat.GUI?
You can chain a series of methods to add more constraints to the menu item, for example:
If you add a property of type Boolean; the menu item will be added as a checkbox.
You can add color, but it’s going to be a bit different:
Or maybe even a function:
References:
Nowhere Near Ithaca
Github - dat.GUI
JSfiddle
gui.add(line.position, 'x').min(-3).max(3).step(0.1).name("Move on X Axis");
gui.add(line.position, 'y').min(-3).max(3).step(0.1).name("Move on Y Axis");
gui.add(line.position, 'z').min(-3).max(3).step(0.1).name("Move on Z Axis");
gui.add(line.scale, 'x').min(0.5).max(2.5).step(0.1).name("Scale on X Axis");
gui.add(line.scale, 'y').min(0.5).max(2.5).step(0.1).name("Scale on Y Axis");
gui.add(line.scale, 'z').min(0.5).max(2.5).step(0.1).name("Scale on Z Axis");
gui.add(line, 'visible');
var globalVariable = { color: 0xff00ff, boxRotation: ()=>{ alert(“GR team rocks");} };
gui.addColor(globalVariable, 'color').onChange(() => {line.material.color.set(globalVariable.color)});
gui.add(globalVariable, 'boxRotation').name("Rotate Animation");
23. 23
FUNDAMENTALS AND THEORIES
WHAT IS .OBJ ANY WAY?
An OBJ file is a common format of 3D model files, that can be exported and viewed by a variety of 3D
application editors. It includes a three-dimensional object with 3D coordinates, texture maps, polygonal
faces, and other object information. OBJ files may reference. MTL files that contain information about
surface shading material for that object.
References:
OBJ
Wavefront .obj file
24. 24
GETTING THE MODEL PREPARED
DESIGNING OR FINDING .OBJ 3D ASSETS
Again, if you can design your own model, then do, and export it to OBJ after you get it completed.
Otherwise, you can just search the internet for something similar, import it to your favorite 3d application
and then export it to .obj format. We will use the following cottage house model:
The model has been designed by Shahid Abdullah and uploaded to free3d.com, and cgtrader.com.
(image source)
25. 25
RENDER THE MODEL INTO THE BROWSER
INCLUDE THE LOADER AND LOAD THE MODEL
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader';
const objLoader = new OBJLoader()
objLoader.load(
'Assets/Models/cottage_obj.obj',
(object) => { scene.add(object); console.log(object); },
(xhr) => { console.log((xhr.loaded / xhr.total) * 100 + '% loaded'); },
(error) => { console.log('Check the following error in OBJLoader object: ' + error); }
);
Firs of all, include the loader. You can do that as follows:
Then you can use the loader. The loader have three main callback functions that they get executed on the
following states: success function(which gets invoked if the file was successfully loaded), Progressing
function ( which gets executed during the time the loader is still in the process of requesting the model
file and rendering it), and the last one is error function( which gets invoked if something went wrong). To
use the loader as follows:
const light = new THREE.PointLight(), light2 = new THREE.PointLight(), light3 = new THREE.PointLight();
light.position.set(0, 30, 0); light2.position.set(550, 50, 0); light3.position.set(-550, 50, 0);
scene.add(light);scene.add(light2);scene.add(light3);
Remember that you need to add the OBJ file in your assets folder
Finally, You may need to consider adding some light sources to
light your scene, as follows:
26. 26
GETTING THE MODEL PREPARED
DEBUGGING & GETTING RID OF UNWANTED
OBJECTS
You may need to debug your loaded object and remove some of the geometries that comes with the
model, and you don’t need them. To debug your loaded object, just log out the model to the console as
follows :
const objLoader = new OBJLoader()
objLoader.load(
'Assets/Models/cottage_obj.obj',
(object) => { scene.add(object); console.log(object); },
(xhr) => { console.log((xhr.loaded / xhr.total) * 100 + '% loaded'); },
(error) => { console.log('Check the following error in OBJLoader object: ' + error); }
);
27. 27
GETTING THE MODEL PREPARED
LOADING .OBJ MATERIALS
OBJ models’ materials are described in separated files with MTL extension. Therefore, they need their
own loaders. You can import MTL loader as follows:
import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader';
const mtlLoader = new MTLLoader();
mtlLoader.load('Assets/Textures/cottage_obj.mtl',
(materials) => {
materials.preload();
console.log(materials);
const objLoader = new OBJLoader();
objLoader.setMaterials(materials);
objLoader.load('Assets/Models/cottage_obj.obj',
(object) => { scene.add(object); console.log(object); },
(xhr) => { console.log((xhr.loaded / xhr.total) * 100 + '% loaded model'); },
(error) => { console.log('Check the following error in OBJLoader object: ' + error); });
},
(xhr) => { console.log((xhr.loaded / xhr.total) * 100 + '% loaded material'); },
(error) => { console.log('Check the following error in OBJLoader object: ' + error); }
);
In order to assign a material to an OBJ object; you need to load the material file first then load the model.
You may be able to assign the material to the object if the material file is loaded successfully. That can be
done as follows:
29. 29
FUNDAMENTALS AND THEORIES
What is .FBX any way?
FBX, which stands for Filmbox, is a propriety file format that owned by Autodesk since 2006. It is older
than GLTF, and was very common 3d object formatting extension and used to standardize the
specifications that of digital 3d content creations and game engines. FBX supports many features such as
3D models, animations, materials, scenes and scene hierarchy … etc.
References:
Adaptable file format for 3D animation software
Loading FBX files into BaseGraphicsSystem
wiki.blender.org - FBX
30. 30
GETTING THE MODEL PREPARED
DESIGNING OR FINDING .FBX 3D ASSETS
Again, if you can design your own model, then do, and export it to fbx after you get it completed.
Otherwise, you can just search the internet for something similar, import it to your favorite 3d application
and then export it to .obj format. We will use the following cottage house model:
This model can be found on Maximo under the name “The Boss”.
References:
Adaptable file format for 3D animation software
Loading FBX files into BaseGraphicsSystem
wiki.blender.org - FBX
31. 31
RENDER THE MODEL INTO THE BROWSER
INCLUDE THE LOADER AND LOAD THE MODEL
import {FBXLoader} from 'three/examples/jsm/loaders/FBXLoader';
const fbxLoader = new FBXLoader();
fbxLoader.load('Assets/Models/StandingIdle.fbx',
(object) => {
scene.add(object);
console.log(object);
object.scale.set(0.01, 0.01, 0.01) },
(xhr) => { console.log((xhr.loaded / xhr.total) * 100 + '% loaded model'); },
(error) => { console.log('Check the following error in OBJLoader object: ' + error); });
Firs of all, include the loader. You can do that as follows:
Then you can use the loader. The loader have three main callback functions that they get executed on the
following states: success function(which gets invoked if the file was successfully loaded), Progressing
function ( which gets executed during the time the loader is still in the process of requesting the model
file and rendering it), and the last one is error function( which gets invoked if something went wrong). To
use the loader as follows:
const light = new THREE.PointLight(), light2 = new THREE.PointLight(), light3 = new THREE.PointLight();
light.position.set(0, 30, 0); light2.position.set(550, 50, 0); light3.position.set(-550, 50, 0);
scene.add(light);scene.add(light2);scene.add(light3);
Remember that you need to add the FBX file in your assets folder
Finally, You may need to consider adding some light sources to light your scene, as follows:
33. 33
FUNDAMENTALS AND THEORIES
What is .GLTF any way?
Graphics Language Transmission Format (glTF) is an acronym for Graphics Language Transmission Format.
The glTF format is an open 3D model and scene format for sending 3D data in rich scenes efficiently. Since
2013, The Khronos Group has established and administered it.
Pros:
- Easy to Read and Write
- Fast and Efficient
- Direct Reads for Game Engines
- Guidance from a Standards Group
- Rich Scene Data
- Augmented Reality
Cons:
- Non-Editable 3D Models
- No Shader Networks
- Non-Backwards Compatible Extensions
Assets can be provided in either JSON (.gltf) or binary (.glb) format.
(image source)
References:
khronos.org
glTF vs FBX: Which format should I use?
glTF: Everything You Need to Know
KhronosGroup/glTF-Sample-Models
34. 34
GETTING THE MODEL PREPARED
DESIGNING OR FINDING . GLTF 3D ASSETS
For the third time, if you can design your own model, then do, and export it to OBJ after you get it
completed. Otherwise, you can just search the internet for something similar, import it to your favorite 3d
application and then export it to .obj format. We will use the following cottage house model:
(image source)
For this loader we will use Totoro 3D By Jesse Ragos
The model after loading it to our scene,
using our own lighting
35. 35
RENDER THE MODEL INTO THE BROWSER
INCLUDE THE LOADER AND LOAD THE MODEL
Firs of all, include the loader. You can do that as follows:
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
const loader = new GLTFLoader()
loader.load(
'Assets/Models/Totoro.glb',
(gltf) => {scene.add(gltf.scene);},
(xhr) => {console.log((xhr.loaded / xhr.total) * 100 + '% model loaded.');},
(error) => {console.log('Check the following error in GLTFLoader object: ' + error);}
);
const light = new THREE.PointLight(), light2 = new THREE.PointLight(), light3 = new THREE.PointLight();
light.position.set(0, 30, 0); light2.position.set(550, 50, 0); light3.position.set(-550, 50, 0);
scene.add(light);scene.add(light2);scene.add(light3);
Then you can use the loader. The loader have three main callback functions that they get executed on the
following states: success function(which gets invoked if the file was successfully loaded), Progressing
function ( which gets executed during the time the loader is still in the process of requesting the model
file and rendering it), and the last one is error function( which gets invoked if something went wrong). To
use the loader as follows:
Remember that you need to add the GLTF file in your assets folder
Finally, You may need to consider adding some light sources to
light your scene, as follows:
36. 36
GETTING THE MODEL PREPARED
DEBUGGING & GETTING RID OF UNWANTED GLTF
Fortunately, in this model we don’t have to remove any unwanted objects that comes with the scene. You
still can log out the model file and see what it contains as follows:
const loader = new GLTFLoader()
loader.load(
'Assets/Models/Totoro.glb',
function (gltf) {scene.add(gltf.scene); console.log(gltf);},
(xhr) => {console.log((xhr.loaded / xhr.total) * 100 + '% model loaded.');},
(error) => {console.log('Check the following error in GLTFLoader object: ' + error);}
);
Notice that you have [scene] & [Scenes], in in the object:
37. 37
GETTING THE MODEL PREPARED
DRACO LOADER WITH GLTF
If your model is compressed with Draco library, you can unpack it using Draco loader. Draco is a library for
compressing and decompressing 3D models which can be used along with GLTF. The compressing process
can significantly reduce the size of your models, however, that comes with the price of getting the
processor heavily involved in decompressing the file, which could take some time.
To compress your model with Darco, you need to open your
3d model in a 3d editor application like blender and export it
again. But, when you do so you need to activate Darco mesh
compression.
Try now to compare the both file sizes, and see to what
extent Draco compressor was able to reduce the size to.
References:
DRACOLoader
Draco 3D data compression
38. 38
GETTING THE MODEL PREPARED
DRACO LOADER WITH GLTF
To load the compressed file, we need to include the Darco loader and use it along with GLTF loader as
follows :
const dracoLoader = new DRACOLoader();
const loader = new GLTFLoader()
loader.setDRACOLoader(dracoLoader);
loader.load(
'Assets/Models/TotoroComp.glb',
function (gltf) {scene.add(gltf.scene);},
(xhr) => {console.log((xhr.loaded / xhr.total) * 100 + '% model loaded.');},
(error) => {console.log('Check the following error in GLTFLoader object: ' + error);}
);
Running the above code will result in an error of 404 files are not founded. You need to grab these files
manually and put them in your js folder.
Then you need to specify the directory of the decoder
as follows:
const dracoLoader = new DRACOLoader();
dracoLoader.setDecoderPath('/Assets/js/draco/');
40. 40
GETTING STARTED WITH REQUESTING IMAGES
LOADING IMAGES
Method 1:
Requesting an Image can be done as follows
const image = new Image();// Image is a JavaScript native object
image.src = '/Assets/Textures/Concrete_Textures/Concrete_1.jpg'
image.onload = () =>{
const texture = new THREE.Texture(image);
const material = new THREE.MeshBasicMaterial({map:texture});
const geometry = new THREE.BoxGeometry(2,2,2);
const mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
console.log(texture);
console.log("Image is loaded");
}
41. 41
USING TEXTURE LOADER
LOADING TEXTURES
Method 2:
Using TextureLoader to load a texture. THREE.TextureLoader() is an object provided by three.js to load
image assets
const loader = new THREE.TextureLoader()
const texture = loader.load('/Assets/Textures/Concrete_Textures/Concrete_5.jpg');
TextureLoader is just like the other model loaders, it has three main callback functions that can be used to
perform specific logic at a certain time.
const texture1 = loader.load('/Assets/Textures/Concrete_Textures/Concrete_5.jpg',
() => console.log("Loaded"),
() => console.log("in progress"),
() => console.log("Error, Check your code")
);
References:
threejs.org - TextureLoader
43. 43
MANAGE YOUR ASSETS
LOAD MULTIPLE RESOURCES ALL AT ONCE
ThreeJS provides you with a great too that enables you to load multiple resources (textures, models,
sounds .. etc.) using loading manager object. When you initialize any type of loader; pass the loading
manager as the first parameter and the engine will do all the management parts for you.
const manager = new THREE.LoadingManager();
const loader = new THREE.TextureLoader(manager);
const texture = loader.load("/Assets/Textures/Concrete_Textures/Concrete_1.jpg");
const texture2 = loader.load("/Assets/Textures/Concrete_Textures/Concrete_2.jpg");
const texture3 = loader.load("/Assets/Textures/Concrete_Textures/Concrete_3.jpg");
const texture4 = loader.load("/Assets/Textures/Concrete_Textures/Concrete_4.jpg");
const texture5 = loader.load("/Assets/Textures/Concrete_Textures/Concrete_5.jpg");
manager.onStart = ( url, itemsLoaded, itemsTotal ) =>console.log( 'Started loading file: ' + url + '.nL
oaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );
manager.onProgress = ( url, itemsLoaded, itemsTotal ) => console.log( 'Loading file: ' + url + '.nLoade
d ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );
manager.onLoad = ()=>console.log('Loading complete!');
manager.onError = ()=>console.log('Error’);
References:
threejs.org - LoadingManager
45. • Find three models from the internet with the following formats:
• FBX
• GLTF
• OBJ
• And load them all in the same scene.
• Compress GLTF file with Draco compressor in blender and decode it in threejs using draco loader.
• Show to what extent the file has lost form its original size.
• Add to the scene a plane object and add a floor texture of your choice
• Write an essay of one-paragraph differentiates between the major three model formats in threejs. Fbx,
GLTF, and OBJ formats
45
DEADLINE 20th/8,
HOMEWORK