Commit c1f845a6 authored by MURRAY David's avatar MURRAY David
Browse files

reverse y axis for textures in phong

parent b8f48892
......@@ -40,7 +40,7 @@ float3 bumpedNormal(float3 n)
uv -= make_float2(floorf(uv.x),floorf(uv.y));
float3 BumpMapNormal
= make_float3(optix::rtTex2D<float4>(_normal_map_id, uv.x, uv.y));
= make_float3(optix::rtTex2D<float4>(_normal_map_id, uv.x, 1.f-uv.y));
BumpMapNormal = 2.0 * BumpMapNormal - make_float3(1.0, 1.0, 1.0);
float3 NewNormal;
Matrix<3, 3> TBN; // = mat3(Tangent, Bitangent, Normal);
......@@ -112,6 +112,7 @@ COLOR getDiffuseColor()
{
float2 uv = _texture_repeat * make_float2(texcoord);
uv -= make_float2(floorf(uv.x),floorf(uv.y));
uv.y = 1.f - uv.y;
# ifdef MRF_RENDERING_MODE_SPECTRAL
#ifdef MRF_RENDERING_MODE_SPECTRAL_MULTIPLEXED
COLOR diffuse = colorFromAsset(_diffuse_color, current_prd.wavelength_offset, current_prd.id_wavelength);
......@@ -151,8 +152,9 @@ COLOR getSpecularColor()
#endif
else
{
float2 uv = _texture_repeat * make_float2(texcoord);
float2 uv = _texture_repeat * make_float2(texcoord);
uv -= make_float2(floorf(uv.x),floorf(uv.y));
uv.y = 1.f - uv.y;
# ifdef MRF_RENDERING_MODE_SPECTRAL
#ifdef MRF_RENDERING_MODE_SPECTRAL_MULTIPLEXED
COLOR diffuse = colorFromAsset(_specular_color, current_prd.wavelength_offset, current_prd.id_wavelength);
......@@ -188,8 +190,9 @@ float getExponent()
return _exponent;
else
{
float2 uv = _texture_repeat * make_float2(texcoord);
float2 uv = _texture_repeat * make_float2(texcoord);
uv -= make_float2(floorf(uv.x),floorf(uv.y));
uv.y = 1.f - uv.y;
return _exponent * (1.f-optix::rtTex2D<float>(_exponent_map_id, uv.x, uv.y));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment