@aras_pr

Aras Pranckevičius

Last I looked at creating shaders that work across various platforms & APIs (i.e. shader translation hlsl -> glsl) it was quite a mess. I know you wrote about this topic on your blog a while ago. Have things improved since?

I hope that they did to some extent, however I have not personally used any of these new shader cross-compilers, so can't vouch for them.
The situation right now in 2016 seems to be:
If you need DX9-level HLSL (with a tiny bit of DX10 things, like instance IDs and some texture arrays), then using hlsl2glslfork + glsl-optimizer is still probably the most "battle tested" solution (being used in Unity and so on). However, the DX9 HLSL syntax is starting to get old. This can get conversion from DX9 HLSL into: GL2.x, GLES2.0, GLES3.0, Metal.
For a "mostly DX9 HLSL but with somewhat more DX10 stuffs", I'd look at HLSLParser , specifically Thekla's fork of it (https://github.com/Thekla/hlslparser). This recently got Metal conversion backend too (from The Witness game port to Metal I guess), and a bunch of improvements from ROBLOX folks. This, as far as I can tell, can get you conversion into OpenGL (possibly ES too?) and Metal.
Khronos' glslang (https://github.com/KhronosGroup/glslang) is getting a HLSL parsing frontend recently, which seems to be targeted at full DX11 HLSL syntax, and is under very active development, with compute shader bits being done as we speak. So this can take GLSL or HLSL as input, and can output SPIR-V (which can be used directly in Vulkan). Another tool, SPIRV-Cross (https://github.com/KhronosGroup/SPIRV-Cross) could be used to convert that into GLSL or Metal. Possibly with some optimization step via SPIRV-Tools in the middle (https://github.com/KhronosGroup/SPIRV-Tools).
There's a DX11 bytecode level translator (as in, compile HLSL with actual D3DCompiler/fxc, and translate the bytecode into GLSL) via HLSLCrossCompiler https://github.com/James-Jones/HLSLCrossCompiler -- my impression is that it needs "a lot" of tweaks on top to be "production ready". We use a fork of it in Unity, but the people working on it haven't got around to push their changes somewhere public. I just know they did *a lot* of changes :)
And then Microsoft at GDC2016 talked about their upcoming open source HLSL compiler, that would be built on top of clang+llvm, and I think they talked about "end of 2016" as potential release date. But I haven't heard updates on that. This of course would only be a HLSL -> DXIL toolchain, but if it were open source then I guess someone could make DXIL -> SPIR-V translator, and from there to other backends via SPIRV-Cross.
So, in summary: right now, for modern HLSL I'd take a look at Khronos' glslang + SPIRV-Cross. If you can wait a bit until Microsoft ships their new HLSL compiler, then would be worth taking a look at that too.
❤️ Likes
show all

Latest answers from Aras Pranckevičius

RE: I could! Who should I ask about (name, email or whatever)? Alex Lian - R&D - Release & Tooling Director Please ask about those beta t-shirts.

I mean, who should I ask *about*? Who did not get the shirt?

Hello Aras! Few weeks ago i got email that i won Unity 2017.1 beta t-shirt, I gave my address and such. Weeks and weeks later there is no info. Could you ask someone at Unity about it? Greets

I could! Who should I ask about (name, email or whatever)?

Hi Aras! I am trying to get programs that uses metal framework run on windows, so I need to write a tool that converts MetalSL to GLSL. Do you think it is possible?

It surely is possible, but someone has to write a tool that does the conversion :) From the top of my head, I'm not aware of any existing tool like that.

Hi Aras! Ignoring the pain of refactoring existing shaders: Would you recommend removing the doubled color calculation in particle shaders? I figured it's related to your atten*2 lighting discussion on the unity forums, but it still shows in builtin shaders. Thanks for your time!

emericanized’s Profile PhotoJ
Hmm, I thought we have removed all the "atten * 2" stuff from built-in shaders in Unity 5. Which particle shaders that do lighting still have it?
I think some others (that aren't lit) might do "color * 2" as a cheap way of allowing "overbrightenning" effect, where 50% gray color is neutral, and brighter than that allows for brighter particles than the actual texture. If you want to copy them and remove that to suit your needs -- sure, just do it.

Already passed a year and there is still no audio, video and animated logo support for Splash Screen even thought devs said that it's coming... Is it still in the works?

I have no idea, nor whether anyone ever said that it's in the works. Sorry!

Hi Aras! we are the guys behind Obi (a suite of physics plugins for Unity, fairly popular in the Asset Store). We were wondering who we´d need to talk to in order to discuss ways to tighten the integration between Unity and our plugins. Is there a "physics guy" in the company?

What worked better for you when using Vulkan: few resource objects with many usage flags or many resource objects with few resource flags each?

I actually don't know! Haven't done any Vulkan code myself.

Hi Aras, little question: Unity 3.5, 4 and 5 got their own trailers, Is the 2017 version going to get the trailer since it's like a new era of Unity?

I don't actually know (that's up to marketing), but I think all your mentioned releases were shipped during some big industry event (e.g. GDC) and the trailers served as event material too. Not sure if 2017.1 is going to be shipped at some big event; probably not.

Hello Aras! 2017.1 beta is out but Scriptable Render Loops are not here, can you say in which beta we can expect them? Thanks!

Scriptable render loops have been there since Unity 5.6 actually, under UnityEngine.Experimental.Rendering namespace (and them being experimental; the API kept on changing quite a lot though).
I'm not sure if in current 2017.1 beta they are out of experimental namespace yet (I kinda stopped doing graphics a while ago). I'm pretty sure there is more APIs & stuff to build scriptable render loops compared to 5.6 though.
Probably best to ask on the beta mailing list (if you're there), or in the beta section on the forums.

Since someone asked about Unity 2017 i remember that there is big post on forum about Visual Scripting in 2017 and people are saying that it's going to be released in 2 years, Is it going to be in 2017.1 or 2 years? Have a great day and thanks!

"Visual Scripting" is put under "research phase" in the roadmap (https://unity3d.com/unity/roadmap), so definitely not in 2017.1 yet.

Language: English