Shader fixes
This commit is contained in:
@@ -73,7 +73,7 @@ function make_voxel_run(data: shader_context_t) {
|
||||
function make_voxel_source(): string {
|
||||
let ds: f32 = make_material_get_displace_strength();
|
||||
///if arm_direct3d11
|
||||
return "#define vec3 float3 \
|
||||
return "#define vec3 float3 \n\
|
||||
uniform float4x4 W; \
|
||||
uniform float3x3 N; \
|
||||
Texture2D<float4> texpaint_pack; \
|
||||
@@ -82,7 +82,7 @@ function make_voxel_source(): string {
|
||||
struct SPIRV_Cross_Output { float4 svpos : SV_POSITION; }; \
|
||||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { \
|
||||
SPIRV_Cross_Output stage_output; \
|
||||
" + make_material_voxelgi_half_extents() + ")} \
|
||||
" + make_material_voxelgi_half_extents() + " \
|
||||
stage_output.svpos.xyz = mul(float4(stage_input.pos.xyz, 1.0), W).xyz / voxelgi_half_extents.xxx; \
|
||||
float3 wnormal = normalize(mul(float3(stage_input.nor.xy, stage_input.pos.w), N)); \
|
||||
float height = texpaint_pack.SampleLevel(_texpaint_pack_sampler, stage_input.tex, 0.0).a; \
|
||||
@@ -91,7 +91,7 @@ function make_voxel_source(): string {
|
||||
return stage_output; \
|
||||
}";
|
||||
///else
|
||||
return "#version 450 \
|
||||
return "#version 450 \n\
|
||||
in vec4 pos; \
|
||||
in vec2 nor; \
|
||||
in vec2 tex; \
|
||||
@@ -100,7 +100,7 @@ function make_voxel_source(): string {
|
||||
uniform mat3 N; \
|
||||
uniform sampler2D texpaint_pack; \
|
||||
void main() { \
|
||||
" + make_material_voxelgi_half_extents() + ")} \
|
||||
" + make_material_voxelgi_half_extents() + " \
|
||||
voxposition_geom = vec3(W * vec4(pos.xyz, 1.0)) / voxelgi_half_extents; \
|
||||
vec3 wnormal = normalize(N * vec3(nor.xy, pos.w)); \
|
||||
float height = textureLod(texpaint_pack, tex, 0.0).a; \
|
||||
|
||||
@@ -536,11 +536,11 @@ float ltc_evaluate(vec3 N, vec3 V, float dotnv, vec3 P, mat3 Minv, vec3 points0,
|
||||
|
||||
let str_get_pos_from_depth: string = " \
|
||||
vec3 get_pos_from_depth(vec2 uv, mat4 invVP, textureArg(gbufferD)) { \
|
||||
#if defined(HLSL) || defined(METAL) || defined(SPIRV) \
|
||||
#if defined(HLSL) || defined(METAL) || defined(SPIRV) \n\
|
||||
float depth = textureLod(gbufferD, vec2(uv.x, 1.0 - uv.y), 0.0).r; \
|
||||
#else \
|
||||
#else \n\
|
||||
float depth = textureLod(gbufferD, uv, 0.0).r; \
|
||||
#endif \
|
||||
#endif \n\
|
||||
vec4 wpos = vec4(uv * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0); \
|
||||
wpos = mul(wpos, invVP); \
|
||||
return wpos.xyz / wpos.w; \
|
||||
|
||||
Reference in New Issue
Block a user