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

GLSL skinning (feature request) #8582

Closed
kebabmamedov opened this issue Apr 2, 2020 · 7 comments
Closed

GLSL skinning (feature request) #8582

kebabmamedov opened this issue Apr 2, 2020 · 7 comments
Labels
area:skinning priority:3 Nice to have, at some point

Comments

@kebabmamedov
Copy link

I don't know if you use OpenGL or Vulkan for graphics, if you do, here's my suggestion:
Can you add custom fragment shaders support? You would draw all the GUI elements with specific shaders. The uniforms can be:

vec2 onScreenPos;
vec2 posInElement;
vec4 elementEdgesDistance; 
float time; // not sure what measurement system can be used for time

and for font postprocessing, perhaps

struct text {
  vec4 corners;
  sampler2D texture;
}

uniform text texts[/**<amount of texts in the element>*/];

and other specific uniforms for each element type. Also there can be a sampler2D called "triangles provider" for getting ready and monochrome triangles that was drawn somewhere (I didn't search this in the code), and can be used in places like buttons in osu! settings and the logo.
I don't know if this will require much PC performance, but new skins will be very cool if you can add this feature.

If you are not an OpenGL programmer, fragment shaders are scripts that can draw some effects on drawn shapes. Uniforms are variables that the scripts can use for adding more dynamic effects (based on current game state)
This idea is very raw and needs some discussing, I think.

@kebabmamedov kebabmamedov changed the title GLSL skinning GLSL skinning (feature request) Apr 2, 2020
@kebabmamedov
Copy link
Author

kebabmamedov commented Apr 2, 2020

This feature assumes that one skin can't use both GLSL and pictures

@bdach
Copy link
Collaborator

bdach commented Apr 2, 2020

As far as I'm aware the plan is to have a declarative markup language for the next version of skinning (see ppy/osu-framework#30 and ppy/osu-framework#3056). Whether custom shaders will play into that is very much up in the air, but there is a quite long way to go before we can even start considering that.

@bdach bdach added area:skinning priority:3 Nice to have, at some point proposal labels Apr 2, 2020
@kebabmamedov
Copy link
Author

kebabmamedov commented Apr 2, 2020

As far as I'm aware the plan is to have a declarative markup language for the next version of skinning (see ppy/osu-framework#30 and ppy/osu-framework#3056). Whether custom shaders will play into that is very much up in the air, but there is a quite long way to go before we can even start considering that.

For implementation processing just shaders is simpler than processing a custom declarative language

@bdach
Copy link
Collaborator

bdach commented Apr 2, 2020

I'm not sure having skinning done entirely on shaders is viable either. The overhead of marshaling data from CPU to GPU and then back every update frame would probably kill performance.

@kebabmamedov
Copy link
Author

kebabmamedov commented Apr 2, 2020

But in a normal OpenGL application you do the same with default shaders. People have GPUs to process graphics on them, not preprocessed on CPU mush

@bdach
Copy link
Collaborator

bdach commented Apr 2, 2020

Not entirely true. Yes, the CPU->GPU run is currently there to upload OpenGL buffer data, but framework-side there are specific optimisations done to avoid overdraw (such as layout invalidation and front-to-back rendering) that I think in the case of what you're proposing would require information (i.e. about drawable colour & bounds) to be marshaled back to CPU from GPU, which is something that I'm pretty sure is not done currently and will be a performance hit. Well, unless that code is also migrated to shaders, but that sounds very unlikely.

@peppy
Copy link
Member

peppy commented Apr 3, 2020

we may add per element shader support in a distant future. too far forward to keep this issue open right now. let’s make the skinning system first.

@peppy peppy closed this as completed Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:skinning priority:3 Nice to have, at some point
Projects
None yet
Development

No branches or pull requests

3 participants