OpenGL Discussion and Help Forums - Math and Algorithms
https://www.opengl.org/discussion_boards/
Discussion about 3D math and linear algebra that is essential as a background to OpenGL codingenWed, 29 Jul 2015 04:20:49 GMTvBulletin60https://www.opengl.org/discussion_boards/images/misc/rss.pngOpenGL Discussion and Help Forums - Math and Algorithms
https://www.opengl.org/discussion_boards/
<![CDATA[Abstract Phong Material Description for OpenGL & Raytracing]]>
https://www.opengl.org/discussion_boards/showthread.php/190973-Abstract-Phong-Material-Description-for-OpenGL-Raytracing?goto=newpost
Wed, 08 Jul 2015 04:31:06 GMTHi,
I have a Phong Material Implementation for OpenGL up and running using the normal setDiffuseColor() / setAmbientColor() / setSpecularColor()...Hi,

I have a Phong Material Implementation for OpenGL up and running using the normal setDiffuseColor() / setAmbientColor() / setSpecularColor() interfaces for Phong Materials inside OpenGL.

Now, I also want to export the same Scene into a raytracer which has a completely different way of describing (Phong) Materials in general.

My question is, does anyone have a pointer to a discussion about creating an abstract material description which can be used as a base material from which the OpenGL and raytracing descriptions of the given (Phong) material can be derived ?

I could not find anything with Google. Limiting the raytracing side of things to the OpenGL description of materials is cripping. However I miss somehow the underlying theory for a common description.

Thanks,

Markus
]]>Math and Algorithmsmarkusmhttps://www.opengl.org/discussion_boards/showthread.php/190973-Abstract-Phong-Material-Description-for-OpenGL-RaytracingRestoring a vector after multiplying it by a matrix
https://www.opengl.org/discussion_boards/showthread.php/190969-Restoring-a-vector-after-multiplying-it-by-a-matrix?goto=newpost
Tue, 07 Jul 2015 18:40:22 GMTHello, normally I wouldn't post but I really can't find a clear answer anywhere on the internet. Basically I got a vector, then multiply it by a matrix and then I want to do something some action to restore it back to the way it was. It looks something like this.

glm::vec4 b = transform.GetMVP(camera) * glm::vec4(model.positions[i], 1.0);
b.x = mx * b.w;
b.y = my * b.w;
glm::vec4 c = (some magic function that does opposite what multiplying by a matrix does) * b;

//transform.GetMVP(camera) is the 4x4 matrix

Solved the problem using glm:: project/Unproject. Feeling stupid now. Sorry for the thread.
]]>Math and Algorithmsgaubtas123https://www.opengl.org/discussion_boards/showthread.php/190969-Restoring-a-vector-after-multiplying-it-by-a-matrix