Thursday, December 12, 2024

A graphics programming mini project idea

Make a tool to make 3D meshes from revolutions of 2d curves or splines.

It is nice to have a model viewer and model exporter accompanied with the tool.

Reference:

https://en.wikipedia.org/wiki/Solid_of_revolution

https://docs.blender.org/manual/en/latest/modeling/meshes/tools/spin.html


Thursday, December 14, 2023

Computer Graphics Techniques

 I searched for a list of computer graphics techniques on the internet and couldn't find such a list. So I prepared one. Here is a list of techniques that I think are important. It's a high-level description. For example, you won't find something like "screen space ambient occlusion" in this list. 

Graphics Techniques (2D)

Drawing 2D Primitives

    Pixel and Point

    Line

    Rectangle

    Polygon

    Circle

    Ellipse

    Curve

    Text

    Image

    Fractal

Transformations

Viewing

Clipping 2D primitives

Alpha

Transparency

Compositing

Filling

Stroking

Antialiasing

Gamma Correction

Transitions

Tiling

Sprites

Layering

Scrolling

Particle Effects

Collision detection


Graphics Techniques (3D )

(For Real Time Rendering)

Rasterization vs Raytracing

3D Graphics Pipeline and different coordinate spaces

3D geometric primitives

3D representations

Modeling Transformations (Scaling, Rotation, Translation),

Viewing, Projection and Cameras

Viewports

Clipping

Making use of GPU resources and synchronizing CPU-GPU communications

Shaders: Vertex, Pixel, Tessellation, Geometry and Compute

Texturing

Lighting, Colors, Materials and Shading

Shadows

Reflection

Transparency and Translucency

Antialiasing

Gamma Correction

Curves, Curved Surfaces and Tessellation

Depth Testing

Blending

Stenciling

Scissoring

Collision detection

Picking

Particle Effects

Special Effects

Animations

Spatial Data Structures and Rendering optimizations

Realtime Raytracing




Sunday, July 23, 2017

A game testing idea


Testing games takes a lot of effort. We need tools to make that easier.

The android sdk has a command line tool called adb for communicating with the devices. In Unreal tournament there was a console window for giving cheat codes.

From these premises I got an idea of LAN based testing for games. The result was that I could make 
DebugConnectionManager (DCM).

Here you can find the source code for DCM Server and Client: GitHub Repository

For games, it is useful for cheat code based game testing.
Provided we know the I.P. address of the machine in which the
game is running, we can send commands to control the behavior
of the game from an another machine.

The trick here is a normal TCP/IP socket connection based protocol and
a delegate mapping mechanism inside the game for mapping
a command string with arguments to a member function of the game object.

A mapping request like
DebugConnectionManager.addRule("health",updateHealth) will
map a command "health" with a function updateHealth.

When the game receives the commands with arguments, the mapped
functions are called with the arguments. This behavior will change the
game properties.

e.g.
"infinite-health",
"all-weapons"
"switch-to-level 12"
"pause enemies"


Information for those who interested in using it

Read the README.md that comes with the source code to build the server in Unity3d.

You can build windows/linux/mac command line clients from client.c or download, install and use the android client

Disable firewall in the client and server machines. Note down the ipv4 address of the server machine for connecting.

Connect to port: 64000. Both server and client should be in the same network.

I have tested it in WiFi network with server running in Windows 11 and client in Android.

I had to turn off McAfee Live Safe and allow all ports inbound and outbound access in Windows Defender.

I recommend what is my ip address tool (playstore link) for getting the ip address of the android phone or tablet.


Game Development Foundations Book TOC

The table of contents for my dream book project Game Development Foundations is updated.
Although, this book can't be made with out  a team work and high budget, the TOC will be useful like a road map for budding game developers.

Tuesday, January 13, 2015

Game development: a hot career

(First published in a college monthly TechVeda on April 10,2006)
 
    Game development is a much sought out career today. Most of the people who like to play games also like to make them. For anyone who choose game development as a career having a passion for games is absolute crucial. If you want to succeed in games it must be the games that you want to make. Let us see what are the basics needed to become a game programmer.
 First things first
You must have skills in mathematics and programming. The three main programming languages used for programming PC and console games are C, C++ and Java. It will be helpful to know the working of PC or console from chip level to application level.
There are some subjects in a computer science course which have relevance to game programming. They are Programming Languages, Data Structures and algorithms, Operating Systems, Compilers, Computer Graphics, Computer organization and architecture. Artificial Intelligence, Computer Networks and Databases. A good knowledge of these subjects will give you a huge advantage.
    To do any kind of game whether in 2D or 3D you should learn graphics APIs and/or game engines.
