PDA

Prikaži potpunu verziju : TERMINI


Nemesis
18.10.2006, 12:19
S obzirom na sve češću pojavu novih poruka u kojima ljudi preko noći prave "engine", pišu "shader"-e sl. ne bi bilo loše da se osvrnemo na neke osnovne termine i njihovo značenje.

GAME ENGINE:
A game engine is the core software component of a computer or video game or other interactive application with real-time graphics. It provides the underlying technologies, simplifies development, and often enables the game to run on multiple platforms such as game consoles and desktop operating systems such as Linux, Mac OS X and Microsoft Windows. The core functionality typically provided by a game engine includes a rendering engine (“renderer”) for 2D or 3D graphics, a physics engine or collision detection, sound, scripting, animation, artificial intelligence, networking, and a scene graph.

Most often, 3D engines or the rendering systems in game engines are built upon a graphics API such as Direct3D or OpenGL which provides a software abstraction of the GPU or video card. Low-level libraries such as DirectX, SDL, and OpenAL are also commonly used in games as they provide hardware-independent access to other computer hardware such as input devices (mouse, keyboard, and joystick), network cards, and sound cards. Before hardware-accelerated 3D graphics, software renderers had been used.

Ono što se u navedenom citatu ne vidi je bitna karakterisitka da game engine preuzima menadžersku ulogu između programera sa jedne strane i hardvera sa drgue. Na primeru komponente koja se bavi grafikom to ne znači da je zadužena samo za iscrtavanje oblika na ekranu, već i za njihovo efikasno manipulisanje. To podrazumeva upravljanje memorijom, sortiranje po raznim kriterijumima kako bi se prilagodili specifičnosti GPUa i omogućili brži rendering i sl. Trivijalan primer je da programer zadaje 3D engine-u poligone za rendering, a da ih on prvo smešta u buffer (u zavisnosti od memorije) i potom sortira prema transformacionim matricama ili teksturama kako bi smanjio broj potrebnog resetovanja GPU u jednom ciklusu i tek onda renderuje.


Dakle, grupa funkcija za iscrtavanje objekata na ekranu NIJE game engine. Čak teško da može da prođe i kao wrapper.

Nemesis
18.10.2006, 12:33
SHADERS:
A shader is a computer program used in 3D computer graphics to determine the final surface properties of an object or image. This often includes arbitrarily complex descriptions of light absorption, diffusion, texture mapping, reflection, refraction, shadowing, surface displacement and post-processing effects.

In the 3D computer graphics creation process, shaders are used to define materials and are attached to the different surfaces of objects. During the rendering process, the rendering program will run the various surface shaders as it attempts to draw the various surfaces, passing to the shader programs all of the needed parameters, such as the specific 3D location of the part of the surface being drawn, the location, directions, and colors of all the lights, any texture or bump maps needed by the shader, and environment or shadow maps. The shader program will return as its output the final color of a given pixel in a scene.

In realtime applications where rendering speed is of utmost importance, such as video games, the shading portion of the rendering pipeline runs on specialized hardware on modern video cards. By design, hardware shaders are ideal candidates for parallel execution by multiple graphic processors, which are usually located on a video card, allowing for scalable multiprocessing and lessening the burden on the CPU for rendering scenes

Because of the goals shaders are designed to address, they are usually written using a shading language, a specifically designed programming language built around the intrinsic strengths and weaknesses of the different computational model. Although limited in some ways when compared to traditional approaches, the parallel architecture exposed by shaders has been used to combine highly scalable processing power with the flexibility of programmable devices, which is a boon in addressing the growing demands for graphics quality.

The increasing performance and programmability of shader-based architectures attracted researchers trying to exploit the new parallel model for General Purpose computation on GPUs. This demonstrated that shaders could be used to process a large variety of information, and not just rendering-specific tasks. This new programming model, which resembles stream processing, allows high computational rates at extremely low cost that will operate on wide installed base (e.g. the common home PC).



Znači, shader nije fancy efekat ugrađen u GPU koji se pozove i eto instant transformacije na ekranu. Oni služe da se GPU programira kako treba da izvršava te transformacije. Za efikasno pisanje shadera pored znanja jednog od jezika (npr. HLSL) potrebno je dobro poznavati kako funkcionišu transformacije ("izabrana poglavlja" iz matematike se podrazumevaju) kao i način funckionisanja samog GPUa. (registri, konstante i sl.)