use alpha map for moons

actorid
scrawl 13 years ago
parent 268987835d
commit bc7876e980

@ -20,6 +20,7 @@
SH_BEGIN_PROGRAM
shSampler2D(diffuseMap)
shSampler2D(alphaMap)
shInput(float2, UV)
#if MRT
shDeclareMrtOutput(1)
@ -36,17 +37,15 @@
shOutputColour(0) = float4(materialEmissive.xyz, 1) * tex;
// use a circle for the alpha (compute UV distance to center)
// looks a bit bad because it's not filtered on the edges,
// but cheaper than a seperate alpha texture.
float sqrUVdist = pow(UV.x-0.5,2) + pow(UV.y-0.5, 2);
shOutputColour(0).a = materialDiffuse.a * (sqrUVdist >= 0.24 ? 0 : 1);
shOutputColour(0).a = shSample(alphaMap, UV).a * materialDiffuse.a;
shOutputColour(0).rgb += (1-tex.a) * shOutputColour(0).a * atmosphereColour.rgb; //fill dark side of moon with atmosphereColour
shOutputColour(0).rgb += (1-materialDiffuse.a) * atmosphereColour.rgb; //fade bump
#if MRT
shOutputColour(1) = float4(1,1,1,1);
#endif
}
#endif

@ -15,6 +15,11 @@ material openmw_moon
{
texture_alias $texture
}
texture_unit alphaMap
{
direct_texture textures\tx_secunda_full.dds
}
}
}

Loading…
Cancel
Save