Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

onnel

Mesh clipping for decals

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

I have a decal system (using a square mesh lined up with the parent face), but I haven''t implemented any kind of clipping (so, ofr example, my decal will hang off the edge of the face into space if near the edge). So I need to clip my decal mesh (or at least the display of it) to the face it is one. Can anyone offer any suggestions as to how to go about this? Onnel

Share this post


Link to post
Share on other sites
Advertisement
I have briefly mentioned this before in your other decal thread:
Don''t use a quad for the decal, but render it fitting precisely onto the existing mesh.

You know where the decal is supposed to be, relative to existing geometry. Render another triangle that is aligned exactly to the underlying mesh triangle, but with the decal texture. Obviously, the decal will usually not fit onto that triangle, so just render the affected neighbouring triangles in the same way. It''s a bit tricky to implement, but will definitely pay off in visual quality in the long run.

- JQ
Full Speed Games. Period.

Share this post


Link to post
Share on other sites
Excellent..I had totally missed that suggestion previously. that''s a perfect way of doing it. I especially like the idea of rendering multiple triangles around it if necessary..time to complicate my decal system!

I guess the "decal" triangle will also have to have dynamically generated texture coordinates so that the texture (which may be smaller than the triangle) can be correctly placed...

Thanks again,

Onnel

Share this post


Link to post
Share on other sites
Yes of course.
There are two ways of doing this: make the decal triangles the same size as the mesh triangles and using "clamp" texture addressing, OR reduce the size of the decal triangles. The latter is of course the "cleaner" and more efficient way of doing it (no render state changes) but it''s slightly harder to implement.

- JQ
Full Speed Games. Period.

Share this post


Link to post
Share on other sites
Actually, even if you want to go against this - why having a QUAD for the decal?

You could use a triangle that has enough space for the whole decal :-)

Reduced triangle count by 50%.


Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)

Share this post


Link to post
Share on other sites
quote:
Original post by thona
Actually, even if you want to go against this - why having a QUAD for the decal?

You could use a triangle that has enough space for the whole decal :-)

Reduced triangle count by 50%.

Err, I think that''s not a good idea. You have to use clamp addressing then (2x SetRenderState), and in any case you''re drawing unnecessary transparent pixels. In any case, for two triangles, the overhead for calling DrawPrimitive() in the first place is so high that the time difference in drawing itself is not measurable.
So, no.



- JQ
Full Speed Games. Period.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!