Sign in to follow this  

Trying to use Attribute Table to exclude certain faces from rendering....with no luck

This topic is 4597 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

Hello, thanks for reading this. I'm trying to use the Attribute Table to exclude certain faces from rendering...the DX9 docs don't have a lot to say about this, except that they make it seem easy. Can somebody explain how to do this for me?

Share this post


Link to post
Share on other sites
The attribute table tells you exactly which triangles and vertices are used in each textured subset. How could you be having a problem using this information?

If you use D3DXmesh, you don't need to look through the attribute table. The DrawSubset method does that for you.

Share this post


Link to post
Share on other sites
Hey, Jiia, must be because I'm a moron, right?

I'm trying to CHANGE the attribute table, not simply access it. Assign AttribID's to certain faces to keep them from rendering.

SO if I have a D3DXMesh, with certain faces scattered about that I don't want to render, I'm creating a NEW attribute table and calling SetAttributeTable to assign the new attribute table. So now I have a new attrib table, say with a table size of 5, with some AttribID's set to 0 and others set to 1, then implemented a bunch of code to get all of the contiguos attributes together, winding up with a table like this:

- attribtable[0] {AttribId=0 FaceStart=0 FaceCount=13209 ...} _D3DXATTRIBUTERANGE
AttribId 0 unsigned long
FaceStart 0 unsigned long
FaceCount 13209 unsigned long
VertexStart 0 unsigned long
VertexCount 10201 unsigned long
- attribtable[1] {AttribId=1 FaceStart=13209 FaceCount=2 ...} _D3DXATTRIBUTERANGE
AttribId 1 unsigned long
FaceStart 13209 unsigned long
FaceCount 2 unsigned long
VertexStart 0 unsigned long
VertexCount 10201 unsigned long
- attribtable[2] {AttribId=0 FaceStart=13211 FaceCount=10 ...} _D3DXATTRIBUTERANGE
AttribId 0 unsigned long
FaceStart 13211 unsigned long
FaceCount 10 unsigned long
VertexStart 0 unsigned long
VertexCount 10201 unsigned long
- attribtable[3] {AttribId=1 FaceStart=13220 FaceCount=2 ...} _D3DXATTRIBUTERANGE
AttribId 1 unsigned long
FaceStart 13220 unsigned long
FaceCount 2 unsigned long
VertexStart 0 unsigned long
VertexCount 10201 unsigned long
- attribtable[4] {AttribId=0 FaceStart=13222 FaceCount=6779 ...} _D3DXATTRIBUTERANGE
AttribId 0 unsigned long
FaceStart 13222 unsigned long
FaceCount 6779 unsigned long
VertexStart 0 unsigned long
VertexCount 10201 unsigned long

NOW, the DX docs say that DrawSubset(0) should draw all of the faces with an AttribID of 0, and DrawSubset(1) should draw all of the faces with an AttribID of 1, but I am getting what can only be defined as "unexpected results".

SO...if any of you have ever done what I'm trying to do, you can probably see where I'm going wrong, and I would appreciate your input. IF NOT, then you needn't bother replying to inform me that I am a moron, for I am only human, and I DO try not to get on the nerves of people with superior intellects, such as Jiia (mostly by maintaining as much distance from them as possible).

THANKS ALL for reading this.

Share this post


Link to post
Share on other sites
Quote:
Original post by danromeo
Hey, Jiia, must be because I'm a moron, right?

I'm trying to CHANGE the attribute table, not simply access it. Assign AttribID's to certain faces to keep them from rendering.

IF NOT, then you needn't bother replying to inform me that I am a moron, for I am only human, and I DO try not to get on the nerves of people with superior intellects, such as Jiia (mostly by maintaining as much distance from them as possible).

Maybe you should take a step back and look at your original question. You didn't mention anything about modifying the attribute table. I have anything but a supior intellect, and I wasn't trying to judge yours.

Now, with the idea that I'm an asshole genius out of the way, I can try to help.

First of all, you should only have one of each attribute ID. I'm sure you could assign several subsets the same ID, but it will make things rough on you. The way you create individual subsets depends on whether or not you use an index buffer as well. If you don't use one, you need to be sure that all of the vertices for each attribute are arranged in the same block of memory.

The next step would be to assign the starting and count face/vertex details in the attribute table for that index. I'm not sure if you know exactly what each detail represents. This is how the details would be used to render an indexed primtive:

DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, Attr.VertexStart, Attr.VertexCount, Attr.FaceStart * 3, Attr.FaceCount );

So the vertex start and vertex count are actually referencing the range of vertices in the vertex buffer that the render uses. This means several of these vertices could actually not be used in the render but still need to be included in the VertexCount member. The FaceStart and FaceCount directly reference the index buffer.

I'm not sure if I know any other information that would help. And I'm sorry to have slapped your ego around, it definitely wasn't my intention.

Share this post


Link to post
Share on other sites
THANKS FOR THE REPLY.

First, not to belabor this, but if I'm trying to exclude certain faces from rendering, I think that it goes without saying that I have to CHANGE the attrib table.

Second, I'm sure I'm not the only one on this board who gets tired of receiving responses to perfectly valid questions that translate basically to "DUHH!".

The info that you've given me looks like exactly what I needed. THANK YOU. I'm very impressed. But I still think that it's about time for people on this board to begin maintaining some modicum of congeniality and respect, as most of the questions that are posted can be very difficult to put into words, and often have to be restated. I think that we also need to take into account that many of us are also dealing with a language barrier that is very difficult to overcome. As a programmer and also as a person who has to deal with REAL people's computer problems on a daily basis, I can tell you all that programmers have a real talent for PISSING PEOPLE OFF, without meaning to, with curt replies to simple questions, refusal to understand that "real" people don't speak their language, and basically forgetting that they were once "stupid" too. Then again, maybe I just woke up on the wrong side of bed this morning. BUT I still maintain that most programmers really need to work on their people skills, if only because people need to use the programs that we write. For example, "How could you be having a problem with this information?" is PROBABLY a perfectly valid question, but people tend to translate it as "How could you <possibly> be having a problem with this information <you dumbass numbskull>?". Now, I admit, many times I'm THINKING those things when I'm dealing with somebody who's bending over backwards to NOT understand so that I'll finally wind up doing their work for them, but I try to review every statement that I make to them for the various ways that they can mis-translate it and use it as ammo to get my ass fired. Most times this means re-wording "How can you be having a problem with this info?" into "I must be misunderstanding your question, can you restate it?". Lastly, geniuses DESERVE to be assholes...but the rest of us need to remember that we are fallible humans.

Ok, sliding my soapbox under the bed for another day. Jiia, THANKS AGAIN, I really do appreciate your help.

Share this post


Link to post
Share on other sites
Quote:
Original post by danromeo
First, not to belabor this, but if I'm trying to exclude certain faces from rendering, I think that it goes without saying that I have to CHANGE the attrib table.

Second, I'm sure I'm not the only one on this board who gets tired of receiving responses to perfectly valid questions that translate basically to "DUHH!".

Well the only one who replied to your question was Jiia who was trying to help you from the beginning, and even excused himself for misunderstanding it the first time. Apart from the post by chad_420 (which I deem a bit unnessesary) I think you are overreacting a little. I use these forums daily and I don't think people get treated badly because of their questions. On the contrary I think most people who come here generally find the people here very friendly and helpful compared to people at other communities on the web. Of course there will always be morons who think themselves better than everybody else but you can deal with that easily by just ignoring them.

Best regards

Share this post


Link to post
Share on other sites
Quote:
Original post by danromeo
First, not to belabor this, but if I'm trying to exclude certain faces from rendering, I think that it goes without saying that I have to CHANGE the attrib table.

Second, I'm sure I'm not the only one on this board who gets tired of receiving responses to perfectly valid questions that translate basically to "DUHH!".

You don't need to change the attribute table to exclude faces from rendering. That's what it's originally for. To allow you to render individual parts of the mesh, one at a time. It looked to me as though you just didn't understand the mesh was already seperated into subsets. I thought you were confused about the attribute table details. But when I went to help, the DrawPrimitive methods all accepted the same parameters (same names) as the attribute table members. So if I implied anything, it was that I thought you were lazy, not that you were stupid.

Quote:
For example, "How could you be having a problem with this information?" is PROBABLY a perfectly valid question, but people tend to translate it as "How could you <possibly> be having a problem with this information <you dumbass numbskull>?". Now, I admit, many times I'm THINKING those things

Which might explain why you inserted those extra details on your own. I wasn't thinking those things.

Share this post


Link to post
Share on other sites

This topic is 4597 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.

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