I've looked at the way the fuzzy reflection map is supplied for vanilla entities in 0.18.
TL;DR - it seems to be a fuzzy upside-down silhouetted version of one frame of the source entity, red channel only. But it's hard to make out exactly how they were made.
I have a mod with about 40 custom entities, most of them 3x3 tiles, but some larger, and some are "tall", exceeding their selection box substantially, i.e. more likely to be caught by the north shore of some water.
Can anyone suggest an automated method of producing the reflection sprite, given the 0.17 prototype data? I can't face doing them all manually one by one, with all their different sizes and offsets and frame counts, and I don't have a copy of the individual separate frames for most of the entities, just the final sheets.
Water reflections
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Water reflections
Last edited by Deadlock989 on Sat Oct 24, 2020 2:49 pm, edited 1 time in total.
Re: Question about reflections
Here is the basic process:
Regarding automation, if you have only sheets then setting up automation would probably take longer than making it by hand. Doing it by hand might be tedious, but it is a fairly simple process. If you have separate frames centered without offset then Photoshop Batch is the fastest route. Just make an Action with invert and blur operations. Gimp and some other editors also have some batching if Photoshop is not an option.
- Invert image along the Y-axis or render shadow type image which will be more accurate
- If inverted then probably some manual painting is required to mimic the reflection shape
- In Photoshop I used gaussian blur with 5 pixels radius
Regarding automation, if you have only sheets then setting up automation would probably take longer than making it by hand. Doing it by hand might be tedious, but it is a fairly simple process. If you have separate frames centered without offset then Photoshop Batch is the fastest route. Just make an Action with invert and blur operations. Gimp and some other editors also have some batching if Photoshop is not an option.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Question about reflections
Here is how I managed to automate this in Blender 2.79 for a custom offshore pump (the only entity that will always have a visible reflection) in case anyone else has ever struggled with this.
1. Set up a water reflection plane and put it on a special layer all of its own. It should be about 16 pixel-equivalent-units (per HD scale 0.5) below the usual ground level. It should have a pure white metallic surface that is pretty rough (0.5 roughness in the Principled BSDF shader). Exclude all of your existing light sources and the ground layer from your reflection layer and set up a special sun lamp that is pointing directly downwards and has a spot size about double what you have for your regular non-shadow lighting. Your actual objects should not be included in this layer but not excluded either (so that their reflection shows up but their actual structure doesn't).
2. Turn off environmental lighting in the reflection layer and give it a separate AO pass. Have AO set to about 16 units in the world settings but leave it turned off (Blender still calculates it for the compositor pass but turning it "off" stops it being automatically added to the main pass output - unless you want that, but I prefer to handle it separately in the compositor for more control over how the AO is blended).
3. We use the AO pass for the foam because it only shows up where your pipes meet / are very close to the water level, and the blurred reflection as the reflection itself. In the Compositor, you want to take the main image, invert it, then ramp it so the majority of the surface (where no reflection is falling) is black. Doesn't hurt to blur it a bit as well, the rendering is going to distort the hell out of it anyway. Put that into the red channel of a Combine RGBA node. Do similar for the AO pass output and put it into the blue channel. Tweak your ramps until you get the desired effect.
4. Hey presto, you have your reflection and foam channels.
5. Figuring out how the holy fuck to get the border cropping and shift values right is an exercise I leave to the reader. Hint: if all else fails, you can specify individual parts of the sheet per direction in the SpriteVariations table with specific x offset values per slice, using variation_count = 1 instead of letting variation_count = 4 do it automatically with the same shift for all the directions.
1. Set up a water reflection plane and put it on a special layer all of its own. It should be about 16 pixel-equivalent-units (per HD scale 0.5) below the usual ground level. It should have a pure white metallic surface that is pretty rough (0.5 roughness in the Principled BSDF shader). Exclude all of your existing light sources and the ground layer from your reflection layer and set up a special sun lamp that is pointing directly downwards and has a spot size about double what you have for your regular non-shadow lighting. Your actual objects should not be included in this layer but not excluded either (so that their reflection shows up but their actual structure doesn't).
2. Turn off environmental lighting in the reflection layer and give it a separate AO pass. Have AO set to about 16 units in the world settings but leave it turned off (Blender still calculates it for the compositor pass but turning it "off" stops it being automatically added to the main pass output - unless you want that, but I prefer to handle it separately in the compositor for more control over how the AO is blended).
3. We use the AO pass for the foam because it only shows up where your pipes meet / are very close to the water level, and the blurred reflection as the reflection itself. In the Compositor, you want to take the main image, invert it, then ramp it so the majority of the surface (where no reflection is falling) is black. Doesn't hurt to blur it a bit as well, the rendering is going to distort the hell out of it anyway. Put that into the red channel of a Combine RGBA node. Do similar for the AO pass output and put it into the blue channel. Tweak your ramps until you get the desired effect.
4. Hey presto, you have your reflection and foam channels.
5. Figuring out how the holy fuck to get the border cropping and shift values right is an exercise I leave to the reader. Hint: if all else fails, you can specify individual parts of the sheet per direction in the SpriteVariations table with specific x offset values per slice, using variation_count = 1 instead of letting variation_count = 4 do it automatically with the same shift for all the directions.