티스토리 뷰
코드 통합도 있겠고, 여러 목적이 있지만
가장 먼저 찾은건,
- Ray-MMD의 Ray의 Ray 프로젝트
대략적 중간 언어 > GLSL > GLSL Optimizer (github)
문제는 optimizer가 compute 처리가 안됨;
어짜피 OSX가 CS 지원을 안해서, 골치 아픔;
윈도우는 다 지원, OSX는 open GL 도 쥐꼬리만큼
- 요즘 나온 툴체인 소개
https://github.com/KhronosGroup/glslang/issues/1417
- XShaderCompiler
http://shader-playground.timjones.io/e3992560499e60815aa0fb68a1d42c30
v0.10-alpha 이지만 쓸만한 결과를 준다
struct PSInput
{
float4 color0 : COLOR0;
float4 color1 : COLOR1;
};
...
// Noraml 코드
의 경우,
out vec4 SV_Target0;
out vec4 SV_Target1;
vec3 EncodeNormal(vec3 xst_normal)
{
float p = sqrt(-xst_normal.z * 8.0f + 8.0f);
vec2 enc = xst_normal.xy / p + vec2(0.5f);
vec2 enc255 = enc * 255.0f;
vec2 residual = floor(fract(enc255) * 16.0f);
return vec3(floor(enc255), residual.x * 16.0f + residual.y) / 255.0f;
}
- Spir-V cross 이용
http://shader-playground.timjones.io/efd31f9326f06a122b59b44b5f29da0a
layout(location = 0) in vec4 input_color0;
layout(location = 1) in vec4 input_color1;
layout(location = 0) out vec4 _entryPointOutput_color;
layout(location = 1) out vec4 _entryPointOutput_normal;
void main()
{
vec3 _112 = sqrt(vec3(0.0));
_entryPointOutput_color = vec4(dot(_112, vec3(0.2989999949932098388671875, 0.58700001239776611328125, 0.114000000059604644775390625)), dot(_112, vec3(-0.0840192139148712158203125, -0.16495059430599212646484375, 0.24901960790157318115234375)) + 0.4980392158031463623046875, dot(_112, vec3(0.24901960790157318115234375, -0.20847921073436737060546875, -0.040490590035915374755859375)) + 0.4980392158031463623046875, 1.0);
_entryPointOutput_normal = vec4(2.0);
}
단지 최적화로 위와 같이 변함;
어짜피 기계가 보는거라;
- HSLcc
Unity-Technologies/HLSLcc
https://gamedev.stackexchange.com/questions/139945/why-does-unity-use-hlsl-instead-of-glsl
Additionally, I found a really good answer for the deprecated Cg here (read there, there are some good answers):
As NVIDIA is not supporting CG anymore, latest unity versions actually compile shaders using HLSL compiler and transform the resulting bytecode to GLSL.
Which also stated before and I missed it:
OpenGL Core, OpenGL ES 3 and Metal use Microsoft’s HLSL followed by bytecode translation into GLSL or Metal, using HLSLcc.
'Game > Graphics' 카테고리의 다른 글
GPU culling (0) | 2018.11.27 |
---|---|
HLSL pow (0) | 2018.08.01 |
Volumetric Light (0) | 2018.03.21 |
Area light cont. (0) | 2018.03.18 |
Real-Time Area Lighting: a Journey from Research to Production (0) | 2018.03.15 |
- Total
- Today
- Yesterday