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
0
Question by mash · Aug 31, 2011 at 06:32 PM · modelgpualgorithm

GPU programming with Unity

How do I use the GPU in Unity? I'm using some extensive algorithms and want to know how I can reduce the time it takes to compute.

Comment
Add comment · Show 2
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 MountDoomTeam · Feb 02, 2013 at 05:21 AM 0
Share

I read a page on here recently from a guy that did some GP GPU program$$anonymous$$g in unity and he used some kind of open source cuda equivalent maybe by $$anonymous$$icrosoft or something with some catchy name but I've forgotten, when I read the wiki article about it said that it was a 3rd type different from stream and cuda

avatar image Invertex · Jan 20, 2014 at 09:01 AM 0
Share

Old ass post, but I'd just like to mention that what $$anonymous$$ountDoomTeam is talking about, is likely DirectCompute. It's basically $$anonymous$$icrosoft's Direct3D answer to CUDA and OpenCL.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Owen-Reynolds · Sep 01, 2011 at 03:56 PM

Just to bump with some so-so info:

o The physics system, Phys-X(sp?) uses the graphics card already (it was written by NVidea to show off the non-graphical uses of their chips.) I'm thinking their could be some conflicts if we throw more on the GPU.

o I believe GPU-as-CPU tricks use render-to-texture as communication back from the GPU, and that only Unity Pro allows R-to-T.

o GPU shaders work just fine, even on free. The docs cover an alternate method of setting lots of switches, instead of writing a shader. Easiest way to write real shaders is click Create->NewShader in your Assets, and also to download their package of the built-in shaders for samples. And read their "surface shaders" section.

Comment
Add comment · Show 5 · 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 djarcas · Feb 01, 2013 at 05:47 PM 1
Share

" The physics system, Phys-X(sp?) uses the graphics card already (it was written by NVidea to show off the non-graphical uses of their chips.) "

This goes contrary to EVERYTHING I have read about PhysX in Unity. Citation needed, please.

avatar image Owen-Reynolds · Feb 02, 2013 at 03:53 AM 0
Share

You mean claims that Unity implements PhysX in software, on the CPU? That sounds reasonable, esp for mobile, lots of people assert it, but I've never seen a source. $$anonymous$$aybe you can citation-need those guys.

avatar image djarcas · Feb 02, 2013 at 11:03 AM 0
Share

If you enable/disable hardware PhysX in the control panel, it makes zero difference to either framerate nor physics compute time within Unity. The logical conclusion is either that it's not any faster(lol), or it's software only.

avatar image Owen-Reynolds · Feb 02, 2013 at 03:11 PM 0
Share

Looks like the hardware/software switch is a recent addition. $$anonymous$$y version 3.5 Edit->ProjSettings->Physics doesn't one. So that may be a sign they are planning to add hardware PhysX for some targets.

You might get better answers by starting a new Question.

avatar image djarcas · Feb 02, 2013 at 03:39 PM 0
Share

What ARE you going on about? The PhysX switch is part of the Nvidia control panel. Unity has no understanding of 'real' PhysX, only their particular implementation of it.

(Why would there be a hardware physics switch in Unity if it didn't support hardware? Derp!)

I'm not particularly after 'answers', here, I'm mostly attempting to stop you disse$$anonymous$$ating completely incorrect information.

avatar image
0

Answer by Sigil · Sep 01, 2011 at 07:50 PM

Some more info. I don't think this requires Unity Pro either.

If you have an NVidia video card you can write your algorithms up using CUDA in a separate DLL and then call them from a Mono/Unity DLL (giving you access from scripts etc). Something like this (from the Mono/Unity DLL):

 using System;
 ...
 using System.Runtime.InteropServices;
 
 namespace MyMonoDllPackage
 {
     public class MyCudaBehaviour : MonoBehaviour
     {
         [DllImport("MyCudaFunctions.dll")]
         public static extern void DoSomethingInCuda(float[] aSomeData);
 
         public void Update()
         {
             float[] tSomeData = { 0.0f, 0.1f, 0.2f, 0.4f };
             DoSomethingInCuda(tSomeData);
         }
     }
 }
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
avatar image
0

Answer by MountDoomTeam · Feb 02, 2013 at 09:02 AM

DirectCompute dll

or

https://github.com/unity3d-jp/unity-doc/blob/master/en/ComputeShaders.txt

http://docs.unity3d.com/Documentation/Manual/ComputeShaders.html

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.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

MMD How to export model and animations to Unity as 3rd person controller? 2 Answers

OGRE 3D Question 2 Answers

horseshoe game - convex mesh colliders with interior spaces 1 Answer

3D Model problems 1 Answer

Maya Sword hilt is not imported into unity. 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