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.

Stupid shader tricks

Post Apr 15th '18, 16:56

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

TrajansRow

Post Apr 15th '18, 22:20

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

ravenshining
Hawai'i

Post Apr 15th '18, 22:30

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

TrajansRow

Post Apr 15th '18, 23:28

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

ravenshining
Hawai'i


Return to Aleph One Discussion



Who is online

Users browsing this forum: No registered users

cron