Novum / vkQuake

Vulkan Quake port based on QuakeSpasm
GNU General Public License v2.0
1.8k stars 220 forks source link

re-open old issue (particle alpha blending) #204

Closed Rikoshet-234 closed 4 years ago

Rikoshet-234 commented 4 years ago

image Hi ! please, check that ( recently closed ) issue. Thank you in advance :)

Tintin-Asterix commented 4 years ago

Oh yeah, that is weird. If r_particles is set to 1 so the particles are circles, they show as circles within transparent squares. If you set r_quadparticles to 0 they show as circles within big triangles like before.

(ignore the vkQuake version number, I compiled it myself a day or so 1.04 was released so it has the changes)

vkquake0001

Rikoshet-234 commented 4 years ago

yea, this half-transparent quads looks weird. and i think we have a blending problem in shader

Rikoshet-234 commented 4 years ago

ha, i fixed it ) image

Rikoshet-234 commented 4 years ago

image problem was in fragment shader. when i tweak this value to 0.0, it starts looks like in quakespasm engine

Novum commented 4 years ago

I can't repro this. What mod is this? But your fix might make sense. I don't think the alpha should be affected by the fog value.

Rikoshet-234 commented 4 years ago

alpha - no, just color. my tweak make no sense, because then it looks different than in qs. there is a map i taken a screenshot from https://www.quaddicted.com/reviews/bindingtower2.html in vanilla quake (id1). i can make some snapshots for you in renderdoc if you want

Rikoshet-234 commented 4 years ago

by the way, how can I rebuild shaders ? I tried through .bat and .sh - they don't work in my case

Rikoshet-234 commented 4 years ago

so, looks like i found what is going wrong image when we create a new vector consisting of xyzw components, it is assumed that the alpha channel is also used in mathematical operations. but when we write vec4(fog), the compiler seems to take it as vec4 (fog, fog, fog, w ). we don't have the w component initially, but we need it for operations on a 4-dimensional array. in this case, the compiler substitutes the standard value for us in the place w of the component (w = 0.5 based on my observations) when I put 1 (alpha = 1) in the place of the missing component value. the particles began to look exactly like in quakespasm image but as soon as I changed the value of the W component to 0.5, I got the same result as before image image

Rikoshet-234 commented 4 years ago

I think we need to review the shaders for the presence of such defects as this

Rikoshet-234 commented 4 years ago

So, I found how to compile shaders and tested my fix. What else... its work the same as in quakespasm :) image image image

Novum commented 4 years ago

@Rikoshet-234 To recompile the shaders, you will have to have the Vulkan SDK installed and make sure to log out afterwards to get the environment variables set up correctly.

Quakespasms shader looks a bit different, I want to make sure that it's really identical.

Rikoshet-234 commented 4 years ago

Yes, quakespasm doesn't have shader code. everything written in C using the gl function etc. but I fixed your mistake. and if you don't know how qs shaders work, then who wrote these shaders ? for vkquake I mean of course. for me its looks the same as in qs engine, i was compared it in many maps i was played before - the same fog and particle blending.

Rikoshet-234 commented 4 years ago

you're right, though. it is better to make sure that everything works exactly the same as in qs. still, this is a transfer to another api, not a reimplementation:) I hope to soon be able to solve these problems with the differences between vkQuake and quakespasm

Novum commented 4 years ago

Why are you trying to lecture me? I wrote all of the vkQuake rendering code. I do understand the QuakeSpasm shaders just fine. I just want to CHECK to make sure I make the right fix and I didn't have time yet. This bug isn't critical.

Rikoshet-234 commented 4 years ago

sorry :) I'm a little confused myself XD. just forget this misunderstanding ;)

Novum commented 4 years ago

1ddea619923d99f6c10e73b3fcdb78f8134f5673