Sign in to follow this  
afraidofdark

multitexutring directx 11

Recommended Posts

afraidofdark    278
hello,
I've got a model which needs 3 different textures to be drawn properly. Some faces (triangles) uses texture 1 (lets say face 1,2,3) and some other faces uses texture two (lets say face 4,5,6) and finally faces 7,8,9 uses texture 3.

Can I draw this mesh in a single draw call, using texture arrays & multitexturing (like this: [url="http://www.rastertek.com/dx10tut17.html"]http://www.rastertek.../dx10tut17.html[/url]) ?

what I am planning to do is :

assign mesh to the pipeline,

assign texture 1
draw call with indexes 1,2,3

assign texture 2
draw call with indexes 4,5,6

assign texture 3
draw call with indexes 7,8,9

can I do this in one draw call ?
thank you for taking time.

Share this post


Link to post
Share on other sites
Aqua Costa    3691
If you add an attribute to each vertice containing a texture ID and bind the 3 textures to a shader you can choose which texture to sample from in the pixel shader.

If you choose to do this, output the textureID from the vertex shader to the pixel shader using the [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb509706%28v=vs.85%29.aspx"][b]nointerpolation[/b][/url] parameter.

Share this post


Link to post
Share on other sites
MJP    19754
Putting a texture index in your vertices like Tiago suggests could work, but you would have to be careful not to share vertices among faces with different textures assigned to them. This means you might have to split some vertices, or use some other means of obtaining the texture index.

[quote name='kubera' timestamp='1329666273' post='4914524']
Maybe you would merge them into one texture.
(Texture altas should be power of two size for its mipmaps.)
[/quote]

Power-of-2 dimensions is not a requirement for texture atlases, or for mipmaps. Besides, he's asking about texture arrays which are a much better solution to his problem.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this