• 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
1
Question by Jacktang · Jun 23, 2012 at 04:53 PM · shaderlabopenglnative

Unity Shaders in Native c++ plugin

Hey, I was wondering if there is any way to use Unity shaders when using the low level native rendering interface from a c++ and openGL plugin. I'm doing some rendering from a plugin and wish to integrate it with the lights in my scene. I would rather not have to re-implement all the complex lighting stuff in unity.

From what I can tell if I can't just easily tap into the unity shader pipeline from my native plugin, then I will need to retrieve a list of all the lights affecting my object, make them available to my GLSL shader, and then perform all the correct lighting calculations from my own custom GLSL shader. Any shortcuts around this? Is there a simple way of getting access to all the variables that unity makes available for "free" when writing GLSL shaders in editor?

Ideally I would like to just be able to write a typical ShaderLab shader and pass the GLSL compiled version into my native plugin and just call glUseProgram(program); and have everything magically work, but I'm guessing it's not going to be quite that easy.

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 Jessy · Jun 23, 2012 at 05:18 PM 0
Share
  • for good question, -1 for not crosslinking. http://forum.unity3d.com/threads/141005-ShaderLab-shaders-in-native-OpenGL

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by TheLazyEngineer · Dec 22, 2020 at 11:19 PM

ever find your answer on this?

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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Does Unity support Array Textures? 0 Answers

GL.lines Drawing over Objects 0 Answers

native ios screencapture vs unity Application.captureScreenshot 0 Answers

Android OpenGL error in Unity 5 but not in Unity 4.6 0 Answers

Why Unity compiled shader doesn't use the GLSLPROGRAM/GLSL syntax? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges