Posts

Showing posts with the label raytracing

Forward, Deferred and Raytracing rendering in openFrameworks and web

Image
Currently, there are three basic approaches for rendering computer graphics scenes: forward rendering, deferred rendering, raytracing. 1. Forward rendering It's that OpenGL does, you create vertices, then make faces, and rasterize them, all passing via shaders. The rendering process is straightworward and fast, but rendering shadows, making degree-of-field effect and drawing clouds is hard here. Most of openFrameworks examples use forward rendering. 2. Deferred rendering It's the same as forward rendering, but additionally some extra data is rendered for computing shadows. The lighting pass is performed after the scene geometry is drawn. See detailed explanation here: https://learnopengl.com/Advanced-Lighting/Deferred-Shading Shadows, degree-of-field effect and some kind of reflections are possible with deferred rendering. Unreal Engine 4 and Unity currently (2019) are based on deferred rendering. openFrameworks: https://github.com/perevalovds...

Raymarching - a way to liberation of generative graphics

Image
I published this article on openFrameworks forum also. Recently I was so fascinating to work with raymarching technology in oF, that I decide to write this detailed post about it. Such technology allows to render non-rigid objects such as clouds, create dynamic and truly geneative volumes without meshes, and, additionally, very simply render in in VR or 360-degrees panoramic images. It was not so fast to collect all information, so I sure it will be useful for somebody desired to work with in in a modern oF/GLSL. We (art-duet Endless Attractions Museum ) recently released VR art project "Night sleep was taken from my eyes, V.2". In the project we are thinking, how are our memories formed? Is it possible to visualize the amnesia process? What will the storage look like in the future? Wearing the VR HMD, a viewer found himself flying in a cloudy space. Some clouds contain inside transformed panoramic photos illustrating one day in the life of...

Creating panoramic images with raymarching

If we have raymarch shader, it's easy to create a panoramic image with it. Here I will explain how to do it by modifying a GLSL fragment shader which performs raymarching (raycasting, raytracing). 1) In the vertex shader, generate normalized 2D coordinates  pos_normalized at [-1,1]x[-1,1] of the rendered pixel: //Declare variable which will be interpolated and passed into fragment shader     out vec2  pos_normalized; //position [-1,1]x[-1,1] //Inside main() shader's function:     gl_Position = modelViewProjectionMatrix * position; //... some normal code     vec2 pos_normalized = gl_Position.xy/gl_Position.w; 2) In the fragment shader, add uniform for passing center of panoram and also optional rotation of panoram horizontally in degrees; and of course pos_normalized input:     uniform vec3 head_position = vec3(0,0,0);     uniform float panoramic_render_angle...

Raytracing APIs

Raytracing is a most powerful technique for making photorealistic 3D images. It's based on literal tracing light's rays path, and requires a lot of computtional resources. See theory of raytracing in a sample chapter of the book Real-Time Rendering, Fourth Edition . Currently NVidia RTX videocards are dedicated to work with raytracing in realtime, and so realtime raytracing becomes the main tool for 3D graphics. There are two main directions for raytracing API: using NVidia RTX cards and Intel CPU. Withoud such special API, raytracing (and reymarching and raycasting) can be implemented directly, for example, in fragment shader, for example, see such shaders on Shadertoy site. NVidia RTX  NVidia RTX videocards allows to work with NVidia's OptiX or Microsoft DirectX: https://developer.nvidia.com/rtx Raytracing with NVidia OptiX raytracing engine: https://developer.nvidia.com/optix https://developer.nvidia.com/rtx/raytracing See tutorial: https:/...