Entries for tag "rendering", ordered from most recent. Entry count: 187.
# Fractals, IFS and a Fern
Sat
14
Nov 2009
Today I've started playing with fractals. Doing such experiments is now easy as I have in my home framework a whole bunch of useful functions like exposing structure fields into a property window or executing computational/IO tasks on the separate thread in the background. My first effect is Barnsley's fern, coded according to the algorithm from Wikipedia.
Comments | #rendering #fractals Share
# Texture Shader for Generating Textures
Thu
22
Oct 2009
There was a discussion recently on our forum (in the topic [HLSL] Przekazywanie struktury ?!?) about shader performance and execution time of texture fetches versus arithmetic operations. When we need a sophisticated function that involves many costly computations in a shader, sometimes it is better to prepare a special texture to be sampled as a lookup table for values of this function. But how to generate such texture?
Of course you can write a simple console program, create Direct3D device of type D3DDEVTYPE_NULLREF, create a texture in the D3DPOOL_SCRATCH pool, fill its pixels and finally save it to a file. But there is another solution called Texture Shaders. It's not a new shader type introduced in DirectX 10/11/... It actually exists for quite a long time and is available in D3DX for generating textures with a shader. Such shader is always executed on CPU. If you are interested, look at functions D3DXCreateTextureShader, D3DXFillTextureTX and the ID3DXTextureShader interface.
Another good news is that you can utilize Texture Shaders without coding any program in C++. All you need is AMD RenderMonkey shader IDE. To generate a texture procedurally:
Here is my example:
Interesting curiosity: there is a intrinsic function in HLSL available only in Texture Shaders - noise, which generates Perlin noise.
Comments | #directx #rendering #tools Share
# About Graphics in Modern Games
Tue
15
Sep 2009
There are always some "trendy" styles that differentiate professional creations from amateur ones. CollegeHumor made a parody of professional-looking trailer for fictional movie Minesweeper [en] and LIMO cabaret did the same with movie Leszek Balcerowicz - Nieznana historia [pl].
What about games? Today people I'm following on Tweeter posted interesting links about graphics in modern games. First, this comic says much. Dark, brown and gray colors are common in today's games, especially in some genres like action games (opposite to colourful fantasy RPG and arcade games, like Trine). Here is also a funny picture. Second, Kayamon posted on his blog quite serious note about how render target size can be reduced by using only two channels to describe pixel colors. His experiment gave quite good results with screenshots from Gears of War :)
Comments | #video #humor #rendering #web Share
# Coding Texture Preview
Sun
13
Sep 2009
Today is the 256's day of the year, so it's the Programmers' Day. Thus I wish all the best, especially a good code and no bugs to all of you who code for fun or/and profit (hopefully "and" :)
I've recently started new home project called "BlueWay". There's noting special about it - just another time I start everyting from scratch :) But this time I have deferred shading, cascaded shadow mapping, new scene management (based on k-d tree), new component-based object system and asynchronous resource manager (resources are loaded in the background on separate thread). I'm not sure whether I can call D3DXCompileShaderFromFile from separate thread without D3DCREATE_MULTITHREADED, but it seems to work OK :)
What I want to show today is a code for previewing textures. When coding some complex effects, it's often handy to look at intermediate results in render-target textures. Of course we have famous PIX and NVIDIA PerfHUD, but I believe that such custom code for real-time in-game texture preview is useful anyway. I wanted to make it general and flexible and here is the way I do it.
Comments | #rendering #directx Share
# Calculating Linear and Quadratic Equation Coefficients
Sun
30
Aug 2009
Some time ago I've written about formulas to calculate coefficients of linear and quadratic equation [pl] when having 2 or 3 given points (x,y). Yesterday I suddenly noticed that my code needs to do it every frame so I need functions to calculate these coefficients. Below you can find the code of my functions. They are templates, so they work with many types including float, double, as well as vectors of any dimmension and other types which have addition, subtraction and assignment operators, as well as multiplication and divistion by float scalar.

Comments | #rendering #math #algorithms Share
# Reflect and Refract Functions
Mon
24
Aug 2009
Every game developer must have some knowledge about maths and especially geometry. Math library for game developers always contains structures like vector, matrix and functions like vector normalization or matrix inversion. But high level shader languages, designed to do geometrical computations, have many more interesting intrinsic functions. Some of more complex ones are reflect and refract, which calculate vector reflection and refraction in relation to the normal of a surface. How to implement them in C++?

Reflection works according the simple rule that "angle of incidence equals angle of reflection". Although there are no angles in the formula - all the necessary work is done by dot product.
void Reflect(VEC3 &out, const VEC3 &incidentVec, const VEC3 &normal)
{
out = incidentVec - 2.f * Dot(incidentVec, normal) * normal;
}
For reflect function, the formula is given in th HLSL documentation, but for refract function it is not. It took me some time to find the implementation, but finally I've found it in the GLSL Specification (thanks KriS!). So here is the code converted to C++. Eta is the refraction index (e.g. 1.5f).
inline void Refract(
VEC3 &out, const VEC3 &incidentVec, const VEC3 &normal, float eta)
{
float N_dot_I = Dot(normal, incidentVec);
float k = 1.f - eta * eta * (1.f - N_dot_I * N_dot_I);
if (k < 0.f)
out = VEC3(0.f, 0.f, 0.f);
else
out = eta * incidentVec - (eta * N_dot_I + sqrtf(k)) * normal;
}
These functions are part of my library: CommonLib.
Comments | #rendering #math Share
# About the Guy Who Made Love
Sat
22
Aug 2009
Today I want to talk a bit about what's the dream of almost every passionate game developer. It seems very hard or almost impossible to achieve, but younger amateurs still hope that they will manage to do it someday. Of course I'm talking about making a 3D MMO game.
As it turned out for me today (thanks for the link KriS!), it actually IS possible. I'm talking about the game called Love written entirely by one person - Eskil Steenberg. He have coded all the software from modeling tools through network protocol and renderer until game mechanics. To see it working I recommend watching these videos. The game is powered by his engine called Quel Solaar, which is actually available for download.
I must admit I haven't been impressed so much for a long time. I suppose the amount of time and passion that had to be put into this code is enormous. Graphical style and gameplay, as well as the user interface of his tools are very unusual and surprising. And all of this is made by one guy...
I recommend watching his lecture from this year's Assembly party titled Developing the technology behind "Love". You can see many technical details and if you don't want to watch the entire one hour video, at least watch the beginning (where he talks about his "smarter way of doing things") and the ending (where he expresses his thoughts about the value of good tools).
BTW it's also nice to watch new videos from GC 2009 of the CryEngine 3. "What you see is what you play" and instant asset update (including textures) - that's how good game editor should look like :)
Comments | #software engineering #networking #web #rendering #games #events #engine #demoscene #philosophy #tools Share
# Source Code and Ray Tracer
Wed
19
Aug 2009
As some of you are interested in seeing source code of my 2D Software Renderer, I'll fullfill this request, although I don't think there is anything special about this code. Here is the file: SoftRender01.zip and here is a brief description of this project:
BTW, I've started coding a raytracer. Of course the first primitive I support is a sphere and first effects I've coded are shadows and reflections. Ray tracing is not magic. It's just like "foreach pixel, foreach object, render", while rasterization is the opposite: "foreach object, foreach pixel, render". But It's quite fascinating that raytracer suppors directly some of effects that require special preprocessing in standard rasterization (like preparing shadow map and enviromental map in case of my effects).