Mirror effect on wet surface

hello guys, i’d like to make a kind of wet surface ground on wich we can see everything mirrored, is it possible to do it on JMOnkey?
if not do you guys have any clues on how to do it ? thanks!

You could take a look at the water stuff, that will give you a starting point.

yes, i’d like to do the same thing as the water shader but of hard surfaces

With SimpleWaterProcessor, you could setDistortionScale(0f) to get a flat, calm surface and setWaterDepth(0f) to make the surface opaque. Would that fulfill your desire?

1 Like

I remember reading an article recently (recently is relative to god knows what) that many games are doing this in screen space now as apposed to re-rendering the scene for real-time reflection. I have no clue if JME currently does this, but if not… There are a ton of articles on the web about how to go about doing this.

EDIT: Keep in mind this won’t work on Android currently, however, this might be the case for the water effect in JME as well.

@navycougar said: hello guys, i'd like to make a kind of wet surface ground on wich we can see everything mirrored, is it possible to do it on JMOnkey? if not do you guys have any clues on how to do it ? thanks!

Well, to directly respond to this: Yes, it is possible! :slight_smile: It is more a matter of a shader than of an engine.
Someone already did something similar some time ago. Maybe he will be able to shed some light on this problem. It was one awesome guy (sadly not much updates from him recently), let me remember his name … something about mTheoryGame … aha @thetoucher. :stuck_out_tongue_winking_eye:

For wet surfaces i suggest some screenspace thing since it would not required to rerender the scene… and you probably don’t need full reflection

Many games (eg borderlands2, source engine) just use our limited visual processing. In fact, they have a spheremap/cubemap and just use that one for reflections, the default lighting material can do this already. The map is either static (as seen in borderlands2) or ona few selected points generated and the one generated next to the actual position is used.

@sgold said: With SimpleWaterProcessor, you could setDistortionScale(0f) to get a flat, calm surface and setWaterDepth(0f) to make the surface opaque. Would that fulfill your desire?
IMO this is the simplest way to have this effect out of the box without any complex shader coding involved.

we do not use a screen space approach, the scene is rendered again from the reflected point of view and the resulting texture is applied on the water surface.

@nehon said: IMO this is the simplest way to have this effect out of the box without any complex shader coding involved.

we do not use a screen space approach, the scene is rendered again from the reflected point of view and the resulting texture is applied on the water surface.

hello nehon, yes, i’ve taken a look at the water processor, It handles reflection and refraction, but there is a big flaw in it I think,
because we have to specify the reflection plane, and since the water is always flat and distorted in shader it doesn’t work for hard surfaces, because they can have different heights, angles, distortions…

since I am making a custom mesh with different heights on the surfatio reflection can be false :confused:

is there anything I can do ? Or i’ll have to work with it that way?

@navycougar said: hello nehon, yes, i've taken a look at the water processor, It handles reflection and refraction, but there is a big flaw in it I think, because we have to specify the reflection plane, and since the water is always flat and distorted in shader it doesn't work for hard surfaces, because they can have different heights, angles, distortions....

since I am making a custom mesh with different heights on the surfatio reflection can be false :confused:

is there anything I can do ? Or i’ll have to work with it that way?

You have three choices, basically:
-screen space reflections implemented yourself in complex post-processing shaders. There are numerous limitations since they can obviously only reflect what is on screen and not what’s hidden.
-real reflections in which case you would have to render the scene once for every reflective plane (given your description I think this is a non-starter)
-fake it with environment maps as someone else mentioned. In that case you will not have real reflections at all as you will only be reflecting what was rendered (or already exists) in the cubemap.

@pspeed said: You have three choices, basically: -screen space reflections implemented yourself in complex post-processing shaders. There are numerous limitations since they can obviously only reflect what is on screen and not what's hidden. -real reflections in which case you would have to render the scene once for every reflective plane (given your description I think this is a non-starter) -fake it with environment maps as someone else mentioned. In that case you will not have real reflections at all as you will only be reflecting what was rendered (or already exists) in the cubemap.

the cube map seems great, so basically I take snapshots of the scene in 6 different angles, top left bottom… uising the viewport and 6 cameras, and then I set the texture of my terrain with it?

this looks great, maybe I can update the cubemap everytime a new object/furniture is added to the scene, do you have any examples of implementation for this?