Forcing Unity Web Player to use OpenGL...

Asked by Yanis Lukes

Hi,

We, Unity Editor on Linux users(using Wine), have managed to force the editor to use OpenGL. Previously the "-force-opengl" option caused Unity Editor to crash.

Some results estimate a performance boost of 10% to 400% due to Wine no longer needing to redirect Direct3D calls to OpenGL.

We fixed it by adding a patch to Wine, which required compiling the whole Wine with the patch.

I am unfamiliar in what the Unity Web Player uses for rendering. A Unity moderator has stated that it use both DirectX and OpenGL. So forcing the Unity Web Player to use OpenGL should increase performance. Unless of course setting the User Agent to a OSX browser already forces the Web Player to use only OpenGL?

Edit: The question of is it possible to force it to use OpenGL has been answered - http://answers.unity3d.com/questions/46812/forcing-opengl-in-the-web-player.html

The script that we used to compile Wine can be found on github:
https://github.com/Unity3D-Wine-Support/Unity3D-on-Wine/blob/master/Compile-Wine/compile-wine-ubuntu-32bit.sh (edited this for you because the script was renamed)

This is the folder with the scripts and the patch used:
https://github.com/Unity3D-Wine-Support/Unity3D-on-Wine/tree/master/Compile-Wine

Question information

Language:
English Edit question
Status:
Answered
For:
Pipelight Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Sebastian Lackner (slackner) said :
#1

Hi,

thanks for sharing these ideas. I'm also not 100% sure what Unity3D Web Player uses right now, but you might be right that it uses WineD3D, and there are probably some ways to speed it up a bit. I didn't have time to do this yet, but I'll do some testing later.

Unfortunately, before inclusion into wine-compholio it will most likely be necessary to modify or even rewrite it: The patch looks like and most probably is a hack ... although our provided Wine version wine-compholio is mainly used in conjunction with Pipelight, there are several ways how this could break things: Pipelight also supports a bunch of other browser plugins which use wined3d, moreover some people also use wine-compholio without Pipelight, just to get a patched version. Including such a hack could break things there.

Regards,
Sebastian

Revision history for this message
Yanis Lukes (pendrokar) said :
#2

The question was answered. There is no "-force-opengl" option for Unity Web Player. Whenever the internet browser uses Direct3D or OpenGL depends on the Operating System. For any OS other than Windows, it uses OpenGL, Windows uses Direct3D/WineD3D.

So the Wine patch won't really help. You would have to find out what a internet browser for Mac OS X that has a Unity Web Player plugin does, which I guess falls out of Pipelight' jurisdiction.

Revision history for this message
Michael Müller (mqchael) said :
#3

Hi,

the windows version of the webplayer simply does not contain any code to use OpenGL. The webplayer loads different libraries to use DirectX like d3d9.dll or D3DCompiler_47.dll but it does not even contain the string "Opengl32.dll" for the OpenGL library on windows. There is now way to make the webplayer use OpenGL since they removed the necessary code.

Michael

Revision history for this message
travis butler (tbutler-butler) said :
#4

So far I am stuck I have been working on the unity 3d web plugin for linux but I cant get the patch to work . I need to know the file the patch burns into . Does anybody know ?

I can show you what I have done just download this read-me page from box.com

https://app.box.com/s/w5plh4dyz0iqb6v1ljk9

In the read-me there is command line code to install the patch . Like I had said though I do not know the file to be patched I tried /usr/bin/wine but it failed . Again if you can work this out post me pls.

ps
The read-me does work I can play any unity game so far and I had a lot that didn't work through-out the most of attempting to compile something that would prove worthy .

Revision history for this message
Michael Müller (mqchael) said :
#5

You are mixing a lot of stuff: There is the Unity3D editor and the Unity3D plugin for browsers.

If you just want to play games in your browser, then you can simply use the Pipelight plugin. There is no need to patch anythin since the plugin does not support OpenGL. The necessary code is simply not compiled into the executable, there is no way to make the plugin use OpenGL.

If you want to use the editor, you don't need Pipelight at all. You just need a patched wine version which contains some fixes for Unity3D. The wine-compholio package contains such patches and there is no need to apply them manually. Simply start the application using /opt/wine-compholio/bin/wine instead of your regular wine version and you are done.

Michael

Can you help with this problem?

Provide an answer of your own, or ask Yanis Lukes for more information if necessary.

To post a message you must log in.