-
Hi! I'm making good progress with the Wii port of Neverball, most things are rendering fine now, but there's one bit of code that I had to change in neverball's source code, which puzzles me a bit. It's about the ball's shadow: unless I comment out the condition at https://github.com/Neverball/neverball/blob/master/share/geom.c#L597 (that is, unless I explicitly set the wrapping mode to "clamp"), the ball shadow texture is repeated all over the stage. I'm using the OpenGL driver I'm developing myself, so it's very likely that the bug is somewhere in there, but I don't understand how can the code work on the desktop, since, AFAIK, the default value for the texture wrap mode is GL_REPEAT. Can someone explain me why the ball shadow is not repeated, on proper OpenGL drivers? For the record, I'm not using the latest master branch of Neverball, but the same 2017 version packaged in Ubuntu (just temporarily, in order to be able to reuse the data files :-p). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hi, First of all, a Wii port sounds awesome. Second, you must be doing more than you're letting on, because in Neverball code Line 139 in 8d01ce9 |
Beta Was this translation helpful? Give feedback.
The clip texture serves one purpose: to clip the shadow above the ball. This was so common in Neverball levels that it actually had a FAQ entry on the old Neverball website. And so I fixed it. The fix was to combine the shadow texture with a clip texture that is positioned such that the shadow color above the midpoint of the ball is multiplied with an alpha value of 0 - and disappears.
In your video, the clip texture is positioned correctly, but appears to be blended incorrectly: it should only affect the shadow color and should itself be invisible.
(I guess there's no difference from using a clip texture vs using a clipping plane - I just did it with a texture.)