- A reflective layer, which would reflect any objects in the scene that are above the y=0 plane. Reflections would be distorted somewhat due to a tangent-space normal map on the floor.
- A diffuse layer, which would be the nonreflective component of the floor. It'd be a steel-gray color, with a slight variation. It'd be nice to generate this map on the fly with an equation, so that the repetition of the floor pattern wasn't visible from far away.
- An ambient shadow layer, which would be blurry and baked on, and fairly subtle. This would have to be a saved texture.
GLSL reflective floor shader
GLSL reflective floor shader
I'm going to have a shiny, stainless steel floor at the y=0 plane, in world coordinates. Anyway, I was thinking that with a GLSL shader, it wouldn't be too hard to have a multi-layered floor with the following layers:
Re: GLSL reflective floor shader
Details up close - try simplex noise in the fragment shader. (google for webglnoise for one port)
Re: GLSL reflective floor shader
Try a detail mapping approach. Detail maps were used on Unreal Engine 2 so it never became too blurry when you moved near an object, i.e. when the fragment is close to the camera, make the detail map more evident, when it is far, make it less noticeable.
http://rastertek.com/tertut13.html
take a look, well, it is a DX11 tutorial, but the basics for detail mapping are there, and passing them to GLSL is trivial
http://rastertek.com/tertut13.html
take a look, well, it is a DX11 tutorial, but the basics for detail mapping are there, and passing them to GLSL is trivial
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: GLSL reflective floor shader
Thanks. I've been looking into noise algorithms, and so far that seems to be the best way to go, as long as I can get the normal map to match the detail map. Or maybe I'll just compute them separately, at different detail levels, that seems a lot easier, and probably would look okay. I mean, it's just a floor after all.
Now I'm trying to figure out if it'd be trivial to calculate the reflection based on distortions from the floor's normal map. It seems trivial, but I guess I just haven't fit all the pieces together yet.
Now I'm trying to figure out if it'd be trivial to calculate the reflection based on distortions from the floor's normal map. It seems trivial, but I guess I just haven't fit all the pieces together yet.