Category Archives: C++

Textures Added

Screenshot from 2013-07-26 04:33:50

So that was fun. Adding sphere surface coordinates to texture space converter. Used this “trivial” technique UV mapping.

Screenshot from 2013-07-26 04:34:39

Apart from that, I moved the code around and cleaned it slightly. that resulted in few additional frames per second. Each Sphere is semi-transparent with the same texture.

now what, normal mapping ?

[edit: 29 Jul 2013]

Apparently ther was a bug in my texturing. It is gone now :)

Screenshot from 2013-07-29 23:57:22

Screenshot from 2013-07-29 23:57:37

Screenshot from 2013-07-30 00:02:08

and night version,

Screenshot from 2013-07-30 00:02:59

Screenshot from 2013-07-30 00:03:25

There is a code that I used.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//intersection point, sphere
//algorithm from http://en.wikipedia.org/wiki/UV_mapping
float3 getTexelID(float3 point, sphere * ss)
{

float3 pole = (float3)(0.0f,1.0f,0.0f);
float3 equator = (float3)(1.0f,0.0f,0.0f);
float U=0.0f;
float V=0.0f;
float phi = 0.0f;
float theta = 0.0f;
float3 normal = point - ss->pos.xyz;

normal = normalize(normal);
phi = acos( -dot(normal, pole));
V=phi/3.141592653589793 ;

theta = acos( dot(normal, equator)/ sin( phi )) / ( 2 * 3.141592653589793 );
if ( dot((cross(pole, equator)), normal) > 0 )
U = theta;
else
U = 1 - theta;

float3 x = (float3)((float)V, (float)U, 0.0f);
return x;
}

3rd Bounce

Screenshot from 2013-07-16 22:58:57

finally I got some spare time to improve this baby.
It is a bit of improvement since the last time – 3rd bounce of rays were hacked into. Now the reflection looks far more realistic.

Screenshot from 2013-07-16 23:03:58

And here reflection of the reflection.. some artefacts here and there – but I can live with them for now.

oh and I need to fix timer for the frame – that is definietly not 0.31ms per frame – it takes about a second per frame. Still not that bad for the vanila implementation.

[Edit: late night]

Screenshot from 2013-07-17 01:38:58

Managed to add semi-transparent spheres! Rendering of the frame became extremely slow – had to reduce number of spheres on the scene.

Is it the right time to introduce optimisations?

How about spheres as voxels?

Screenshot from 2013-07-07 22:06:12
I did a litte bit of research and it kept me wondering.. how about using spheres for voxels representation this time?
Lets try it out and see how much the GPU can take.

Grid of 10^3 Spheres – there is no acceleration architecture implemented yet – Octree for spheres? that feels odd..

Oh, btw. That’s raytraced.. so far quite interactive.

It uses OpenCL on Radeon 5700 HD – only primary rays so far on ambient material. Give it some time.

[Edit: 08-Jul-2013]

Screenshot from 2013-07-08 21:15:59

Simple directional light lighting system implemented.

Screenshot from 2013-07-08 23:05:21

Secondary bounces in place (depth of bounces set to two) – little bit of hackery had to be done since there is problem with recursion in OpenCL.

Screenshot from 2013-07-08 23:09:12

Every third sphere is ambient.

L

Power of well balanced octree

300 FPS when moves - Insane!

Small memory leak was driving me crazy; Debugging process was taking ages.. bored, frustrated and tired decided to play about with octrees depth and minimal/maximal number of elements in leaf.. Amazed by 300FPS discovered the stupid mistake of creating VBO each time the leaf is regenerated. Instant win; fix of memory leak and 10 times greater performance.

Who said that the mistakes are stupid?