-
Notifications
You must be signed in to change notification settings - Fork 17
Description
I am trying to start studying this project and have made an experimental branch https://github.com/meisei4/ps2gl/blob/experimentation_only (not planning to request merge, I just have it for studying so far) and I am finding some issues with Color behavior quite a lot.
I know that from this Issue: #11, the fix has been to add to the examples ColorMaterial enabling and Lighting as well, but I am trying to figure out how to get things working without Lighting or Material.
Lesson05 Behavior
I was able to get lesson05 working to what I think is expected to show up (but it still requiring lighting and material though):
Where two things happen:
-
The
Colorsfor the quad based cube are not set at a per face basis like they seem to be intended to (instead they are only attached per vertex, where unlike theNormalsandTexcoords, there is no filling of the per vertex colors via anyGetCurColor(something i will bring up later, and have tried to reconcile withCurMatColor, andCurGeomColorin some experiments i have added <- this is likely only introducing more complexity though compared to how i think OpenGL would expect this to work).- Example of how
Texcoordsdoes it:
https://github.com/ps2dev/ps2gl/blob/master/src/base_renderer.cpp#L167
- Example of how
-
After enough time the rotations result in the per vertex colors completely fading to black because they depend on the lighting.
- A hack to avoid this is by always updating the lighting direction to be facing the
Normalsas they rotate (documented in comments where this happens, and how i understand it to work:https://github.com/meisei4/ps2gl/blob/experimentation_only/src/gmanager.cpp#L50)
- A hack to avoid this is by always updating the lighting direction to be facing the
Experiments fork
Here is my fork’s result after updating the two issues to allow for updating the Colors at a per vertex basis (still trying to figure out if this should be on Material or if it’s better as an actual Geometry attribute... it seems to cause issues with other tests like lesson02).
Code changes involve:
- Adding the directional light update to face rotating
Normals:
https://github.com/meisei4/ps2gl/blob/experimentation_only/examples/nehe/lesson05/lesson5.cpp#L50 - In the
ImmgManager, trying to correct the wayColorsare being added, such that it follows the pattern ofTexcoordsandNormalsmore closely (from my understanding this is how OpenGL would be doing it, rather than only storingColorsas aMaterialattribute...):
https://github.com/meisei4/ps2gl/blob/experimentation_only/src/immgmanager.cpp#L123
intended Examples
I have also added two examples that I am trying to get working:
-
PVC lit:
https://github.com/meisei4/ps2gl/blob/experimentation_only/examples/box/lit_pvc_box.cpp
-
Corresponding unlit version:
https://github.com/meisei4/ps2gl/blob/experimentation_only/examples/box/unlit_pvc_box.cpp
The unlit version relies on a very poor attempt at working backwards from general_pvc_diff_tri_vcl.vsm to make this microcode:
https://github.com/meisei4/ps2gl/blob/experimentation_only/vu1/proper_nolights_pv_color_vcl.vsm
That aims to get the RGBA data to just pass through without any lighting instructions. I spent a little bit too much time on this and kind of gave up because I am hoping I can be pointed towards better VCL tools... (or even any vsm examples that cover the most simple way to diagnose what registers are set up for RGBA when its a pass through and then also just how kInputQPerV works with the ordering of lanes when XferColors, XferNormals and everything is being passed
As you can see in the result, I am able to get Vertex data through, it is just that the Registers for loading in the correct RGBA data seem to be scrambling or reading from the wrong lanes or something and alignment is all wrong.
Contribution Interest
I would really like to help contribute to this project in light of the potential it has for raylib interfacing, but I am having trouble with the approach here and whether or not VU1 should be how this GL layer is done.
I will provide some links of the resources I have found just for documenting myself below (some I have tried, e.g. VCL Linux compiler, but having no luck with getting it to work, and it seems like many ps2sdk libraries no longer use VU microcode to draw things anymore).
Resources
very dense ps2 documentation: * http://lukasz.dk/playstation-2-programming/an-introduction-to-ps2dev/
- Potential reference for bypassing VU1 in a renderer abstraction: https://github.com/h4570/tyra
- VU1 instruction manual: http://lukasz.dk/files/vu-instruction-manual.pdf
(even the core ps2sdk draw examples do not demonstrate any simple PVC non-lighting, non-textured rendering... * https://github.com/ps2dev/ps2sdk/tree/master/ee/draw/samples
lua abstraction layer for potential inspiration * https://github.com/DanielSant0s/Enceladus
I hope to come back to this, but I believe that I need to take a break and am hoping for potential review of the locations in the code I am trying to experiment with, to get any insight as to what the main design is intended to be here and what is the best way to begin reviving this project.
