Narann
Graphic programming enthusiast
Hi guys! As you maybe know, I'm rewritting some parts of mupen64plus-video-rice to make it more OpenGL 2.1 compliant (aka rewritting almost everything related to graphic...). The idea is to throw away old deprecated OpenGL functions (and pipeline) and have a code that could be easely ported to OpenGL ES 2 (used in a modern way, OpenGL 2.1 is supposed to be easy to port to OpenGL ES 2).
I'm very new to the N64 HLE scene so I learn smoothly. Massive thanks to Gonetz's blog and his answers that totally help me to jump. You have no idea how guru comments are valuable when you have no idea where to start.
Before do the big jump to go in massive shader use (aka OpenGL 2.1 refactor), my two big bugfixes where fix fog (fog in Rice!) and fix fractionnal part of the insertMatrix command (fix leaning trees in SSB64). Unfortunately, fog (and a lot of others things) are breaks now that the Color Combiner has been rewrite to avoid deprecated OpenGL functions (Full GLSL). I surprised myself to actually read MESS's code and other plugin's code to see if I get it or not. I must admit my programming knowledge just bounce up since I'm working on Rice (and I still have a lot to learn).
Anyway, I choosed to create this thread after a lot of investigations to understand the relation between ALPHA_CVG_SEL and CVG_X_ALPHA. Digging over the internet I found this thread (it seems to was the good old time where everything has to be done, so many peoples discussing) and I have the impression it is the way to go: Create a thread to help others to follow you work and maybe get some help. So now I think I've (kind of) understood.
What I hope (we will see) is peoples here could help me, just giving the good word I'd miss or I should look for. When you are digging in a problem, often a simple "Did you check <magic word here>?" is enougth to help you to look at the right place.:inlove:
Don't expect massive activity (spare time project) but I will try to update this thread each time I get something new.
What took my time recently (and I should defenetly move to something else as there is a lot of work): The relation between ALPHA_CVG_SEL and CVG_X_ALPHA:
CVG_X_ALPHA alone : Surface is clamped (coverage) if alpha == 0 Aka do a nice alpha blending but clamp on places where alpha is not needed. This create a transparency artefact when two transparency objects are displayed. 1080SB over use this and you can see this artefact here on trees your going under (on the left). It could be considered as a "strict cutoff".
Have CVG_X_ALPHA avoid this:
Providing something like this:
While it can do the job, this is not perfect. This is why we often see this:
CVG_X_ALPHA and ALPHA_CVG_SEL : Surface is clamped if alpha > 0.5. (0.5 is arbitrary value even if I'm sure there is a true way to find it (I guess it's because coverage is anti aliased and I guess there is no interest to put CVG_X_ALPHA and ALPHA_CVG_SEL without AA_EN but I need to investigate).
Anyway, this works: Mario Kart Karts sprites (CVG_X_ALPHA and ALPHA_CVG_SEL) are nicely clamped. MK64 items, 1080SB border trees (CVG_X_ALPHA alone) are not but keep pass a "honest" Z depth test.
If you look the 1080SB video carefully at the provided time (effect visible a 6min20s), you will realize the transparency is not arsh but a little rounded (hard to see on the video, I agree, this is why I ask for valid N64 screenshots. :whistling: ). Actually, put a >0.1 instead of a == 0 give a better visual result on highest resolutions as ==0 show pixel squares on the transparency borders (I guess it's not a problem on native resolution), >0.1 loose a little of the border (most of the time it has no visual impact on the alpha blending so...).
If I missed something (I'm sure AA_EN has some words to say here) don't hesitate to notice me.
What I still have to do:
I'm very new to the N64 HLE scene so I learn smoothly. Massive thanks to Gonetz's blog and his answers that totally help me to jump. You have no idea how guru comments are valuable when you have no idea where to start.
Before do the big jump to go in massive shader use (aka OpenGL 2.1 refactor), my two big bugfixes where fix fog (fog in Rice!) and fix fractionnal part of the insertMatrix command (fix leaning trees in SSB64). Unfortunately, fog (and a lot of others things) are breaks now that the Color Combiner has been rewrite to avoid deprecated OpenGL functions (Full GLSL). I surprised myself to actually read MESS's code and other plugin's code to see if I get it or not. I must admit my programming knowledge just bounce up since I'm working on Rice (and I still have a lot to learn).
Anyway, I choosed to create this thread after a lot of investigations to understand the relation between ALPHA_CVG_SEL and CVG_X_ALPHA. Digging over the internet I found this thread (it seems to was the good old time where everything has to be done, so many peoples discussing) and I have the impression it is the way to go: Create a thread to help others to follow you work and maybe get some help. So now I think I've (kind of) understood.
What I hope (we will see) is peoples here could help me, just giving the good word I'd miss or I should look for. When you are digging in a problem, often a simple "Did you check <magic word here>?" is enougth to help you to look at the right place.:inlove:
Don't expect massive activity (spare time project) but I will try to update this thread each time I get something new.
What took my time recently (and I should defenetly move to something else as there is a lot of work): The relation between ALPHA_CVG_SEL and CVG_X_ALPHA:
CVG_X_ALPHA alone : Surface is clamped (coverage) if alpha == 0 Aka do a nice alpha blending but clamp on places where alpha is not needed. This create a transparency artefact when two transparency objects are displayed. 1080SB over use this and you can see this artefact here on trees your going under (on the left). It could be considered as a "strict cutoff".
Have CVG_X_ALPHA avoid this:

Providing something like this:

While it can do the job, this is not perfect. This is why we often see this:
CVG_X_ALPHA and ALPHA_CVG_SEL : Surface is clamped if alpha > 0.5. (0.5 is arbitrary value even if I'm sure there is a true way to find it (I guess it's because coverage is anti aliased and I guess there is no interest to put CVG_X_ALPHA and ALPHA_CVG_SEL without AA_EN but I need to investigate).
Anyway, this works: Mario Kart Karts sprites (CVG_X_ALPHA and ALPHA_CVG_SEL) are nicely clamped. MK64 items, 1080SB border trees (CVG_X_ALPHA alone) are not but keep pass a "honest" Z depth test.
If you look the 1080SB video carefully at the provided time (effect visible a 6min20s), you will realize the transparency is not arsh but a little rounded (hard to see on the video, I agree, this is why I ask for valid N64 screenshots. :whistling: ). Actually, put a >0.1 instead of a == 0 give a better visual result on highest resolutions as ==0 show pixel squares on the transparency borders (I guess it's not a problem on native resolution), >0.1 loose a little of the border (most of the time it has no visual impact on the alpha blending so...).
If I missed something (I'm sure AA_EN has some words to say here) don't hesitate to notice me.
What I still have to do:
- Rewrite Fill shaders (now it use deprecated OpenGL functions and it doesn't work anymore).
- Rewrite Copy shader.
- Now, some triangles with points outside the camera disappear, investigate.
- Integrate fog computation in Blender (aka the last step of the Color Combiner).
- Clean classes. The way classes are abstracted is outdated (fix OpenGL/DirectX pipeline way) and confusing (the biggest proof is that they are used in an inconsistent way all over the code). OGLCombiner had 5 inheritance levels before I start to clean. Now its has three... Same for RSP_Parser is supposed to call RenderBase class which is suppose to call Render class which is supposed to call OGL/DirectXRender class... I don't know what is the point of RenderBase and, once again, Render class is designed to work in a fixed (and deprecated) pipeline way.
- FrameBuffer emulation has always poorly worked in Rice, investigate.