[jME3] [Solved] Super confused on passing variables to shader

Yeah, I have a more heavily modified Lighting material so I have to hand diff mine every time, both the .vert and the .frag.



…someday maybe I’ll finally contribute back the per-pixel fog changes for Lighting and then I can stop moving those. Someday. :slight_smile:

thanks men… so as i understand we can have as many vert and frag shaders as we want in one j3md.??

I just was confused with main() method in every vert/frag shader…



Another question: if i switsh hdr and bloom on… will they increase render passes? Or render pass depends on only lights?

Someone more “in the know” can correct me, but the material’s techniques will be selected for the given use of the material. So it’s not that they all always run. One will run for a particular situation, though in lighting’s case it may run in more than one pass.



To your other question: yes. At least one extra pass, I think bloom does too. But these are full framebuffer passes so it’s not like it’s redrawing all of the geometry. Bloom, fog, and depth of field combined only drop me from 64 to 63 FPS on average.

There are several kind of filters, most of them just take the rendered scene as a texture and render it on a full screen quad adding the desired effect to each pixel.



The bloom filter has 2 modes : Scene and objects.

In scene mode the scene is rendered once and there are several passes done on the resulting texture (highlight extractions, horizontal and vertical gaussian blur)

In object mode the scene is re-rendered with the Glow technique forced for every geometries. If a material doesn’t have a glow map or a glow color it’s rendered as black. This could be optimized with some kind of glow bucket…



Another example SSAO, needs the screen space normals of the scene, so the first ssao pass render the scene once again with the normal technique forced.

Cool!!! Thanks a lot! Are you ready for another question?



I want to have a try using ambient lighting shader based on cubemap (hemisphere ambient lighting). This method is used in lugaru and valve shaders. It will give us to see normal map without any lights based on hemisphere lighting and we will not need any additioanal lights for ambient lighting (just a cubemap texture). I found one good project where that was made with glsl.



http://cs294-13-glsl.googlecode.com/files/pcf_00.png - screen

http://cs294-13-glsl.googlecode.com/files/cs294-13-glsl-1.2.tar.gz - demo with shaders.

http://cs294-13-glsl.googlecode.com - project



Will these shaders work with JME?

This would require another change of the lighting material, but it’s typically what does the reflection.j3md (not the ambient lighting though)



So… why not.