0
\$\begingroup\$

I'm currently reading this book and are at the chapter about the rendering subsystem of a game engine.

Now, the book suggests that a material is a structure that provides information on how to shade a mesh. So the material contains visual properties and also what information to send to the shader prior to rendering.

My question is: What is a good tructure/syntax of such a material model?

My current ideas are that the material holds info such as specularity, diffuse colors, textures and so on. The (to me) tricky part comes when a shader needs multiple render passes.

A simple material could be something a long the lines of:

Transform info:
ModelMatrix : get_from_model   
ViewMAtrix: get_from_camera
ProjectionMatrix: get_from_camera

Textures:
diffuse: get_from_file
normalmap: get_from_file
glossmap: get_from_file

Lighting:
direction: get_from_somewhere
.
.
.

But for instance, if I want to render the reflection of a mirror, need a good way to tell the engine that I want to render the scene with the camera flipped in the mirror plane, and perhaps with a lower LOD. Is there a well know good way to encode this in the interface between user-data and the shader program?

Also, in general, are there well proven methods for mapping in-game data to shaders without too much manual instruction on where to find the data?

Thanks in advance : )

\$\endgroup\$
  • \$\begingroup\$ 3D Game Engine Design by David Eberly is what I truly TRULY recommend. A lot of game design books sell false hope and dreams and I hate them for it. I looked at your one in a library once - it gave me that sense. I really recommend the first book - that truly is saying something as there are only 5 non maths books I actually vouch for. \$\endgroup\$ – Alec Teal Sep 21 '15 at 21:00
  • \$\begingroup\$ Due to lack of feedback, good faith and any response to my partial answer, I'm deleting not fixing it. Good luck! (Genuinely) \$\endgroup\$ – Alec Teal Sep 22 '15 at 9:29
  • \$\begingroup\$ Sorry for the lacking feedback. It's not that I don't appreciate it at all! Though, I was hoping for a less sourcecode-intensive response. More of an architecture angled view on what classes are responsible for setting which variables and how to streamline the process of rendering in an extendable fashion that allows these multipass renders and some degree arbitrary configuration of shader programs. \$\endgroup\$ – user1291510 Sep 22 '15 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.