I randomly noticed that my flashlight (a Spotlight) only affects the front sides of geometries. The back sides are basically just ignored. Of course this only can be noticed with geometries whose face cull mode is set to off.
Here is an example of a simple bush geometry (common Lighting material).
The front side with enabled flashlight (works as it should)
The front side with disabled flashlight (works as it should)
The back side with enabled flashlight (does not work as it should)
The back side with disabled flashlight (works as it should ^^)
So you actually can not see a difference between the last two pictures. I would like the back side to be affected by my flashlight as the front side does.
Double-sided lighting is only supported in single-pass mode. It is not possible to implement double-sided lighting in the multi-pass so its not supported there.
@mitm yes it is just one plane. I am not sure if that would work. And in the case it does, I would have to modify almost every model I have in blender which means a lot of work too⌠Maybe there is another solutionâŚ
@Momoko_Fan is it possible to implement this in multi-pass? Or what else should I do in this case?
Okay, I got the issue solved by using Single-pass mode as @Momoko_Fan suggested.
Is there anything that I need to know / consider when using single pass mode?
Here is the code to enable single pass
app.getRenderManager().setPreferredLightMode(TechniqueDef.LightMode.SinglePass);
app.getRenderManager().setSinglePassLightBatchSize(3); // 3 is a good value for my scene
Just a detail: the light batch size is the number of light handled by each light pass.
The number of lights is actually the number of lights affecting the geom being rendered (not the number of light in the scene). This number is computed for each geom. Thatâs our light culling system.
If the batch size is 3, 3 lights will be handled in the shader, even if there is only one light affecting the geom (to avoid dynamic loops in shader that kills the perf, itâs often better to make a fixed number of iterations even if some of them are for naught)
If the batch size is 3 but 4 lights affects a geometry, the geometry will be rendered twice (once for the 3 first lights once for the last one).
Hi there, I hope you can help me. I have just started using JME to convert our CAD engine from Java3D. I am also having trouble using double sided lighting. Iâve tried setting the lightmode to singlepass but the back of my triangle faces are still black. Is there any other setting that needs to be specified (maybe on the material) to activate the double sided lighting as I expect it wonât enable by default?
99% sure that standard JME lighting is single-sided⌠so youâd have to fork the shader and reverse the normals for the back sides (thatâs why those sides are dark because the normals are facing away).
Or you could duplicate your mesh and flip the normals that way. Itâs not really that much more processing since both of those meshes would be single sided. The benefit to this approach is that itâs all Java programming if you donât know shader programming well already. (Though shader programming is tons of fun⌠itâs fun in the âwhen I stop banging my head against the wall, it feels greatâ sort of way. )
well⌠yes there is, youâll have more probability to hit the case where it needs to perform an additional render pass for the geometry.
But that can never happen depending on your scene.
@Domenic - Yes FaceCullMode is set to off. I had a look at SPLighting.frag and it appears normals should be flipped when in SinglePass mode.
@pspeed - I understand I can duplicate the mesh and flip the normals. However, I would like to avoid that if possible. Our software is used in the mining industry to visualise mine layouts and earthquakes (each earthquake is a sphere). So our 3D scene can become very populated, especially if a user has 10000 spheres as well as showing his entire mine layout.
In my case I have a single light source (DirectionalLight) that is always behind the camera. This works well for lighting up spheres as with our experience in Java3D. I have read other posts where the double-sided face issue was solved by enabling SinglePass mode, but I cannot seem to get it working. Any help would be appreciated.