🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

OpenGL 4 reflections

Started by
110 comments, last by taby 1 year, 7 months ago

I am stumped by the simplest of problems. When I “flip” the object, I do:

model = scale(model, vec3(1, -1, 1));

… everything is messed up. It seems that the normals are messed up.

Advertisement

taby said:
… everything is messed up. It seems that the normals are messed up.

Maybe it's because winding order is reversed.
There is some GL command to set this, something like glSetFrontFace(GL_CCW or GLCW).
But it might be better to flip vertex indices from [a,b,c] to [a,c,b] per triangle.

I could have sworn that I tried that. Second time I tried it, it works. Thanks man.

I"ve got the scaffolding up in the code. I should have it working tomorrow, if it will work at all.

One last screenshot LOL

Looks good : )

But i still wonder about all the Peter Panning going on on the top edge of vertical faces, which seem to be back faces of both lights.
So they should be completely black, no matter what the shadow map test gives. Still confused by that.

There is also a discontinuity of DOF on / off near the camera. If all else fails, you can fix such issues with jittering, e.g. by adding small random numbers to the radius, to turn banding into noise.

Well, I have reflections working, but the depth buffer is messed up.

Haha, wow - you really work fast.

But i guess that's planar reflections, no SSR?

Yep, it’s only planar, one plane. LOL it’s a hack

taby said:
LOL it’s a hack

Nah. SSR is a hack. Planar is ground truth.

Just only for one plane, but not sure if we have researched all related options well already.
E.g. we could implement SSR using two or more images to minimize the missing information problem. Some research papers proposed such things for various reasons.
Seems expensive, but so is DXR.

I was thinking on a ‘reversed’ algorithm to get reflections.

Idea is:
Process each surface just once, like rasterization does.
Then, for each processed ‘fragment’, find the (potentially multiple) parts in the image where it is reflected and accumulate contribution.

So instead having rays traversing a acceleration structure from the shading point to the unknown reflected surface, we do it the other way around.
Likely we again need AS to do the search. But we could build this AS from the framebuffer. No need to have it for the whole scene. That's interesting.

I ended up at an algorithm which is very similar to ray packets. So disappointingly, i got back to just another variant of classical ray tracing.
But maybe i've overlooked something…

This topic is closed to new replies.

Advertisement