6.837 Intro to Computer Graphics Assignment 1: Ray Casting

computer graphics assignment 1

Ray, Hit & Material Classes

Parsing command line arguments & input files, additional references, input files, makefile for g++ on linux, sample results.

computer graphics assignment 1

Institute for Computer Graphics site logo

Institute for Computer Graphics

  • News & Events
  • Past Research
  • Publications
  • Technical Reports, Thesis and Dissertation
  • Festival of Animation
  • Hierarchical Multi-View Heterogeneous Large-scale 3D Capture System
  • RGB-D scan of the surface of human body for biomedical applications
  • Flight Dynamics and Control
  • Spatial Cognition
  • Foot Function and the Evolution of Human Gait
  • Funding Sources

Institute for Computer Graphics

CS 4554- Computer Graphics I: Assignment 1 : 2D Transform

Requirements.

  • Download the project : CG1_LAB1.zip ;
  • Load multiple 2D objects in the scene;
  • Control one object ( translate and rotate ) by keyboard or mouse;
  • Detect collision between objects and avoid penetration;

Upload( blackboard )

  • A description of your project structure (short documentation);
  • Source code with enough comments to make it clear what you are doing;
  • Movie of your animation

Transformations

  • The primary goal of this project is to implement 2D transformations that performs the rotations and translations on objects. In OpenGL, there are two ways to do this:
  • Update GL_ModelView matrix via OpenGL API. Since all object vertices are multiplied by the modelView matrix before being rendered (OpenGL does this automatically), this will render the object in a new location and orientation.
  • Apply the transformation to all the individual vertices of an object manually (multyply transform matrix with vertex vectors) and then just draw the transformed object, so no need to update the modelView matrix.
  • No matter which way you choose, generally you need to create a matrix class to calculate the transformation. And you may find it useful in the future.
  • To find collisions among models and boundary, a simpler (but less accurate) way is to define a sphere or AABB (axis-aligned bounding box) big enough to cover the object and find collisions between that and any of the objects in the scene. When a collision occurs, you need to solve the penetration by stopping moving or sliding along the thing it hits. If your code implements collision detection without any response, try to find some way to show a occurring collision visually, for example, draw the intersected objects in a different color.

Extensions (Bonus)

  • Use more precise bounding box such as OBB, triangles, or convex polygons to detect the collisions among objects; Sometimes you may need to use different type of bounding boxes for different objects ( for example, you may prefer sphere for ball, box for wall );
  • Better collision response. Change the moving direction, add penalty force, or any other way to solve the penetration for a better quality;

Other Notes

  • The default display range in the project is from ( -1, -1 ) to ( 1, 1 ), so if you want to display your models correctly, you may need to scale them.
  • Update modelView Matrix in OpenGL : check glMatrixMode, glLoadIdentity, glTranslatef, glRotatef, etc. for more information;
  • Process keyboard input in GLUT : In this project, you need to do that in function key_press and special_key; check glutKeyboardFunc and glutSpecialFunc for more information;

Browse Course Material

Course info, instructors.

  • Prof. Wojciech Matusik
  • Prof. Frédo Durand

Departments

  • Electrical Engineering and Computer Science

As Taught In

  • Algorithms and Data Structures
  • Graphics and Visualization
  • Programming Languages

Learning Resource Types

Computer graphics, lecture notes.

LEC # TOPICS
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19 Image-Based Rendering and Lighting (Lecture notes not available)
20 Output Devices (Lecture notes not available)
21
22
23
24 Graphics Hardware and Computer Games (Lecture notes not available)

facebook

You are leaving MIT OpenCourseWare

Computer Graphics I

4003-570-70 / 4005-761-70 (fall 2008), assignment #1: 2d drawing in opengl.

  • experience in using a graphics package (OpenGL),
  • an understanding of 2D primitives and attributes,
  • an understanding of 2D clipping,
  • an understanding of the window to viewport transformation, and
  • an understanding of callback functions.
Effect OpenGL commands needed
OpenGl Setup glutInit, glutInitDisplayMode, glutInitWindowSize, glutInitWindowPosition, glutCreateWindow, glutMainLoop, glutDisplayFunc, glClearColor, glFlush or glSwapBuffers
Using different primitives (lines, line-strip, line-loop, triangles, triangle-strip, triangle-fan, rectangle, quads, quad-strip, polygon) glBegin/glEnd, glVertex, glRect
Using different attributes (line style, line width, fill style, color) glLineStiple, glLineWidth, glPolygonStiple, glColor, glEnable
Moving from one screen to the next glutMouseFunc, glutPostRedisplay

