Skip to main content
gamedev.net
🔒 Locked

Using multiple vertex formats

Started by Schluppi 0 replies 350+ views
Original Post
Schluppi
Schluppi
Hello. My current project is a small level editor. I'm going to implement following functionality, but I don't know how to do it best way: Let's assume the user has created a polygon. Then he should be able to modify it, like adding one or more textures for texture blending or a colour component (diffuse and specular) for each vertex individually. But in DirectX it is possible to use up to eight textures at once. When I distinguish between lit and unlit vertices furthermore, I have to declare sixteen different vertex formats, that are many. Do I really have to declare all of them? Can anybody say me, how to do this best? Thanks.
Demus79
Demus79

I'd suggest you to define your goal first. I am not sure if you'll actully need 8 sets of texture coordinates per vertex.

- Perhaps you can create a general purpose vertex format which has all the required features. Sometimes you don't need to optimize away some un-used vertex data (lit/unlit). Let's say that a vertex format with 2 sets of texture coordinates, and some lighting information would do for you. Most of the textures you'll apply may be able to use the same texture coordinates (consider a diffuse and normal map, usually they'll use the same coordinates). Fitting the information in 1 format is beneficial, and good for performance. If you end up having a big vertex structure, you can use several packing methods in order to make it fit in a smaller space.

- How about using multiple streams ? Have some base type vertex and then another stream which contains some effect specific data.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.