How to get high quality graphics in openGL?

Started by
9 comments, last by Yann L 14 years, 1 month ago
Hi, I have been learning openGL for 2 months now. I have seen a lot of samples from redbook and Nehe tutorials and written some of my own. But still I don't get the game style high quality graphics. The graphic quality looks very childish. Should I use some shaders ( I have heard about GLSL)or some other library also?
Advertisement
Shaders are essential for any modern realistic graphics application. A big step using shaders is per-pixel lighting, computed in the fragment shader. Many more advanced and popular techniques, such as parallax mapping, correct HDR and bloom build upon the basic shader techniques.

GLSL is a fine choice for shaders, since it is present in the core of OpenGL as from version 3.0 and thus requires no added libraries. It is at least the easiest choice to get started.

HLSL is DirectX's GLSL counterpart. It is not usable in OpenGL.

CG works with both OpenGL and HLSL, but requires the CG library. Some would defend writing shaders using CG, since they are easily portable to DirectX. Shaders look very much alike however and porting them is easy regardless. Note that OpenGL also runs on Windows, so in a way you shouldn't need a DirectX port at all.
It's also important to understand that to achieve "realistic" graphics, it's not just down to shaders, shaders play a part but you also need high quality art such as models and texture work, good level of detail and culling methods to allow you to push your artworks polygon count, texture sizes and number of texture stages. Also things you may want to do outside of shaders to precompute certain effects (pre-computed radiosity transfer and the like) can be taken into account. Obviously all of this needs to be highly optimised to allow you to accumulate all the various layers and effects to create "realistic" looking scenes running at interactive framerates.

It is my opinion that good artwork and average tech in an engine can look a lot better than the best tech imaginable and shoddy artwork... so dont put it all down to just the shaders but yes shaders are a good step :)
Very true. Whatever an engine tries to draw will only look as good as the art it uses. :)
Thanks for the help. Now how to go about it? I don't want to design games. Most of the tutorials on web are for game programming. I want to add some graphics for image viewer applications. Where should I look?
Quote:Original post by Ignifex
GLSL is a fine choice for shaders, since it is present in the core of OpenGL as from version 3.0 and thus requires no added libraries. It is at least the easiest choice to get started.


bzzzzz wrong.
GLSL became core since GL 2.0
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Quote:Original post by Ignifex
Very true. Whatever an engine tries to draw will only look as good as the art it uses. :)

Although that's obviously true, lighting and shadowing are also tremendously important. It's surprising how much of the visual processing in our brain is dependent on correct lighting. Physically implausible lighting is the prime reason for that 'unrealistic CGI feel' a lot of rendered images show.

In fact, even a simple uni-coloured box can look photorealistic if the right lighting system (global illumination) and the right physically modeled surface representation (BRDF) is used. A good GI system can actually make up for crappy art in a way. It will still look bad, but bad in a photorealistic way :)
Quote:
CG works with both OpenGL and HLSL, but requires the CG library. Some would defend writing shaders using CG, since they are easily portable to DirectX. Shaders look very much alike however and porting them is easy regardless. Note that OpenGL also runs on Windows, so in a way you shouldn't need a DirectX port at all.

Cg also has the added feature of offline-compilation. Other languages like HLSL and GLSL require the programmer to keep the shader source around and compile it at runtime, but Cg can be compiled beforehand and the binary shader executable just loaded right in at runtime.
Perhaps this is a selling point for developers who wish to obfuscate their source in the end-product, or wish to optimize the load times as much as humanly possible.
For lighting check this paper out:

http://www.valvesoftware.com/publications/2007/NPAR07_IllustrativeRenderingInTeamFortress2.pdf

It's NPR rendering but should give you an idea as to what can be achieved through well-implemented lighting.
Quote:Original post by V-man
Quote:Original post by Ignifex
GLSL is a fine choice for shaders, since it is present in the core of OpenGL as from version 3.0 and thus requires no added libraries. It is at least the easiest choice to get started.


bzzzzz wrong.
GLSL became core since GL 2.0

Aw damnit, that's why I don't like trying to post facts. The risks involved...
Quote:Original post by Yann L
Although that's obviously true, lighting and shadowing are also tremendously important. It's surprising how much of the visual processing in our brain is dependent on correct lighting. Physically implausible lighting is the prime reason for that 'unrealistic CGI feel' a lot of rendered images show.

In fact, even a simple uni-coloured box can look photorealistic if the right lighting system (global illumination) and the right physically modeled surface representation (BRDF) is used. A good GI system can actually make up for crappy art in a way. It will still look bad, but bad in a photorealistic way :)

Often enough, graphics programmers overlook the importance of a realistic and artistically correct scene to show off their rendering techniques. I'm sure you're also familiar with the engines showing parallax mapping on a brick wall, where the texturemapping is done so poorly that the seams between the faces ruin the realism of the effect. And for most scenes, the BRDF and lighting parameters are also determined by the artist.

I agree with you though. :) But don't overlook the importance of a cleverly sculpted model or proper material settings, especially for real time applications.

This topic is closed to new replies.

Advertisement