When the PointLight gets removed (when the projectile gets destroyed), the terrain goes back to being bright again. Why does this PointLight darken everything else?
What could be going on here? The moment the engine goes back to one PointLight (or none), and just the worldās ambient light, the FPS returns to around 111 FPS.
PS: The blocks have different lights on different edges because that is how the material / texture was designed (so I could use less lights to get the same effect)
This is expected, for every light you add the entire scene is rendered another time. Perhaps you need to optimise what is drawn, for example, are you drawing all of the boxes in your hill even though they are not visible?
In any case, attaching a light to your bullets probably isnāt the way to go, it is very computationally expensive. Unless you make lights only affect the geometry within their radius which is another story.
I am not rendering all the boxes in that hill⦠when it generates the hill, it only creates quads for visible faces.
Is there another way to achieve this effect without attaching a light to every bullet? ⦠and, how would I make it only affect geometry within the radius? Just adding it to a node with the nearby geometry?
I was hoping to use lighting around the buildings for nighttime⦠but if my performance drops after 2 lights, Iām not sure what Iām going to do
Is your scene static? If so you could have a daytime texture and a night time texture, bake the lights in and blend between the two. Then you only have to worry about lighting dynamic objects. Obviously this wouldnāt work with a fully dynamic scene and more trickery would be needed.
FYI, when a spatial is rendered the lights that are used are ones attached to the spatial itself and all of the spatials above it in the scene graph. If you need to have a lot of lights, I would look for a way to only use nearby ones. Perhaps some kind of spatial partitioning⦠I havenāt used jme for long enough to know what itās really capable of in this area.
Iām going to have to rethink my strategy for lighting⦠my terrain isnāt static (destructible / procedurally generated etc.)⦠my āchunksā are pretty big (33x33x33 blocks) and sit on a single node, which makes re-rendering even a single chunk each frame for each light not much of an optionā¦
Hereās one idea. If you spread the blocks out into smaller partitions so there is less blocks per node. You can then attach your lights to nodes that are within range instead of to the root node. If lights move just attach and detach them to the nodes as they come within a certain range. (Lights sitting in between two nodes would be attached to both).
It is a good idea, and might be what I need to do⦠but I currently generate buildings within each chunk, so shrinking the chunk size will require changes elsewhere too Also shrinking the chunk size will require my game to load more chunks to keep the draw distance high, which will add to the overhead (e.g. positioning each chunk relative to the player [which always sits at 0,0,0], which I do because chunk locations may be in the millions, where float positions donāt have as good precision).
Is there a way to modify the brightness of each individual block via the material in real-time? I could compute lighting and modify the material each time lights changes, kinda like Minecraft? My terrain is built in large chunks as all one mesh, so this may further complicate things
One real light seems like the only practical way forward⦠is the one light an ambient affecting all geometry equally, or is there a way to partially apply a light to individual faces?