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 cj31387 · May 22, 2014 at 01:01 AM · editorcullingviewportlodfaces

Culling faces from models in the unity editor viewport?

I'm playing around making a Minecraft like game. But instead of generating buildings and levels from code I'm modeling them with a pretty decent workflow I have going. But I am in need of removing/deleting faces that are unviewable in the viewport editor. I've never tried to make a unity editor extension, can someone give me some info on how I could remove certain faces from a model in the editor NOT when the game plays. How do you find a particular face on a model and delete it? My main concern is that they are already 3d models .fbx to be exact. I've never seen any info on culling already made models in unity, only when they are generated procedurally.

I know it can be done though because of tools like probuilder etc.. But I think even those are procedural. Info and tutorials would be appreciated.

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

1 Reply

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

Answer by MakeCodeNow · May 22, 2014 at 03:30 PM

If you want to cull individual faces, you'll need to create a new Mesh resource, copy the data from the fbx mesh into it, and then remove all of the backfacing or occluded faces. You'd need to do this every frame that the camera moves.

If you want to cull individual renderer's, that's easier. You just need to determine what is occluded (which it sounds like you have a way to do?) and then set the active flag to false.

If you're not sure how to have a script run in the editor, then add the ExecuteInEditor class attribute. You may also need to manually hook your Update function into EditorApplication.Update.

Comment
Add comment · Show 8 · 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 cj31387 · May 22, 2014 at 09:10 PM 0
Share

By mesh resource do you mean having the FBX's in the resource folder? Can you link some info on copying the data from the FBX mesh? Would I have to re-uv the mesh from script or can that be copied over too?

avatar image cj31387 · May 22, 2014 at 09:17 PM 0
Share

Do you mean load the fbx through script like this? http://answers.unity3d.com/questions/193008/loading-imported-fbx-data-from-script.html this actually makes sense to me.

avatar image MakeCodeNow · May 23, 2014 at 04:46 PM 1
Share

http://docs.unity3d.com/Documentation/ScriptReference/$$anonymous$$esh.html

avatar image cj31387 · May 25, 2014 at 04:30 AM 0
Share

If you want to cull individual faces, you'll need to create a new $$anonymous$$esh resource, copy the data from the fbx mesh into it, and then remove all of the backfacing or occluded faces. You'd need to do this every frame that the camera moves.

Yeah that's what I want to do. Any tutorials on this or anything? I managed to copy the fbx verts and uvs into a array. I don't really know how delete a specific face, If i just delete the verts of that face will it delete that face automatically or do I need a specific face deletion function?

$$anonymous$$y logic of deleting a face I am still co$$anonymous$$g up with Will be like a raycast in each direction of the faces to check 1 meter if there is another block in front of it, then to delete that face, But yeah I don't understand how to know how to delete a specific face yet. I need some info on that.

Also I was getting a editor error that I $$anonymous$$UST use .sharedmesh ins$$anonymous$$d of .mesh. In doing this I might have messed up the original FBX how can I know if I messed it up or not? I read after using it that it overwrites the model file.

Thanks in advance for your time.

avatar image MakeCodeNow · May 25, 2014 at 07:09 PM 1
Share

Deleting a cube face means removing the two triangles that represent it from the list of triangles for the entire mesh. You can also delete the verts that those faces use, but that's not strictly necessary.

In your case, you probably want to make a copy of the mesh, i.e. new $$anonymous$$esh() and then set the new mesh verts/uvs/normals to be copies of those from the source mesh, then modify the copy.

1 cube should be 12 tris.

I think that you're at a point now where you know what has to be done and now you need to buckle down and bang on the code for a while. You'll learn fastest that way rather than asking for more and more fine grained advice.

Show more comments

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

23 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

"W" key not working in Unity3D Mac OS X 5 Answers

Select parent object when LOD object is clicked 0 Answers

Cullingmask issue. 0 Answers

How can I zoom the game mode viewport to its native scale? 1 Answer

LOD system with Partial object culling? 2 Answers


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