I didn't read your message carefully enough. The physics system supports this with the caveats I mentioned below, but ray tracing does not. It only supports the one surfaceprop defined in the qc file for studio models.
Jay > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Jay Stelly > Sent: Monday, September 12, 2005 4:44 PM > To: [email protected] > Subject: RE: [hlcoders] Model Surface Properties > > I'm not sure why you're seeing a 77 everywhere. However it > looks like the code only supports one remapping table for the > level and the objects, so any material indices are going to > get remapped through the table created by the world. You can > always set up your own table or remap the world materials at > load time, but it's something else you'll have to deal with > to do this. > > The material index set by SetTriangleMaterialIndex() is > compiled into the collision model and will be saved when you > serialize it. > > Jay > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Justin > > Krenz > > Sent: Wednesday, September 07, 2005 2:13 PM > > To: [email protected] > > Subject: Re: [hlcoders] Model Surface Properties > > > > I implemented the code you pasted from vbsp into studiomdl. > > I then used the value of 'j' in the triangle loop as the material > > index number for that triangle just to see if it works. This is > > retained by the collision model within studiomdl correctly > until I try > > hitting the model with a trace in game. The trace's > surface material > > seems to remain a constant value "77" for all areas of the > model even > > though it should have been the index number that I set when > compiling > > it. Is the material index of each triangle actually being saved in > > the collision model file automatically as being a part of > the class or > > is it being ignored and the blanket value of "77" being applied > > elsewhere? > > > > Jay Stelly wrote: > > > You definitely don't want to use a polysoup for this. You'll > > > dramatically increase the cost of physics for every object > > you do this > > > to. > > > > > > Unfortunately, there isn't an API in vphysics that allows you to > > > construct non-polysoup convexes with a specific > triangulation. So > > > you're not going to be able to solve this exactly. The planar > > > constraints will be the same, but the triangulation of > those planar > > > polygons may not be (since it gets chosen by the code > that creates > > > convex hulls). > > > > > > Anyway, the best method I can think of is to use what vbsp uses: > > > > > > ICollisionQuery *pQuery = > > > physcollision->CreateQueryModel( pCollide ); > > > int convex = pQuery->ConvexCount(); > > > for ( int i = 0; i < convex; i++ ) > > > { > > > int triCount = pQuery->TriangleCount( i ); > > > int brushIndex = pQuery->GetGameData( i ); > > > > > > Vector points[3]; > > > for ( int j = 0; j < triCount; j++ ) > > > { > > > pQuery->GetTriangleVerts( i, j, > > points ); > > > > > > // REPLACE THIS CODE > > > Vector normal = TriangleNormal( > > > points[0], points[1], points[2] ); > > > dbrushside_t *pside = > > FindBrushSide( brushIndex, normal ); > > > if ( pside->texinfo != TEXINFO_NODE ) > > > { > > > int prop = > > > g_SurfaceProperties[texinfo[pside->texinfo].texdata]; > > > > > > pQuery->SetTriangleMaterialIndex( i, j, RemapWorldMaterial( > > prop ) ); > > > } > > > // REPLACE THIS CODE > > > // > > pQuery->SetTriangleMaterialIndex( i, j, your index here ); > > > } > > > } > > > physcollision->DestroyQueryModel( pQuery ); > > > > > > > > > And then replace that bracketed code with something that > > matches to the > > > nearest face in the SMD collision model to get your > > texture/material. > > > > > > > > >>-----Original Message----- > > >>From: [EMAIL PROTECTED] > > >>[mailto:[EMAIL PROTECTED] On Behalf > Of Justin > > >>Krenz > > >>Sent: Tuesday, September 06, 2005 1:35 AM > > >>To: [email protected] > > >>Subject: Re: [hlcoders] Model Surface Properties > > >> > > >>Ok, I checked out the studiomdl source to find out how to > go about > > >>doing this. It looks like when the collision model is built, it > > >>first gets the vertices, creates a convex hull, and then > makes the > > >>final collision element. That's no good so I altered it > to take the > > >>vertices and turn them into triangles using the "Poly Soup" > > >>functions and then build the collidable from the soup where I can > > >>assign a material id per face. > > >>Unfortunately, only a few of the triangles are actually > where they > > >>should be with some having vertices that can't possibly > be right. > > >>The model reports 72 vertices, but then the original function to > > >>turn the vertices into convex hulls only reports 14 non-duplicate > > >>vertices. If I try using all 72, it outputs yellow text > errors in > > >>the command window. > > >>Can you offer any advice? My brain is fried for now, but > I suppose > > >>it's just a matter of messing with it until it works. > > >> I only hope that the exported .phy file is actually saving the > > >>material index for the faces. > > >> > > >>Jay Stelly wrote: > > >> > > >> > > >>>The collision models built by the MDL/studiomdl path > have the same > > >>>low-level features as the ones built in Hammer. But the > > >> > > >>tools do not > > >> > > >>>put per-face materials on the collision models. So you > > >> > > >>would have to > > >> > > >>>modify the model compiler or do this in a post-process in > > >> > > >>your mod. At > > >> > > >>>runtime, there is a 7-bit material index available per > > >> > > >>triangle on any > > >> > > >>>collision model. In vbsp, the world model compiler builds a > > >> > > >>table of > > >> > > >>>the different surfaceprops used by the world and stores an > > >> > > >>index into > > >> > > >>>that table on each triangle. You could do the same for > > your models, > > >>>but currently our tools do not do this. > > >>> > > >>>Jay > > >>> > > >>> > > >>> > > >>> > > >>> > > >>>>-----Original Message----- > > >>>>From: [EMAIL PROTECTED] > > >>>>[mailto:[EMAIL PROTECTED] On Behalf Of > > >>>>[EMAIL PROTECTED] > > >>>>Sent: Saturday, September 03, 2005 8:53 AM > > >>>>To: [email protected] > > >>>>Subject: [hlcoders] Model Surface Properties > > >>>> > > >>>>I want to be able to group faces/triangles of a collision > > >> > > >>mesh in one > > >> > > >>>>of my models into separate groups. Inside my mod, I want > > >> > > >>to be able > > >> > > >>>>to tell from a trace which group of faces was hit by the > > >> > > >>trace. The > > >> > > >>>>closest thing I can see at doing that is by looking at the > > >> > > >>"surface" > > >> > > >>>>(csurface_t) of the trace. This doesn't give me much > > >> > > >>information, but > > >> > > >>>>from there I can use "surface.surfaceProps" to get to > > surfacedata_t. > > >>>>From there, I can get to "surfacegameprops_t" which has an > > >> > > >>interesting > > >> > > >>>>variable named "material". > > >>>>I was hoping from that I could get information about > the material > > >>>>assigned to the collision mesh's faces. > > >>>>Unfortunately, the entire model yields the same > material no matter > > >>>>what texture is assigned to it, and it looks like it's > > >> > > >>intended for a > > >> > > >>>>material defined in Hammer. I'd rather not use hitboxes, > > >> > > >>but I will > > >> > > >>>>if that's the only alternative. > > >>>> > > >>>>_______________________________________________ > > >>>>To unsubscribe, edit your list preferences, or view the > > >> > > >>list archives, > > >> > > >>>>please visit: > > >>>>http://list.valvesoftware.com/mailman/listinfo/hlcoders > > >>>> > > >>>> > > >>>> > > >>>> > > >>> > > >>>_______________________________________________ > > >>>To unsubscribe, edit your list preferences, or view the list > > >> > > >>archives, please visit: > > >> > > >>>http://list.valvesoftware.com/mailman/listinfo/hlcoders > > >>> > > >>> > > >>> > > >>> > > >> > > >>_______________________________________________ > > >>To unsubscribe, edit your list preferences, or view the list > > >>archives, please visit: > > >>http://list.valvesoftware.com/mailman/listinfo/hlcoders > > >> > > >> > > > > > > > > > _______________________________________________ > > > To unsubscribe, edit your list preferences, or view the > > list archives, please visit: > > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > > > > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the > list archives, > > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list > archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

