使用多个纹理将纹理分配给对象 [英] Assigning texture to an object using multiple textures
问题描述
制作对象加载器,并且所有纹理部分在不同的纹理文件中。什么是将其映射到模型上的最佳解决方案?
我需要将每个具有自己的纹理的部分作为1个模型来处理,以便最终的body有多个独立的绘图调用,每个都有一个纹理。
随着可编程渲染管线(即: 现代GPU有多个纹理单元( 你的问题不是很具体,所以这是我现在可以说的。如果您有更多具体问题,请随意提问。 I'm making a object loader, and all the texture parts are in different texture files. What is the best solution of having it mapped on the model?
Do I need to treat every part that has it's own texture as 1 model, so that the final body has many separate drawing calls with one texture each? With the advent of the programmable rendering pipeline (i.e.: shaders) you can now apply and combine multiple textures to meshes without the need for multiple draw calls. Modern GPUs have several texture units ( Your question is not very specific, so this is all I can say for now. If you have more specific questions, please fell free to ask. 这篇关于使用多个纹理将纹理分配给对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
glActiveTexture
),着色器可以一次读取多个单元。例如,您在图片中显示的右侧模型可能使用了 Phong 具有漫反射纹理的照明模型,法线贴图纹理,可能还包含高光贴图纹理的亮点。所有这些三个纹理肯定应用于一个纹理单元,整个模型在一个绘制调用中渲染。片段着色器然后读取这些纹理,并组合它们以产生最终的图像。
glActiveTexture
) and shaders can read from may units at a time. The model on the right that you showed in the picture, for example, probably uses a variation of the Phong lighting model with a diffuse texture, a normal map texture and probably a specular map texture for the highlights. All these three textures are certainly applied each to a texture unit and the whole model is rendered in one draw call. The fragment shader then reads this textures and combines them to produce the final image.