News for hackers. Stuff that matters.
Re:Shader-like holographic effects with CSS by gilbetron on Thursday July 07, 2022 @04:23PM (#32018846)
Not anything like a shader, really, just standard non-shader masking and blending. (I mean, you can implement them in a shader, but that's besides the point). Nothing standard fixed pipelines haven't been doing for ages.

Having said that, it is an excellent use of it - well applied, and the explanation is solid!

Re:Shader-like holographic effects with CSS by monocasa on Thursday July 07, 2022 @10:33PM (#32022366)
Simple pixel shaders are pretty much the same thing. PS 1.0 hardware was the same hardware as register combiners, the compiled shader program was simply what got blitted over the register combiner config registers. You could absolutely write a simplified shader ASM that would compile to these css statements.
Re:Shader-like holographic effects with CSS by gfxgirl on Thursday July 07, 2022 @06:04PM (#32020140)
agreed and honestly really annoying when the wrong terms are used and then you need to invent new words to distinguish the actual thing "shaders" from layering effects.
Re:Shader-like holographic effects with CSS by dylan604 on Thursday July 07, 2022 @02:27PM (#32017567)
For once, something I'm actually more than impressed by the overall effect. I love the fact that someone was familiar enough with all of the abilities of CSS plus other effects to be able to pull it off in the confines of CSS.
Re:Shader-like holographic effects with CSS by danuker on Thursday July 07, 2022 @03:43PM (#32018413)
The simple gradients used give it an "artificial" or "color-overexposed" look.

Check out perceptually uniform color maps:

https://colorcet.com/

Re:Shader-like holographic effects with CSS by paulsmith on Thursday July 07, 2022 @03:27PM (#32018243)
I wonder if you could use this to achieve an animation effect like some 8- and 16-bit games did with color cycling. eg http://www.effectgames.com/effect/article-Old_School_Color_C...
Re:Shader-like holographic effects with CSS by thecloud on Thursday July 07, 2022 @04:01PM (#32018617)
not exactly color cycling per se, but you might be able to achieve a similar animation effect by overlaying an svg turbulence filter over a mask of the waterfall, like described here[0]

unfortunately the dynamic displacement mapping is not very performant and this technique is hard to pull off on mobile devices

[0] https://redstapler.co/realistic-water-effect-svg-turbulence-...

Re:Shader-like holographic effects with CSS by aaaaaaaaaaab on Thursday July 07, 2022 @03:37PM (#32018352)
You can't.
Re:Shader-like holographic effects with CSS by dylan604 on Thursday July 07, 2022 @03:58PM (#32018583)
What if your mask/specular layers were made of an SVG that you then animate the colors within to "cycle"?
Re:Shader-like holographic effects with CSS by aaaaaaaaaaab on Thursday July 07, 2022 @05:14PM (#32019520)
Color cycling works with paletted images. CSS blending modes work in RGB with a limited set of blend functions. The closest thing to color cycling is "filter: hue-rotate(...)", but you can't limit the colors to a particular subset of the hue wheel, so it's gonna be useless.
Re:Shader-like holographic effects with CSS by dylan604 on Thursday July 07, 2022 @06:23PM (#32020339)
Right, but the colors within the SVG are what is cycling. It's not a rasterized image, so you could create a "pixel map". I'm not saying it's not convoluted as hell, but the effect [w|c]ould look paletted
Re:Shader-like holographic effects with CSS by aaaaaaaaaaab on Thursday July 07, 2022 @06:45PM (#32020588)
At that point what's the purpose of having a mask image + blending at all?
Re:Shader-like holographic effects with CSS by dylan604 on Thursday July 07, 2022 @09:25PM (#32021911)
because you can now overlay onto other RGB rasterized images

The SVG is just the spectral map. We're using its native possibilites to pull off some other crazy wild hare of an idea to do things that other image compositing programs do, but in a browser. I'm way way outside a box here, but that's where I prefer to play. This is one of those things where I'm taking an idea that someone developed with a specific idea, but I'm jerking the wheel hard left to suggest something zanny just because it might be interesting and cool. Following directions and creator's intent is boring ;-)

Re:Shader-like holographic effects with CSS by eurasiantiger on Thursday July 07, 2022 @11:29PM (#32022737)
You can also overlay animated <canvas> elements.
Re:Shader-like holographic effects with CSS by aaaaaaaaaaab on Friday July 08, 2022 @08:18AM (#32026229)
I don’t really get what you’re saying, but ok.
Re:Shader-like holographic effects with CSS by andix on Thursday July 07, 2022 @03:51PM (#32018502)
It's kind of cool. But I don't like the results. Doesn't look nice, or fancy. Just odd.
Re:Shader-like holographic effects with CSS by dylan604 on Thursday July 07, 2022 @03:56PM (#32018560)
We all like different things. The thing that impresses me is getting the result out of CSS only. Now it is out there and potentially other people can now take the idea and run with it to potentially make even more interesting ideas. These are just proof of concepts to get the imagination running on the potential of being possible.
Re:Shader-like holographic effects with CSS by rchaud on Thursday July 07, 2022 @03:59PM (#32018587)
The article is still very helpful esp. if you've tried to use mix-blend-mode before to tint photos like how Photoshop does pretty easily. To have this ability in CSS is a big leap forward.
Re:Shader-like holographic effects with CSS by synu on Thursday July 07, 2022 @03:08PM (#32017984)
Does this not work on mobile? I don’t seem to be seeing it on iOS Chrome.
Re:Shader-like holographic effects with CSS by bawolff on Thursday July 07, 2022 @03:34PM (#32018315)
Seems like the answer should be yes https://caniuse.com/?search=blend-mode

I can confirm it works on android

Re:Shader-like holographic effects with CSS by Uehreka on Thursday July 07, 2022 @03:51PM (#32018501)
From the known issues tab:

> iOS Safari is reported to not support multiple background-blend-modes

Since iOS Chrome is really just an iOS Safari webview, that means it won't work there either.

Re:Shader-like holographic effects with CSS by camjohnson26 on Thursday July 07, 2022 @03:34PM (#32018312)
It’s basically only visible when scrolling, and yeah I don’t see the effect on mobile.
Re:Shader-like holographic effects with CSS by tedunangst on Thursday July 07, 2022 @03:58PM (#32018582)
Well, this explains why I couldn't understand why you wouldn't just do it in photoshop.
Re:Shader-like holographic effects with CSS by theandrewbailey on Thursday July 07, 2022 @04:33PM (#32018966)
Yeah, not having the right browser would make it more... static.

If you did it in photoshop, you can't alter the image based on where it is in the viewport. Doing it in this CSS way, the image subtly changes as it scrolls past (particularly the bloom to the right covering someone's head).

Re:Shader-like holographic effects with CSS by soperj on Thursday July 07, 2022 @04:12PM (#32018735)
Another Safari fail.
Re:Shader-like holographic effects with CSS by totetsu on Thursday July 07, 2022 @10:01PM (#32022175)
If you could link that holographic sticker effect to mobile tilt input that would be neat.
Re:Shader-like holographic effects with CSS by Baloo on Monday July 11, 2022 @05:44AM (#32054048)
You can definitely link it to gyroscope
Re:Shader-like holographic effects with CSS by brundolf on Thursday July 07, 2022 @07:14PM (#32020893)
It works for me on regular iOS Safari. The effect is subtle in some of them; easier to see on the ones you can toggle yourself
Re:Shader-like holographic effects with CSS by cercatrova on Thursday July 07, 2022 @09:15PM (#32021844)
That's because iOS browsers are just a reskin of Safari, and Safari does not support multiple background-blend-modes.
Re:Shader-like holographic effects with CSS by ThomW on Thursday July 07, 2022 @09:13PM (#32021822)
I didn't see it on my iPhone's iOS Safari either. :/
Re:Shader-like holographic effects with CSS by sexy_seedbox on Thursday July 07, 2022 @08:35PM (#32021560)
Works fine on Kiwi Browser.
Re:Shader-like holographic effects with CSS by beebeepka on Thursday July 07, 2022 @04:22PM (#32018831)
Runs fine on Firefox.
Re:Shader-like holographic effects with CSS by junon on Thursday July 07, 2022 @03:21PM (#32018167)
Wow, the rare new CSS trick that actually looks really nice. Bravo.
Re:Shader-like holographic effects with CSS by MrLeap on Thursday July 07, 2022 @02:22PM (#32017514)
It's a shame filter: custom() died. It would be easier to skip shader-like and just go right to shader.
Re:Shader-like holographic effects with CSS by beebeepka on Thursday July 07, 2022 @04:19PM (#32018812)
Damn, this can't be upvoted enough. I almost never say this but what an awesome read. Good job, whoever you are.

CSS doesn't get enough recognition but it really is a very powerful tool. Yes, performance is an issue but running canvas at 60 FPS isn't exactly cheap either. Fans will be spun

Re:Shader-like holographic effects with CSS by ZeroGravitas on Friday July 08, 2022 @06:17AM (#32025153)
I don't think I've ever seen a simple explanation of the mix blend modes. Seems most people use them in a trial and error kind of way.

Surely one exists as they're a very common tool across Photoshop and now web, but is just swamped by the people repeating the basic instructions.

Feels like an explanation might need to split between various tasks but focus on the fact that you are changing each pixel by different amounts. The confusing thing is that the choice of which pixel to change, and how to change it, is a combination of the source images and the blend mode.

Re:Shader-like holographic effects with CSS by bawolff on Thursday July 07, 2022 @03:21PM (#32018175)
This made me nostalgic for that css/edge demo from back in the day [1]. This demo seems like a similar idea as the css/edge demo just taken much further.

[1] https://meyerweb.com/eric/css/edge/complexspiral/glassy.html

Re:Shader-like holographic effects with CSS by unraveller on Friday July 08, 2022 @10:29PM (#32030832)
Remove Sticky bookmarklet to get rid of the CSS overlays protruding into the beautiful content area.

    javascript:(function(){   let i, elements = document.querySelectorAll('body *');   for (i = 0; i < elements.length; i++) {     if(getComputedStyle(elements[i]).position === 'fixed'        || getComputedStyle(elements[i]).position === 'sticky'){       elements[i].parentNode.removeChild(elements[i]);     }   } window.history.replaceState( {} , document.title, location.href+'#cleaned')})()
Re:Shader-like holographic effects with CSS by fio_ini on Thursday July 07, 2022 @03:10PM (#32018003)
Dude this guy is a god at CSS. Wow thanks for the tips and tricks!
Re:Shader-like holographic effects with CSS by dylan604 on Thursday July 07, 2022 @04:00PM (#32018600)
And I still have issues getting layouts to flow correctly, and then this person comes along and does this type of stuff. Seriously impressive CSS knowledge this one has.
Re:Shader-like holographic effects with CSS by _the_inflator on Thursday July 07, 2022 @01:45PM (#32017068)
This is a very in-depth and thorough article and fun to play with the techniques mentioned. Some view modes however, are best viewed with LSD... ;)
Re:Shader-like holographic effects with CSS by etaioinshrdlu on Thursday July 07, 2022 @07:25PM (#32021010)
Would have been a nice combo with device orientation, but alas, that's now considered a security hazard.
Re:Shader-like holographic effects with CSS by dumpsterdiver on Thursday July 07, 2022 @07:41PM (#32021150)
I'm curious what security hazard you're referring to? Just wondering if I missed a news cycle, because I don't recall hearing about a security issue in this context.
Re:Shader-like holographic effects with CSS by etaioinshrdlu on Thursday July 07, 2022 @09:00PM (#32021741)
Could read here for more: https://www.wired.com/story/mobile-websites-can-tap-into-you...

At one point, this was available by default, but no longer.

Re:Shader-like holographic effects with CSS by rendall on Friday July 08, 2022 @04:47AM (#32024521)
For me on both Android mobile and desktop Chrome, the effect is there but rather subtle. On desktop it was so subtle that I thought it wasn't working, at first. Perhaps screen brightness affects it. It is an extremely bright day now, here.
Re:Shader-like holographic effects with CSS by eminence32 on Thursday July 07, 2022 @03:10PM (#32018005)
This is neat, and it makes me more fully realize how complicated modern CSS engines must be!
Re:Shader-like holographic effects with CSS by mirekrusin on Thursday July 07, 2022 @02:54PM (#32017821)
Really nice.

ps. we'll surely wake up tomorrow to holographically-authentic-NFTs all over the place!

Re:Shader-like holographic effects with CSS by mkdirpepper on Thursday July 07, 2022 @10:26PM (#32022330)
Does rendering this type of stuff drain the battery on mobile devices as the processor attempts to render all this?
Re:Shader-like holographic effects with CSS by rchaud on Thursday July 07, 2022 @01:42PM (#32017013)
Useful article, the visual examples help a lot. As the author says "why should JS have all the fun?"
Re:Shader-like holographic effects with CSS by aaaaaaaaaaab on Thursday July 07, 2022 @03:38PM (#32018369)
Someone discovered CSS blend modes!
Re:Shader-like holographic effects with CSS by spartanatreyu on Thursday July 07, 2022 @07:39PM (#32021131)
Blend modes are usually either boring (e.g. sepia) or used to make something hacky that doesn't have a better solution...

But every now and then someone uses blend modes to their fullest potential and I get all fuzzy inside.

Re:Shader-like holographic effects with CSS by theandrewbailey on Thursday July 07, 2022 @04:40PM (#32019063)
Could this be implemented with ::before and ::after pseudo elements on a parent element?
Re:Shader-like holographic effects with CSS by a-walker on Thursday July 07, 2022 @03:11PM (#32018025)
That hologram looks real.
Re:Shader-like holographic effects with CSS by samstave on Thursday July 07, 2022 @03:26PM (#32018233)
This is FN awesome.

Ill never have use, but I can't wait to see this in the wild.

One thought: FORCE any site that uses this to not be behind a cookie paywall ;-)