Materials when rendering geometry

DeadMG
  • Materials when rendering geometry DeadMG

    When specifying the material (ambient/diffuse/specular) for use in lighting calculations, what level of detail is the material specified at? Per vertex, mesh, bone?

  • Generally, in a stateful graphics API, a material's settings will apply to anything rendered after the material state is set to the API. Whether or not the effect of that material will be per-vertex or per-pixel depends on the actual vertex and fragment shading programs that execute for the rendering of each individual primitive.

    If you're using the materials built in to fixed function D3D9 pipeline, then the resulting object color is vertex-oriented, but the material's impact will be apparent for every object you render until you change the material.

    Writing your own material system can allow you to embed material data into the vertex attributes, if you so choose (either directly into the vertex stream or indirectly via texture lookups) and thus have finer control over the material properties of an object without having to render that object in multiple draw batches just to swap out material data.

    Materials rarely apply to bones in any significant fashion (although that might make for an interested system to write: assigning materials to bones, blending material effects using the vertex weights).

Tags
c++ directx rendering lighting
Related questions and answers
  • on exporting animation information, especially when the mesh changes its geometry? I would be thankful for advices that could point me into right direction. It would be nice to save some time instead of wasting it on incorrect approaches. I use Softimage as my 3D authoring tool. Target platform is OpenGL ES 2.0 running on mobile devices (iOS, Android). Programming language: C++. ...After careful consideration to use middleware, I have decided on creating my own 3d file format format to export meshes from 3D authoring application (Softimage) into my game. I will need to export

  • that make really hard to work with when coding some functions that use them. I was thinking of making ie. SimpleMesh and HierarchyMesh objects, which will also require that the renderer can deal... animation I would end up storing a lot of data that I don't really need, even if I'm indexing node and frame data when saving and then store the hierarchy with the indices to the actual data. I don't... for my needs. Ah and I forgot to mention that nodes can have hierarchy, but this is not a problem if the frame data is reduced. The structure instances don't get duplicated unless any value changes. When

  • class (I know, the name is terrible), which is more or less using a composite pattern, and a Material class. Material have different important properties (noise, color...). For the time being... : Using a pointer. Simple and brutal. Using an integer material-id, then get the materials out of a table when engine manipulates the object for various purposes (display, attack analysis, etc.). Not very beautiful, I think, and not very flexible. Using an integer material-id, then get the materials out of a std::map. A bit more flexible, but still not perfect. Do you see other possibilities

  • As most of game programming is done - I read on this very site - in C/C++ I was wondering if there is any learning/studying material for C/C++ that would target specifically game programming. I am not looking for material about "developing games" or "software architecture for games", but rather for material that uses "game programming" as the CONTEXT for introducing and illustrating C/C... experience in OO scripting languages and only some experience in C and Assembler (on AVR microcontrollers), so I am thinking to mid-to-advanced level material, rather than tutorials for beginners

  • be specific as to what you benefited from them, and their strengths and weaknesses. Though I am most interested in reinforcing computer science fundamentals with respect to game development, I would also like to know if the material is relevant to today's technologies. I'm especially interested in responses from working professionals who have taken their courses or reviewed their materials. Background: My work week is spent mostly with SQL Server ETL and some C# web forms development. I have ideas for 2D and 3D platformers, but I don't have the skills to build them to completion yet. TIA!

  • Im writing a game for which, one of the models are loaded from an .obj file. It's a model of a plane, and I want to rotate the propeller. The object file is broken into groups, and the propeller is identified, so that's all good. I'm writing the game in C++ with OpenGl/GLFW The drawing function is: int win_width; int win_height; glfwGetWindowSize(&win_width, &win_height); float win...); glLoadIdentity(); gluLookAt(0, 0, 30.0, 0, 0, 0, 0.0, 1.0, 0.0); glEnable(GL_DEPTH); glEnable(GL_DEPTH_TEST); glEnable(GL_COLOR_MATERIAL); glEnable(GL_NORMALIZE); glEnable(GL_LIGHTING); glEnable

  • I'm making a game with Box2D with a top left coordinate system. I multiply positions by an M_TO_PX_RATIO of 10.0f to convert from meters to pixels. I noticed that when I set gravity to 9.8, the simulation is rather slow. When I set gravity to 9.8 * M_TO_PX_RATIO, the simulation runs at the correct speed, like normal gravity. However, the high gravity causes jittering. Am I doing it properly? When using a top left, pixel coordinate system, must I do anything else to account for meters to pixels? Thanks

  • caps. Sweet. Still, I have some worries regarding possible Field of View and Line of Sight issues. C) The total overhaul variant. Or, I could just create borders and corners as separate containers...After spending time today to jot down some notes regarding the implementation of walls into my tile-based game, I've suddenly realized it's not going to be as simple as I imagined before. While..., and whether I missed something or not. Important: a character CAN stand on a tile that has walls, regardless of their form. The common thing for all the three variants: the tilemap will be "kept

  • For OpenGL, the OpenGL SuperBible 5th edition was just released only a few months ago, and is considered a fantastic, highly rated book for not only learning OpenGL 3 (Part 1 of the book), but it also goes into advanced OpenGL topics in Parts 2 and 3. For DirectX, what is the current material we should be reading to learn? Books & websites with tutorials welcome. Are there any modern books available that go through the CURRENT version of DirectX that are intended for a beginning audience with a decent grasp of C++, but with no experience for DirectX at all? This one seems to be highly

Data information