I have a scene with a basic skybox and, a couple of cameras, and an environment-mapped pillar that is spinning. I can verify that my cubemap is turning out just fine as you can tell in the image where I render a small skybox with my environment map applied to it. The only problem is that environment mapping it to the pillar isn't turning out well at all.
Now, for my uniforms... I believe I'm transforming them correctly. My "u_vmMat" is my view-model matrix that I've gotten by multiplying my view and model matrices together. Then, I multiply my world-space "u_cameraPosition" by the inverse of my view-model matrix.
Do a pass and output the fragment as a_normal and eyeDir, and see what is wrong.
this should be subtracted the other way around.
[color=#1C2837][size=2][color=#000000] vec3 eyeDir [color=#666600]=[color=#000000] normalize[color=#666600]([color=#000000]a_position[color=#666600].[color=#000000]xyz [color=#666600]-[color=#000000] u_cameraPosition[color=#666600]);
[color=#1C2837][size=2]Do a pass and output the fragment as a_normal and eyeDir, and see what is wrong.
this should be subtracted the other way around.
[color=#1C2837][size=2][color=#000000]vec3 eyeDir [color=#666600]=[color=#000000] normalize[color=#666600]([color=#000000]a_position[color=#666600].[color=#000000]xyz [color=#666600]-[color=#000000] u_cameraPosition[color=#666600]);[/quote]
How do I output values from shaders? All I know is that it's a gl_FragColor trick, but haven't found any code on that.
I tried switching that line to: [color=#1C2837][size=2][color=#1C2837][size=2][color=#000000]vec3 eyeDir [color=#666600]=[color=#000000] normalize[color=#666600](u_cameraPosition - [color=#000000]a_position[color=#666600].[color=#000000]xyz[color=#666600]);[/quote]
It gave me different results, but they weren't correct. Do you think the issue could be my normals?
Can you describe the problem, other than "isn't turning out well"?
That's as descriptive as I can describe it in words, unfortunately. The cubemap looks distorted on my pillar as if it's scrunched together. To better illustrate the issue, I posted a screenshot in my original post. It's the image with the skybox in it right beneath the topic post.