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.

//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;
}