Jump to content
  • Advertisement
Sign in to follow this  
leiavoia

Lighting and Materials: Per-Vertex or Per-Mesh?

This topic is 3438 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm scraping together a basic rendering system which renders 3d meshes. The mesh class contains indexed vertices and triangle data. Pretty ordinary. However, when you put together the space coords, texture coords, texture index, normal, colors, lighting info, materials, and eventual bone data, this starts to look like a LOT of info per-vertex. So i'm wondering what the "normal" setup should be a for a 3d mesh. Is lighting and material info stored per-vertex or per-mesh? I'm inclined to say per-vertex, even though that is a lot of data. I can imagine a model with multiple textures and multiple materials types. It would be much simpler if there were only one texture and material per mesh. However, another way to approach this would be to make one material and texture per mesh and just create a different mesh for each different type within a single model. Then render them all on top of each other. For example: lets say there is a model of box with a stripe around the middle. The stripe is shiney metal and the box is mat texture. You have two textures and two materials here. In theory, could you just split this into 2 different meshes and render each seperately? Then the materials and textures wouldn't have to be stored in each vertex. Please let me know what the "normal" way of doing this is. I'd really appreciate it. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Yes, in general, you would split each mesh into a number of sub meshes depending on the different materials. Each sub mesh would be a 'geometrical chunk' which contains a single material.

Also, note that for your specific box example, it can be achieved using specular map. You'd have a texture that has the stripe in the middle, and a specular map would define the stripe to be very shiny while everything else would not be shiny.

Share this post


Link to post
Share on other sites
Yeah. In our engine, we'd do this either per-mesh (multi-sub in 3ds Max), or per-texel (using specular maps, reflection-mask textures, etc...). Both of those techniques are very easy for artists to author using standard tools. Painting complicated material parameters onto vertices is much harder (and requires lots of extra work during the pipeline to maintain), so we avoid that kind of stuff.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!