Fixed the billboard shader to be what I intended from the start.
This commit is contained in:
		| @@ -27,10 +27,13 @@ void SimpleBillboardedShaderProgram::compile() { | ||||
|  | ||||
|       "out vec2 o_TextCoord;\n" | ||||
|       "void main() {\n" | ||||
|         "vec3 camRight = vec3(u_View[0][0], u_View[1][0], u_View[2][0]);\n" | ||||
|         "vec3 camUp = vec3(u_View[0][1], u_View[1][1], u_View[2][1]);\n" | ||||
|         "vec3 billboardPos = u_View[3].xyz + aPos.x * camRight + aPos.y * camUp;\n" | ||||
|         "gl_Position = u_Proj * u_View * u_Model * vec4(billboardPos, 1.0);\n" | ||||
|         "vec3 billboardPos = u_Model[3].xyz;\n" | ||||
|         "vec3 viewDirection = normalize(billboardPos - u_View[3].xyz);\n" | ||||
|         "vec3 up = normalize(vec3(0, 1, 0));\n" | ||||
|         "vec3 right = normalize(cross(up, viewDirection));\n" | ||||
|         "up = normalize(cross(viewDirection, right));\n" | ||||
|         "vec3 billboardPosCam = vec3(u_View * vec4(billboardPos, 1.0));\n" | ||||
|         "gl_Position = u_Proj * vec4(billboardPosCam + (right * aPos.x + up * aPos.y), 1.0);\n" | ||||
|         "o_TextCoord = vec2(aTexCoord.x, aTexCoord.y);\n" | ||||
|       "}", | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user