# Calculation of light levels to predict plant growth

Hello, Does anyone know how to calculate light level on a surface and position of a shadow and its intensity? I need this to calculate plant growth.

1 Like

Welcome to the forum @Gabriel_Pislar!

Hey @sebavan, got an idea of how to approach this? Sounds like a good usecase for a compute shader, since it sounds like @Gabriel_Pislar wants to use the real lighting intensity.

Iâ€™m not too well informed on this, but is there a way to â€śpass backâ€ť per-pixel data to the CPU? or should all this be done via shaders?

1 Like

You could render to a render target texture by using a full white material. Then you could read back the pixel color to deduce the intensity of the light.

Be careful as this my be pretty slow due to the back and forth CPU - GPU

2 Likes

Off-topic, or maybe on, â€¦but let supose to increase the light you have a logic, some variables, maybe a function, why you do not use these informations which you already have to grow your plants? Sounds too complicated to me to try to get light from scene when you can create the grow system totaly independent of light, based only on time. And why not, link the light to it but not oposite. Or maybe I missunderstood
Cheers!

2 Likes

Why not take a single point on the â€śplantâ€ť at the very end, or the growth point.

Then iterate through the lights in the scene, and get their offset Vector and contribution. Add all the offset Vectors together scaled by their contribution. Fire a single ray toward the light and see if it hits any meshes if so the point is in shadow for that light so contribution = 0. Take the result and divide it by number of lights that contributed. Displace the growth point buy the new contribution vector rinse wash repeat?

Duplicate the process per node of the plant?

2 Likes