0
$\begingroup$

How do I tell what kind of shader this is: https://github.com/aras-p/UnityGaussianSplatting/blob/main/package/Shaders/GaussianSplatting.hlsl Among these options: vs – vertex shader

ps – pixel shader

gs – geometry shader

ds – domain shader

hs – hull shader

cs – compute shader

By looking at the code? I need to know in order to convert it to a glsl shader. Thanks.

$\endgroup$
5
  • $\begingroup$ The code from the URL looks to me like regular hlsl code... It seems like it is shader stage independent $\endgroup$
    – Thomas
    Commented Oct 27, 2023 at 14:42
  • $\begingroup$ Look at the meta info in those files (files that have meta at the end)to find which file actually contain shaders. The meta file for the file linked in the question is pretty clearly functions and is listed as shader includes. Look at some of the other meta files will list actual shaders. $\endgroup$
    – pmw1234
    Commented Oct 27, 2023 at 15:01
  • $\begingroup$ @Thomas The thing is I'm trying to use this diligentgraphics.com/diligent-engine/shader-converter/… to convert the shader to glsl, but it requires I give it the shader type. $\endgroup$
    – Ethan
    Commented Oct 27, 2023 at 16:58
  • $\begingroup$ then you have to roll them into a real shader...or figure out the includes and put them together, there is nothing complex about it. You just have to take a few minutes and do the work don't ask us to do it for you. $\endgroup$
    – pmw1234
    Commented Oct 27, 2023 at 17:39
  • $\begingroup$ Why don't you convert it by hand? GLSL and HLSL are not so different. These 550 lines of code would take a few hours to convert by hand including testing... $\endgroup$
    – Thomas
    Commented Oct 28, 2023 at 6:20

1 Answer 1

2
$\begingroup$

The real work horse shader looks to be the compute shader near the bottom of the list in this file.

The other shaders which has fragment and vertex code in it is in this file.

One of the first things it does at line 19 is:

#include "GaussianSplatting.hlsl"

Which is a reference to the file in the question.

At line 32 it has:

v2f vert (uint vtxID : SV_VertexID, uint instID : SV_InstanceID)

and then at line 58

half4 frag (v2f i) : SV_Target

The file: https://github.com/aras-p/UnityGaussianSplatting/blob/main/package/Shaders/GaussianDebugRenderBoxes.shader and https://github.com/aras-p/UnityGaussianSplatting/blob/main/package/Shaders/GaussianComposite.shader

have similar lines.

It looks like the compute shader is implementing the algorithm and the other shaders are there largely, for showing the results.

Hope this helps.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.