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 herufeanor · Nov 12, 2012 at 01:27 AM · shadermeshlightinggraphicsunity 4

Geometry shader output to mesh in Unity 4

I've written an implementation of the marching cubes algorithm in a geometry shader in Unity 4. It works great, but it has no lighting, because of course writing a shader program with vertex and geometry shaders requires overriding Unity's surface shaders, and thus you lose the built-in lighting engine.

When working in OpenGL or Direct3D directly, you can make a shader that outputs the results of the geometry shader stage directly to a VBO, instead of rendering it to the screen. In this way, you can write a shader that modifies a mesh, and then a separate shader that renders it. With this feature, assuming I could get a Mesh object associated with the output VBO, I could then render that using Unity's standard shaders (or my own surface shader), both in order to cache the output of marching cubes (so I wouldn't have to re-run it each frame) and to use Unity's existing lighting model.

In Unity 4 you can do something like this with compute shaders, but unfortunately I can't treat the ComputeBuffer as a Mesh, so I can't render it with a surface shader, and thus still can't use Unity's lighting model on it.

So firstly, is there a way in Unity 4 to output the geometry shader output to a VBO associated with a Mesh object?

And if not, is there a way to access Unity 4's lighting model from a custom fragment shader?

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 Caiuse · Jan 03, 2013 at 04:23 PM 0
Share

Interesting question did you get anywhere with it?

0 Replies

· Add your reply
  • Sort: 

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

10 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

Related Questions

Dymanic Mesh Hiding 2 Answers

2D Sprite Shader Acting like Light 0 Answers

How do I make the meshes show up as dark as the scene if there is no light? 3 Answers

How to light back side of quad mesh same way as front side? 1 Answer

Playdead's Inside AO decal 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