One of the new features in Unity 5.1 is a new unified OpenGL rendering backend. A unified what now? Until now, we had a separate renderer for OpenGL ES 2.0, one for OpenGL ES 3.0 (that shared a good deal, but not all, code with ES 2.0) and then a completely different one for the desktop OpenGL (that was stuck in the OpenGL 2.1 feature set). This, of course, meant a lot of duplicate work to get new features in, various bugs that may or may not happen on all renderer versions etc.
I'm running unity 5.3.0 on a 64 bit windows 7 machine and really all I'm trying to do is make a build for mac. I've made a pc build easily enough, but when i go into build settings to select the mac option it simply isn't there. May 28, 2016 - In Unity, choose “File” > “Build Settings” > Platform “PC, Mac & Linux Standalone” > Choose target platform “Mac OS”. Then go to certificates, choose the dropdown with “OS X” and click the “+” button. Otherwise, head back to iTunes Connect, select the uploaded build, and change the status “Preparing.
So, in order to get some sense into this, and in order to make it easier to add features in the future, we created a unified GL renderer. It can operate in various different feature levels, depending on the available hardware:. OpenGL ES 2.0. OpenGL ES 3.0. OpenGL ES 3.1 ( + Android Extension Pack).
desktop OpenGL: all versions from 2.1 to 4.5 (desktop OpenGL support is experimental in 5.1) All the differences between these API versions are baked into a capabilities structure based on the detected OpenGL version and the extensions that are available. This has multiple benefits, such as:. When an extension from the desktop GL land is brought to mobiles (such as Direct State Access), and we already support that on desktop, it is automatically detected on mobiles and taken into use. We can artificially clamp the caps to match whichever target level (and extension set) we wish, for emulation purposes. Provided that the necessary compatibility extensions are present on desktop, we can run GL ES 2.0 and 3.x shaders directly in the editor (again, still experimental in 5.1). We get to use all the desktop graphics profiling and debugging tools against the OpenGL code already on the desktop and catch most of the rendering issues there. We do not need to maintain separate diverging codebases, bugs need to only be fixed once and all optimizations we do benefit all the platforms simultaneously.
Compute shaders. From the Unity Asset Store running on OpenGL ES 3.1. No modifications needed. One of the first new features we brought to the new OpenGL renderer is compute shaders and image loads/stores (UAVs in DX11 parlance).
And again, as we have an unified codebase, it is (more or less) automatically supported on all GL versions that support compute shaders (desktop OpenGL 4.3 onwards and OpenGL ES 3.1 onwards). The compute shaders are written in HLSL just as you’d do on DX11 in previous versions of Unity, and they get translated to GLSL. You’ll use the same Graphics.SetRandomWriteTarget scripting API to bind the UAVs and the same Dispatch API to launch the compute process. The UAVs are also available on other shader stages if supported by the HW (do note that some, usually mobile, GPUS have limitations on that, for example the Mali T-604 in Nexus 10 only supports image loads/stores in compute shaders, not in pixel or vertex shaders). Tessellation and Geometry shaders. GPU Tessellation running on OpenGL ES 3.1 Both tessellation and geometry shaders from DX11 side should work directly on Android devices supporting Android Extension Pack.
The shaders are written as usual, with either #pragma target 50 or #pragma target es31aep (see below for the new shader targets), and it’ll “just work” (if it doesn’t, please file a bug). Other goodies Here’s a short list of other things that are working mostly the same as on DX11. DrawIndirect using the results of compute shader via append/consume buffers.
The API is the same as the DX11 features are currently using. Advanced blend modes (dodge, burn, darken, lighten, etc) are exposed whenever the KHRblendequationadvanced extension is supported by the GPU. The extension is part of the Android Extension Pack, and can be found on most semi-recent desktop GPUs as well as the high-end mobile ones (Adreno 4xx, Mali 7xx, nVidia K1+). DirectX 11 does not support these blend modes. These can be set both from the scripting API and from ShaderLab shaders.
The new blend mode enums can be found from the UnityEngine.Rendering.BlendOp documentation. Differences from DX11 There are some differences to the feature set available in DX11, apart from things discussed above:. The mobile GPUs have fairly limited list of supported UAV formats: 16- and 32-bit floating point RGBA, RGBA Int32, 8-bit RGBA, and single-channel 32-bit Int and floating point formats. Notably, the 2-channel RG formats are not supported for any data type. These formats are available on desktop GL rendering, though. GL ES 3.1 does not support any other HLSL Shader interpolation qualifiers than ‘centroid’, all other qualifiers are ignored in ES shaders. GL ES 3.1 still does not mandate floating-point render targets, although most GPUs do support them through extensions.
The memory layout for structured compute buffers have some minor differences between DX11 and OpenGL, so make sure your data layouts match on both renderers. We’re working on minimizing the impact of this, though. Shader pipe The shader compilation process for ES 2.0 and the old desktop GL renderer (and, until now, for ES3.0 as well) is as follows:. The HLSL shader is translated to GLSL / GLSL ES using hlsl2glsl. The resulting GLSL shader is fed to GLSL optimizer The problem with this is that neither of the modules above support anything later than Shader Model 3.0 shaders, effectively limiting the shaders to DX9 feature set. In order to compile HLSL shaders that use DX11 / Shader Model 5.0 features, we are using the following shader compilation pipeline for GL ES 3.0 and above, and for all desktop GL versions running on unified GL backend:.
The HLSL shader is compiled to DX bytecode using the Microsoft D3D compiler. The bytecode is translated to GLSL / GLSL ES using our heavily reworked fork of HLSLCrossCompiler The new shader pipeline seems to be working fairly well for us, and allows us to use the shader model 5.0 features. It also can benefit from the optimizations the D3D compiler performs (but also all the drawbacks of having a bytecode that treats everything as vec4’s, always). As a downside, we’ll have a dependency to the D3D compiler and the language syntax it provides, so we’ll have to go through some hoops to get our Unity-specific language features through (such as sampler2Dfloat for sampling depth textures). Existing OpenGL ES 3.0 (and of course, OpenGL ES 2.0) shaders should continue to work as they did previously. If they do not, please file a bug.
So, how can I use it? For Unity 5.1 release, we are not yet deprecating the legacy OpenGL renderer, so it will still be used on OS X and on Windows when using the -force-opengl flag. Firstly, let me double check if you meant concave mesh colliders instead? Concave mesh colliders are only possible on kinematic and static bodies since Unity 5 due to changes in PhysX.
On the other hand, convex meshes are very welcome everywhere aren’t they? The way we see resolving concave mesh colliders being less useful in Unity 5 is to have an approximate convex decomposition library integrated at some point, which would take your concave mesh as in input, and provide a set of convex mesh colliders as an output. Then, this convex set would be used instead of your concave mesh. PhysX 3 reduced concave meshes support for a reason actually. That was never actually working reliably. There were cases where it sort of worked fine, but there were even more cases in my grabbag where it bloody misbehaved.
Another important consideration is performance — convex meshes are noticeably faster to process collisions with. Unfortunately, I can’t say when this comes available. We’ve had the task on HACD integration for a while so far, but more of other priority stuff keeps coming in.
We’re spending a lot on addressing fogbugz cases devs file to us.