Output Format:

  • You are expected to use EACH of the routines mentioned above.
  • "Best Of" selections from previous quarters are available for your viewing from the page http://www.cs.rit.edu/~ncs/Courses/570.shtml . You'll need to copy the executable into your Unix account to run them. I will select the "best" of your submittals to add to the web page and for use in future demonstrations.

What to submit

last updated 09/10/08        

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications You must be signed in to change notification settings

Parth1906/SPPU-2019-Pattern-SE-COMP-Computer-Graphics-Practicals

Folders and files.

NameName
39 Commits

Repository files navigation

Sppu-2019-pattern-se-comp-computer-graphics-practicals.

Group A Practicals :

Write a C++ program for drawing graphics primitives and color it.

Write a C++ program to divide screen into four region and draw circle,rectangle,arc and ellipse.

Write a C++ program for drawing a simple object.

Write a c++ program for drawing a line using DDA and Bresahnams Line Drawing Algorithm.

A) Write a C++ program for drawing a following pattern(diamond in rectangle). B) Write a c++ program inscribed and circumscribed circles in triangle.

Write C++ program to draw a concave polygon and fill it with desired color using scan fill algorithm.

Write C++ program to implement Cohen Southerland line clipping algorithm.

Group B Practicals :

Write C++/Java program to draw 2-D object and perform following basic transformations, a) Scaling b) Translation c) Rotation. Use operator overloading.

Write C++ Program to generate Hilbert Curve using concept of fractals.

Write a program to draw Sunrise and Sunset.

PDF is also uploaded with output screenshots of every program.

  • Trending Now
  • Foundational Courses
  • Data Science
  • Practice Problem
  • Machine Learning
  • System Design
  • DevOps Tutorial

Introduction to Computer Graphics

The term ‘Computer Graphics’ was coined by Verne Hudson and William Fetter from Boeing who were pioneers in the field. Computer graphics is a dynamic and essential field within computing that involves the creation, manipulation, and rendering of visual content using computers.

In today’s digital era, computer graphics technologies have revolutionized how we perceive and interact with visual information, playing a pivotal role in video games, movies, architectural design, medical imaging, and more. There are several tools used for the implementation of Computer Graphics. The basic is the graphics.h header file in Turbo-C, Unity for advanced, and even OpenGL can be used for its Implementation.

This article delves into the fundamental concepts of computer graphics, its diverse applications, and the underlying technologies that drive innovation in this field.

What is Computer Graphics?

Computer Graphics including digital images, animations, and interactive graphics used in various sectors such as entertainment, education, scientific visualization, and virtual reality. Computer Graphics can be used in UI design , rendering, geometric objects, animation, and many more. In most areas, computer graphics is an abbreviation of CG.

Computer Graphics refers to several things

  • The manipulation and the representation of the image or the data in a graphical manner.
  • Various technology is required for the creation and manipulation.
  • Digital synthesis and its manipulation.

Types of Computer Graphics

  • Raster Graphics: In raster, graphics pixels are used for an image to be drawn. It is also known as a bitmap image in which a sequence of images is into smaller pixels. Basically, a bitmap indicates a large number of pixels together.
  • Vector Graphics: In vector graphics , mathematical formulae are used to draw different types of shapes, lines, objects, and so on.

Applications of Computer Graphics

There are many applications of computer graphics discussed below-

  • Computer Graphics are used for the aided design of systems engineering and architectural systems- These are used in electrical automobiles and electro-mechanical, and electronic devices. For example gears and bolts.
  • Computer Art – MS Paint.
  • Presentation Graphics – It is used to summarize financial statistical scientific or economic data. For example- Bar charts systems and line charts.
  • Entertainment- It is used in motion pictures, music videos, and television gaming.
  • Education and training- It is used to understand the operations of complex systems. It is also used for specialized systems such as framing for captains, pilots, and so on.
  • Visualization- To study trends and patterns. For example- Analyzing satellite photos of earth.

Why are Computer Graphics used?

Imagine a car manufacturing company that wants to showcase its vehicle sales over the past decade. Storing and presenting this huge amount of data can be both time-consuming and memory-intensive. Furthermore, it can be difficult for the average person to understand. In such cases, by using graphics can be a more effective solution. By using charts and graphs to visually signify the data, it becomes much easier to understand and analyse the data.

Interactive computer graphics utilize a two-way communication concept between users and computers. The computer receives input signals from the user, and the picture is modified accordingly. When a command is applied, the picture updates promptly.

How To Get Started in Computer Graphics

Step by step process to getting started with computer graphics-

Step-1: Understaind the basics

Learn the fundamental and basics of computer graphics such as rendering, shading, animation, and modeling. Learn basic concepts of mathematics like linear algebra , geometry , and calculus as well as basic principles of physics that support computer graphics.

