So Im looking for a shader editor that supports Shader Model 4 specifically for this command "lt"
http://msdn.microsoft.com/en-us/library/windows/desktop/hh447181(v=vs.85).aspx
Unfortunately I dont have access to Visual Studio, and am not keen on using it anyway. The perfect example would be Shazzam - as the shader is a post effect. Any ideas?
Here is the code its from John Hables stuff on photography spec;
float LinearToSrgb(float val)
{
float ret;
if (val <= 0.0)
ret = 0.0f;
else if (val <= 0.0031308f)
ret = 12.92f*val;
else if (val <= 1.0f)
ret = (pow(val, 0.41666)*1.055f)-0.055f;
else
ret = 1.0f;
return ret;
}
float SrgbToLinear(float val)
{
float ret;
if (val <= 0.0f)
ret = 0;
else if (val <= 0.04045f)
ret = val / 12.92f;
else if (val <= 1.0f)
ret = pow((val + 0.055f)/1.055f,2.4f);
else
ret = 1.0f;
return ret;
}
int g_bSpecOrDiff;
float4 ps_main( float2 texCoord : TEXCOORD0 ) : COLOR
{
float3 srcA = tex2D(Texture0, texCoord ).rgb;
float3 srcB = tex2D(Texture1, texCoord ).rgb;
float3 linA = SrgbToLinear(srcA);
float3 linB = SrgbToLinear(srcB);
float3 linDiff = linA*2;
float3 linSpec = linB-linA;
float3 texDiff = LinearToSrgb(linDiff);
float3 texSpec = LinearToSrgb(linSpec);
float3 ret = g_bSpecOrDiff ? texDiff : texSpec;
return ret;
}
Any ideas? Ive tried ShaderFX, Maya '14 and LT, Shazzam, and some random web based or indie editors
Replies
so essentially: if (val <= 0.0) {} should work
but you should be able to append a 1.0 for alpha. Something like
return float4(ret.xyz,1.0);