The graphics APIs implement basic computer graphics concepts and algorithms and give interfaces to graphics hardware. Two graphics APIs which give power to major games available today are OpenGL and DirectX. Game engine is a core software component that implements the non-game specific technology. Most commonly a game engine provides rendering facility for 2D/3D. Game engines also come with game design tools like level editor etc. 2D game engines are easier to make and almost every game company owns their own 2D game engine.3D engines are not that easy to make and it takes almost two year to make a commercial quality 3D engine.Two popular commercial 3D game engines are Quake and Unreal.
Start with 2D    By doing different types of 2D games you will master coding, game play logic, implementing physics and ai, capturing input, bringing music and sound in game etc. That will definitely help you when you do 3D games. I would recommend to any budding game programmer to do clones of the following games before entering the world of 3D game programming or starting commercial development of 2D games.
1) Tetris
2) Breakout
3) Pac-Man
4) Super Mario
5) Galaga
6) Pong
7) Tank
8) Snake
9) Othello
10) CarRace
Diving into 3D
    Learning OpenGL is a good place to start. Study the different graphics concepts and try to implement them using the API.
After learning almost all the core features of the API make demos that shows off 3D Math skills (Projected geometry/textures, environment mapping, complex shadows, complex camera tracking etc.) and Special effects(smoke, fog, water etc.)
Approaching a company
    The first thing by which game companies filter candidates out is through probing CVs. Your CV must reflect your passion for games and programming. Sending a portfolio of your works with the CV is a good idea. The recruiters normally test technical, analytical and logical skills.

Tuesday, July 05, 2011

Hello GPU












[Fig: Rubik's Cube shader in action]

The following is a simple method to paint cube faces with different colours according to the directions of the object space vertex normals.
Latest code is here.

It could be a 'hello world' program for shader programming.

Thursday, June 23, 2011

Meshes

 3D Models are made up of vertices that can form drawing primitives.
Thus conceptually a mesh can be defined by a set of vertices and a set of indices.
Vertices have information for position, color, texturing, lighting etc.
And indices group those vertices into drawing primitives.

//A simple vertex will have the following data
Vertex
{
position,
normal,
texture coordinate
};

//A mesh will have the following data
VertexArray[] = {...} //What are the vertices that form the model
IndexArray[] = {...} //What is the order of the vertices that form the drawing primitive

Where
drawing primitive = {point, line, triangle, ... }

Now we can.

Stream the mesh data between graphics card memory and system memory.
Define local axes,angles, axial and object bounding volumes.
Connect the mesh with a scene graph system.
Connect the mesh with a physics system.
Apply transforms on meshes to make simple animations;
Register a bone hierarchy suitable to the mesh with transforms and weights.
Chain a list of morph targets.
Chain a list of meshes with decreasing level of detail.
Add a list of vertex/fragment shaders.
Change the state of rendering/animation with game/graphics events.

and so on.

All of this start from how to render the vertices with less space and in minimum time.

Ref:
OpenGL : begin .. end paradigm, vertex arrays, VBO

For commercial file formats refer
3D File formats: Obj, 3DS, PVR, X, COLLADA, FBX

Sunday, May 24, 2009

Animation

Definition
Animation is realistically affecting any visual change in a scene with respect to time. The variables may include position, size, orientation, color, transparency or surface texture of the graphics object. "It is all about timing and positioning"
Frame Animation
Normally 30 to 60 frames of a 3D scene is to be rendered per second for a convincing animation. Although game engines usually expose a setFrameRate() interface for controlling frame rate, the efffective framerate depends on the scene complexity.
Character Animation
It deals with creating the moving pictures of the actors in the scene. In game development, it is done using two techniques: - Morph animation and Skelton animation.
In skeletal animation, a character is represented in two parts: a surface representation (skin) used to draw the character and a hierarchical set of bones used for animation only. By using skeletal animation one can control of every joint, bone, and muscle of the character's body to alter the shape of its skin.
Morphing is the transformation of one shape to another using some kind of interpolation. It is the kind of animation used for modeling character's expressions and lip synchronization.
Every type of animation requires key frames. Pre calculated key frames add the realism of character animation. 3D artists work with models using packages such as Maya or use motion capture for this purpose. Simulation of rigid body is not enough for certain situations. Descriptions of object behavior under the influence of force are generally referred to as physics based modeling. Some examples for these objects are cloths, ropes, soft bodies etc.

Reflection

Planar reflection follows the law of reflection and works reasonably fast.
Ray tracing is the solution for high quality reflection mapping but it may not work at real time. Environment mapping is a fast technique that simulates highly reflective surfaces.

Transparency

A transparent surfaces in general produce both reflected and refracted light.
It is assumed that for simple transmittance, the incoming light comes from directly beyond the transmitter. This is a reasonable assumption when the front and back surfaces of the transmitter are parallel and the thickness is not great, e.g., for a pane of glass. A transparent surface can be treated as a blend color. When blending, the transmitter's color is mixed with the incoming color from the objects seen through the transmitter. For other transparent media, the refractive index by Snell's law plays a role.