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
0
Question by Kaji-Atsushi · Mar 25, 2013 at 10:13 AM · terrainmeshhole

How to make holes in your mesh/terrain during runtime?

I have researched and I've seen you can do some shader+collision tricks to make holes in terrain. So for a flat terrain, using a simple plane with the special shader would work to make a hole. So it seems you would need a preset mesh to overlap onto your mesh that you're trying to make a hole in.

However, lets say you have a custom terrain mesh and you want to dynamically create round holes onto the ground. What would be the best way to approach this?

Should I find a way to only select and duplicate the specific polygons somehow 'cut it out into a circle or whatever shape I wanted and take that mesh and apply the masking shader? Even though that wouldn't quite make sense since it's probably not possible to do that, or we wouldn't even need the special shader, if we can cut out shapes in the mesh?

Is it possible to overlap to mesh objects? and somehow cut out the intersecting?

Any guidance in this matter would be most helpful.

Thank you in advance!

Edit:

To clarify my question, I definitely mean during runtime/gameplay. In this game theres a type of digging action, and you'd be able to choose whatever location on the terrain. So pre-making meshes to make holes would not be an option.

Comment
Add comment
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

3 Replies

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

Answer by Fattie · Mar 25, 2013 at 10:37 AM

"Is it possible to overlap to mesh objects? and somehow cut out the intersecting?"

You would have to do this BY HAND, working with the mesh. This is by no means simple, and not something you can do as a beginner.

Now, is there an existing tool that does this? I'm pretty sure, no, I've not seen any tool (say on the asset store) that will take a flat mesh, a "ground", and knock a hole in it.

based on your further comments ...

Note that using a PROJECTOR is a very common and very simple solution to what you are describing.

(A "decal" is somewhat similar conceptually, but it does not work if the ground is, as you say, not perfectly flat. A "projector" will work perfectly for you here -- depending on the look you want.)

To try a projector basically, just click once to add an example projector ("blob light" or whatever) from the standard example assets

Comment
Add comment · Show 2 · 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 Kaji-Atsushi · Mar 25, 2013 at 04:28 PM 0
Share

I am trying to make holes in terrain meshes by runtime. I have already been able to make 'visual/rendering holes' by applying shaders to certain objects. $$anonymous$$y problem is that my terrain is hilly/bumpy. So let's say I apply the special shader to a plane, and put it on the ground. It would make a visual hole on the terrain. But only where the plane actually is placed. And since it's not shaped into the bumpiness of the terrain. We'd have a weird visual hole.

avatar image Kaji-Atsushi · Mar 25, 2013 at 11:52 PM 0
Share

Thanks for your reply it sounds very promising so far. Once I get back to my computer, I'll look into that and check answered if it seems like the correct road to go down.

avatar image
1

Answer by Venryx · May 13, 2013 at 08:44 PM

Tarlius' response is in the right direction. That will take care of dynamic terrain texture changes.

To actually make holes, though, you have to have a texture that it switches to, that's transparent, and a script system that makes objects fall through those dynamically-made-transparent areas.

I've made a plugin for this second half, that can be found on the Asset Store: Terrain Hole System

Description: "This Unity extension lets you make holes in your terrain that characters and other objects can go through."

More information can be found on the forum thread.

To get it working with the dynamic texture setting, just have the dynamic-texture-setting set the terrain texture of the area to the "Transparent" texture talked about in my plugin's manual.

Let me know if you need more details into how to get this to work.

Comment
Add comment · 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
0

Answer by Tarlius · Mar 25, 2013 at 11:11 AM

I would suggest looking for "destructible terrain".

Check this out. I didn't read the code, but the concept is explained in the video description. Basically he uses a texture to adjust the hieghtmap. The disadvantage of this is there will be no way to make "caves", which might be a problem.

voxelform looks like it would get around this (and looks awesome in general), although I can't find it on the asset store now. :(

If you aren't looking to do this in real time, then Fattie has the answer

(Disclaimer: I am not affiliated in any way with either of these solutions)

Comment
Add comment · Show 2 · 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 Kaji-Atsushi · Mar 25, 2013 at 04:25 PM 0
Share

Thanks for you answer.

Voxelform looks to be the most promising solution so far, I do need actual holes in terrain, ins$$anonymous$$d of heightmap changes. Though, I have no idea what the cost is yet. I'll have to research it further.

Edit:

After searching around, Voxelform seems to be a dead plug-in to be found nowhere. Perhaps...I'll have to figure out how it was done and duplicate the process.

avatar image Fattie · Mar 25, 2013 at 05:01 PM 0
Share

writing a voxel engine is a staggeringly large undertaking. it is inconceivable you could do that, purely to solve the problem at hand!

yes, voxelform.com disappeared mysteriously about a year ago. it was a vaguely $$anonymous$$ecraft-like technology.

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

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

terrain hole shader needs fixing 1 Answer

Lighting Banding Artifact 0 Answers

Questions about render distance in an open world game 0 Answers

How would i go about meshing over several objects? 1 Answer

Need Pointer: How to create 2D map in Unity? 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