Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Glow bars... #14

Open
make-42 opened this issue Jun 2, 2020 · 145 comments · Fixed by #17
Open

[Feature Request] Glow bars... #14

make-42 opened this issue Jun 2, 2020 · 145 comments · Fixed by #17

Comments

@make-42
Copy link
Contributor

make-42 commented Jun 2, 2020

Basically like the shadow effect but with colors and gradients...

@nikp123
Copy link
Owner

nikp123 commented Jun 2, 2020

you can change the shadow color, which should achieve the same effect, though gradients are yet to be implemented

@make-42
Copy link
Contributor Author

make-42 commented Jun 2, 2020

It sort of achieves it but I think a different spreading curve and having it be on both sides of the bars would make the glow more convincing

@make-42
Copy link
Contributor Author

make-42 commented Jun 2, 2020

I made a demo with GLSL of what a glow effect could look like.

#ifdef GL_ES
precision mediump float;
#endif

#extension GL_OES_standard_derivatives : enable

uniform vec2 resolution;
uniform float time;

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}


void main( void ) {

	vec2 position = ( gl_FragCoord.xy / resolution.xy );
	float brightness=1.;
	float color = 0.0;
	float r = (position.y*0.843)+((1.-position.y)*0.243);
	float g = (position.y*0.)+((1.-position.y)*0.286);
	float b = (position.y*0.564)+((1.-position.y)*1.);
	float barheight = (noise(position.x+time))*(1.-position.y);
	color += ceil(sin(position.x*50.));
	color += exp(sin(position.x*50.)/brightness);
	color *= barheight;
	gl_FragColor = vec4( vec3( color*r, color*g,color*b),1);

}

http://glslsandbox.com/e#65127.5

@nikp123
Copy link
Owner

nikp123 commented Jun 2, 2020

True, it's as convincing as I thought it would be.
Since shaders achieve a lot of functionality that pure code doesn't, I though of migrating the entire OGL renderer to be VBO based instead of 90s OGL, which would allow me to just cram in shaders. But I have no idea how to organize them, so that would be a major pain to do. Also this would resolve many workarounds that I've implemented simply due to default shaders being different on different drivers and OS-es. I think I have a demo working in VBO, so that would be a good starting point.

@nikp123
Copy link
Owner

nikp123 commented Jun 2, 2020

The tree is 70 commits old, so it shouldn't be that hard to work with. Just updates are going to be slow since I'm busy atm.

https://github.com/nikp123/xava/tree/opengl-vbo

@nikp123
Copy link
Owner

nikp123 commented Jun 2, 2020

Also since I'm kinda bad with OGL, can you link me to a resource where I could share local variables (in C code) with shader code.

@make-42
Copy link
Contributor Author

make-42 commented Jun 3, 2020

Will do!

@make-42
Copy link
Contributor Author

make-42 commented Jun 3, 2020

@make-42
Copy link
Contributor Author

make-42 commented Jun 3, 2020

Improved the demo and edited my comment...

@nikp123 nikp123 added the feature label Jun 4, 2020
@nikp123 nikp123 added this to the switch to VBO milestone Jun 4, 2020
@nikp123 nikp123 linked a pull request Jun 4, 2020 that will close this issue
@make-42
Copy link
Contributor Author

make-42 commented Jun 4, 2020

Hell yeah! Nice work!

@make-42
Copy link
Contributor Author

make-42 commented Jun 5, 2020

Made it generate a curve http://glslsandbox.com/e#65127.6

@make-42
Copy link
Contributor Author

make-42 commented Jun 5, 2020

For integrating it inside the program I just need to replace float barheight = (noise(position.x+time))*(1.-position.y); with float barheight = data(position.y);

@make-42
Copy link
Contributor Author

make-42 commented Jun 5, 2020

ehehehehe http://glslsandbox.com/e#65239.0

@make-42
Copy link
Contributor Author

make-42 commented Jun 6, 2020

A short video shot at 800x450,60fps showing my shader in action...
XAVAShaderDemo.zip

@make-42
Copy link
Contributor Author

make-42 commented Jun 7, 2020

Ported my shader to GLava in about 10 min...

reencodeportedtoglava.zip

@nikp123 nikp123 reopened this Jul 25, 2020
@nikp123
Copy link
Owner

nikp123 commented Jul 25, 2020

Guess I closed this issue by accident, sorry.

@nikp123
Copy link
Owner

nikp123 commented Aug 20, 2020

I'm adding the "help wanted", since the current shader is quite unoptimized (a whole third of an Intel HD5500 used when being run). If anyone could come up with a:

  • Customizable (being able to change not just the looks, but also the shape of the visualizer) - like being able to go from bars (the default) to a circle (potentially)
  • Lightweight (I mean this speaks for itself really)
  • Simple to implement (Like not adding an additional 10k SLOC and/or chaning the entire codebase to accomidate the change)

solution, I would gladly accept it.

@nikp123
Copy link
Owner

nikp123 commented Jan 28, 2021

dynamically loading code sounds fun

Obviously need to clean this up and make the functionality flawless before even thinking about merging it to master.

@nikp123
Copy link
Owner

nikp123 commented Jan 28, 2021

by the way, I think leaving XAVA logic purely to the cpu is the best option, while I could for example make an output mode which processes shaders on top of what the dynamic function did

If this turns out to be the best solution, redoing this as a lib would be the solution, since it doesnt interfere with what I've already done, increasing stability.