Step-2: Choose Your Area of Interest

Choose your area of interest like 2D-Graphics, 3D-Graphics, Animation, and special effect (VFX ).

Step-3: Learn Programming

Learn programming language that is used in graphics, such as Python , C++ , and JavaScript . Learn about Graphics Libraries and APIs like OpenGL , Vulkan, DirectX, and frameworks like WebGL that is used in web based graphics.

Step-4: Use Graphics Software

Learn about modeling and animation tools such as Blender , Autodesk Maya , or 3ds Max for 3D modeling and animation. Learn about 2D-Graphics software like Adobe Photoshop, Illustrator, and GIMP.

Step-5: Study and Practice

Take online courses and tutorials, many institution offer Computer Graphics course like Coursera, Udemy, and Khan Academy. And read textbooks like “Computer Graphics: Principles and Practice” by John F. Hughes. Now, Starts with simple projects, such as creating basic shapes and gradually move on to more complex scenes and animations.

Step-6:  Create a portfolio of your work

create your own projects and build an online portfolio to display your work, which is helpful for job application.

Step-7: Apply for jobs in computer graphics

If you aim to build a career in computer graphics and grow in this field, gaining experience is important. Search for entry-level positions, freelance, contract work, and internships. When searching for jobs, read the descriptions carefully to understand the responsibilities, required qualifications, and company details. This will help you find roles that align with your career goals and skill set.

Frequently Asked Question On Computer Graphics – FAQs

What are examples of computer graphics.

Examples of computer graphics are photographs, drawings, line art, mathematical graphs, line graphs, charts, diagrams, typography, numbers, symbols, geometric designs, maps, engineering drawings, or other images. Graphics often combine text, illustration, and color.

What are the different types of computer graphics?

There are two type of computer graphics Vector graphics Raster graphics

What are the basic elements of computer graphics?

Basic elements of computer graphics included Line, Shape, Form, Texture, Space, Imagery, Typography, Color.

What are the main application of computer graphics?

main application of computer graphics are in marketing, entertainment, education, healthcare, architecture.

What are the four type of computer graphics?

Four type of computer graphics are Raster graphics Vector graphics 3D-Graphics Animation

Please Login to comment...

Similar reads.

  • Computer Subject
  • computer-graphics

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

IMAGES

  1. NPTEL COMPUTER GRAPHICS ASSIGNMENT 1 ANSWERS

    computer graphics assignment 1

  2. CG-Assignment-1

    computer graphics assignment 1

  3. SOLUTION: Computer graphics assignment 1

    computer graphics assignment 1

  4. BTEC Level 2

    computer graphics assignment 1

  5. Computer Graphics Assignment 1 part 2

    computer graphics assignment 1

  6. Computer Graphics Assignment 1

    computer graphics assignment 1

