To me, "cool" is not about how realistic things are, but how artistic they are. That's why I build this, for your consideration:
I spent some time doing the swirl effect on that giant sphere in the middle, which turns out to be very sweet. Like many cool effects, this one requires post processing (in this case the opaque texture). Once I got the texture and data required for the texture coordinates look-up, the rest is all in pixel shader, and this is the core part of the effect:
float2 center = float2(0.5,0.5);
float2 toUV = texcoord_screen - center;
float distanceFromCenter = length(toUV);
float2 normToUV = toUV / distanceFromCenter;
float angle = atan2(normToUV.y, normToUV.x);
angle += distanceFromCenter * distanceFromCenter * (20* sin(g_secondsElapsed/10));
float2 newUV;
sincos(angle, newUV.y, newUV.x);
newUV *= distanceFromCenter;
newUV += center;
float4 c1 = tex2D(g_textureSampler, newUV);
float4 c2 = tex2D(g_textureSampler, texcoord_screen);
float4 textureSample = lerp(c1,c2, 0.3); //this is for the partial transparency
As for other objects, it's nothing we haven't done before.
- The rook and the ground is done by using environment map.
- The knight has a normal map with a soft intersection effect.
- As for the moon that you can't see, it's using the normal diffuse lighting with a normal map.
- The background is a simple plane with lighting disabled in fragment shader.
- The UI is just ... UI, plus a vignetting effect.
Controls:
WASD - to move all the objects.
UOJKIL - to move the directional light to control the shadow.
Anyways, enough for talking, let's enjoy this image for another minute and call this an end.
Link to the code:

No comments:
Post a Comment