I’m trying to implement a generated skydome and aerial perspective based on the Precomputed Atmospheric Scattering Paper (by Eric Bruneton and Fabrice Neyret).
I’ve run into some missing features in jme3 that I would like to add.
So far I’ve got a new Texture3D class (based on Texture2D) and a Vector4f (Based on Vector3f minus the cross product) and I’ve so far modified the Material class and the LwjglRender to be able to pass these as shader parameters.
I’m now looking at what I need to do to be able to use geometry shaders.
I’ve already added “GeometryShader” to J3MLoader, and in LwjglRender.convertShaderType I added the geometry case, returning GL32.GL_GEOMETRY_SHADER.
Are there other modifications I need to do as well?
I’m probably missing something here, because I can’t imagine it to be that easy.
Does anyone have some more pointers for me?
Is anyone already working on this?
I understood this is currently postponed for a future version.
Thanks!
Hi, Someone once talked about creating a Vector4f, but I don’t know how it ended up. This could be useful indeed. For now the use of it is just to pass them to shaders. So instead we use the ColorRGBA class or the Quaternion class which is slightly hacky.
But…indeed this could be added to the core once and for all.
It would require to create the appropriate mult mehtod in the Matrix4f class etc…
Texture3D is very welcome too.
For the geometry shaders : JME3 does not support them for now, because it’s an OpenGL 3.2 feature, and the lowest requirement for jME3 is OpenGL 2.0. Implementing them to the core or not is @Momoko_Fan’s call, because he’s the lead developer and the one who designed the core of the engine.
I don’t think it’s as easy as you mention, because I guess this will imply heavy changes in the rendering flow.
If you wish to share your work, you can contribute patches for Vector4f, and Texture3D.
Also if you want to share your skydome implementation, we are very interested too
Thank you !
Hi Nehon,
I had found the quaternion ‘solution’ as well. I would have gone with it if that had been all that was required.
Regarding the geometry shaders, the use case I have for these is rather simple so the rendering flow should not be impacted.
The algorithm I’m trying to copy is generating 3D textures with shaders.
The only thing that the geometry shader needs to do is specify the layer the fragment shader needs to write in to.
As far as I can tell, there is no way to do that using OpenGL 2 as only the top layer will be written to.
I could probably do the same with arrays of 2D textures, but I’d need to do lookups in two layers and interpolate between those values.
Besides, I’d like to keep the algorithm intact for now, as I’m having a hard time understanding it.
I’d love to contribute my patches. I hadn’t looked at modifying Matrix4f yet, as it was not required for my use case. I’ll see if I can add that as well, in combination with the missing cross product methods.
What would be the best way to get my modifications in?
I already have the project up and running in Eclipse and can update subversion from there. In theory it should be easy enough to commit as well. I would need to take care not to commit any other modifications though.
Thanks!
Maarten
Post a patch in the jme3 contributions forum.
Ok, will do! Thanks!
Ok, I’ve just submitted Vector4f and Texture3D.
They probably need some more testing, but both seemed to be pretty straight forward to implement. (More so because most of the code was copied from their lower dimension equivalents… )
Maarten
Ok, no luck rendering to my 3D texture so far.
I’ve copied the FrameBuffer add/set ColorTexture methods to accept the 3D texture. Nothing special to see here. Image already seems to supports tree dimensional textures as does LwjglRenderer.
Somehow OpenGL (Actually Lwjgl) is not happy with the state of the framebuffer though as my program halts with “IllegalStateException: Framebuffer is missing required attachment.”
Unfortunately it fails to mention what it is missing.
I’m basing this on some c++ code, but I can’t find anything weird in here.
Anyone any ideas where I could look further?
Thanks!
Maarten
I managed to figure this out.
updateRenderTexture in LwjglRenderer assumes a 2D texture.
Calling glFramebufferTexture3DEXT instead of glFramebufferTexture2DEXT solved the issue.
Now on tho the shader errors!