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
3
Question by shwayCAT · Jan 17, 2013 at 02:48 PM · shadervectorcullingvectrositywireframe

How do you write a flexible wireframe shader with backface culling?

Hello! My First question here.

I'm working on a game concept, and I'd like to use Unity to build a working prototype, if not the completed game, but I'm stuck on how to render the game the way I'd like it to look visually. This is a question that has been asked time and again, but I haven't seen a comprehensive answer yet, so I'll see what happens here.

So I'm looking for a game that renders like a Tron game mixed with old 80's 3D vector game graphics, ala Battlezone or Star Wars arcade. Better yet, FOTONICA (http://www.fotonica-game.com/). I reached out to the author of Fotonica, and he said they built the game in Unity, and used a post processing effect (shader) to get the desired vector effect. Shader's are a bit out of my comfort zone, but I am not unwilling to dive in to CG/HLSL/Shaderlab if needed.

Additionally, I want to be able to animate the lines as textures. So, for example, if I wanted the vector lines of a sword to animate different colors in waves along the edge of the sword, I'd simply use an animated texture. Additionally, I want to add glows to my wireframe objects. Lastly, I want backface culling, or even better, phong shading to give a very dull dark matte finish to the objects so that the edge are brightly lit and colored, but the objects themselves have a sense of "weight."

I've looked at a lot of online resources (including a number of posts on Unity Answers), and even purchased the latest version of Vectrosity. This might do the trick, but when playing around with a few prototypes, seeing how hard I could push Vectrosity to render as many lines as possible, it choked a bit earlier than I would have liked. I see that in Unity 4 you can render scenes with GL.wireframe = true, but it doesn't appear to be very flexible (documentation is pretty sparse on this).

Any thoughts out there on where to begin? Any thoughts/insights/pointers/direction would be greatly appreciated. Thanks so much!

Comment
Add comment · Show 3
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 MD_Reptile · Mar 12, 2013 at 02:00 PM 1
Share

I too would like to see a definitive answer to this. I've read about a way to do this using like barycentric calculations or something like that, but never tried it our seen examples, but hey maybe check this out

http://answers.unity3d.com/questions/198467/How-to-create-VectrexVector-look-in-games-.html

avatar image Fattie · Mar 12, 2013 at 02:20 PM 0
Share

one point: by wireframe + backface culling,

do you mean you want it to draw a wireframe, BUT, only for the triangle edges where the face of the tri is visible?

("backface culling" just means that the rendering pipeline understands that (of course) mesh has a front side (which it renders) and a backside (which it does not render). this is completely standard and normal on any game engine or rendering pipeline today.)

avatar image MD_Reptile · Mar 12, 2013 at 02:35 PM 0
Share

I imagine he must mean that, have a look at that game he was talking about, it does just that in unity somehow, very nicely. Any idea how its done?

1 Reply

· Add your reply
  • Sort: 
avatar image
4

Answer by Bunny83 · Mar 12, 2013 at 02:54 PM

I've added a comment to my answer on the above mentioned question. I created a sample project of the barycentric wireframe shader quite a while ago.

Comment
Add comment · Show 4 · 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 Fattie · Mar 12, 2013 at 03:10 PM 1
Share

"So each corner of each triangle should be either (0,0) , (0,1) or (1,0)." Brilliant, i never knew the trick. How awesome.

avatar image Bunny83 · Mar 12, 2013 at 03:22 PM 1
Share

Exactly ;) Since all the primitive geometry in Unity (cube, sphere, ...) are mapped to a single texture all coordinates are always between 0 and 1 and work pretty well with the shader.

avatar image Fattie · Mar 12, 2013 at 03:30 PM 0
Share

right, what you describe even works "out of the box" with the unity menu shapes. anyway V clever

avatar image MD_Reptile · Mar 12, 2013 at 09:49 PM 0
Share

awesome, I will give this a shot today.

EDIT: I dig it, will probably put this to use soon!

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

12 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

Related Questions

How to make vector monitor graphics in Unity? 3 Answers

Shader Graph Wireframe Shader? 0 Answers

Efficient Way to Draw Wireframes (OpenGL ES 2.0, iOS) 0 Answers

Vertex Offset Shader deforming verts but not the rendered mesh 0 Answers

Culling part of a sprite in Sprite Manager 2 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