0
\$\begingroup\$

How would I load two diffuse maps onto one mesh. I have a mesh with multiple sub meshes but each one of those sub meshes has a vertex buffer and I don't think that's very efficient. How could I have two diffuse maps on one mesh without having to go into 3d modeling software and merge the Uv coordinates of the two objects. I'm using directX and C++.

\$\endgroup\$
5
  • \$\begingroup\$ "I don't think that's very efficient" - have you actually benchmarked this? Until you have hard evidence that it's actually not very efficient, you're indulging in premature optimization. \$\endgroup\$ Sep 20, 2014 at 11:29
  • 1
    \$\begingroup\$ Why wouldn't you do this in 3D modeling software exactly? That's the normal way of solving this problem. \$\endgroup\$
    – JarkkoL
    Sep 20, 2014 at 11:59
  • \$\begingroup\$ Just wanted to know if there was another way to go about it to minimize vertex buffer switches. \$\endgroup\$ Sep 21, 2014 at 1:47
  • \$\begingroup\$ @AndrewWilson Why do you need to switch vertex buffers? Do the submeshes have different input layouts? \$\endgroup\$
    – MooseBoys
    Sep 21, 2014 at 4:27
  • \$\begingroup\$ @MooseBoys May be out of inexperience. But I thought for each distinct mesh you should have a separate vertex buffer? \$\endgroup\$ Sep 21, 2014 at 7:28

1 Answer 1

1
\$\begingroup\$

The only way I can even think of accomplishing this would be to add some sort of selector data to the vertex information that would allow a custom shader to select between the two textures to be applied. This technique can be applied with a little custom code to rewrite/combine the two vertex buffers, and of course the custom shader to take the new vertex format and the two textures to be used.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .