Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Xav_m · May 30, 2011 at 06:49 PM · shaderoptimize

Selecting shader based on video card

Hello, I'm trying to optimize some shaders that I would like to use depending on video card model.

For example: Nvidia 8500 -- use simple shader (diffuse) Nvidia 9500 -- use medium shader (cubemap + diffuse) Nvidia 265 and up -- use compelx shader (cubemap + rim light)

How can I determine what video card is in the machine, and select the shader to use depending on that?

Thanks.

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
1

Answer by burnumd · May 30, 2011 at 07:25 PM

While you can get specific makes and models of graphics card using SystemInfo.graphicsDeviceVendorID, SystemInfo.graphicsDeviceID, and SystemInfo.graphicsDeviceName, those are more typically used to exclude certain cards if an effect or shader doesn't work on them. In general, what you ought to do is first attempt to put a fallback pass in your shader. Typically this just involves adding Fallback "Diffuse" after closing your SubShader. If you're not comfortable mucking about with shaders, you should check against the card's capabilities (also found in the SystemInfo class) rather than the card's specific identifiers. Properties like graphicsDeviceVersion and graphicsShaderLevel should be particularly useful, but familiarize yourself with the documentation for the entire class (it's not overly complex).

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 Xav_m · May 31, 2011 at 02:39 PM 0
Share

Thank you burnumd. The reason I wanted to use different shaders according to card spec, is because even tho the 8500 can use the shader, it slows badly in game when I use it.

Another optimization I was thinking about is swapping shaders based on distance, but I don't know if unity can do this automatically.

Thanks again.

avatar image burnumd · Jun 01, 2011 at 02:35 PM 0
Share

In that case you're doing what I described in the beginning of my answer. Namely, excluding a graphics set from doing something. Unity can swap the shader on a material instance. I don't know if you mean "Automatically" as in "flip a switch and it'll do it," but you can definitely code it yourself using $$anonymous$$aterial.shader: http://unity3d.com/support/documentation/ScriptReference/$$anonymous$$aterial-shader.html

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

2 People are following this question.

avatar image avatar image

Related Questions

Mesh.Optimize() in Unity 5.6.0 1 Answer

Intensive Shaders + Dynamic Batching 1 Answer

How to force the compilation of a shader in Unity? 5 Answers

Materials With Standart Shader Reflects Pink 0 Answers

Need help with Oren-Nayar lighting model. 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