On Friday 21 July 2006 11:19, Jason Green wrote:
- /* Calculate reflection vector (Assume normal is normalized): RF =
2*(N.E)*N -E */
- shader_addline(buffer, "tmp0.w = dot(vec3(tmp0), %s);\n", src1_str);
- shader_addline(buffer, "tmp0 = tmp0.w * tmp0;\n");
- shader_addline(buffer, "tmp0 = (2.0 * tmp0) - %s;\n", src1_str);
I'm hardly an expert, but couldn't this be simplified to:
shader_addline(buffer, "tmp0 = reflect(-%s, vec3(tmp0));\n", src1_str);
On 7/21/06, Chris chris.kcat@gmail.com wrote:
On Friday 21 July 2006 11:19, Jason Green wrote:
- /* Calculate reflection vector (Assume normal is normalized): RF =
2*(N.E)*N -E */
- shader_addline(buffer, "tmp0.w = dot(vec3(tmp0), %s);\n", src1_str);
- shader_addline(buffer, "tmp0 = tmp0.w * tmp0;\n");
- shader_addline(buffer, "tmp0 = (2.0 * tmp0) - %s;\n", src1_str);
I'm hardly an expert, but couldn't this be simplified to:
shader_addline(buffer, "tmp0 = reflect(-%s, vec3(tmp0));\n", src1_str);
Yeah, looks correct from the GLSL spec. I basically just copied the formula from the arb_shader routine and it seemed to display everything the same in both modes. It's probably worth simplifying, though. Either way should work.