limebar, to random
@limebar@mastodon.social avatar
scdollins, to genart
@scdollins@genart.social avatar
julienbarnoin, to programming
@julienbarnoin@mastodon.gamedev.place avatar

I've been working a lot with #glsl for a while now, writing complex code. Overall, I feel like the single improvement that would make the most difference for the language would be support for pass-by-reference instead of copy in/copy out syntax, as suggested here https://github.com/KhronosGroup/GLSL/issues/84

This would make it possible to do a lot of things that are either not possible or ridiculously inefficient to compile, including object oriented programming.

#programming #gamedev

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

Also one thing that should be easier to do (I imagine) if pass by reference exists, is to accept arbitrary length arrays as parameters.

Right now you can declare a local array and iterate on it with a for loop on its .length(), but you can't move that for loop to a common function that accepts various array sizes as input. The only way to avoid repeating the code is using macros, which sucks.

Again for a language that inlines everything this seems like a strange omission.

dneto,
@dneto@mastodon.gamedev.place avatar

@gfxstrand @julienbarnoin

#WGSL has pass by ref but we call them pointers.

And it also has a no aliasing restriction; you can't have two names for the same variable memory and have a RW, WR, or WW hazard in the same function.
https://www.w3.org/TR/WGSL/#alias-analysis

And with all that our compiler does call site specialization until it boils those pointer params away. It's convenient for the programmer but can bloat code size (hopefully no more than hand rolling it yourself)

pekkavaa, to GraphicsProgramming
@pekkavaa@mastodon.gamedev.place avatar

A new post: "Shader post-processing in a hurry"

How to improve the perceived image quality by avoiding basic mistakes.

https://30fps.net/pages/post-processing/

kandid, to photography
@kandid@chaos.social avatar

"into the dark"

Made another filter for the smartphone. It is a bit frustrating to take photos with this manipulation because Safari crashes after every shot on my smartphone. OK, it's too much for the device when you push it to the limit.

manipulated

renedudfield,
@renedudfield@fosstodon.org avatar

@kandid ah, I read you can connect to iOS safari with chrome dev tools.

kandid,
@kandid@chaos.social avatar

@renedudfield Thank you, I will try that.

totetmatt, to random French
@totetmatt@mastodon.social avatar

https://www.shadertoy.com/view/XcyGRz Maybe a stream today to explain all of this .

video/mp4

AgateDragon, to GraphicsProgramming
@AgateDragon@mastodon.gamedev.place avatar
julienbarnoin, to GraphicsProgramming
@julienbarnoin@mastodon.gamedev.place avatar

I know SPIR-V is not meant for human readability and all that, but damn. Is there not any way that the variables were named anything closer to useful than %13525? I understand that it's not a one-to-one match with my glsl variables, but like... This feels like it's actively trying to obfuscate the code 🥲

Maybe there's some glslang option I don't know about that tries to make them a bit clearer?

julienbarnoin,
@julienbarnoin@mastodon.gamedev.place avatar

Ha, in the light of the whole discussion around how people treated the original maintainer of , I'm having a little moment of self-awareness as I complain about the features in the open source software I'm using for free, while the amazing people who actually work on it like @gfxstrand and @crzwdjk patiently explain to me why it's not that simple... 😅

Thanks for all your work friends ! ❤️

gfxstrand,
@gfxstrand@mastodon.gamedev.place avatar

@julienbarnoin You're welcome! And we do it gladly, or at least I do. As long as I can keep getting a paycheck to go along with it, I see no reason to stop.

But also, it's okay to gripe a little about things that suck. I know they suck, too. It usually only gets frustrating when people expect me to get out my magic wand and pointy hat and retroactively fix a feature that shipped 25 years ago. 😅

pablolarah, to webdev
@pablolarah@mastodon.social avatar
AgateDragon, to GraphicsProgramming
@AgateDragon@mastodon.gamedev.place avatar

Learn how to change the look of the halftone pattern shader with different blend modes. View the Shadertoy demo to see it in action, and change the options.

http://agatedragon.blog/2024/04/01/halftone-shader-part-2/
#Shader #Shaders #Shadertoy #GLSL #artwork #coding #creativity #education #gamedevelopment #gamedev #halftone #pattern #programming #tutorial #videogames

julienbarnoin, to gamedev
@julienbarnoin@mastodon.gamedev.place avatar

Somehow I was under the impression that the const keyword for function parameters in was mostly there for the benefit of programmers, so we'd get an error if we try to modify something we're not supposed to, but that the compiler would figure out if it does get modified or not on its own.

I was wrong. I have a case where just adding the const keyword to one parameter makes a shader twice as fast - from 750µs to 300µs.
Totally unexpected for me, am I the only one?

gfxstrand,
@gfxstrand@mastodon.gamedev.place avatar

@oblomov @julienbarnoin Yes, I think? I'm having trouble parsing the original question. But it's less because of aliasing and more because GLSL doesn't have pointers/references at all. If you write

void foo(inout a, inout b) {
a = 3;
b = b + 5;
}

and then you called

x = 7;
foo(x, x);

With C or C++ reference semantics, that would turn into

x = 3;
x = x + 5;

and x would be 8. In GLSL, it's

a = x;
b = x;
a = 3;
b = b + 5;

// Then, in some order...
x = a;
x = b;

and x would be 3 or 12

oblomov,
@oblomov@sociale.network avatar

@gfxstrand @julienbarnoin oh nice example, very clear (and in some sense this is an aliasing issue, although not via pointers in the traditional C sense). And it is entirely due to what can happen in a single work-item (I'm more used to work with things like OpenCL and CUDA, where, work-items can step on each other's toes). Thank you very much.

kandid, to photography
@kandid@chaos.social avatar

This was a tea towel. I folded it by loading a shader onto the smartphone.

manipulated

kandid, to random
@kandid@chaos.social avatar

In the mathematical sense, this is is not a kaleidoscope but a conformal mapping. What they have in common with a kaleidoscope are the distortions that lead to symmetries.

(p^c-1)/(p^c+1)

This mapping (distortions of the image plane) is calculated with complex numbers. Where p are the pixel coordinates and c is a constant.

kandid, to random
@kandid@chaos.social avatar

The colors are manipulated with a shader directly in the smartphone during the shot.

The geometric distortion is a dipol conformal map. It is made with as post processing.

kandid,
@kandid@chaos.social avatar

@twilliability So far, the new workflow is very incomplete and unreliable. If it ever works I will publish it as open source.

(4/4)

kandid,
@kandid@chaos.social avatar

@twilliability This is roughly how one could implement this mapping in as a fragment shader. The constants in this example are chosen somewhat arbitrarily.

The camera image comes from a USB web cam and the effect can be calculated in real time. This is a screen shot of my test / development environment.

kandid, to photography
@kandid@chaos.social avatar

An experiment with a homemade Sobel operator. This is an edge detection filter having normally some gray scale output.

The colored edges of my Sobel variant are mixed with the original image.

made with a custom shader i added to my smart phone.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • tacticalgear
  • magazineikmin
  • cubers
  • everett
  • rosin
  • Youngstown
  • ngwrru68w68
  • slotface
  • osvaldo12
  • Durango
  • kavyap
  • InstantRegret
  • DreamBathrooms
  • JUstTest
  • khanakhh
  • GTA5RPClips
  • normalnudes
  • thenastyranch
  • mdbf
  • ethstaker
  • modclub
  • Leos
  • tester
  • provamag3
  • cisconetworking
  • anitta
  • lostlight
  • All magazines