Fake reflections from sampler2D

I have a pbr shader that samples from a cube map if the metalness is > 0.

Now, in my engine, the user may choose to use a regular 2D background (for 2D side scrollers and such).
If the user does so, I would like to send this 2D background as sampler2D to the shader and somehow fake at least some sort of poor reflections in order for the metalness to actually make the object look metal-ish.

Do you guys know how I could achieve that?
Thanks for any hints!!

Use the 2D texture as all six faces of a cube map. In essence, determine which component has the largest magnitude (absolute value) and divide the two smaller components by it. The result will be in the range [-1,1]. Map to the [0,1] range and use as 2D texture coordinates. Choose the orientation so that the texture is reflected at each edge to reduce visibility of the seams.

You can implement the calculation as a low-resolution two-component (GL_RG) cube map; perform the cube map lookup and use the value as texture coordinates.

Oh wow this is a good idea!! Thank you a lot. I will try to implement this right away.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.