Stupid shader tricks

Have a question, suggestion, or comment about Aleph One's features and functionality (Lua, MML, the engine itself, etc)? Post such topics here.
Post Reply
User avatar
TrajansRow
Born on Board
Posts: 69
Joined: Sep 29th '16, 15:53

I took a stab at tweaking the wall and sprite shaders to create sort of a volumetric media effect. It's not perfect, but probably better than the default fader:

https://youtu.be/ZyrMaOJrMN4

Conveniently, it also handles the case where the camera can see both above and below the media at the same time!
User avatar
ravenshining
Vidmaster
Posts: 889
Joined: Jun 17th '17, 22:50
Location: Hawai'i

That is amazing! This makes having transparent liquids always on finally work.

Is that the mobile version of Aleph one? Is this portable to the regular Aleph One?
User avatar
TrajansRow
Born on Board
Posts: 69
Joined: Sep 29th '16, 15:53

This was sort of a dirty modification I threw in while I was in the process of updating some shaders for OpenGL ES2. The work might be useful in the main engine when it’s further along.

To make it work in the current Aleph One, we need an additional vec4 uniform fed into the various fragment shaders, which represents the plane of the media in the polygon being rendered. Then in the shader, you just do a dot product to see whether the fragment is above or below the media, and tint accordingly.
User avatar
ravenshining
Vidmaster
Posts: 889
Joined: Jun 17th '17, 22:50
Location: Hawai'i

TrajansRow wrote:This was sort of a dirty modification I threw in while I was in the process of updating some shaders for OpenGL ES2. The work might be useful in the main engine when it’s further along.

To make it work in the current Aleph One, we need an additional vec4 uniform fed into the various fragment shaders, which represents the plane of the media in the polygon being rendered. Then in the shader, you just do a dot product to see whether the fragment is above or below the media, and tint accordingly.
I have no idea what any of that means, but I sure hope someone who does takes interest.

From the scenario developer's perspective, we would need to be able to specify the colour. For example, grabbing what colour to use from the media fader for the appropriate liquid as it is specified in MML would be convenient enough that it could be backwards-compatible with scenarios that already have custom liquids.
User avatar
TrajansRow
Born on Board
Posts: 69
Joined: Sep 29th '16, 15:53

This is a crude sprite emboss effect. It mostly works as you would expect; you can see the glare on objects shift as the player pans left/right. The only major issue is that the effect is sometimes flipped horizontally or vertically, depending on how the sprite was transformed for display (I’m not sure how to detect that situation in the shader yet).


https://youtu.be/6-mrzCgU1wg

https://youtu.be/0LLGXO2bx7A
User avatar
ravenshining
Vidmaster
Posts: 889
Joined: Jun 17th '17, 22:50
Location: Hawai'i

I'm going to have to start maintaining a fork of A1 with your improvements :-P

I mean I guess I already do, with my music behaviour restoration. Just now I'll synthesise multiple sources of goodness.
Post Reply