@nikp123
Copy link
Owner

nikp123 commented Apr 25, 2021

I guess implementing geometry shaders would be better, as doing this logic in fragments is just silly.

Anyway future me, start off here: https://www.youtube.com/watch?v=r2hue52wLF4

@nikp123 nikp123 closed this as completed Aug 29, 2021
@nikp123 nikp123 reopened this Aug 29, 2021
@nikp123
Copy link
Owner

nikp123 commented Aug 29, 2021

oops

nikp123 added a commit that referenced this issue Aug 29, 2021
This will prevent issues like
#14 (comment)
creeping up.

Related issues: #14, #41, #39
@make-42
Copy link
Contributor Author

make-42 commented Aug 31, 2021

fixed the issue

@make-42
Copy link
Contributor Author

make-42 commented Aug 31, 2021

kinetic still doesn't work

nikp123 added a commit that referenced this issue Sep 1, 2021
This means that I'll be able to ship multiple shaderpacks relatively
effortlessly at the cost of some UX on the users side, because the
errors would be more confusing. Sorry.

Related #14
nikp123 added a commit that referenced this issue Sep 1, 2021
@nikp123
Copy link
Owner

nikp123 commented Sep 1, 2021

the issue was simple... only files labeled with "default" were treated as XAVA configs. The others were custom and therefore featured a different error message. Instead of checking which default files were installed, I just made it so that it treats custom shaderpacks as default ones.

@nikp123
Copy link
Owner

nikp123 commented Sep 2, 2021

Anyway on your side, you'll just have to clear the shaders folder and run XAVA again.

@make-42
Copy link
Contributor Author

make-42 commented Sep 2, 2021

It works, kinetic darkens the viewport when there is a high velocity of bars right?

@nikp123
Copy link
Owner

nikp123 commented Sep 2, 2021

yes

@make-42
Copy link
Contributor Author

make-42 commented Sep 2, 2021

Nice

@nikp123
Copy link
Owner

nikp123 commented Sep 3, 2021

Actually I like the opposite effect more. Sending in a new version

@nikp123
Copy link
Owner

nikp123 commented Sep 3, 2021

@nikp123
Copy link
Owner

nikp123 commented Oct 14, 2021

image
geometry shaders BOII

ps: gpu requirements up in OGL 4.2. Sorry not sorry that your Librebooted T60 ain't gonna run this.

@nikp123
Copy link
Owner

nikp123 commented Oct 14, 2021

also PS: OpenGL ES is dead also

@nikp123
Copy link
Owner

nikp123 commented Oct 14, 2021

dd3a6c4

i should've just used modern ogl from the beginning, it's so MUCH better and I wouldn't be rewriting this once again

@make-42
Copy link
Contributor Author

make-42 commented Oct 16, 2021

ouch

@nikp123
Copy link
Owner

nikp123 commented Oct 20, 2021

yet i wrote it once again

turns out cutting out a single stage made things significantly worse to work with

@bypepe
Copy link

bypepe commented Nov 4, 2021

is it possible to see the highest level peaks??
regards

@nikp123
Copy link
Owner

nikp123 commented Nov 4, 2021

is it possible to see the highest level peaks?? regards

Not ATM. I was thinking about adding lua support since geometry shaders are not flexible enough.

Currently debating whether I should do lua or add C "modules".

Lua is easy, compatible, less prone to errors

C is native, faster and fundamentally more flexible

Performance is no biggie since it's basically doing basic math each frame...
Compatibility is big because with Lua I'd most likely have to generate huge header files.
Also I'd like for the shaders to be simple enough that anyone with basic programming knoweledege could do them

That's where I'm at ATM. The current shader system sucks even if it has all this effort put into it.

@nikp123
Copy link
Owner

nikp123 commented Nov 4, 2021

Also with Lua scripts or "C modules" I could lower the OGL requirements once again.

@make-42
Copy link
Contributor Author

make-42 commented Nov 12, 2021

Personally, C modules sound better to me, but since this is your project, you can do as you wish!

nikp123 added a commit that referenced this issue Nov 14, 2021
A lot to go through, but in a nutshell.

OpenGL renderers are now independent from their captive window
libarary-based outputs. They are platform agnostic since all they use is
the cross-platform OpenGL stuff. Pre shaders are gone since mixing those
always causes unforseen consequences, instead they are managed by the
"gl_module" that is responsible about how the visualizer will be shaped.

For now only "bars" is introduced as a stable interface for other
gl_modules to be built off of. Since GL modules are independent by their
own design that means that they carry a ton of code all by themselves,
so future plans would be that I introduce some feature testing
functionality within xava-shared and use that to test whether the
remaining post shaders are compatible with the gl_module that you're
running.

Overdesigned? I'd say so.

Also for the same purposes I'll try to split the "bars" default module
into seperate functions that can be reused by other modules so they
don't have to carry as much code as "bars" does now. The idea is that
they are imported as macros/functions within your OpenGL codebase

That will allow me to easily test for supported features within the
shader loader so that it will properly alert the user instead throwing a
compiler error at them.

Over-engineered as well, because software sucks.

Signing out,
nik
@nikp123
Copy link
Owner

nikp123 commented Nov 16, 2021

i think they're good enough now...

@nikp123
Copy link
Owner

nikp123 commented Feb 16, 2022

Update, gl modules exist and are cairo-like. Now to just implement them ;)

nikp123 added a commit that referenced this issue Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants