Geometry and Compute Shaders

Hello,
I was wondering if there were any future plans to integrate support for these two shader types. Thanks for the info.

What would you use compute shaders for? Are they used at all in gaming space?

@abies said: What would you use compute shaders for? Are they used at all in gaming space?

They can be used for lots of things, actually. The GPU Gems and GPU Pro books all devote significant amounts of paper to compute shaders for a variety of things too numerous to list here. Easily 80% of those are applicable to games.

Edit: that being said… there are no current plans to integrate these until someone has a specific need and pushes that ball forward.

1 Like

I guess we’ll do it eventually. But I guess we’ll add all shader stages type at once, for card that supports them, including the tessellation stage.
That’s not priority one though

Hi

I already added some support of geometry and tessellation shaders into another engine, it wouldn’t be very difficult to implement in the existing renderers but I don’t know what it would imply in the editor and in some high level helpers.

Also there is a inofficial tesselation stage floating in the forums around, that does probably work with minimal or no adjustments.
(Actually we should probably put it on git or similar, so it can be kept current while inofficial, so that when finally the stages are added its less work to just put it in?)

1 Like

Oh ok, very interesting… I was just wondering after I found this: Link I suppose openCL is pretty similar in functionality to a compute shader? Will there ever be memory sharing for it?

You mean between opencl and opengl ? yes that already works

I know this is a very old topic, but are compute shaders supported in the engine or no? I can’t find any documentation and looking through the source I don’t see support as far forward as 3.2.4. Is this coming with 3.3 or is it even on the roadmap?

Not sure if CS is supported somewhere, but CS requires ~4.x openGl. There are some forum topics about openCL integration. Well the main thing is for what do you want to use CS for? I know that it can be useful for some tasks, such as GPU culling, but there are also alternatives, such as Transform Feedback(sometimes known as poor man’s compute shader) which can be also used to implement GPU culling + it requires 3.x openGL. If you would like to give TF a try, you’ll have to include this PR in your jme build: https://github.com/jMonkeyEngine/jmonkeyengine/pull/1078

Yes, this would depend on opengl 4.x (4.3 I think). I am working on volumetric clouds, similar to this:

The volume clouds are implemented using a compute shader.

3 Likes

i also wanted to know how Assasin Creed Odyssey made a clouds, but i belive there is something similar to what you linked.

im curious about the visual effect you will be able to create.

Ah okay, I can see that compute shader can be useful there. On the other hand, I also worked on volumetric clouds in jme that don’t use CS.

1 Like

yes, i really liked it,

but it had a lot of issues related to different configurations, often too blurry clouds and some seams visible on sky.

there were also filter issues(i dont remember when now), so i needed change its code i remember.

touching a little of parameters were giving unexpected results. maybe its just about learning how to use it.

idk if you changed it a lot or not, but anyway some nice looking configuration examples might be nice to show really realistic results. (because myself i was unable to)

Thanks, yes there are plenty of tweakable parameters. Adding some sliders to see what they do in action helps. Eg. for clouds, they are in Clouds.java

Or you might be interested in the volumetric cloud shader, located in: CloudPost.frag .
It uses at most 16 cloud samples per ray, to render the clouds. You could increase the samples for better quality.
In case you’re up for customization or for a quick prototype of your own volumetric cloud algorithm, the shader is pretty straightforward:

Basically Density(vec3 pos) function returns density of clouds at point pos.
and Sunlight(vec3 pos) returns sunlight present at point pos (color and intensity). Etc…
Eg. currently an attempt for cloud self-shadowing is commented out in Sunlight(vec3 pos).

I might get to change the overall library once I get back to working on sky again. Definitely some presets for different skies would be good and also to clean up the code a bit.

2 Likes

thanks,

i will need look at this CloudPost.frag

but still its just shader, so i thought there will be proper TestCases

about for example Density(vec3 pos), what is pos in this case anyway? x,y for loc and z for depth(ray)? i ask because i dont know how this idea work overall, so i would need anyway first look how it works, while i just wanted use lib and dont learn it.

But what you said help a lot already.

pos is a 3d point in world space. Basically pos is in the same units as jme scene.

There is also documentation of the cloud shader along with images found under the Clouds section in SevenSky/docs at master · TehLeo/SevenSky · GitHub
For simple usage & customization creating default SkyVars and editing them a bit might be enough eg.

I’ll prepare some basic good looking configurations, as I can see it can be quite hard to achieve them without tweaking of the params…

1 Like

thanks :slight_smile:

i still dont get why pos is not 2d, since on sky there is no 3d really, its 2d texture that looks 3d thanks to layers right?

but i will look at this big documentation file later, so i will probably understand it.

volumetric clouds means they got volume, thus they are 3D, you can actually fly through them if you were making a game with airplanes.

Regarding compute shaders, would it be best for me to do the work and submit a pull request? I see where I’d need to make the changes I think.