COMMENTS

  1. Assignment 1 Tutorial

    In this video I demonstrate how to complete Assignment 1 for 6.837 Computer Graphics MIT OpenCourseWare.https://ocw.mit.edu/courses/electrical-engineering-an...

  2. Computer Graphics

    Computer graphics is one of the fundamental aspects of any computing system. Its primary role is to render the digital content (0's and 1's) in a human-compr...

  3. PDF 6.837: Computer Graphics Fall 2012

    Programming Assignment 1: Curves and Surfaces. In this assignment, you will be implementing splines and swept surfaces to model interesting shapes. The primary goal of this assignment is to introduce you to splines and coordinate systems. Upon successful completion of this assignment, you will be rewarded with a powerful tool for modeling 3D ...

  4. 6.837 Assignment 1

    6.837 Assignment 1. 6.837 Intro to Computer Graphics Assignment 1: Ray Casting. In this assignment, you will implement a basic ray caster. This will be the basis of many future assignments, so proper code design is quite important. As seen in class, a ray caster sends a ray for each pixel and intersects it with all the objects in the scene.

  5. Assignments

    Assignments. This course makes use of Athena, MIT's UNIX-based computing environment. OCW does not provide access to this environment. In each assignment's handout, there is a section called "Getting Started" that explains how to use the executable files.

  6. PDF Computer Graphics

    Computer Graphics - Assignment 1 CS 4830 | Dr. Mihail Department of Mathematics Computer Science Valdosta State University January 25, 2019 1 Introduction ... Given a slope 1, the idea is to evaluate which point should be chosen at the next step (x 0 + 1;y 0) 1. or (x 0 + 1;y 0 + 1). This is done by looking at the midpoint, or D = f(x

  7. PDF Computer Graphics

    Computer Graphics - Assignment 1 1 Overview For this assignment, you will have the opportunity to familiarize yourself with basic OpenGL concepts and real-time graphics programming. You will implement basic camera and lighting functionality, and render a 3D mesh. 2 Objective This assignment is designed to give you an opportunity to implement some

  8. Interactive Computer Graphics

    Interactive Computer Graphics - Assignment 1 Getting Started. ... Modify the starter code to create an image with WebGL that contains 1 red pentagon (any 5-sided polygon) that fits inside the default view volume. ... Submit a zip file that contains a folder with your initials and assignment number, for example ak876_a1. All the files required ...

  9. PDF to Computer Graphics

    6.837 Introduction to Computer Graphics Assignment 1: Ray Casting Due Wednesday September 17, 2003 at 11:59pm In this assignment, you will implement a basic ray caster. This will be the basis of all the following assignments, so proper code design is quite important. As seen in class, a ray caster sends a ray for each pixel and intersects it ...

  10. 15-462 Computer Graphics I / Assignment 1

    15-462 Computer Graphics I Assignment 1 - Height Fields 100 points Overview . Height fields are commonplace in computer graphics, from scientific visualization to terrain in video games. In this assignment, you will implement a program that loads in heightfield data from an image supplied on the command line and allows the user to view it ...

  11. CS 4554- Computer Graphics I: Assignment 1 : 2D Transform

    The default display range in the project is from ( -1, -1 ) to ( 1, 1 ), so if you want to display your models correctly, you may need to scale them. Update modelView Matrix in OpenGL : check glMatrixMode, glLoadIdentity, glTranslatef, glRotatef, etc. for more information;

  12. Interactive Computer Graphics

    Interactive Computer Graphics - Assignment 1 Getting Started. Programs for this class will be tested and evaluated on either tux or MacOS. Topics: ... Submit a zip file that contains a folder with your initials and assignment number, for example ak876_a1. All your files (source files, Makefile and a README) should be inside this folder. ...

  13. 6.837 Computer Graphics Assignment1: Curves and Surfaces

    Here are instructions. 1. Unzip submission on Stellar and extract all files to designated directory. 2. In terminal, cd to directory containing "one" folder. 3.command make. 4.command ./a1 swp/file_name.swp. 5."one" folder contains all necessary files including updated.

  14. Lecture Notes

    21. Graphics Pipeline and Rasterization (PDF - 2.4MB) 22. Graphics Pipeline and Rasterization II (PDF - 2.2MB) 23. Real-time Shadows (PDF - 2.8MB) 24. Graphics Hardware and Computer Games (Lecture notes not available) This section provides the schedule of lecture topics along with lecture notes where available.

  15. 15-462 Computer Graphics I / Assignments

    15-462 Computer Graphics I Assignments. The programming and written assignments are the heart of this course and count for 65% of your total grade. Much of what you learn in this course will be through doing these assignments. The programming assignments require heavy use of the OpenGL libraries. Like any large library, it has its ...

  16. Computer Graphics I

    Computer Graphics I 4003-570-70 / 4005-761-70 (Fall 2008) Assignment #1: 2D Drawing in OpenGL. Date posted: September 10, 2008 ... Look for the folder named "Assignment 1" in the dropbox area. Assessment Your overall programming assignment grade will be based on the following: demonstration of the use of the required routines, the complexity ...

  17. CS4406

    Computer Graphics Discussion Assignment Unit 6. 2 pages. 2022/2023. 100% (1) 2022/2023 100% (1) Save. CS4406 Learning Journal Unit 5. 3 pages. 2023/2024 ... Before completing this assignment, review the reading material listed below: Computer graphics through OpenGL: From theory to experiments, 3rd edition. (Download/access book from syllabus ...

  18. GitHub

    Are you looking for NPTEL Week 1 assignment answers for 2024 for July Dec Session ! If you're enrolled in any of the NPTEL courses, this post will help you find the relevant assignment answers for Week 1. Ensure to submit your assignments by August 8, 2024.

  19. Parth1906/SPPU-2019-Pattern-SE-COMP-Computer-Graphics-Practicals

    SPPU-2019-Pattern-SE-COMP-Computer-Graphics-Practicals. Write a C++ program for drawing graphics primitives and color it. Write a C++ program to divide screen into four region and draw circle,rectangle,arc and ellipse. Write a C++ program for drawing a simple object. Write a c++ program for drawing a line using DDA and Bresahnams Line Drawing ...

  20. Introduction to Computer Graphics

    Step-1: Understaind the basics. Learn the fundamental and basics of computer graphics such as rendering, shading, animation, and modeling. Learn basic concepts of mathematics like linear algebra, geometry, and calculus as well as basic principles of physics that support computer graphics. Step-2: Choose Your Area of Interest.