Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Erik · Nov 04, 2010 at 08:16 AM · raycastmeshdetectiondecalcorner

Decals on corners

I've tried different approaches to make decals (bullet holes, blood splats, etc.), but performance wise, the best metod seems to be instantiating a plane on the hit point of the surface, be it a prefab plane or a runtime built plane mesh. It's working fine, but now I need to solve the infamous problem of decals around corners of a mesh, so I was wondering if there is an easy way to get this done.

I thought I could just check the hit mesh, and scale the decal plane if its bounds exceeds a corner on a wall, but I couldn't find an easy way to detect a corner on a mesh.

Any suggestions?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · Oct 19, 2011 at 09:29 AM 0
Share

@Erik YES there is a fairly simple 90% solution to the corner problem. http://forum.unity3d.com/threads/2562-blood-splatter?p=719943&viewfull=1#post719943

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Anton Petrov · Nov 04, 2010 at 08:47 AM

I have not tried doing it in the Unity yet.

But in games (like Quake) they use procedural meshes for decals. When you have found a face to put decal on you should clip your decal rectangle by target face edges. So your rectangle may become triangluated a bit.

Or you can just ignore decals which do not fit inside the target face entirely.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Erik · Nov 04, 2010 at 11:04 AM 0
Share

I was going for the procedural mesh generation, and I got some results so far: the hit triangle is being "duplicated" in a new mesh, along with it's adjacent triangle (right now, just it's opposite one, but I also tried and succeed to generate all it's adjacent triangles, sharing vertices with it). Now I just need a way to "complete" the missing triangles to end up with quads.

avatar image Anton Petrov · Nov 05, 2010 at 09:30 AM 0
Share

I am not sure I understood you right, but it looks like you build a decal mesh from target triangles.

And I suggest you to clip your rectangular decal with target face edges. Where target face is a polygon made of adjacent coplanar triangles for$$anonymous$$g for example a wall.

Good luck!

avatar image Erik · Nov 06, 2010 at 07:07 AM 0
Share

Yes, that's exactly what I did. Now the problem was that if the wall being hit was made up of big triangles, the decal quad would be too big in size (since it's generated by a copy of the wall triangles). I tried to Lerp the decal vertices towards the hit point, and it's kinda working, though in this way the decal mesh is awlays dependent on the original triangles being hit, which is not a big deal. I was looking for a better way to generate a square plane for the decal, just making sure it's not going to exceed the wall's boundaries.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

How i can repair my shoot decals? 2 Answers

Map from terrain scanning 0 Answers

How do I check if the mouse is over a VISIBLE vertex? 1 Answer

How can I make it so that my player only moves if there is no wall in the direction he wishes to move? 1 Answer

180 Degree raycast 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges